mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-07 04:26:29 +00:00
Add next_seg_seq field to super
Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -151,7 +151,7 @@ struct scoutfs_segment_block {
|
||||
__le32 crc;
|
||||
__le32 _padding;
|
||||
__le64 segno;
|
||||
__le64 max_seq;
|
||||
__le64 seq;
|
||||
__le32 nr_items;
|
||||
__le32 _moar_pads;
|
||||
struct scoutfs_segment_item items[0];
|
||||
@@ -342,6 +342,7 @@ struct scoutfs_super_block {
|
||||
__le64 ring_blocks;
|
||||
__le64 ring_tail_block;
|
||||
__le64 ring_gen;
|
||||
__le64 next_seg_seq;
|
||||
__le64 buddy_blocks;
|
||||
struct scoutfs_buddy_root buddy_root;
|
||||
struct scoutfs_btree_root btree_root;
|
||||
|
||||
@@ -153,6 +153,7 @@ static int write_new_fs(char *path, int fd)
|
||||
super->ring_blocks = cpu_to_le64(ring_blocks);
|
||||
super->ring_tail_block = cpu_to_le64(1);
|
||||
super->ring_gen = cpu_to_le64(1);
|
||||
super->next_seg_seq = cpu_to_le64(2);
|
||||
|
||||
first_segno = DIV_ROUND_UP(le64_to_cpu(super->ring_blkno) +
|
||||
le64_to_cpu(super->ring_blocks),
|
||||
@@ -163,7 +164,7 @@ static int write_new_fs(char *path, int fd)
|
||||
|
||||
/* write seg with root inode */
|
||||
sblk->segno = cpu_to_le64(first_segno);
|
||||
sblk->max_seq = cpu_to_le64(1);
|
||||
sblk->seq = cpu_to_le64(1);
|
||||
sblk->nr_items = cpu_to_le32(1);
|
||||
|
||||
ikey = (void *)&sblk->items[1];
|
||||
|
||||
@@ -224,6 +224,13 @@ static void print_item(struct scoutfs_segment_block *sblk, u32 pos)
|
||||
printer(key, item.key_len, val, item.val_len);
|
||||
}
|
||||
|
||||
static void print_segment_block(struct scoutfs_segment_block *sblk)
|
||||
{
|
||||
printf(" sblk: segno %llu seq %llu nr_items %u\n",
|
||||
le64_to_cpu(sblk->segno), le64_to_cpu(sblk->seq),
|
||||
le32_to_cpu(sblk->nr_items));
|
||||
}
|
||||
|
||||
static int print_segment(int fd, u64 segno)
|
||||
{
|
||||
struct scoutfs_segment_block *sblk;
|
||||
@@ -234,7 +241,7 @@ static int print_segment(int fd, u64 segno)
|
||||
return -ENOMEM;
|
||||
|
||||
printf("segment segno %llu\n", segno);
|
||||
// print_block_header(&sblk->hdr);
|
||||
print_segment_block(sblk);
|
||||
|
||||
for (i = 0; i < le32_to_cpu(sblk->nr_items); i++)
|
||||
print_item(sblk, i);
|
||||
@@ -376,7 +383,8 @@ static int print_super_blocks(int fd)
|
||||
/* XXX these are all in a crazy order */
|
||||
printf(" next_ino %llu total_blocks %llu free_blocks %llu\n"
|
||||
" ring_blkno %llu ring_blocks %llu ring_tail_block %llu\n"
|
||||
" ring_gen %llu alloc_uninit %llu total_segs %llu\n",
|
||||
" ring_gen %llu alloc_uninit %llu total_segs %llu\n"
|
||||
" next_seg_seq %llu\n",
|
||||
le64_to_cpu(super->next_ino),
|
||||
le64_to_cpu(super->total_blocks),
|
||||
le64_to_cpu(super->free_blocks),
|
||||
@@ -385,7 +393,8 @@ static int print_super_blocks(int fd)
|
||||
le64_to_cpu(super->ring_tail_block),
|
||||
le64_to_cpu(super->ring_gen),
|
||||
le64_to_cpu(super->alloc_uninit),
|
||||
le64_to_cpu(super->total_segs));
|
||||
le64_to_cpu(super->total_segs),
|
||||
le64_to_cpu(super->next_seg_seq));
|
||||
printf(" alloc root:");
|
||||
print_treap_ref(&super->alloc_treap_root.ref);
|
||||
printf("\n");
|
||||
|
||||
Reference in New Issue
Block a user