From: Gui Hecheng Date: Wed, 18 Jun 2014 05:28:22 +0000 (+0800) Subject: btrfs-progs: clean fsck noise for free inode generation 0 X-Git-Tag: upstream/4.16.1~2795 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=978542ff59e731dcc45084a7341b2cd8b5437163;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: clean fsck noise for free inode generation 0 When we write a btrfs to full and then we have no space left for free space cache. The btrfs check will output msg as follows which is noise indeed: # free space inode generation (0) did not match free space cache generation (XXX) When the free space cache is not written out normally, the free inode generation will be 0. In this condition, no noise should be outputed. Also, check 0-sized inode eariler together with 0-generationed inode. Signed-off-by: Gui Hecheng Signed-off-by: David Sterba --- diff --git a/free-space-cache.c b/free-space-cache.c index bddde24..2440dd8 100644 --- a/free-space-cache.c +++ b/free-space-cache.c @@ -310,6 +310,13 @@ static int __load_free_space_cache(struct btrfs_root *root, leaf = path->nodes[0]; inode_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_inode_item); + + inode_size = btrfs_inode_size(leaf, inode_item); + if (!inode_size || !btrfs_inode_generation(leaf, inode_item)) { + btrfs_release_path(path); + return 0; + } + if (btrfs_inode_generation(leaf, inode_item) != generation) { printf("free space inode generation (%llu) did not match " "free space cache generation (%llu)\n", @@ -320,10 +327,7 @@ static int __load_free_space_cache(struct btrfs_root *root, return 0; } - inode_size = btrfs_inode_size(leaf, inode_item); btrfs_release_path(path); - if (inode_size == 0) - return 0; if (!num_entries) return 0;