Also take the opportunity to simplify CHUNK_BLOCK_RATIO.
Signed-off-by: NeilBrown <neilb@suse.de>
- BITMAP_BLOCK_SHIFT);
/* now that chunksize and chunkshift are set, we can use these macros */
- chunks = (blocks + bitmap->counts.chunkshift - 1) >>
- bitmap->counts.chunkshift;
- pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO;
+ chunks = DIV_ROUND_UP(blocks, CHUNK_BLOCK_RATIO(bitmap));
+ pages = DIV_ROUND_UP(chunks, PAGE_COUNTER_RATIO);
BUG_ON(!pages);
#define BITMAP_BLOCK_SHIFT 9
/* how many blocks per chunk? (this is variable) */
-#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->mddev->bitmap_info.chunksize >> BITMAP_BLOCK_SHIFT)
+#define CHUNK_BLOCK_RATIO(bitmap) (1 << (bitmap)->counts.chunkshift)
#endif