sbin/hammer2: Simplify bitmap offset calculation in "freemap"
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Thu, 15 Aug 2019 15:10:10 +0000 (00:10 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Thu, 15 Aug 2019 15:38:20 +0000 (00:38 +0900)
Eliminate a magic number 256 (4MB / 16KB).
Each hammer2_bmap_data in leaf covers 4MB (level 0) data store.

sbin/hammer2/cmd_debug.c

index 8605ef2..16da9ef 100644 (file)
@@ -788,7 +788,7 @@ show_bref(hammer2_volume_data_t *voldata, int fd, int tab,
 
                for (i = 0; i < HAMMER2_FREEMAP_COUNT; ++i) {
                        hammer2_off_t data_off = bref->key +
-                               i * 256 * HAMMER2_FREEMAP_BLOCK_SIZE;
+                               i * HAMMER2_FREEMAP_LEVEL0_SIZE;
 #if HAMMER2_BMAP_ELEMENTS != 8
 #error "cmd_debug.c: HAMMER2_BMAP_ELEMENTS expected to be 8"
 #endif