From a96f71a79728c7d53a1c5dc5303d651e8d616517 Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Tue, 13 Aug 2019 01:13:47 +0900 Subject: [PATCH] sys/vfs/hammer2: Move duplicated macros H2FM*() to hammer2_disk.h These macros exist in both freemap and bulkfree code. Should be part of ondisk layout spec. --- sys/vfs/hammer2/hammer2_bulkfree.c | 9 --------- sys/vfs/hammer2/hammer2_disk.h | 9 +++++++++ sys/vfs/hammer2/hammer2_freemap.c | 11 ----------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/sys/vfs/hammer2/hammer2_bulkfree.c b/sys/vfs/hammer2/hammer2_bulkfree.c index 062a7b2d4e..f77a762fc9 100644 --- a/sys/vfs/hammer2/hammer2_bulkfree.c +++ b/sys/vfs/hammer2/hammer2_bulkfree.c @@ -46,15 +46,6 @@ #include "hammer2.h" -/* - * XXX I made a mistake and made the reserved area begin at each LEVEL1 zone, - * which is on a 1GB demark. This will eat a little more space but for - * now we retain compatibility and make FMZONEBASE every 1GB - */ -#define H2FMZONEBASE(key) ((key) & ~HAMMER2_FREEMAP_LEVEL1_MASK) -#define H2FMBASE(key, radix) ((key) & ~(((hammer2_off_t)1 << (radix)) - 1)) -#define H2FMSHIFT(radix) ((hammer2_off_t)1 << (radix)) - /* * breadth-first search */ diff --git a/sys/vfs/hammer2/hammer2_disk.h b/sys/vfs/hammer2/hammer2_disk.h index 0e037e8034..1e1fcff079 100644 --- a/sys/vfs/hammer2/hammer2_disk.h +++ b/sys/vfs/hammer2/hammer2_disk.h @@ -384,6 +384,15 @@ #define HAMMER2_FREEMAP_COUNT (int)(HAMMER2_FREEMAP_LEVELN_PSIZE / \ sizeof(hammer2_bmap_data_t)) +/* + * XXX I made a mistake and made the reserved area begin at each LEVEL1 zone, + * which is on a 1GB demark. This will eat a little more space but for + * now we retain compatibility and make FMZONEBASE every 1GB + */ +#define H2FMZONEBASE(key) ((key) & ~HAMMER2_FREEMAP_LEVEL1_MASK) +#define H2FMBASE(key, radix) ((key) & ~(((hammer2_off_t)1 << (radix)) - 1)) +#define H2FMSHIFT(radix) ((hammer2_off_t)1 << (radix)) + /* * 16KB bitmap granularity (x2 bits per entry). */ diff --git a/sys/vfs/hammer2/hammer2_freemap.c b/sys/vfs/hammer2/hammer2_freemap.c index 1a97e35735..7a2a1b6604 100644 --- a/sys/vfs/hammer2/hammer2_freemap.c +++ b/sys/vfs/hammer2/hammer2_freemap.c @@ -74,21 +74,10 @@ static int hammer2_freemap_iterate(hammer2_chain_t **parentp, * chains use fixed storage offsets in the 4MB reserved area at the * beginning of each 2GB zone * - * XXX I made a mistake and made the reserved area begin at each LEVEL1 zone, - * which is on a 1GB demark. This will eat a little more space but for - * now we retain compatibility and make FMZONEBASE every 1GB - * - * (see same thing in hammer2_bulkfree.c near the top, as well as in - * newfs_hammer2). - * * Rotate between four possibilities. Theoretically this means we have three * good freemaps in case of a crash which we can use as a base for the fixup * scan at mount-time. */ -#define H2FMZONEBASE(key) ((key) & ~HAMMER2_FREEMAP_LEVEL1_MASK) -#define H2FMBASE(key, radix) ((key) & ~(((hammer2_off_t)1 << (radix)) - 1)) -#define H2FMSHIFT(radix) ((hammer2_off_t)1 << (radix)) - static int hammer2_freemap_reserve(hammer2_chain_t *chain, int radix) -- 2.41.0