linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Filipe Manana <fdmanana@kernel.org>
Cc: David Sterba <dsterba@suse.com>,
	Josef Bacik <josef@toxicpanda.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v3] btrfs: zoned: make auto-reclaim less aggressive
Date: Tue, 15 Mar 2022 13:51:32 +0000	[thread overview]
Message-ID: <PH0PR04MB741627CCED189B4D1B5B1ADD9B109@PH0PR04MB7416.namprd04.prod.outlook.com> (raw)
In-Reply-To: YjB8perl04WEeTnE@debian9.Home

On 15/03/2022 12:47, Filipe Manana wrote:
> On Tue, Mar 15, 2022 at 04:02:57AM -0700, Johannes Thumshirn wrote:
>> The current auto-reclaim algorithm starts reclaiming all block-group's
>> with a zone_unusable value above a configured threshold. This is causing a
>> lot of reclaim IO even if there would be enough free zones on the device.
>>
>> Instead of only accounting a block-group's zone_unusable value, also take
>> the number of empty zones into account.
>>
>> Cc: Josef Bacik <josef@toxicpanda.com>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>>
>> ---
>> Changes since v4:
>> * Use div_u64()
>>
>> Changes since RFC:
>> * Fix logic error
>> * Skip unavailable devices
>> * Use different metric working for non-zoned devices as well
>> ---
>>  fs/btrfs/block-group.c |  3 +++
>>  fs/btrfs/zoned.c       | 30 ++++++++++++++++++++++++++++++
>>  fs/btrfs/zoned.h       |  6 ++++++
>>  3 files changed, 39 insertions(+)
>>
>> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
>> index c22d287e020b..2e77b38c538b 100644
>> --- a/fs/btrfs/block-group.c
>> +++ b/fs/btrfs/block-group.c
>> @@ -1522,6 +1522,9 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
>>  	if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
>>  		return;
>>  
>> +	if (!btrfs_zoned_should_reclaim(fs_info))
>> +		return;
>> +
>>  	sb_start_write(fs_info->sb);
>>  
>>  	if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_BALANCE)) {
>> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
>> index 49446bb5a5d1..dc62a14594de 100644
>> --- a/fs/btrfs/zoned.c
>> +++ b/fs/btrfs/zoned.c
>> @@ -15,6 +15,7 @@
>>  #include "transaction.h"
>>  #include "dev-replace.h"
>>  #include "space-info.h"
>> +#include "misc.h"
> 
> Why is this included added?
> Did you intended to use div_factor()?
> 

Indeed a earlier version of this patch (using a different metric) used 
div_factor_fine(). This is a left over, I'll remove it in the next version,
as it's not needed anymore.

Good catch, thanks :)

  reply	other threads:[~2022-03-15 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 11:02 [PATCH v3] btrfs: zoned: make auto-reclaim less aggressive Johannes Thumshirn
2022-03-15 11:46 ` Filipe Manana
2022-03-15 13:51   ` Johannes Thumshirn [this message]
2022-03-15 14:20 ` Josef Bacik
2022-03-15 14:36   ` Johannes Thumshirn

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=PH0PR04MB741627CCED189B4D1B5B1ADD9B109@PH0PR04MB7416.namprd04.prod.outlook.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@kernel.org \
    --cc=josef@toxicpanda.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;
as well as URLs for NNTP newsgroup(s).