sys/vfs/hammer: Cast HAMMER_BLOCKMAP_LAYER1|2_INDEX macros to int
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 1 Dec 2015 17:06:32 +0000 (02:06 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 2 Dec 2015 06:43:37 +0000 (15:43 +0900)
This commit does the same as 37fa1bc7 for INDEX macros.

RADIX macro is how many layer entries a big-block can hold,
INDEX macro is an index of layer entry for the given offset.
(i.e. Maximum INDEX equals (RADIX - 1))

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

index cc7ae01..1b07c5c 100644 (file)
@@ -186,7 +186,7 @@ dump_blockmap(const char *label, int zone)
                                        HAMMER_BLOCKMAP_LAYER1_OFFSET(scan2),
                                        HAMMER_BLOCKMAP_LAYER2_OFFSET(scan2));
                        else if (VerboseOpt > 0)
-                               printf("vol=%-3d L1=%-6lu L2=%-6lu ",
+                               printf("vol=%-3d L1=%-6d L2=%-6d ",
                                        HAMMER_VOL_DECODE(scan2),
                                        HAMMER_BLOCKMAP_LAYER1_INDEX(scan2),
                                        HAMMER_BLOCKMAP_LAYER2_INDEX(scan2));
index c31140b..10a0da0 100644 (file)
@@ -534,7 +534,7 @@ print_bigblock_fill(hammer_off_t offset)
        int error;
 
        blockmap_lookup(offset, &layer1, &layer2, &error);
-       printf("z%d:v%d:%lu:%lu:%lu=",
+       printf("z%d:v%d:%d:%d:%lu=",
                HAMMER_ZONE_DECODE(offset),
                HAMMER_VOL_DECODE(offset),
                HAMMER_BLOCKMAP_LAYER1_INDEX(offset),
index bf2c93d..f686cfa 100644 (file)
@@ -344,8 +344,8 @@ hammer_add_zone_stat(struct zone_stat *stats, hammer_off_t offset,
        vol = HAMMER_VOL_DECODE(offset);
 
        offset &= HAMMER_OFF_SHORT_MASK;  /* cut off volume bits from layer1 */
-       i = (int)HAMMER_BLOCKMAP_LAYER1_INDEX(offset);
-       j = (int)HAMMER_BLOCKMAP_LAYER2_INDEX(offset);
+       i = HAMMER_BLOCKMAP_LAYER1_INDEX(offset);
+       j = HAMMER_BLOCKMAP_LAYER2_INDEX(offset);
 
        if (i > l1_max[vol]) {
                assert(i < 1024);  /* XXX hardcoded */
index e685e9b..e98e6d0 100644 (file)
@@ -359,12 +359,12 @@ typedef struct hammer_blockmap_layer2 *hammer_blockmap_layer2_t;
  * a zone-2 physical offset.
  */
 #define HAMMER_BLOCKMAP_LAYER1_INDEX(zone2_offset)             \
-       (((zone2_offset) & HAMMER_BLOCKMAP_LAYER1_MASK) /       \
-        HAMMER_BLOCKMAP_LAYER2)
+       ((int)(((zone2_offset) & HAMMER_BLOCKMAP_LAYER1_MASK) / \
+        HAMMER_BLOCKMAP_LAYER2))
 
 #define HAMMER_BLOCKMAP_LAYER2_INDEX(zone2_offset)             \
-       (((zone2_offset) & HAMMER_BLOCKMAP_LAYER2_MASK) /       \
-       HAMMER_BIGBLOCK_SIZE64)
+       ((int)(((zone2_offset) & HAMMER_BLOCKMAP_LAYER2_MASK) / \
+       HAMMER_BIGBLOCK_SIZE64))
 
 /*
  * Byte offset within layer1 or layer2 big-block for the entry representing