From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>,
kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/9] btrfs: do not allow reservations if we have pending tickets
Date: Fri, 23 Aug 2019 10:33:17 +0300 [thread overview]
Message-ID: <d1d8b3ad-9fd0-1afe-c033-36bc63aa8064@suse.com> (raw)
In-Reply-To: <20190822191102.13732-2-josef@toxicpanda.com>
On 22.08.19 г. 22:10 ч., Josef Bacik wrote:
> If we already have tickets on the list we don't want to steal their
> reservations. This is a preparation patch for upcoming changes,
> technically this shouldn't happen today because of the way we add bytes
> to tickets before adding them to the space_info in most cases.
>
> This does not change the FIFO nature of reserve tickets, it simply
> allows us to enforce it in a different way. Previously it was enforced
> because any new space would be added to the first ticket on the list,
> which would result in new reservations getting a reserve ticket. This
> replaces that mechanism by simply checking to see if we have outstanding
> reserve tickets and skipping straight to adding a ticket for our
> reservation.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/space-info.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 5f8f65599de1..33fa0ba49759 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -993,6 +993,7 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
> struct reserve_ticket ticket;
> u64 used;
> int ret = 0;
> + bool pending_tickets;
>
> ASSERT(orig_bytes);
> ASSERT(!current->journal_info || flush != BTRFS_RESERVE_FLUSH_ALL);
> @@ -1000,14 +1001,17 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
> spin_lock(&space_info->lock);
> ret = -ENOSPC;
> used = btrfs_space_info_used(space_info, true);
> + pending_tickets = !list_empty(&space_info->tickets) ||
> + !list_empty(&space_info->priority_tickets);
>
> /*
> * Carry on if we have enough space (short-circuit) OR call
> * can_overcommit() to ensure we can overcommit to continue.
> */
> - if ((used + orig_bytes <= space_info->total_bytes) ||
> - can_overcommit(fs_info, space_info, orig_bytes, flush,
> - system_chunk)) {
> + if (!pending_tickets &&
> + ((used + orig_bytes <= space_info->total_bytes) ||
> + can_overcommit(fs_info, space_info, orig_bytes, flush,
> + system_chunk))) {
> btrfs_space_info_update_bytes_may_use(fs_info, space_info,
> orig_bytes);
> trace_btrfs_space_reservation(fs_info, "space_info",
>
next prev parent reply other threads:[~2019-08-23 7:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 19:10 [PATCH 0/9][v3] Rework reserve ticket handling Josef Bacik
2019-08-22 19:10 ` [PATCH 1/9] btrfs: do not allow reservations if we have pending tickets Josef Bacik
2019-08-23 7:33 ` Nikolay Borisov [this message]
2019-08-22 19:10 ` [PATCH 2/9] btrfs: roll tracepoint into btrfs_space_info_update helper Josef Bacik
2019-08-23 12:12 ` David Sterba
2019-08-22 19:10 ` [PATCH 3/9] btrfs: add space reservation tracepoint for reserved bytes Josef Bacik
2019-08-23 12:17 ` David Sterba
2019-08-22 19:10 ` [PATCH 4/9] btrfs: rework btrfs_space_info_add_old_bytes Josef Bacik
2019-08-23 7:48 ` Nikolay Borisov
2019-08-23 12:30 ` David Sterba
2019-08-28 15:15 ` [PATCH][v2] btrfs: stop partially refilling tickets when releasing space Josef Bacik
2019-08-22 19:10 ` [PATCH 5/9] btrfs: refactor the ticket wakeup code Josef Bacik
2019-08-22 19:10 ` [PATCH 6/9] btrfs: rework wake_all_tickets Josef Bacik
2019-08-23 8:17 ` Nikolay Borisov
2019-08-27 13:04 ` David Sterba
2019-08-28 15:12 ` [PATCH][v2] " Josef Bacik
2019-08-22 19:11 ` [PATCH 7/9] btrfs: fix may_commit_transaction to deal with no partial filling Josef Bacik
2019-08-23 8:18 ` Nikolay Borisov
2019-08-22 19:11 ` [PATCH 8/9] btrfs: remove orig_bytes from reserve_ticket Josef Bacik
2019-08-22 19:11 ` [PATCH 9/9] btrfs: rename btrfs_space_info_add_old_bytes Josef Bacik
2019-08-23 8:18 ` Nikolay Borisov
2019-08-23 12:55 ` [PATCH 0/9][v3] Rework reserve ticket handling David Sterba
2019-08-28 18:02 ` 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=d1d8b3ad-9fd0-1afe-c033-36bc63aa8064@suse.com \
--to=nborisov@suse.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.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).