From: David Woodhouse Subject: First three bits are identical in rq->cmd_flags and bio->bi_rw? Date: Tue, 05 Aug 2008 10:29:14 +0100 Message-ID: <1217928554.3454.711.camel@pmac.infradead.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org To: axboe@kernel.dk Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:59641 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751090AbYHEJ3Q (ORCPT ); Tue, 5 Aug 2008 05:29:16 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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