All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 004 of 6] md: Use ffz instead of find_first_set to convert multiplier to shift.
Date: Fri, 29 Sep 2006 12:53:16 +1000	[thread overview]
Message-ID: <1060929025316.15249@suse.de> (raw)
In-Reply-To: 20060929125047.14064.patches@notabene


From: Paul Clements <paul.clements@steeleye.com>

find_first_set doesn't find the least-significant bit on bigendian
machines, so it is really wrong to use it.

ffs is closer, but takes an 'int' and we have a 'unsigned long'.
So use ffz(~X) to convert a chunksize into a chunkshift.


Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/bitmap.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff .prev/drivers/md/bitmap.c ./drivers/md/bitmap.c
--- .prev/drivers/md/bitmap.c	2006-09-29 11:44:38.000000000 +1000
+++ ./drivers/md/bitmap.c	2006-09-29 11:49:40.000000000 +1000
@@ -1444,8 +1444,7 @@ int bitmap_create(mddev_t *mddev)
 	if (err)
 		goto error;
 
-	bitmap->chunkshift = find_first_bit(&bitmap->chunksize,
-					sizeof(bitmap->chunksize));
+	bitmap->chunkshift = ffz(~bitmap->chunksize);
 
 	/* now that chunksize and chunkshift are set, we can use these macros */
  	chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) /

  parent reply	other threads:[~2006-09-29  2:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29  2:52 [PATCH 000 of 6] md: Introduction NeilBrown
2006-09-29  2:52 ` [PATCH 001 of 6] md: Fix duplicity of levels in md.txt NeilBrown
2006-09-29  2:52   ` NeilBrown
2006-09-29  2:52 ` [PATCH 002 of 6] md: Remove MAX_MD_DEVS which is an arbitrary limit NeilBrown
2006-09-29  2:53 ` [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape NeilBrown
2006-09-29  4:24   ` Jeff Breidenbach
2006-10-02  8:07   ` David Greaves
2006-09-29  2:53 ` NeilBrown [this message]
2006-09-29  2:53 ` [PATCH 005 of 6] md: Allow SET_BITMAP_FILE to work on 64bit kernel with 32bit userspace NeilBrown
2006-09-29  2:53 ` [PATCH 006 of 6] md: Add error reporting to superblock write failure NeilBrown

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=1060929025316.15249@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.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 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.