linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Mark Lord <liml@rtr.ca>
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH 2/4] libata: separate out rw ATA taskfile building into ata_build_tf()
Date: Wed, 15 Nov 2006 01:51:03 +0900	[thread overview]
Message-ID: <4559F3F7.4080509@gmail.com> (raw)
In-Reply-To: <4559EB3B.9050805@rtr.ca>

Mark Lord wrote:
> This logic sequence bothers me slightly:
> 
> Tejun Heo wrote:
>> Separate out rw ATA taskfile building from ata_scsi_rw_xlat() into
>> ata_build_tf().  This will be used to improve media error handling.
> ...
>> +    if ((dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF |
>> +               ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ) {
>> +        /* yay, NCQ */
>> +        if (!lba_48_ok(block, n_block))
>> +            return -ERANGE;
> ...
>> +    } else if (dev->flags & ATA_DFLAG_LBA) {
>> +        tf->flags |= ATA_TFLAG_LBA;
>> +
>> +        if (lba_28_ok(block, n_block)) {
>> +            /* use LBA28 */
>> +            tf->device |= (block >> 24) & 0xf;
>> +        } else if (lba_48_ok(block, n_block)) {
>> +            if (!(dev->flags & ATA_DFLAG_LBA48))
>> +                return -ERANGE;
> ...
> 
> In the first case, if !lba_48_ok(), then we should at least attempt
> to see if the request can be issued via non-NCQ.
> 
> Something like this:
> 
> if (lba_48_ok() && dev->flags & 
> (ATA_DFLAG_PIO|ATA_DFLAG_NCQ_OFF|ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ) {
>   /* yay, NCQ */
>   ...
> } else if (dev->flags & ATA_DFLAG_LBA) {
>   ...
> 
> ..except prettier!  ;)
> 
> In theory, it looks like an impossible sequence anyway..
> if we have the NCQ flag set, then we probably already *know*
> that LBA48 is okay.  But since we're not making that assumption,
> let's give it the benefit of a doubt and try non-NCQ if LBA48 is a no-go.

First of all, that function is moved verbatim from ata_scsi_rw_xlat(), 
and I don't really understand your point.  lba_48_ok() checks whether 
the given block and n_block are inside LBA48 limit.  NCQ commands use 
LBA48 (well, nsect is in the different registers but the limits are the 
same) which is the largest addressing mode currently available.  So, if 
a command cannot be issued using NCQ, it cannot be issued w/ any command 
mode.  ie. if !lba_48_ok(), that command just cannot be issued.

Am I misunderstanding you?

-- 
tejun

  reply	other threads:[~2006-11-14 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-14 13:47 [PATCHSET] libata: improve media error handling Tejun Heo
2006-11-14 13:47 ` [PATCH 1/4] libata: implement ata_exec_internal_sg() Tejun Heo
2006-11-28  9:02   ` Jeff Garzik
2006-11-14 13:47 ` [PATCH 2/4] libata: separate out rw ATA taskfile building into ata_build_tf() Tejun Heo
2006-11-14 16:13   ` Mark Lord
2006-11-14 16:51     ` Tejun Heo [this message]
2006-11-14 21:04       ` Mark Lord
2006-11-28  9:17   ` Jeff Garzik
2006-11-14 13:47 ` [PATCH 3/4] libata: prepare ata_sg_clean() for invocation from EH Tejun Heo
2006-11-28  9:02   ` Jeff Garzik
2006-11-14 13:47 ` [PATCH 4/4] libata: improve media error handling Tejun Heo
2007-03-02 23:37   ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4559F3F7.4080509@gmail.com \
    --to=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=liml@rtr.ca \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).