diff options
author | Paul Clements <paul.clements@steeleye.com> | 2006-10-03 01:16:01 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 08:04:18 -0700 |
commit | a638b2dc951c4cafea31b34a1db1c3d94809649e (patch) | |
tree | 73c1c2135a117290308b5807b6ede21389e3264c /drivers/md | |
parent | 14f50b49fdab8f4c9fc87b55d3631e3bf1ffd385 (diff) | |
download | op-kernel-dev-a638b2dc951c4cafea31b34a1db1c3d94809649e.zip op-kernel-dev-a638b2dc951c4cafea31b34a1db1c3d94809649e.tar.gz |
[PATCH] md: use ffz instead of find_first_set to convert multiplier to shift
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bitmap.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 0a44298..8e67634 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -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) / |