sys/vfs/hammer2: Cleanup freemap index calculation
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 16 Sep 2019 13:02:13 +0000 (22:02 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 16 Sep 2019 22:56:32 +0000 (07:56 +0900)
Freemap bitmaps (64KB x 5levels x 8rotations) exist in the first
4MB area of every 1GB, so bitmap offset mask should be 4MB-1 rather
than 1GB-1. It explicitly wants to clear bit 22-29.

This doesn't change the result since bref->data_off for freemap
itself has to have 0 for bit 22-29.

sys/vfs/hammer2/hammer2_freemap.c

index 7a9b6d8..edb9d44 100644 (file)
@@ -103,7 +103,7 @@ hammer2_freemap_reserve(hammer2_chain_t *chain, int radix)
                index = 0;
        } else {
                off = bref->data_off & ~HAMMER2_OFF_MASK_RADIX &
-                     HAMMER2_FREEMAP_LEVEL1_MASK;
+                     HAMMER2_SEGMASK;
                off = off / HAMMER2_PBUFSIZE;
                KKASSERT(off >= HAMMER2_ZONE_FREEMAP_00 &&
                         off < HAMMER2_ZONE_FREEMAP_END);