All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC
@ 2010-07-09  0:38 FUJITA Tomonori
  2010-07-09  0:38 ` [PATCH 1/3] block: set REQ_TYPE_FS on flush requests FUJITA Tomonori
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: FUJITA Tomonori @ 2010-07-09  0:38 UTC (permalink / raw)
  To: James.Bottomley; +Cc: axboe, linux-scsi, fujita.tomonori

This is the second version of flush REQ_TYPE_FS conversion:

http://marc.info/?l=linux-scsi&m=127730591527424&w=2

There is no major changes since the first version. Just minor
adjustment for the discard changes.

This can be applied to block's for-2.6.36.

The git tree is also available:

git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git fs-flush

=
 block/blk-barrier.c       |    3 ++-
 drivers/scsi/scsi_error.c |   19 ++++---------------
 drivers/scsi/sd.c         |    2 --
 3 files changed, 6 insertions(+), 18 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] block: set REQ_TYPE_FS on flush requests
  2010-07-09  0:38 [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
@ 2010-07-09  0:38 ` FUJITA Tomonori
  2010-07-09  0:38 ` [PATCH 2/3] block: set up rq->rq_disk properly for " FUJITA Tomonori
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: FUJITA Tomonori @ 2010-07-09  0:38 UTC (permalink / raw)
  To: James.Bottomley; +Cc: axboe, linux-scsi, fujita.tomonori

the block layer doesn't set rq->cmd_type on flush requests. By
definition, it should be REQ_TYPE_FS (the lower layers build a command
and interpret the result of it, that is, the block layer doesn't know
the details).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 block/blk-barrier.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index eefbde8..e7fed5e 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -134,6 +134,7 @@ static void queue_flush(struct request_queue *q, unsigned which)
 	}
 
 	blk_rq_init(q, rq);
+	rq->cmd_type = REQ_TYPE_FS;
 	rq->cmd_flags = REQ_HARDBARRIER | REQ_FLUSH;
 	rq->rq_disk = q->bar_rq.rq_disk;
 	rq->end_io = end_io;
-- 
1.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] block: set up rq->rq_disk properly for flush requests
  2010-07-09  0:38 [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
  2010-07-09  0:38 ` [PATCH 1/3] block: set REQ_TYPE_FS on flush requests FUJITA Tomonori
@ 2010-07-09  0:38 ` FUJITA Tomonori
  2010-07-09  0:38 ` [PATCH 3/3] scsi: use REQ_TYPE_FS for flush request FUJITA Tomonori
  2010-07-21  2:15 ` [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
  3 siblings, 0 replies; 6+ messages in thread
From: FUJITA Tomonori @ 2010-07-09  0:38 UTC (permalink / raw)
  To: James.Bottomley; +Cc: axboe, linux-scsi, fujita.tomonori

q->bar_rq.rq_disk is NULL. Use the rq_disk of the original request
instead.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 block/blk-barrier.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index e7fed5e..fa047b3 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -136,7 +136,7 @@ static void queue_flush(struct request_queue *q, unsigned which)
 	blk_rq_init(q, rq);
 	rq->cmd_type = REQ_TYPE_FS;
 	rq->cmd_flags = REQ_HARDBARRIER | REQ_FLUSH;
-	rq->rq_disk = q->bar_rq.rq_disk;
+	rq->rq_disk = q->orig_bar_rq->rq_disk;
 	rq->end_io = end_io;
 
 	elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
-- 
1.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] scsi: use REQ_TYPE_FS for flush request
  2010-07-09  0:38 [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
  2010-07-09  0:38 ` [PATCH 1/3] block: set REQ_TYPE_FS on flush requests FUJITA Tomonori
  2010-07-09  0:38 ` [PATCH 2/3] block: set up rq->rq_disk properly for " FUJITA Tomonori
@ 2010-07-09  0:38 ` FUJITA Tomonori
  2010-07-21  2:15 ` [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
  3 siblings, 0 replies; 6+ messages in thread
From: FUJITA Tomonori @ 2010-07-09  0:38 UTC (permalink / raw)
  To: James.Bottomley; +Cc: axboe, linux-scsi, fujita.tomonori

scsi-ml uses REQ_TYPE_BLOCK_PC for flush requests from file
systems. The definition of REQ_TYPE_BLOCK_PC is that we don't retry
requests even when we can (e.g. UNIT ATTENTION) and we send the
response to the callers (then the callers can decide what they want).
We need a workaround such as the commit
77a4229719e511a0d38d9c355317ae1469adeb54 to retry BLOCK_PC flush
requests. We will need the similar workaround for discard requests too
since SCSI-ml handle them as BLOCK_PC internally.

This uses REQ_TYPE_FS for flush requests from file systems instead of
REQ_TYPE_BLOCK_PC.

scsi-ml retries only REQ_TYPE_FS requests that have data to
transfer when we can retry them (e.g. UNIT_ATTENTION). However, we
also need to retry REQ_TYPE_FS requests without data because the
callers don't.

This also changes scsi_check_sense() to retry all the REQ_TYPE_FS
requests when appropriate. Thanks to scsi_noretry_cmd(),
REQ_TYPE_BLOCK_PC requests don't be retried as before.

Note that basically, this reverts the commit
77a4229719e511a0d38d9c355317ae1469adeb54 since now we use REQ_TYPE_FS
for flush requests.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 drivers/scsi/scsi_error.c |   19 ++++---------------
 drivers/scsi/sd.c         |    2 --
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 1b88af8..2768bf6 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -307,20 +307,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
 		    (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
 			return FAILED;
 
-		if (scmd->request->cmd_flags & REQ_HARDBARRIER)
-			/*
-			 * barrier requests should always retry on UA
-			 * otherwise block will get a spurious error
-			 */
-			return NEEDS_RETRY;
-		else
-			/*
-			 * for normal (non barrier) commands, pass the
-			 * UA upwards for a determination in the
-			 * completion functions
-			 */
-			return SUCCESS;
-
+		return NEEDS_RETRY;
 		/* these three are not supported */
 	case COPY_ABORTED:
 	case VOLUME_OVERFLOW:
@@ -1336,7 +1323,9 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
 		 * assume caller has checked sense and determinted
 		 * the check condition was retryable.
 		 */
-		return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
+		if (scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
+		    scmd->request->cmd_type == REQ_TYPE_BLOCK_PC)
+			return 1;
 	}
 
 	return 0;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index fc5d69a..e0902bb 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -478,8 +478,6 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
 
 static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
 {
-	/* for now, we use REQ_TYPE_BLOCK_PC. */
-	rq->cmd_type = REQ_TYPE_BLOCK_PC;
 	rq->timeout = SD_TIMEOUT;
 	rq->retries = SD_MAX_RETRIES;
 	rq->cmd[0] = SYNCHRONIZE_CACHE;
-- 
1.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC
  2010-07-09  0:38 [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
                   ` (2 preceding siblings ...)
  2010-07-09  0:38 ` [PATCH 3/3] scsi: use REQ_TYPE_FS for flush request FUJITA Tomonori
@ 2010-07-21  2:15 ` FUJITA Tomonori
  2010-07-21  2:19   ` Jens Axboe
  3 siblings, 1 reply; 6+ messages in thread
From: FUJITA Tomonori @ 2010-07-21  2:15 UTC (permalink / raw)
  To: axboe; +Cc: James.Bottomley, linux-scsi

On Fri,  9 Jul 2010 09:38:23 +0900
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:

> This is the second version of flush REQ_TYPE_FS conversion:
> 
> http://marc.info/?l=linux-scsi&m=127730591527424&w=2
> 
> There is no major changes since the first version. Just minor
> adjustment for the discard changes.
> 
> This can be applied to block's for-2.6.36.
> 
> The git tree is also available:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git fs-flush
> 
> =
>  block/blk-barrier.c       |    3 ++-
>  drivers/scsi/scsi_error.c |   19 ++++---------------
>  drivers/scsi/sd.c         |    2 --
>  3 files changed, 6 insertions(+), 18 deletions(-)

Jens, any reason why this flush conversion isn't included in your
for-2.6.36 yet? I've just confirmed that this can be still applied
cleanly.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] convert flush to REQ_TYPE_FS instead of  REQ_TYPE_BLOCK_PC
  2010-07-21  2:15 ` [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
@ 2010-07-21  2:19   ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2010-07-21  2:19 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: James.Bottomley, linux-scsi

On 07/20/2010 08:15 PM, FUJITA Tomonori wrote:
> On Fri,  9 Jul 2010 09:38:23 +0900
> FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> 
>> This is the second version of flush REQ_TYPE_FS conversion:
>>
>> http://marc.info/?l=linux-scsi&m=127730591527424&w=2
>>
>> There is no major changes since the first version. Just minor
>> adjustment for the discard changes.
>>
>> This can be applied to block's for-2.6.36.
>>
>> The git tree is also available:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git fs-flush
>>
>> =
>>  block/blk-barrier.c       |    3 ++-
>>  drivers/scsi/scsi_error.c |   19 ++++---------------
>>  drivers/scsi/sd.c         |    2 --
>>  3 files changed, 6 insertions(+), 18 deletions(-)
> 
> Jens, any reason why this flush conversion isn't included in your
> for-2.6.36 yet? I've just confirmed that this can be still applied
> cleanly.

Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-21  2:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-09  0:38 [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
2010-07-09  0:38 ` [PATCH 1/3] block: set REQ_TYPE_FS on flush requests FUJITA Tomonori
2010-07-09  0:38 ` [PATCH 2/3] block: set up rq->rq_disk properly for " FUJITA Tomonori
2010-07-09  0:38 ` [PATCH 3/3] scsi: use REQ_TYPE_FS for flush request FUJITA Tomonori
2010-07-21  2:15 ` [PATCH 0/3] convert flush to REQ_TYPE_FS instead of REQ_TYPE_BLOCK_PC FUJITA Tomonori
2010-07-21  2:19   ` Jens Axboe

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.