From: Josef Bacik <josef@toxicpanda.com>
To: Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 4/8] btrfs-progs: simple quotas fsck
Date: Thu, 13 Jul 2023 16:22:14 -0400 [thread overview]
Message-ID: <20230713202214.GV207541@perftesting> (raw)
In-Reply-To: <929adaf2889519f82cb79db3077eef2d8938a247.1688599734.git.boris@bur.io>
On Wed, Jul 05, 2023 at 04:36:23PM -0700, Boris Burkov wrote:
> Add simple quotas checks to btrfs check.
>
> Like the kernel feature, these checks bypass most of the backref walking
> in the qgroups check. Instead, they enforce the invariant behind the
> design of simple quotas by scanning the extent tree and determining the
> owner of each extent:
> Data: reading the owner ref inline item
> Metadata: reading the tree block and reading its btrfs_header's owner
>
> This gives us the expected count from squotas which we check against the
> on-disk state of the qgroup items
>
> Signed-off-by: Boris Burkov <boris@bur.io>
> ---
> check/main.c | 2 +
> check/qgroup-verify.c | 122 ++++++++++++++++++++++++++++++++++--------
> 2 files changed, 102 insertions(+), 22 deletions(-)
>
> diff --git a/check/main.c b/check/main.c
> index 77bb50a0e..07f31fbe0 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -5667,6 +5667,8 @@ static int process_extent_item(struct btrfs_root *root,
> btrfs_shared_data_ref_count(eb, sref),
> gen, 0, num_bytes);
> break;
> + case BTRFS_EXTENT_OWNER_REF_KEY:
> + break;
> default:
> fprintf(stderr,
> "corrupt extent record: key [%llu,%u,%llu]\n",
> diff --git a/check/qgroup-verify.c b/check/qgroup-verify.c
> index 1a62009b8..0d079f3b7 100644
> --- a/check/qgroup-verify.c
> +++ b/check/qgroup-verify.c
> @@ -85,6 +85,8 @@ static struct counts_tree {
> unsigned int num_groups;
> unsigned int rescan_running:1;
> unsigned int qgroup_inconsist:1;
> + unsigned int simple:1;
> + u64 enable_gen;
> u64 scan_progress;
> } counts = { .root = RB_ROOT };
>
> @@ -341,14 +343,14 @@ static int find_parent_roots(struct ulist *roots, u64 parent)
> ref = find_ref_bytenr(parent);
> if (!ref) {
> error("bytenr ref not found for parent %llu",
> - (unsigned long long)parent);
> + (unsigned long long)parent);
> return -EIO;
> }
> node = &ref->bytenr_node;
> if (ref->bytenr != parent) {
> error("found bytenr ref does not match parent: %llu != %llu",
> - (unsigned long long)ref->bytenr,
> - (unsigned long long)parent);
> + (unsigned long long)ref->bytenr,
> + (unsigned long long)parent);
> return -EIO;
> }
>
> @@ -364,8 +366,8 @@ static int find_parent_roots(struct ulist *roots, u64 parent)
> prev = rb_entry(prev_node, struct ref, bytenr_node);
> if (prev->bytenr == parent) {
> error(
> - "unexpected: prev bytenr same as parent: %llu",
> - (unsigned long long)parent);
> + "unexpected: prev bytenr same as parent: %llu",
> + (unsigned long long)parent);
> return -EIO;
> }
> }
> @@ -717,9 +719,6 @@ static int travel_tree(struct btrfs_fs_info *info, struct btrfs_root *root,
> u64 new_bytenr;
> u64 new_num_bytes;
>
> -// printf("travel_tree: bytenr: %llu\tnum_bytes: %llu\tref_parent: %llu\n",
> -// bytenr, num_bytes, ref_parent);
> -
Don't make big formatting changes with code changes, it makes it hard to tell
what's important and what I can gloss over. Thanks,
Josef
next prev parent reply other threads:[~2023-07-13 20:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 23:36 [PATCH 0/8] btrfs-progs: simple quotas Boris Burkov
2023-07-05 23:36 ` [PATCH 1/8] btrfs-progs: document squotas Boris Burkov
2023-07-13 18:02 ` Josef Bacik
2023-07-05 23:36 ` [PATCH 2/8] btrfs-progs: simple quotas kernel definitions Boris Burkov
2023-07-13 20:19 ` Josef Bacik
2023-07-05 23:36 ` [PATCH 3/8] btrfs-progs: simple quotas dump commands Boris Burkov
2023-07-13 20:20 ` Josef Bacik
2023-07-05 23:36 ` [PATCH 4/8] btrfs-progs: simple quotas fsck Boris Burkov
2023-07-13 20:22 ` Josef Bacik [this message]
2023-07-05 23:36 ` [PATCH 5/8] btrfs-progs: simple quotas mkfs Boris Burkov
2023-07-13 20:23 ` Josef Bacik
2023-07-05 23:36 ` [PATCH 6/8] btrfs-progs: simple quotas btrfstune Boris Burkov
2023-07-13 20:25 ` Josef Bacik
2023-07-05 23:36 ` [PATCH 7/8] btrfs-progs: simple quotas enable cmd Boris Burkov
2023-07-13 20:26 ` Josef Bacik
2023-07-05 23:36 ` [PATCH 8/8] btrfs-progs: tree-checker: handle owner ref items Boris Burkov
2023-07-13 20:28 ` 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=20230713202214.GV207541@perftesting \
--to=josef@toxicpanda.com \
--cc=boris@bur.io \
--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