提交 a638b2dc 编写于 作者: P Paul Clements 提交者: Linus Torvalds

[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: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 14f50b49
...@@ -1444,8 +1444,7 @@ int bitmap_create(mddev_t *mddev) ...@@ -1444,8 +1444,7 @@ int bitmap_create(mddev_t *mddev)
if (err) if (err)
goto error; goto error;
bitmap->chunkshift = find_first_bit(&bitmap->chunksize, bitmap->chunkshift = ffz(~bitmap->chunksize);
sizeof(bitmap->chunksize));
/* now that chunksize and chunkshift are set, we can use these macros */ /* now that chunksize and chunkshift are set, we can use these macros */
chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) / chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) /
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册