public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs: kill update_block_group_flags
Date: Tue, 7 Jan 2020 10:09:32 -0500	[thread overview]
Message-ID: <5d39b16c-627a-1472-2d4e-d6861ec03c8f@toxicpanda.com> (raw)
In-Reply-To: <4bc7e4f5-c370-4e0e-405c-5d3aa67f95b0@gmx.com>

On 1/7/20 6:08 AM, Qu Wenruo wrote:
> 
> 
> On 2020/1/7 上午12:50, Josef Bacik wrote:
>> btrfs/061 has been failing consistently for me recently with a
>> transaction abort.  We run out of space in the system chunk array, which
>> means we've allocated way too many system chunks than we need.
> 
> Isn't that caused by scrubbing creating unnecessary system chunks?
> 
> IIRC I had a patch to address that problem by just simply not allocating
> system chunks for scrub.
> ("btrfs: scrub: Don't check free space before marking a block  group RO")
> 

This addresses the symptoms, not the root cause of the problem.  Your fix is 
valid, because we probably shouldn't be doing that, but we also shouldn't be 
forcing restriping of block groups arbitrarily.

> Although that doesn't address the whole problem, but it should at least
> reduce the possibility.
> 
> 
> Furthermore, with the newer over-commit behavior for inc_block_group_ro
> ("btrfs: use btrfs_can_overcommit in inc_block_group_ro"), we won't
> really allocate new system chunks anymore if we can over-commit.
> 
> With those two patches, I guess we should have solved the problem.
> Or did I miss something?
> 
You are missing that we're getting forced to allocate a system chunk from this

alloc_flags = update_block_group_flags(fs_info, cache->flags);
if (alloc_flags != cache->flags) {
	ret = btrfs_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE);

which you move down in your patch, but will still get tripped by rebalance.  So 
you sort of paper over the real problem, we just don't get bitten by it as hard 
with 061 because balance takes longer than scrub does.  If we let it run longer 
per fs type we'd still hit the same problem.

In short, your patches do make it better, and are definitely correct because we 
probably shouldn't be allocating new chunks for scrub, but they don't address 
the real cause of the problem.  All the patches are needed.  Thanks,

Josef

  reply	other threads:[~2020-01-07 15:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 16:50 [PATCH] btrfs: kill update_block_group_flags Josef Bacik
2020-01-07 11:08 ` Qu Wenruo
2020-01-07 15:09   ` Josef Bacik [this message]
2020-01-08  5:36     ` Qu Wenruo
2020-01-08 17:03 ` 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=5d39b16c-627a-1472-2d4e-d6861ec03c8f@toxicpanda.com \
    --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