diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-09-14 09:19:19 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-09-14 09:19:19 -0400 |
commit | 8454d619a7f6966f65f17c2a727e07ae3667b631 (patch) | |
tree | e2e93114bbeebd92fdd1f581e6f0bf40f074b5f0 | |
parent | 71d1230de782a38e392d90f3e0af411063b52a8c (diff) |
extra stats for btrfsck, link count in print-tree.c
-rw-r--r-- | btrfsck.c | 10 | ||||
-rw-r--r-- | print-tree.c | 5 |
2 files changed, 13 insertions, 2 deletions
@@ -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; } diff --git a/print-tree.c b/print-tree.c index 60deda54..72893201 100644 --- a/print-tree.c +++ b/print-tree.c @@ -76,11 +76,12 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) switch (type) { case BTRFS_INODE_ITEM_KEY: ii = btrfs_item_ptr(l, i, struct btrfs_inode_item); - printf("\t\tinode generation %llu size %llu block group %llu mode %o\n", + printf("\t\tinode generation %llu size %llu block group %llu mode %o links %u\n", (unsigned long long)btrfs_inode_generation(ii), (unsigned long long)btrfs_inode_size(ii), (unsigned long long)btrfs_inode_block_group(ii), - btrfs_inode_mode(ii)); + btrfs_inode_mode(ii), + btrfs_inode_nlink(ii)); break; case BTRFS_DIR_ITEM_KEY: di = btrfs_item_ptr(l, i, struct btrfs_dir_item); |