From: Tejun Heo <htejun@gmail.com>
To: axboe@suse.de, jgarzik@pobox.com, James.Bottomley@steeleye.com,
bzolnier@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH linux-2.6-block:master 05/10] blk: add FUA support to SCSI disk
Date: Wed, 19 Oct 2005 21:48:06 +0900 (KST) [thread overview]
Message-ID: <20051019124716.07E1F764@htj.dyndns.org> (raw)
In-Reply-To: <20051019124716.EF1F6546@htj.dyndns.org>
05_blk_scsi-add-fua-support.patch
Add FUA support to SCSI disk.
Signed-off-by: Tejun Heo <htejun@gmail.com>
sd.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
Index: blk-fixes/drivers/scsi/sd.c
===================================================================
--- blk-fixes.orig/drivers/scsi/sd.c 2005-10-19 21:47:13.000000000 +0900
+++ blk-fixes/drivers/scsi/sd.c 2005-10-19 21:47:13.000000000 +0900
@@ -102,6 +102,7 @@ struct scsi_disk {
u8 write_prot;
unsigned WCE : 1; /* state of disk WCE bit */
unsigned RCD : 1; /* state of disk RCD bit, unused */
+ unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
};
static DEFINE_IDR(sd_index_idr);
@@ -343,6 +344,7 @@ static int sd_init_command(struct scsi_c
if (block > 0xffffffff) {
SCpnt->cmnd[0] += READ_16 - READ_6;
+ SCpnt->cmnd[1] |= blk_fua_rq(rq) ? 0x8 : 0;
SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;
SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0;
SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0;
@@ -362,6 +364,7 @@ static int sd_init_command(struct scsi_c
this_count = 0xffff;
SCpnt->cmnd[0] += READ_10 - READ_6;
+ SCpnt->cmnd[1] |= blk_fua_rq(rq) ? 0x8 : 0;
SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff;
SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff;
SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff;
@@ -370,6 +373,17 @@ static int sd_init_command(struct scsi_c
SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff;
SCpnt->cmnd[8] = (unsigned char) this_count & 0xff;
} else {
+ if (unlikely(blk_fua_rq(rq))) {
+ /*
+ * This happens only if this drive failed
+ * 10byte rw command with ILLEGAL_REQUEST
+ * during operation and thus turned off
+ * use_10_for_rw.
+ */
+ printk(KERN_ERR "sd: FUA write on READ/WRITE(6) drive\n");
+ return 0;
+ }
+
SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f);
SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff);
SCpnt->cmnd[3] = (unsigned char) block & 0xff;
@@ -1390,10 +1404,18 @@ sd_read_cache_type(struct scsi_disk *sdk
sdkp->RCD = 0;
}
+ sdkp->DPOFUA = (data.device_specific & 0x10) != 0;
+ if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
+ printk(KERN_NOTICE "SCSI device %s: uses "
+ "READ/WRITE(6), disabling FUA\n", diskname);
+ sdkp->DPOFUA = 0;
+ }
+
ct = sdkp->RCD + 2*sdkp->WCE;
- printk(KERN_NOTICE "SCSI device %s: drive cache: %s\n",
- diskname, types[ct]);
+ printk(KERN_NOTICE "SCSI device %s: drive cache: %s%s\n",
+ diskname, types[ct],
+ sdkp->DPOFUA ? " w/ FUA" : "");
return;
}
@@ -1472,7 +1494,8 @@ static int sd_revalidate_disk(struct gen
* QUEUE_ORDERED_TAG_* even when ordered tag is supported.
*/
if (sdkp->WCE)
- ordered = QUEUE_ORDERED_DRAIN_FLUSH;
+ ordered = sdkp->DPOFUA
+ ? QUEUE_ORDERED_DRAIN_FUA : QUEUE_ORDERED_DRAIN_FLUSH;
else
ordered = QUEUE_ORDERED_DRAIN;
next prev parent reply other threads:[~2005-10-19 12:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-19 12:47 [PATCH linux-2.6-block:master 00/10] blk: reimplementation of I/O barrier Tejun Heo
2005-10-19 12:47 ` [PATCH linux-2.6-block:master 01/10] blk: add @uptodate to end_that_request_last() and @error to rq_end_io_fn() Tejun Heo
2005-10-19 12:47 ` [PATCH linux-2.6-block:master 02/10] blk: separate out bio init part from __make_request Tejun Heo
2005-10-19 12:47 ` [PATCH linux-2.6-block:master 03/10] blk: reimplement handling of barrier request Tejun Heo
2005-10-19 12:48 ` [PATCH linux-2.6-block:master 04/10] blk: update SCSI to use new blk_ordered Tejun Heo
2005-10-19 12:48 ` Tejun Heo [this message]
2005-10-19 12:48 ` [PATCH linux-2.6-block:master 06/10] blk: update libata " Tejun Heo
2005-10-19 12:48 ` [PATCH linux-2.6-block:master 07/10] blk: add FUA support to libata Tejun Heo
2005-10-19 12:48 ` [PATCH linux-2.6-block:master 08/10] blk: update IDE to use new blk_ordered Tejun Heo
2005-10-19 12:48 ` [PATCH linux-2.6-block:master 09/10] blk: add FUA support to IDE Tejun Heo
2005-10-19 12:48 ` [PATCH linux-2.6-block:master 10/10] blk: I/O barrier documentation Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2005-07-26 15:45 [PATCH linux-2.6-block:master 00/10] blk: reimplementation of I/O barrier Tejun Heo
2005-07-26 15:46 ` [PATCH linux-2.6-block:master 05/10] blk: add FUA support to SCSI disk Tejun Heo
2005-07-26 15:55 ` 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=20051019124716.07E1F764@htj.dyndns.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®