sbin/hammer2: Add assertion for freemap index in "show"
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 16 Sep 2019 12:58:31 +0000 (21:58 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 16 Sep 2019 22:56:01 +0000 (07:56 +0900)
Test lower end of index.

sbin/hammer2/cmd_debug.c

index 8a29bce..7280f99 100644 (file)
@@ -779,6 +779,7 @@ show_bref(hammer2_volume_data_t *voldata, int fd, int tab,
                tmp = bref->data_off & ~HAMMER2_OFF_MASK_RADIX;
                tmp &= HAMMER2_SEGMASK;
                tmp /= HAMMER2_PBUFSIZE;
+               assert(tmp >= HAMMER2_ZONE_FREEMAP_00);
                assert(tmp < HAMMER2_ZONE_FREEMAP_END);
                tmp -= HAMMER2_ZONE_FREEMAP_00;
                tmp /= HAMMER2_ZONE_FREEMAP_INC;
@@ -817,6 +818,7 @@ show_bref(hammer2_volume_data_t *voldata, int fd, int tab,
                tmp = bref->data_off & ~HAMMER2_OFF_MASK_RADIX;
                tmp &= HAMMER2_SEGMASK;
                tmp /= HAMMER2_PBUFSIZE;
+               assert(tmp >= HAMMER2_ZONE_FREEMAP_00);
                assert(tmp < HAMMER2_ZONE_FREEMAP_END);
                tmp -= HAMMER2_ZONE_FREEMAP_00;
                tmp /= HAMMER2_ZONE_FREEMAP_INC;