From 8454d619a7f6966f65f17c2a727e07ae3667b631 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Fri, 14 Sep 2007 09:19:19 -0400 Subject: extra stats for btrfsck, link count in print-tree.c --- btrfsck.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'btrfsck.c') diff --git a/btrfsck.c b/btrfsck.c index e5be0319..628dfc3c 100644 --- a/btrfsck.c +++ b/btrfsck.c @@ -33,6 +33,8 @@ static u64 blocks_used = 0; static u64 total_csum_bytes = 0; static u64 total_btree_blocks = 0; static u64 btree_space_waste = 0; +static u64 data_blocks_allocated = 0; +static u64 data_blocks_referenced = 0; struct extent_record { struct btrfs_disk_key parent_key; @@ -353,6 +355,11 @@ static int run_next_block(struct btrfs_root *root, continue; if (btrfs_file_extent_disk_blocknr(fi) == 0) continue; + + data_blocks_allocated += + btrfs_file_extent_disk_num_blocks(fi); + data_blocks_referenced += + btrfs_file_extent_num_blocks(fi); ret = add_extent_rec(extent_radix, NULL, blocknr, btrfs_file_extent_disk_blocknr(fi), btrfs_file_extent_disk_num_blocks(fi), @@ -522,5 +529,8 @@ int main(int ac, char **av) { (unsigned long long)total_btree_blocks); printf("btree space waste bytes: %llu\n", (unsigned long long)btree_space_waste); + printf("file data blocks allocated: %llu\n referenced %llu\n", + (unsigned long long)data_blocks_allocated, + (unsigned long long)data_blocks_referenced); return ret; } -- cgit v1.2.3