From: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
To: "Holger Hoffstätte" <holger@applied-asynchrony.com>,
linux-btrfs@vger.kernel.org,
"Naohiro Aota" <naohiro.aota@hgst.com>
Subject: Re: [PATCH v3] btrfs: should block unused block groups deletion work when allocating data space
Date: Mon, 12 Sep 2016 15:38:20 +0800 [thread overview]
Message-ID: <57D65B6C.4030400@cn.fujitsu.com> (raw)
In-Reply-To: <57D29579.1080700@applied-asynchrony.com>
hello,
On 09/09/2016 06:56 PM, Holger Hoffstätte wrote:
> On 09/09/16 12:18, Holger Hoffstätte wrote:
>> On Fri, 09 Sep 2016 16:17:48 +0800, Wang Xiaoguang wrote:
>>
>>> cleaner_kthread() may run at any time, in which it'll call btrfs_delete_unused_bgs()
>>> to delete unused block groups. Because this work is asynchronous, it may also result
>>> in false ENOSPC error.
>> <snip>
>>
>> With this v3 I can now no longer balance (tested only with metadata).
>> New chunks are allocated (as balance does) but nothing ever shrinks, until
>> after unmount/remount, when the cleaner eventually kicks in.
>>
>> This might be related to the recent patch by Naohiro Aota:
>> "btrfs: let btrfs_delete_unused_bgs() to clean relocated bgs"
>>
>> which by itself doesn't seem to do any harm (i.e. everything still seems
>> to work as expected).
> Actually even that is not true; both patches seem to be wrong in subtle
> ways. Naohiro's patch seems to prevent the deletion during balance, whereas
> yours prevents the cleaner from kicking in.
Indeed in my patch, I just change "struct mutex delete_unused_bgs_mutex"
to "struct rw_semaphore bg_delete_sem", and try to get bg_delete_sem when
we allocate data space, so this patch should work as before :)
>
> As a simple reproducer you can convert from -mdup to -msingle (to create
> bloat) and then balance with -musage=10. Depending on which of the two
> patches are applied, you end with bloat that only grows and never shrinks,
> or bloat that ends up in mixed state (dup and single).
Can you give me a simple test script to reproduce your problem.
(I can write it myself, but I'm afraid I may misunderstand you :) )
Regards,
Xiaoguang Wang
>
> Undoing both makes both balancing and cleaning work again.
>
> -h
>
>
>
next prev parent reply other threads:[~2016-09-12 7:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-09 8:17 [PATCH v3] btrfs: should block unused block groups deletion work when allocating data space Wang Xiaoguang
2016-09-09 8:25 ` Wang Xiaoguang
2016-09-09 9:02 ` David Sterba
2016-09-09 10:18 ` Holger Hoffstätte
2016-09-09 10:56 ` Holger Hoffstätte
2016-09-12 7:38 ` Wang Xiaoguang [this message]
2016-09-12 8:19 ` Holger Hoffstätte
2016-09-10 6:04 ` Stefan Priebe - Profihost AG
-- strict thread matches above, loose matches on Subject: below --
2016-07-25 13:32 [PATCH v2 4/4] " Josef Bacik
2016-07-26 12:04 ` [PATCH v3] " Wang Xiaoguang
2016-07-26 15:51 ` Josef Bacik
2016-07-26 16:25 ` David Sterba
2016-07-27 1:26 ` Wang Xiaoguang
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=57D65B6C.4030400@cn.fujitsu.com \
--to=wangxg.fnst@cn.fujitsu.com \
--cc=holger@applied-asynchrony.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=naohiro.aota@hgst.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).