md/bitmap: use DIV_ROUND_UP instead of open-code
authorNeilBrown <neilb@suse.de>
Tue, 22 May 2012 03:55:25 +0000 (13:55 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 22 May 2012 03:55:25 +0000 (13:55 +1000)
Also take the opportunity to simplify CHUNK_BLOCK_RATIO.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/bitmap.c

index c100a47bc157b84b0478598f72c5cf06e572a3c3..bc552bbad83ed958a2d8939f4818c2f815e2de99 100644 (file)
@@ -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);