Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"kernel-team@fb.com" <kernel-team@fb.com>
Subject: Re: [PATCH 4/7] btrfs: use the global rsv size in the preemptive thresh calculation
Date: Thu, 29 Apr 2021 11:19:35 -0400	[thread overview]
Message-ID: <4db7b3b0-ca7a-12a7-156e-153dbcf6e9fa@toxicpanda.com> (raw)
In-Reply-To: <PH0PR04MB741630B03D3693142C46EF639B5F9@PH0PR04MB7416.namprd04.prod.outlook.com>

On 4/29/21 10:04 AM, Johannes Thumshirn wrote:
> On 28/04/2021 19:40, Josef Bacik wrote:
>> -	thresh += (space_info->total_bytes - space_info->bytes_used -
>> -		   space_info->bytes_reserved - space_info->bytes_readonly);
>> +	used = space_info->bytes_used + space_info->bytes_reserved +
>> +		space_info->bytes_readonly + global_rsv_size;
>> +	if (used < space_info->total_bytes)
>> +		thresh += space_info->total_bytes - used;
>>   	thresh >>= space_info->clamp;
> 
> 
> I don't quite understand why you introduced the 'if' here. Now we're only
> adding the new free space to the threshold if we're using less than our
> total free space, which kinda makes sense that we're not going over our
> total free space.
> 

Because it's possible that the global_rsv_size + used is > total_bytes, because 
sometimes the global reserve can end up being calculated as larger than the 
available size (think stupid small fs'es where we only have the original 8mib 
chunk of metadata).  It doesn't usually happen, but that sort of thinking gets 
me into trouble, so this is safer.  Thanks,

Josef

  reply	other threads:[~2021-04-29 15:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 17:38 [PATCH 0/7] Preemptive flushing improvements Josef Bacik
2021-04-28 17:38 ` [PATCH 1/7] btrfs: check worker before need_preemptive_reclaim Josef Bacik
2021-04-29 13:35   ` Johannes Thumshirn
2021-04-28 17:38 ` [PATCH 2/7] btrfs: only clamp the first time we have to start flushing Josef Bacik
2021-04-28 17:38 ` [PATCH 3/7] btrfs: take into account global rsv in need_preemptive_reclaim Josef Bacik
2021-04-29 13:50   ` Johannes Thumshirn
2021-04-29 20:03   ` David Sterba
2021-04-29 20:05     ` David Sterba
2021-04-28 17:38 ` [PATCH 4/7] btrfs: use the global rsv size in the preemptive thresh calculation Josef Bacik
2021-04-29 14:04   ` Johannes Thumshirn
2021-04-29 15:19     ` Josef Bacik [this message]
2021-04-28 17:38 ` [PATCH 5/7] btrfs: don't include the global rsv size in the preemptive used amount Josef Bacik
2021-04-29 14:19   ` Johannes Thumshirn
2021-04-28 17:38 ` [PATCH 6/7] btrfs: only ignore delalloc if delalloc is much smaller than ordered Josef Bacik
2021-04-28 17:38 ` [PATCH 7/7] btrfs: handle preemptive delalloc flushing slightly differently Josef Bacik
     [not found] ` <20210429094852.DAC3.409509F4@e16-tech.com>
2021-04-29 15:06   ` [PATCH 0/7] Preemptive flushing improvements Josef Bacik
2021-04-29 21:40     ` Wang Yugui
2021-04-29 22:23       ` Wang Yugui
2021-04-30 15:28         ` David Sterba
2021-04-30 15:43           ` Wang Yugui
2021-04-30 15:47 ` 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=4db7b3b0-ca7a-12a7-156e-153dbcf6e9fa@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=Johannes.Thumshirn@wdc.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