From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>, Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 4/4] btrfs: statfs: Use virtual chunk allocation to calculation available data space
Date: Fri, 3 Jan 2020 08:38:52 +0800 [thread overview]
Message-ID: <4f7113c2-bdd8-7f74-a038-dda4db4015f1@gmx.com> (raw)
In-Reply-To: <6b836ff3-29ab-9a06-b76f-114cb0a5cb5b@toxicpanda.com>
[-- Attachment #1.1: Type: text/plain, Size: 1819 bytes --]
On 2020/1/3 上午12:20, Josef Bacik wrote:
> On 1/2/20 6:27 AM, Qu Wenruo wrote:
>> Although btrfs_calc_avail_data_space() is trying to do an estimation
>> on how many data chunks it can allocate, the estimation is far from
>> perfect:
>>
>> - Metadata over-commit is not considered at all
>> - Chunk allocation doesn't take RAID5/6 into consideration
>>
>> Although current per-profile available space itself is not able to
>> handle metadata over-commit itself, the virtual chunk infrastructure can
>> be re-used to address above problems.
>>
>> This patch will change btrfs_calc_avail_data_space() to do the following
>> things:
>> - Do metadata virtual chunk allocation first
>> This is to address the over-commit behavior.
>> If current metadata chunks have enough free space, we can completely
>> skip this step.
>>
>> - Allocate data virtual chunks as many as possible
>> Just like what we did in per-profile available space estimation.
>> Here we only need to calculate one profile, since statfs() call is
>> a relative cold path.
>>
>> Now statfs() should be able to report near perfect estimation on
>> available data space, and can handle RAID5/6 better.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>
> Can you put a comparison of the statfs call time for the old way vs the
> new way in your changelog? Say make a raid5 fs for example, populate it
> a little bit, and then run statfs 10 times and take the average with and
> without your patch so we can make sure there's no performance penalty.
> You'd be surprised how many times statfs() things have caused problems
> for us in production. Thanks,
Sure no problem.
Never considered statfs() can be a problem.
Will keep an eye on that.
Thanks,
Qu
>
> Josef
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]
prev parent reply other threads:[~2020-01-03 0:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-02 11:27 [PATCH v2 0/4] Introduce per-profile available space array to avoid over-confident can_overcommit() Qu Wenruo
2020-01-02 11:27 ` [PATCH v2 1/4] btrfs: Introduce per-profile available space facility Qu Wenruo
2020-01-02 16:13 ` Josef Bacik
2020-01-04 6:40 ` kbuild test robot
2020-01-02 11:27 ` [PATCH v2 2/4] btrfs: Update per-profile available space when device size/used space get updated Qu Wenruo
2020-01-02 16:17 ` Josef Bacik
2020-01-03 0:51 ` Qu Wenruo
2020-01-03 9:52 ` Qu Wenruo
2020-01-03 16:35 ` Josef Bacik
2020-01-02 11:27 ` [PATCH v2 3/4] btrfs: space-info: Use per-profile available space in can_overcommit() Qu Wenruo
2020-01-02 16:18 ` Josef Bacik
2020-01-02 11:27 ` [PATCH v2 4/4] btrfs: statfs: Use virtual chunk allocation to calculation available data space Qu Wenruo
2020-01-02 16:20 ` Josef Bacik
2020-01-03 0:38 ` Qu Wenruo [this message]
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=4f7113c2-bdd8-7f74-a038-dda4db4015f1@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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