From: Jens Axboe <jens.axboe@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: First three bits are identical in rq->cmd_flags and bio->bi_rw?
Date: Tue, 5 Aug 2008 13:31:09 +0200 [thread overview]
Message-ID: <20080805113108.GV20055@kernel.dk> (raw)
In-Reply-To: <1217928554.3454.711.camel@pmac.infradead.org>
On Tue, Aug 05 2008, David Woodhouse wrote:
> According to the comment in blk_rq_io_prep(), about line 2030 of
> blk-core.c:
>
> /* first two bits are identical in rq->cmd_flags and bio->bi_rw */
> rq->cmd_flags |= (bio->bi_rw & 3);
>
> Is this true? These are the bits in bi_rw:
>
> #define BIO_RW 0
> #define BIO_RW_AHEAD 1
> #define BIO_RW_BARRIER 2
> #define BIO_RW_FAILFAST 3
> #define BIO_RW_SYNC 4
> #define BIO_RW_META 5
>
> And these are the (first) bits in rq->cmd_flags:
> __REQ_RW, /* not set, read. set, write */
> __REQ_FAILFAST, /* no low level driver retries */
> __REQ_SORTED, /* elevator knows about this request */
> __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
> __REQ_HARDBARRIER, /* may not be passed by drive either */
> __REQ_FUA, /* forced unit access */
>
> Are we intending that BIO_RW_AHEAD maps to REQ_FAILFAST? When I started
> composing this mail I was just going to call it a lie -- but now I think
> about it, it makes a certain amount of sense. The comment really ought
> to be a little more explicit though, if that's the case. That's not
> _identical_, even if it's intentional.
>
> In blk_alloc_request() we have an even more interesting claim -- this
> time it's _three_ bits which are identical:
>
> /*
> * 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;
>
> AFAICT the only thing passed in via the 'rw' variable is the R/W bit and
> maybe REQ_RW_SYNC when it's called from get_request(), so the comment
> doesn't matter and can just be removed, I think?
That last comment is stale, the first two bits is the correct one (it
used to be all three, but not anymore). RA does indeed just map to
failfast at the request end, since we don't a lot of error handling on
those. But yeah, the comment could do with an explicit note to that
effect :-)
--
Jens Axboe
prev parent reply other threads:[~2008-08-05 11:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-05 9:29 First three bits are identical in rq->cmd_flags and bio->bi_rw? David Woodhouse
2008-08-05 11:31 ` Jens Axboe [this message]
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=20080805113108.GV20055@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=dwmw2@infradead.org \
--cc=linux-fsdevel@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.