All of lore.kernel.org
 help / color / mirror / Atom feed
* First three bits are identical in rq->cmd_flags and bio->bi_rw?
@ 2008-08-05  9:29 David Woodhouse
  2008-08-05 11:31 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: David Woodhouse @ 2008-08-05  9:29 UTC (permalink / raw)
  To: axboe; +Cc: linux-fsdevel

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?

-- 
dwmw2


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

* Re: First three bits are identical in rq->cmd_flags and bio->bi_rw?
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2008-08-05 11:31 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-fsdevel

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


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

end of thread, other threads:[~2008-08-05 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.