From: Jens Axboe <axboe@kernel.dk>
To: Joe Perches <joe@perches.com>,
Leonardo Bras <leonardo@linux.ibm.com>,
linux-kernel@vger.kernel.org
Cc: Dennis Zhou <dennis@kernel.org>, Hannes Reinecke <hare@suse.com>,
Damien Le Moal <damien.lemoal@wdc.com>, Tejun Heo <tj@kernel.org>,
"Dennis Zhou (Facebook)" <dennisszhou@gmail.com>,
Johannes Thumshirn <jthumshirn@suse.de>,
Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH 1/1] block: Use bits.h macros to improve readability
Date: Sun, 4 Aug 2019 14:10:05 -0700 [thread overview]
Message-ID: <a0ca29ac-ce51-16e7-d0b8-c90cbb4835e6@kernel.dk> (raw)
In-Reply-To: <15450f6ba169de8862e11bc2d20b3645958f4efd.camel@perches.com>
On 8/4/19 1:17 PM, Joe Perches wrote:
> On Fri, 2019-08-02 at 21:18 -0700, Jens Axboe wrote:
>> On 8/1/19 6:00 PM, Leonardo Bras wrote:
>>> Applies some bits.h macros in order to improve readability of
>>> linux/blk_types.h.
> []
>> I know precisely what that does, whereas I have to think about the other
>> one, maybe even look it up to be sure. For instance, without looking
>> now, I have no idea what the second argument is. Looking at the git log,
>> I see numerous instances of:
>
> While I'm not at all a proponent of GENMASK/GENMASK_ULL,
> and so not a proponent of this patch, latent defects are
> possible in both cases.
>
> You'd likely have to look at SOME_SHIFT to see if it's 0
> to verify the actual mask is what's really desired.
>
> $ git grep -P '_SHIFT\s+\(?\s*0\s*\)?\b' | wc -l
> 11907
Usually SOME_SHIFT is either a numeric value, and you already know,
or it's part of a series of enums/defines (like in the case that's
being done here) where you already have prior knowledge about the
values. For those cases, GENMASK/GENMASK_ULL adds nothing imho, it
only makes it less readable and more error prone.
--
Jens Axboe
next prev parent reply other threads:[~2019-08-04 21:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-02 0:00 Leonardo Bras
2019-08-03 4:18 ` Jens Axboe
2019-08-04 20:17 ` Joe Perches
2019-08-04 21:10 ` Jens Axboe [this message]
2019-08-08 18:35 ` Leonardo Bras
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=a0ca29ac-ce51-16e7-d0b8-c90cbb4835e6@kernel.dk \
--to=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=dennis@kernel.org \
--cc=dennisszhou@gmail.com \
--cc=hare@suse.com \
--cc=joe@perches.com \
--cc=jthumshirn@suse.de \
--cc=leonardo@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sagi@grimberg.me \
--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
Powered by JetHome