Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15702d7f authored by NeilBrown's avatar NeilBrown
Browse files

md/bitmap: use DIV_ROUND_UP instead of open-code



Also take the opportunity to simplify CHUNK_BLOCK_RATIO.

Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 40cffcc0
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);