public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Optimise space flushing machinery
Date: Wed, 11 Mar 2020 19:57:58 +0200	[thread overview]
Message-ID: <412a6539-66b4-1497-d9ee-d6b2d14c4a14@suse.com> (raw)
In-Reply-To: <e66667cb-7be0-9d26-f462-d6094b892cde@toxicpanda.com>



On 11.03.20 г. 19:52 ч., Josef Bacik wrote:
> On 3/10/20 5:00 AM, Nikolay Borisov wrote:
>> Instead of iterating all pending tickets on the normal/priority list to
>> sum their total size the cost can be amortized across ticket addition/
>> removal. This turns O(n) + O(m) (where n is the size of the normal list
>> and m of the priority list) into O(1). This will mostly have effect in
>> workloads
>> that experience heavy flushing.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>> ---
>>   fs/btrfs/space-info.c | 13 ++++++++-----
>>   fs/btrfs/space-info.h |  4 ++++
>>   2 files changed, 12 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
>> index 9cb511d8cd9d..316a724dc990 100644
>> --- a/fs/btrfs/space-info.c
>> +++ b/fs/btrfs/space-info.c
>> @@ -389,6 +389,8 @@ void btrfs_try_granting_tickets(struct
>> btrfs_fs_info *fs_info,
>>                                     space_info,
>>                                     ticket->bytes);
>>               list_del_init(&ticket->list);
>> +            ASSERT(space_info->reclaim_size >= ticket->bytes);
>> +            space_info->reclaim_size -= ticket->bytes;
>>               ticket->bytes = 0;
>>               space_info->tickets_id++;
>>               wake_up(&ticket->wait);
>> @@ -784,16 +786,15 @@ static inline u64
>>   btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
>>                    struct btrfs_space_info *space_info)
>>   {
>> -    struct reserve_ticket *ticket;
>>       u64 used;
>>       u64 avail;
>>       u64 expected;
>>       u64 to_reclaim = 0;
>>
>> -    list_for_each_entry(ticket, &space_info->tickets, list)
>> -        to_reclaim += ticket->bytes;
>> -    list_for_each_entry(ticket, &space_info->priority_tickets, list)
>> -        to_reclaim += ticket->bytes;
>> +    lockdep_assert_held(&space_info->lock);
>> +
>> +    if (space_info->reclaim_size)
>> +        return space_info->reclaim_size;
> 
> This undoes the fix that I put up making sure we include any space we
> can no longer overcommit.  Thanks,

Which fix is that?

> 
> Josef

  reply	other threads:[~2020-03-11 17:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10  9:00 [PATCH] btrfs: Optimise space flushing machinery Nikolay Borisov
2020-03-11  1:14 ` David Sterba
2020-03-11 17:52 ` Josef Bacik
2020-03-11 17:57   ` Nikolay Borisov [this message]
2020-03-11 17:59     ` Josef Bacik
2020-03-12 20:36       ` 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=412a6539-66b4-1497-d9ee-d6b2d14c4a14@suse.com \
    --to=nborisov@suse.com \
    --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