From: Boaz Harrosh <bharrosh@panasas.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <jens.axboe@oracle.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-scsi <linux-scsi@vger.kernel.org>,
Niel Lambrechts <niel.lambrechts@gmail.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH 2/4] block: use the same failfast bits for bio and request
Date: Thu, 09 Jul 2009 12:12:51 +0300 [thread overview]
Message-ID: <4A55B493.6070402@panasas.com> (raw)
In-Reply-To: <4A553DA4.4080408@kernel.org>
On 07/09/2009 03:45 AM, Tejun Heo wrote:
> Hello, Boaz.
>
> Boaz Harrosh wrote:
>> Thanks for doing this, it has been neglected for a long time.
>> However, it will happen again, I don't like these implicit matches
>> which are not enforced, They get to drift away. There are several ways
>> to make sure two sets of enums stay in sync. (I'll have a try at it
>> tomorrow. if you want).
>
> They don't share the exact same set of bits, so it's a bit blurry but
> yeah it would be better if the bits are defined in more systematic
> way.
>
I meant something simple like:
__REQ_RW = BIO_RW,
__REQ_FAILFAST_DEV = BIO_RW_FAILFAST_DEV,
__REQ_FAILFAST_TRANSPORT = BIO_RW_FAILFAST_TRANSPORT,
__REQ_FAILFAST_DRIVER = BIO_RW_FAILFAST_DRIVER,
...
And a fat comment which you did
>>> @@ -142,37 +142,40 @@ struct bio {
>>> *
>>> * bit 0 -- data direction
>>> * If not set, bio is a read from device. If set, it's a write to device.
>>> - * bit 1 -- rw-ahead when set
>>> - * bit 2 -- barrier
>>> + * bit 1 -- fail fast device errors
>>> + * bit 2 -- fail fast transport errors
>>> + * bit 3 -- fail fast driver errors
>>> + * bit 4 -- rw-ahead when set
>>> + * bit 5 -- barrier
>> Please kill all these evil bit 1, bit 2 ,bit n comments. The ways we
>> invent to torture ourselfs...
>>
>> Just move all the comments to the enums declarations below. And be done
>> with it, also for the next time.
>
> Heh... I agree too. Unless ABI is fixed, this type of comments are
> often painful. Care to submit a patch. This series is already in
> block#for-next.
>
It's becoming futile to comments on patches these days they get submitted
before and during any comments. ;-)
>>> #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag)))
>>>
>> I wish there was also an helper to set these bits. it gives me an heart attack
>> every time I need to:
>> bio->bi_rw &= ~(1 << BIO_RW);
>
> What's more disturbing to me is the different between RQ and BIO
> flags. __REQ_* are bit positions, REQ_* are masks while BIO_* are bit
> positions. Sadly it seems it's already too late to change that. I
> personally an not a big fan of simple accessors or flags defined as
> bit positions. They seem to obscure things without much benefit.
>
I think that everywhere we should use __set_bit() __clear_bit() and
test_bit() with enums defined as bit-positions. It is most clear readable
code wise, least error prone, and easiest to maintain.
Perhaps a new:
test_bits(void *flag, unsigned bit1, ...);
for testing bunch of bits at once
Please note that with inlines and constant bits the generated code is
just as fast as bit-mask. Without slaving over double definitions.
(and accessors)
> Thanks.
>
Boaz
next prev parent reply other threads:[~2009-07-09 9:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-03 8:48 [PATCHSET] block: fix merge of requests with different failfast settings Tejun Heo
2009-07-03 8:48 ` [PATCH 1/4] block: don't merge requests of " Tejun Heo
2009-07-03 8:48 ` [PATCH 2/4] block: use the same failfast bits for bio and request Tejun Heo
2009-07-05 9:27 ` Boaz Harrosh
2009-07-09 0:45 ` Tejun Heo
2009-07-09 9:12 ` Boaz Harrosh [this message]
2009-07-09 13:37 ` Christoph Hellwig
2009-07-09 17:20 ` Jeff Garzik
2009-07-09 17:39 ` Jens Axboe
2009-07-10 13:18 ` Tejun Heo
2009-07-12 12:06 ` Boaz Harrosh
2009-07-15 9:27 ` Tejun Heo
2009-07-03 8:48 ` [PATCH 3/4] block: implement mixed merge of different failfast requests Tejun Heo
2009-07-05 9:27 ` Boaz Harrosh
2009-07-09 0:47 ` Tejun Heo
2009-07-09 9:17 ` Boaz Harrosh
2009-07-15 9:41 ` Tejun Heo
2009-07-03 8:48 ` [PATCH 4/4] scsi,block: update SCSI to handle mixed merge failures Tejun Heo
2009-07-03 10:54 ` [PATCHSET] block: fix merge of requests with different failfast settings Jens Axboe
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=4A55B493.6070402@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=niel.lambrechts@gmail.com \
--cc=tj@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 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).