From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
Jens Axboe <jens.axboe@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Gabriel C <nix.or.die@googlemail.com>,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
Hannes Reinecke <hare@suse.de>
Subject: [PATCH] REQ-flags to/from BIO-flags bugfix
Date: Wed, 12 Dec 2007 13:03:10 +0200 [thread overview]
Message-ID: <475FBFEE.9010009@panasas.com> (raw)
In-Reply-To: <475FB316.6040804@panasas.com>
- BIO flags bio->bi_rw and REQ flags req->cmd_flags no longer match.
Remove comments and do a proper translation between the 2 systems.
(Please look in ll_rw_blk.c/blk_rq_bio_prep() below if we need more flags)
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
block/ll_rw_blk.c | 23 +++++++++++++++++------
include/linux/blktrace_api.h | 8 +++++++-
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 8b91994..c6a84bb 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1990,10 +1990,6 @@ blk_alloc_request(struct request_queue *q, int rw, int priv, gfp_t gfp_mask)
if (!rq)
return NULL;
- /*
- * first three bits are identical in rq->cmd_flags and bio->bi_rw,
- * see bio.h and blkdev.h
- */
rq->cmd_flags = rw | REQ_ALLOCED;
if (priv) {
@@ -3772,8 +3768,23 @@ EXPORT_SYMBOL(end_request);
static void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
struct bio *bio)
{
- /* first two bits are identical in rq->cmd_flags and bio->bi_rw */
- rq->cmd_flags |= (bio->bi_rw & 3);
+ if (bio_data_dir(bio))
+ rq->cmd_flags |= REQ_RW;
+ else
+ rq->cmd_flags &= ~REQ_RW;
+
+ if (bio->bi_rw & (1<<BIO_RW_SYNC))
+ rq->cmd_flags |= REQ_RW_SYNC;
+ else
+ rq->cmd_flags &= ~REQ_RW_SYNC;
+ /* FIXME: what about other flags, should we sync these too? */
+ /*
+ BIO_RW_AHEAD ==> ??
+ BIO_RW_BARRIER ==> REQ_SOFTBARRIER/REQ_HARDBARRIER
+ BIO_RW_FAILFAST ==> REQ_FAILFAST
+ BIO_RW_SYNC ==> REQ_RW_SYNC
+ BIO_RW_META ==> REQ_RW_META
+ */
rq->nr_phys_segments = bio_phys_segments(q, bio);
rq->nr_hw_segments = bio_hw_segments(q, bio);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7e11d23..9e7ce65 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -165,7 +165,13 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
u32 what)
{
struct blk_trace *bt = q->blk_trace;
- int rw = rq->cmd_flags & 0x03;
+ /* blktrace.c prints them according to bio flags */
+ int rw = (((rq_rw_dir(rq) == WRITE) << BIO_RW) |
+ (((rq->cmd_flags & (REQ_SOFTBARRIER|REQ_HARDBARRIER)) != 0) <<
+ BIO_RW_BARRIER) |
+ (((rq->cmd_flags & REQ_FAILFAST) != 0) << BIO_RW_FAILFAST) |
+ (((rq->cmd_flags & REQ_RW_SYNC) != 0) << BIO_RW_SYNC) |
+ (((rq->cmd_flags & REQ_RW_META) != 0) << BIO_RW_META));
if (likely(!bt))
return;
--
1.5.3.3
next prev parent reply other threads:[~2007-12-12 11:03 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071120204525.ff27ac98.akpm@linux-foundation.org>
2007-11-23 1:39 ` 2.6.24-rc3-mm1 Gabriel C
2007-11-23 4:12 ` 2.6.24-rc3-mm1 Andrew Morton
2007-11-23 5:55 ` 2.6.24-rc3-mm1 Gabriel C
2007-11-27 6:15 ` 2.6.24-rc3-mm1 Andrew Morton
2007-12-11 16:33 ` 2.6.24-rc3-mm1 James Bottomley
2007-12-12 10:08 ` 2.6.24-rc3-mm1 Boaz Harrosh
2007-12-12 11:03 ` Boaz Harrosh [this message]
2007-12-12 15:18 ` [PATCH] REQ-flags to/from BIO-flags bugfix Matthew Wilcox
2007-12-12 15:54 ` Matthew Wilcox
2007-12-13 5:36 ` David Chinner
2007-12-12 16:06 ` Boaz Harrosh
2007-12-12 16:33 ` Matthew Wilcox
2007-12-12 11:36 ` 2.6.24-rc3-mm1 Jens Axboe
2007-12-14 9:00 ` 2.6.24-rc3-mm1 Hannes Reinecke
2007-12-14 14:26 ` 2.6.24-rc3-mm1 James Bottomley
2008-01-07 14:05 ` Multipath failover handling (Was: Re: 2.6.24-rc3-mm1) Hannes Reinecke
2008-01-07 17:57 ` James Bottomley
2008-01-07 18:24 ` Mike Christie
[not found] ` <4744A6F2.4030302@free.fr>
[not found] ` <20071121144116.c932727b.akpm@linux-foundation.org>
2007-11-23 7:29 ` 2.6.24-rc3-mm1: I/O error, system hangs Laurent Riffard
2007-11-23 7:51 ` Hannes Reinecke
2007-11-23 11:38 ` Hannes Reinecke
2007-11-23 17:52 ` Laurent Riffard
2007-11-24 6:42 ` James Bottomley
2007-11-24 12:57 ` Laurent Riffard
2007-11-24 13:26 ` James Bottomley
2007-11-24 17:54 ` Gabriel C
2007-11-24 18:04 ` James Bottomley
2007-11-24 18:08 ` Gabriel C
2007-11-24 18:28 ` Gabriel C
2007-11-24 22:59 ` Laurent Riffard
2007-11-25 7:37 ` James Bottomley
2007-11-25 20:39 ` Laurent Riffard
2007-11-28 21:38 ` Laurent Riffard
2007-11-24 17:44 ` James Bottomley
2007-11-26 7:54 ` Hannes Reinecke
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=475FBFEE.9010009@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=hare@suse.de \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nix.or.die@googlemail.com \
/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).