[v2,6/7] btrfs: check/original: Check and repair free space cache inode item
diff mbox series

Message ID 20190401055551.6837-7-wqu@suse.com
State New
Headers show
Series
  • btrfs: check: Check and repair invalid free space cahce inode mode
Related show

Commit Message

Qu Wenruo April 1, 2019, 5:55 a.m. UTC
Just like lowmem mode, also check and repair free space cache inode
item.

And since we don't really have a good timing/function to check free
space chace inodes, we use the same common mode
check_repair_free_space_inode() when iterating root tree.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 check/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch
diff mbox series

diff --git a/check/main.c b/check/main.c
index 608fe7bb02fb..7466d5d00858 100644
--- a/check/main.c
+++ b/check/main.c
@@ -3626,6 +3626,17 @@  again:
 			   key.type == BTRFS_ROOT_BACKREF_KEY) {
 			process_root_ref(leaf, path.slots[0], &key,
 					 root_cache);
+		} else if (key.type == BTRFS_INODE_ITEM_KEY &&
+			   is_fstree(key.objectid)) {
+			ret = check_repair_free_space_inode(fs_info, &path);
+			if (ret < 0 && !path.nodes[0]) {
+				err = 1;
+				goto out;
+			}
+			if (ret < 0 && path.nodes[0]) {
+				err = 1;
+				goto next;
+			}
 		}
 next:
 		path.slots[0]++;