From 80e0c4bd56925c77a8f19c8abe7c9ebc4038c957 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 24 Oct 2017 15:41:30 -0700 Subject: [PATCH] scoutfs-utils: add support for btree migration key Signed-off-by: Zach Brown --- utils/src/format.h | 5 +++++ utils/src/print.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/utils/src/format.h b/utils/src/format.h index e30a1320..3c78a8dd 100644 --- a/utils/src/format.h +++ b/utils/src/format.h @@ -103,10 +103,15 @@ struct scoutfs_btree_ref { /* * A height of X means that the first block read will have level X-1 and * the leaves will have level 0. + * + * The migration key is used to walk the tree finding old blocks to migrate + * into the current half of the ring. */ struct scoutfs_btree_root { struct scoutfs_btree_ref ref; __u8 height; + __le16 migration_key_len; + __u8 migration_key[SCOUTFS_BTREE_MAX_KEY_LEN]; } __packed; struct scoutfs_btree_item_header { diff --git a/utils/src/print.c b/utils/src/print.c index 29338454..ebf22dc9 100644 --- a/utils/src/print.c +++ b/utils/src/print.c @@ -562,8 +562,8 @@ static void print_super_block(struct scoutfs_super_block *super, u64 blkno) " alloc_uninit %llu total_segs %llu free_segs %llu\n" " btree ring: first_blkno %llu nr_blocks %llu next_block %llu " "next_seq %llu\n" - " alloc btree root: height %u blkno %llu seq %llu\n" - " manifest btree root: height %u blkno %llu seq %llu\n", + " alloc btree root: height %u blkno %llu seq %llu mig_len %u\n" + " manifest btree root: height %u blkno %llu seq %llu mig_len %u\n", le64_to_cpu(super->next_ino), le64_to_cpu(super->next_seq), le64_to_cpu(super->next_seg_seq), @@ -577,9 +577,11 @@ static void print_super_block(struct scoutfs_super_block *super, u64 blkno) super->alloc_root.height, le64_to_cpu(super->alloc_root.ref.blkno), le64_to_cpu(super->alloc_root.ref.seq), + le16_to_cpu(super->alloc_root.migration_key_len), super->manifest.root.height, le64_to_cpu(super->manifest.root.ref.blkno), - le64_to_cpu(super->manifest.root.ref.seq)); + le64_to_cpu(super->manifest.root.ref.seq), + le16_to_cpu(super->manifest.root.migration_key_len)); printf(" level_counts:"); counts = super->manifest.level_counts;