All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: axboe@suse.de, jgarzik@pobox.com, James.Bottomley@steeleye.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH linux-2.6-block:post-2.6.15 09/10] blk: add FUA support to IDE
Date: Sat, 19 Nov 2005 00:25:37 +0900	[thread overview]
Message-ID: <437DF271.6050702@gmail.com> (raw)
In-Reply-To: <58cb370e0511171239i16e0aaffr237ef7af68ece946@mail.gmail.com>

Hi, Bartlomiej.

Bartlomiej Zolnierkiewicz wrote:
> On 11/17/05, Tejun Heo <htejun@gmail.com> wrote:
> 
> What does happen for fua && drive->vdma case?
> 

Thanks for pointing out, wasn't thinking about that.  Hmmm... When using 
vdma, single-sector PIO commands are issued instead but there's no 
single-sector FUA PIO command.  Would issuing 
ATA_CMD_WRITE_MULTI_FUA_EXT instead of ATA_CMD_WRITE_FUA_EXT work?  Or 
should I just disable FUA on vdma case?

> 
>>                        } else {
>>                                command = lba48 ? WIN_READDMA_EXT : WIN_READDMA;
>>                                if (drive->vdma)
>>@@ -284,8 +298,20 @@ static ide_startstop_t __ide_do_rw_disk(
>>        } else {
>>                if (drive->mult_count) {
>>                        hwif->data_phase = TASKFILE_MULTI_OUT;
>>-                       command = lba48 ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
>>+                       if (!fua)
>>+                               command = lba48 ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
>>+                       else
>>+                               command = ATA_CMD_WRITE_MULTI_FUA_EXT;
>>                } else {
>>+                       if (unlikely(fua)) {
>>+                               /*
>>+                                * This happens if multisector PIO is
>>+                                * turned off during operation.
>>+                                */
>>+                               printk(KERN_ERR "%s: FUA write but in single "
>>+                                      "sector PIO mode\n", drive->name);
>>+                               goto fail;
>>+                       }
> 
> 
> Wouldn't it be better to do the following check at the beginning
> of __ide_do_rw_disk() (after checking for dma vs lba48):
> 
>         if (fua) {
>                 if (!lba48 || ((!dma || drive->vdma) && !drive->mult_count))
>                         goto fail_fua;
>         }
> 
> ...
> 
> and fail the request if needed *before* actually touching any
> hardware registers?
> 
> fail_fua:
>         printk(KERN_ERR "%s: FUA write unsupported (lba48=%u dma=%u"
>                                        " vdma=%u mult_count=%u)\n", drive->name,
>                                        lba48, dma, drive->vdma,
> drive->mult_count);
>         ide_end_request(drive, 0, 0);
>         return ide_stopped;
> 

Hmmm... The thing is that those failure cases will happen extremely 
rarely if at all.  Remember this post?

http://marc.theaimsgroup.com/?l=linux-kernel&m=111798102108338&w=3

It's mostly guaranteed that those failure cases don't occur, so I 
thought avoiding IO on failure case wasn't that helpful.

> 
>>                        hwif->data_phase = TASKFILE_OUT;
>>                        command = lba48 ? WIN_WRITE_EXT : WIN_WRITE;
>>                }
>>@@ -295,6 +321,10 @@ static ide_startstop_t __ide_do_rw_disk(
>>
>>                return pre_task_out_intr(drive, rq);
>>        }
>>+
>>+ fail:
>>+       ide_end_request(drive, 0, 0);
>>+       return ide_stopped;
>> }
>>
>> /*
>>@@ -846,7 +876,7 @@ static void idedisk_setup (ide_drive_t *
>> {
>>        struct hd_driveid *id = drive->id;
>>        unsigned long long capacity;
>>-       int barrier;
>>+       int barrier, fua;
>>
>>        idedisk_add_settings(drive);
>>
>>@@ -967,10 +997,19 @@ static void idedisk_setup (ide_drive_t *
>>                        barrier = 0;
>>        }
>>
>>-       printk(KERN_INFO "%s: cache flushes %ssupported\n",
>>-               drive->name, barrier ? "" : "not ");
>>+       fua = barrier && idedisk_supports_lba48(id) && ide_id_has_fua(id);
>>+       /* When using PIO, FUA needs multisector. */
>>+       if ((!drive->using_dma || drive->hwif->no_lba48_dma) &&
>>+           drive->mult_count == 0)
>>+               fua = 0;
> 
> 
> Shouldn't this check also for drive->vdma?
> 

Yes, it does.  Thanks for pointing out.  One question though.  FUA 
support should be changed if using_dma/mult_count settings are changed. 
  As using_dma configuration is handled by IDE midlayer, we might need 
to add a callback there.  What do you think?

-- 
tejun

  reply	other threads:[~2005-11-18 15:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 15:36 [PATCH linux-2.6-block:post-2.6.15 00/10] blk: reimplementation of I/O barrier Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 01/10] blk: add @uptodate to end_that_request_last() and @error to rq_end_io_fn() Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 02/10] blk: separate out bio init part from __make_request Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 03/10] blk: reimplement handling of barrier request Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 04/10] blk: update SCSI to use new blk_ordered Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 05/10] blk: add FUA support to SCSI disk Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 06/10] blk: update libata to use new blk_ordered Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 07/10] blk: add FUA support to libata Tejun Heo
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 08/10] blk: update IDE to use new blk_ordered Tejun Heo
2005-11-17 20:11   ` Bartlomiej Zolnierkiewicz
2005-11-18 15:07     ` Tejun Heo
2005-11-18 15:59       ` Bartlomiej Zolnierkiewicz
2005-11-22  2:44         ` Tejun Heo
2005-11-22  8:36           ` Bartlomiej Zolnierkiewicz
2005-11-22  8:39             ` Bartlomiej Zolnierkiewicz
2005-11-23  7:23             ` Tejun Heo
2005-11-23  8:40               ` Bartlomiej Zolnierkiewicz
2005-11-23  8:46                 ` Jens Axboe
2005-11-23  9:00                   ` Tejun
2005-11-23  9:05                     ` Bartlomiej Zolnierkiewicz
2005-11-17 15:36 ` [PATCH linux-2.6-block:post-2.6.15 09/10] blk: add FUA support to IDE Tejun Heo
2005-11-17 20:39   ` Bartlomiej Zolnierkiewicz
2005-11-18 15:25     ` Tejun Heo [this message]
2005-11-18 16:17       ` Bartlomiej Zolnierkiewicz
2005-11-18 17:02         ` Alan Cox
2005-11-18 16:38           ` Bartlomiej Zolnierkiewicz
2005-11-18 17:41             ` Alan Cox
2005-11-24 11:58         ` Tejun Heo
2005-11-24 12:21           ` Tejun Heo
2005-11-24 14:21             ` Bartlomiej Zolnierkiewicz
2005-11-17 15:37 ` [PATCH linux-2.6-block:post-2.6.15 10/10] blk: I/O barrier documentation Tejun Heo
2005-11-17 16:20 ` [PATCH linux-2.6-block:post-2.6.15 00/10] blk: reimplementation of I/O barrier 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=437DF271.6050702@gmail.com \
    --to=htejun@gmail.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=axboe@suse.de \
    --cc=bzolnier@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.