public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, Pankaj Raghav <p.raghav@samsung.com>
Subject: Re: [PATCH 2/5] btrfs: allow block group background reclaim for !zoned fs'es
Date: Tue, 22 Mar 2022 13:38:09 -0400	[thread overview]
Message-ID: <YjoJgS244Y9x6OPu@localhost.localdomain> (raw)
In-Reply-To: <ef7463193e228bbb348bf8a8d587aa8b95bebf22.1647878642.git.johannes.thumshirn@wdc.com>

On Mon, Mar 21, 2022 at 09:14:11AM -0700, Johannes Thumshirn wrote:
> From: Josef Bacik <josef@toxicpanda.com>
> 
> We have found this feature invaluable at Facebook due to how our
> workload interacts with the allocator.  We have been using this in
> production for months with only a single problem that has already been
> fixed.  This will allow us to set a threshold for block groups to be
> automatically relocated even if we don't have zoned devices.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  fs/btrfs/block-group.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
> index 59f18a10fd5f..628741ecb97b 100644
> --- a/fs/btrfs/block-group.c
> +++ b/fs/btrfs/block-group.c
> @@ -3208,6 +3208,31 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans)
>  	return ret;
>  }
>  
> +static inline bool should_reclaim_block_group(struct btrfs_block_group *block_group,
> +					      u64 bytes_freed)
> +{
> +	const struct btrfs_space_info *space_info = block_group->space_info;
> +	const int reclaim_thresh = READ_ONCE(space_info->bg_reclaim_threshold);
> +	const u64 new_val = block_group->used;
> +	const u64 old_val = new_val + bytes_freed;
> +	u64 thresh;
> +

Actually do we want to do a

if (btrfs_zoned())
	return false;

here and leave the auto reclaim zoned behavior the way it is?  Or do you want to
delete your stuff and rely on this as the way that we setup zoned block groups
for relocation?  If we use this then you could make the
fs_info->bg_reclaim_threshold also apply here.  Thanks,

Josef

  reply	other threads:[~2022-03-22 17:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 16:14 [PATCH 0/5] btrfs: rework background block group relocation Johannes Thumshirn
2022-03-21 16:14 ` [PATCH 1/5] btrfs: make the bg_reclaim_threshold per-space info Johannes Thumshirn
2022-03-22 17:32   ` Josef Bacik
2022-03-22 17:34     ` Johannes Thumshirn
2022-03-21 16:14 ` [PATCH 2/5] btrfs: allow block group background reclaim for !zoned fs'es Johannes Thumshirn
2022-03-22 17:38   ` Josef Bacik [this message]
2022-03-22 17:40     ` Johannes Thumshirn
2022-03-21 16:14 ` [PATCH 3/5] btrfs: change the bg_reclaim_threshold valid region from 0 to 100 Johannes Thumshirn
2022-03-21 16:14 ` [PATCH 4/5] btrfs: make calc_available_free_space available outside of space-info Johannes Thumshirn
2022-03-22 17:34   ` Josef Bacik
2022-03-21 16:14 ` [PATCH 5/5] btrfs: zoned: make auto-reclaim less aggressive Johannes Thumshirn
2022-03-23  9:08   ` Pankaj Raghav
2022-03-23  9:11     ` Johannes Thumshirn
2022-03-23  9:14       ` Pankaj Raghav
2022-03-23 10:39         ` Johannes Thumshirn
2022-03-23 11:24           ` Pankaj Raghav
2022-03-23 11:52             ` Johannes Thumshirn
2022-03-23 19:37               ` Pankaj Raghav
2022-03-24  0:06               ` Damien Le Moal

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=YjoJgS244Y9x6OPu@localhost.localdomain \
    --to=josef@toxicpanda.com \
    --cc=dsterba@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=p.raghav@samsung.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