linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs-progs: add a --check-bg-usage option to fsck
Date: Fri, 2 Aug 2019 10:03:02 -0400	[thread overview]
Message-ID: <20190802140301.t7od3oj2qsnbfjyq@MacBook-Pro-91.local> (raw)
In-Reply-To: <c4ffca4b-f2a2-b570-5354-c13ac46154fd@gmx.com>

On Fri, Aug 02, 2019 at 09:54:12PM +0800, Qu Wenruo wrote:
> 
> 
> On 2019/8/2 下午9:06, Josef Bacik wrote:
> > Sometimes when messing with the chunk allocator code we can end up
> > over-allocating chunks.  Generally speaking I'll notice this when a
> > random xfstest fails with ENOSPC when it shouldn't, but I'm super
> > worried that I won't catch a problem until somebody has a fs completely
> > filled up with empty block groups.  Add a fsck option to check for too
> > many empty block groups.  This way I can set FSCK_OPTIONS="-B" to catch
> > cases where we're too aggressive with the chunk allocator but not so
> > aggressive that it causes problems in xfstests.
> > 
> > Thankfully this doesn't trip up currently, so this will just keep me
> > from regressing us.  Thanks,
> 
> I think the empty bg check is valid.
> 
> Although I hope this check can be a warning for default check, and a new
> option to report too many empty bgs as error.
> 

I don't want to make it default for the reason you describe below.  I'm thinking
of some new log-writes test that checks an fs at a transaction commit where
we've emptied a ton of block groups but haven't removed them yet.

<snip>

> > +
> > +	if (empty_data > 1) {
> > +		ret = -EINVAL;
> > +		fprintf(stderr, "Too many empty data block groups: %d\n",
> > +			empty_data);
> > +	}
> > +	if (empty_metadata > 1) {
> > +		ret = -EINVAL;
> > +		fprintf(stderr, "Too many empty metadata block groups: %d\n",
> > +			empty_metadata);
> > +	}
> > +	if (empty_system > 1) {
> > +		ret = -EINVAL;
> > +		fprintf(stderr, "Too many empty system block groups: %d\n",
> > +			empty_system);
> > +	}
> 
> This hard coded threshold (1) is too vague and maybe too restrict.
> What will happen for things like a lot of data got removed and cleaner
> didn't get kicked in quickly enough before unmount?
> 

Which is why I ran it through xfstests first to verify this wasn't too weird.
What I'm try to capture is the case where something has really gone wrong, so
there will be tons of empty block groups, not just one.  I think generally
speaking having 1 left over makes sense for the testcases that fill and then
delete a bunch, so I don't want those to fail.  Thanks,

Josef

  reply	other threads:[~2019-08-02 14:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 13:06 [PATCH] btrfs-progs: add a --check-bg-usage option to fsck Josef Bacik
2019-08-02 13:54 ` Qu Wenruo
2019-08-02 14:03   ` Josef Bacik [this message]
2019-08-29 16:16 ` David Sterba

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=20190802140301.t7od3oj2qsnbfjyq@MacBook-Pro-91.local \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /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).