summaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-22 13:55:25 +1000
committerNeilBrown <neilb@suse.de>2012-05-22 13:55:25 +1000
commit15702d7fb6e7a6baf5a04286a227b0ad2fe4a03f (patch)
treee3f99eab7c841bb51ee48a8806e140f751d8e95d /drivers/md/bitmap.c
parent40cffcc0e8f9f6e295630cb8b8d58a13baa6c7f9 (diff)
downloadlinux-15702d7fb6e7a6baf5a04286a227b0ad2fe4a03f.tar.bz2
md/bitmap: use DIV_ROUND_UP instead of open-code
Also take the opportunity to simplify CHUNK_BLOCK_RATIO. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index c100a47bc157..bc552bbad83e 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1694,9 +1694,8 @@ int bitmap_create(struct mddev *mddev)
bitmap->counts.chunkshift = (ffz(~mddev->bitmap_info.chunksize)
- BITMAP_BLOCK_SHIFT);
- chunks = (blocks + (1 << bitmap->counts.chunkshift) - 1) >>
- bitmap->counts.chunkshift;
- pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO;
+ chunks = DIV_ROUND_UP_SECTOR_T(blocks, 1 << bitmap->counts.chunkshift);
+ pages = DIV_ROUND_UP(chunks, PAGE_COUNTER_RATIO);
BUG_ON(!pages);