linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 6/7] btrfs: check/original: Check and repair free space cache inode item
Date: Mon,  1 Apr 2019 13:55:50 +0800	[thread overview]
Message-ID: <20190401055551.6837-7-wqu@suse.com> (raw)
In-Reply-To: <20190401055551.6837-1-wqu@suse.com>

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(+)

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]++;
-- 
2.21.0


  parent reply	other threads:[~2019-04-01  5:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01  5:55 [PATCH v2 0/7] btrfs: check: Check and repair invalid free space cahce inode mode Qu Wenruo
2019-04-01  5:55 ` [PATCH v2 1/7] btrfs-progs: check/lowmem: Add inode mode check Qu Wenruo
2019-04-01  5:55 ` [PATCH v2 2/7] btrfs-progs: check/original: " Qu Wenruo
2019-04-01  5:55 ` [PATCH v2 3/7] btrfs-progs: check/lowmem: Repair invalid inode mode in root tree Qu Wenruo
2019-04-01  5:55 ` [PATCH v2 4/7] btrfs-progs: check/original: " Qu Wenruo
2019-04-01  5:55 ` [PATCH v2 5/7] btrfs: check/lowmem: Check and repair free space cache inode mode Qu Wenruo
2019-04-01  5:55 ` Qu Wenruo [this message]
2019-04-01  5:55 ` [PATCH v2 7/7] btrfs: tests/fsck: Add test image for free space cache mode repair Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190401055551.6837-7-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).