From: NeilBrown <neilb@suse.de>
To: Namhyung Kim <namhyung@gmail.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH 1/2] md/bitmap: use proper accessor macro
Date: Wed, 8 Jun 2011 12:37:51 +1000 [thread overview]
Message-ID: <20110608123751.41abc489@notabene.brown> (raw)
In-Reply-To: <1307458172-19373-1-git-send-email-namhyung@gmail.com>
On Tue, 7 Jun 2011 23:49:31 +0900 Namhyung Kim <namhyung@gmail.com> wrote:
> Use COUNTER()/NEEDED() macro instead of open-coding them.
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> drivers/md/bitmap.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
> index 70bd738b8b99..8b40bd71bb4a 100644
> --- a/drivers/md/bitmap.c
> +++ b/drivers/md/bitmap.c
> @@ -1332,7 +1332,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
> return 0;
> }
>
> - if (unlikely((*bmc & COUNTER_MAX) == COUNTER_MAX)) {
> + if (unlikely(COUNTER(*bmc) == COUNTER_MAX)) {
> DEFINE_WAIT(__wait);
> /* note that it is safe to do the prepare_to_wait
> * after the test as long as we do it before dropping
> @@ -1404,10 +1404,10 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
> sysfs_notify_dirent_safe(bitmap->sysfs_can_clear);
> }
>
> - if (!success && ! (*bmc & NEEDED_MASK))
> + if (!success && !NEEDED(*bmc))
> *bmc |= NEEDED_MASK;
>
> - if ((*bmc & COUNTER_MAX) == COUNTER_MAX)
> + if (COUNTER(*bmc) == COUNTER_MAX)
> wake_up(&bitmap->overflow_wait);
>
> (*bmc)--;
Thanks....
Personally I loathe such macros - I prefer things to be open codes so I can
see what is happening without having to guess.
But as we have the macros and they are already in use we should be consistent
and use them everywhere.
So I'll apply the patch.
Thanks,
NeilBrown
prev parent reply other threads:[~2011-06-08 2:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 14:49 [PATCH 1/2] md/bitmap: use proper accessor macro Namhyung Kim
2011-06-07 14:49 ` [PATCH 2/2] md/bitmap: remove unused fields from struct bitmap Namhyung Kim
2011-06-08 2:38 ` NeilBrown
2011-06-08 2:37 ` NeilBrown [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=20110608123751.41abc489@notabene.brown \
--to=neilb@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=namhyung@gmail.com \
/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).