public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 5/8] btrfs: tree-checker: don't fail on empty extent roots for extent tree v2
Date: Sat, 6 Nov 2021 09:05:58 +0800	[thread overview]
Message-ID: <59a47abb-4725-bbcd-ce44-2b78c46eda57@gmx.com> (raw)
In-Reply-To: <8fada4dda40dbfb5cefad7eabd16ac00a340896d.1636145221.git.josef@toxicpanda.com>



On 2021/11/6 04:49, Josef Bacik wrote:
> For extent tree v2 we can definitely have empty extent roots, so skip
> this particular check if we have that set.

OK I guess the changes in tree-checker is not yet complete.

As I thought there would be more and bigger changes to support those
global roots.

But so far so good for tree-checker.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>   fs/btrfs/tree-checker.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> index 7733e8ac0a69..1c33dd0e4afc 100644
> --- a/fs/btrfs/tree-checker.c
> +++ b/fs/btrfs/tree-checker.c
> @@ -1633,7 +1633,6 @@ static int check_leaf(struct extent_buffer *leaf, bool check_item_data)
>   		/* These trees must never be empty */
>   		if (unlikely(owner == BTRFS_ROOT_TREE_OBJECTID ||
>   			     owner == BTRFS_CHUNK_TREE_OBJECTID ||
> -			     owner == BTRFS_EXTENT_TREE_OBJECTID ||
>   			     owner == BTRFS_DEV_TREE_OBJECTID ||
>   			     owner == BTRFS_FS_TREE_OBJECTID ||
>   			     owner == BTRFS_DATA_RELOC_TREE_OBJECTID)) {
> @@ -1642,12 +1641,25 @@ static int check_leaf(struct extent_buffer *leaf, bool check_item_data)
>   				    owner);
>   			return -EUCLEAN;
>   		}
> +
>   		/* Unknown tree */
>   		if (unlikely(owner == 0)) {
>   			generic_err(leaf, 0,
>   				"invalid owner, root 0 is not defined");
>   			return -EUCLEAN;
>   		}
> +
> +		/* EXTENT_TREE_V2 can have empty extent trees. */
> +		if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2))
> +			return 0;
> +
> +		if (unlikely(owner == BTRFS_EXTENT_TREE_OBJECTID)) {
> +			generic_err(leaf, 0,
> +			"invalid root, root %llu must never be empty",
> +				    owner);
> +			return -EUCLEAN;
> +		}
> +
>   		return 0;
>   	}
>
>

  reply	other threads:[~2021-11-06  1:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 20:49 [PATCH 0/8] btrfs: extent tree v2, support for global roots Josef Bacik
2021-11-05 20:49 ` [PATCH 1/8] btrfs: add definition for EXTENT_TREE_V2 Josef Bacik
2021-11-05 20:49 ` [PATCH 2/8] btrfs: disable balance for extent tree v2 for now Josef Bacik
2021-11-05 20:49 ` [PATCH 3/8] btrfs: disable qgroups in extent tree v2 Josef Bacik
2021-11-05 20:49 ` [PATCH 4/8] btrfs: use metadata usage for global block rsv " Josef Bacik
2021-11-05 20:49 ` [PATCH 5/8] btrfs: tree-checker: don't fail on empty extent roots for " Josef Bacik
2021-11-06  1:05   ` Qu Wenruo [this message]
2021-11-05 20:49 ` [PATCH 6/8] btrfs: abstract out loading the tree root Josef Bacik
2021-11-05 20:49 ` [PATCH 7/8] btrfs: add code to support the block group root Josef Bacik
2021-11-06  1:11   ` Qu Wenruo
2021-11-08 19:36     ` Josef Bacik
2021-11-09  1:14       ` Qu Wenruo
2021-11-09 19:24         ` Josef Bacik
2021-11-09 23:44           ` Qu Wenruo
2021-11-10 13:57             ` Josef Bacik
2021-11-10  7:13           ` Qu Wenruo
2021-11-10 13:54             ` Josef Bacik
2021-11-05 20:49 ` [PATCH 8/8] btrfs: add support for multiple global roots Josef Bacik
2021-11-06  1:18   ` Qu Wenruo
2021-11-06  1:51     ` Qu Wenruo
2021-11-08 19:39       ` Josef Bacik

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=59a47abb-4725-bbcd-ce44-2b78c46eda57@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.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