Skip to content

Commit

Permalink
md/bitmap: use DIV_ROUND_UP instead of open-code
Browse files Browse the repository at this point in the history
Also take the opportunity to simplify CHUNK_BLOCK_RATIO.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed May 22, 2012
1 parent 40cffcc commit 15702d7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 15702d7

Please sign in to comment.