From: David Sterba <dsterba@suse.cz>
To: Dennis Zhou <dennis@kernel.org>
Cc: David Sterba <dsterba@suse.com>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
Omar Sandoval <osandov@osandov.com>,
kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 03/12] btrfs: limit max discard size for async discard
Date: Fri, 3 Jan 2020 15:41:10 +0100 [thread overview]
Message-ID: <20200103144110.GU3929@twin.jikos.cz> (raw)
In-Reply-To: <b0dada84ff74a4c7246acad7fe78250550b89f7f.1577999991.git.dennis@kernel.org>
On Thu, Jan 02, 2020 at 04:26:37PM -0500, Dennis Zhou wrote:
> Throttle the maximum size of a discard so that we can provide an upper
> bound for the rate of async discard. While the block layer is able to
> split discards into the appropriate sized discards, we want to be able
> to account more accurately the rate at which we are consuming ncq slots
> as well as limit the upper bound of work for a discard.
>
> Signed-off-by: Dennis Zhou <dennis@kernel.org>
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
> ---
> fs/btrfs/discard.h | 5 +++++
> fs/btrfs/free-space-cache.c | 41 +++++++++++++++++++++++++++++--------
> 2 files changed, 37 insertions(+), 9 deletions(-)
>
> diff --git a/fs/btrfs/discard.h b/fs/btrfs/discard.h
> index 5250fe178e49..562c60fab77a 100644
> --- a/fs/btrfs/discard.h
> +++ b/fs/btrfs/discard.h
> @@ -3,10 +3,15 @@
> #ifndef BTRFS_DISCARD_H
> #define BTRFS_DISCARD_H
>
> +#include <linux/sizes.h>
> +
> struct btrfs_fs_info;
> struct btrfs_discard_ctl;
> struct btrfs_block_group;
>
> +/* Discard size limits */
> +#define BTRFS_ASYNC_DISCARD_MAX_SIZE (SZ_64M)
> +
> /* Work operations */
> void btrfs_discard_cancel_work(struct btrfs_discard_ctl *discard_ctl,
> struct btrfs_block_group *block_group);
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index 40fb918a82f4..34291c777998 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -3466,16 +3466,36 @@ static int trim_no_bitmap(struct btrfs_block_group *block_group,
> extent_start = entry->offset;
> extent_bytes = entry->bytes;
> extent_trim_state = entry->trim_state;
> - start = max(start, extent_start);
> - bytes = min(extent_start + extent_bytes, end) - start;
> - if (bytes < minlen) {
> - spin_unlock(&ctl->tree_lock);
> - mutex_unlock(&ctl->cache_writeout_mutex);
> - goto next;
> - }
> + if (async) {
> + start = entry->offset;
> + bytes = entry->bytes;
> + if (bytes < minlen) {
> + spin_unlock(&ctl->tree_lock);
> + mutex_unlock(&ctl->cache_writeout_mutex);
> + goto next;
> + }
> + unlink_free_space(ctl, entry);
> + if (bytes > BTRFS_ASYNC_DISCARD_MAX_SIZE) {
> + bytes = extent_bytes =
> + BTRFS_ASYNC_DISCARD_MAX_SIZE;
You still left one chain assignment here, fixed and also in the followup
patch that switches to the variable limit.
next prev parent reply other threads:[~2020-01-03 14:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-02 21:26 [PATCH 00/12] btrfs: async discard follow up Dennis Zhou
2020-01-02 21:26 ` [PATCH 01/12] btrfs: calculate discard delay based on number of extents Dennis Zhou
2020-01-03 14:38 ` David Sterba
2020-01-02 21:26 ` [PATCH 02/12] btrfs: add bps discard rate limit for async discard Dennis Zhou
2020-01-03 14:40 ` David Sterba
2020-01-02 21:26 ` [PATCH 03/12] btrfs: limit max discard size " Dennis Zhou
2020-01-03 14:41 ` David Sterba [this message]
2020-01-02 21:26 ` [PATCH 04/12] btrfs: make max async discard size tunable Dennis Zhou
2020-01-03 14:44 ` David Sterba
2020-01-02 21:26 ` [PATCH 05/12] btrfs: have multiple discard lists Dennis Zhou
2020-01-02 21:26 ` [PATCH 06/12] btrfs: only keep track of data extents for async discard Dennis Zhou
2020-01-02 21:26 ` [PATCH 07/12] btrfs: keep track of discard reuse stats Dennis Zhou
2020-01-02 21:26 ` [PATCH 08/12] btrfs: add async discard header Dennis Zhou
2020-01-02 21:26 ` [PATCH 09/12] btrfs: increase the metadata allowance for the free_space_cache Dennis Zhou
2020-01-02 21:26 ` [PATCH 10/12] btrfs: make smaller extents more likely to go into bitmaps Dennis Zhou
2020-01-02 21:26 ` [PATCH 11/12] btrfs: ensure removal of discardable_* in free_bitmap() Dennis Zhou
2020-01-02 21:26 ` [PATCH 12/12] btrfs: add correction to handle -1 edge case in async discard Dennis Zhou
2020-01-03 14:42 ` David Sterba
2020-01-05 20:35 ` Nikolay Borisov
2020-01-06 13:44 ` David Sterba
2020-01-03 14:51 ` [PATCH 00/12] btrfs: async discard follow up David Sterba
2020-01-03 17:43 ` Dennis Zhou
2020-01-06 15:25 ` David Sterba
2020-01-06 17:14 ` Dennis Zhou
2020-01-06 17:37 ` David Sterba
2020-01-06 16:30 ` David Sterba
2020-01-06 17:28 ` Dennis Zhou
2020-01-06 17:49 ` 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=20200103144110.GU3929@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dennis@kernel.org \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=osandov@osandov.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