From: NeilBrown Date: Tue, 22 May 2012 03:55:25 +0000 (+1000) Subject: md/bitmap: use DIV_ROUND_UP instead of open-code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=15702d7fb6e7a6baf5a04286a227b0ad2fe4a03f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git md/bitmap: use DIV_ROUND_UP instead of open-code Also take the opportunity to simplify CHUNK_BLOCK_RATIO. Signed-off-by: NeilBrown --- 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);