sys/vfs/hammer: Cast HAMMER_BLOCKMAP_RADIX1|2 macros to int
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 1 Dec 2015 13:25:07 +0000 (22:25 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 1 Dec 2015 15:02:46 +0000 (00:02 +0900)
RADIX macros represent how many layer1/2 entries (32/16 bytes)
a 8MB big-block can hold, but these aren't zone-x offset.

These are typicaly used as an index of array where each entry
is a data structure that corresponds to layer1/2 entry,
therefore it makes sense to cast these macros to int.

sbin/hammer/cmd_blockmap.c
sys/vfs/hammer/hammer_disk.h

index 286f5ff..cc7ae01 100644 (file)
@@ -279,7 +279,7 @@ check_freemap(hammer_blockmap_t freemap)
 
        collect_freemap_layer1(freemap);
 
-       for (i = 0; i < (int)HAMMER_BLOCKMAP_RADIX1; ++i) {
+       for (i = 0; i < HAMMER_BLOCKMAP_RADIX1; ++i) {
                offset = freemap->phys_offset + i * sizeof(*layer1);
                layer1 = get_buffer_data(offset, &buffer1, 0);
                if (layer1->phys_offset != HAMMER_BLOCKMAP_UNAVAIL)
@@ -586,8 +586,7 @@ dump_collect(collect_t collect, struct zone_stat *stats)
        struct hammer_blockmap_layer2 *track2;
        struct hammer_blockmap_layer2 *layer2;
        hammer_off_t offset;
-       size_t i;
-       int zone;
+       int i, zone;
 
        for (i = 0; i < HAMMER_BLOCKMAP_RADIX2; ++i) {
                track2 = &collect->track2[i];
index 31a7acc..e685e9b 100644 (file)
@@ -342,9 +342,9 @@ typedef struct hammer_blockmap_layer2 *hammer_blockmap_layer2_t;
 #define HAMMER_BLOCKMAP_UNAVAIL        ((hammer_off_t)-1LL)
 
 #define HAMMER_BLOCKMAP_RADIX1 /* 2^18 = 262144 */     \
-       (HAMMER_BIGBLOCK_SIZE / sizeof(struct hammer_blockmap_layer1))
+       ((int)(HAMMER_BIGBLOCK_SIZE / sizeof(struct hammer_blockmap_layer1)))
 #define HAMMER_BLOCKMAP_RADIX2 /* 2^19 = 524288 */     \
-       (HAMMER_BIGBLOCK_SIZE / sizeof(struct hammer_blockmap_layer2))
+       ((int)(HAMMER_BIGBLOCK_SIZE / sizeof(struct hammer_blockmap_layer2)))
 
 #define HAMMER_BLOCKMAP_LAYER1 /* 2^(18+19+23) = 1EB */        \
        (HAMMER_BLOCKMAP_RADIX1 * HAMMER_BLOCKMAP_LAYER2)