- To: linux-raid@xxxxxxxxxxxxxxx
- Subject: [md PATCH 19/24] md/bitmap: use DIV_ROUND_UP instead of open-code
- From: NeilBrown <neilb@xxxxxxx>
- Date: Tue, 17 Apr 2012 18:43:42 +1000
- In-reply-to: <20120417084324.6433.68345.stgit@notabene.brown>
- User-agent: StGIT/0.14.3
Also take the opportunity to simplify CHUNK_BLOCK_RATIO.
Signed-off-by: NeilBrown <neilb@xxxxxxx>
---
drivers/md/bitmap.c | 5 ++---
drivers/md/bitmap.h | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index d2750a3..bcd5107 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1695,9 +1695,8 @@ int bitmap_create(struct mddev *mddev)
- 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);
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h
index 256a850..530be4d 100644
--- a/drivers/md/bitmap.h
+++ b/drivers/md/bitmap.h
@@ -102,7 +102,7 @@ typedef __u16 bitmap_counter_t;
#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
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[ATA RAID]
[Linux SCSI Target Infrastructure]
[Managing RAID on Linux]
[Linux IDE]
[Linux SCSI]
[Linux Hams]
[Device-Mapper]
[Kernel]
[Linux Books]
[Linux Admin]
[Linux Net]
[GFS]
[RPM]
[git]
[Photos]
[Yosemite Photos]
[Yosemite News]
[AMD 64]
[Linux Networking]