From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>, Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org
Cc: Tomasz Chmielewski <mangoo@wpkg.org>,
Martin Raiber <martin@urbackup.org>
Subject: Re: [PATCH] btrfs: super: Make btrfs_statfs() work with metadata over-commiting
Date: Wed, 18 Dec 2019 08:38:11 +0800 [thread overview]
Message-ID: <556d6c05-9b6f-632b-561e-114b277d64ad@gmx.com> (raw)
In-Reply-To: <488111c4-03e3-2211-a8fe-5bab7c0f030b@toxicpanda.com>
[-- Attachment #1.1: Type: text/plain, Size: 1593 bytes --]
On 2019/12/18 上午12:05, Josef Bacik wrote:
> On 12/16/19 1:12 AM, Qu Wenruo wrote:
>> [BUG]
>> There are several reports about vanilla `df` reports no available space,
>> while `btrfs filesystem df` is still reporting tons of unallocated
>> space.
>>
>> https://lore.kernel.org/linux-btrfs/CAJCQCtQEu_+nL_HByAWK2zKfg2Zhpm3Ezto+sA12wwV0iq8Ghg@mail.gmail.com/T/#t
>>
>> https://lore.kernel.org/linux-btrfs/CAJCQCtSWW4ageK56PdHtSmgrFrDf_Qy0PbxZ5LSYYCbr3Z10ug@mail.gmail.com/T/#t
>>
>>
>> The example output from vanilla `df` would look like:
>> Filesystem Size Used Avail Use% Mounted on
>> /dev/loop0 7.4T 623G 0 100% /media/backup
>>
>> [CAUSE]
>> There is a special check in btrfs_statfs(), which reset f_bavail:
>>
>> if (!mixed && total_free_meta - SZ_4M < block_rsv->size)
>> buf->f_bavail = 0;
>
> Why not just read fs_info->free_chunk_space and take that into account?
> The point is we want to tell the user there's no room left if we can't
> allocate a new chunk and we only have the global reserve space left. So
> just subtract the global reserve size from the total f_bavail as long as
> free_chunk_space is sufficient, otherwise fall back to the original
> calculation. Thanks,
Because not all unallocated space can be utilized by all profiles,
that's why we have complex calculation in btrfs_calc_avail_data_space(),
which tries to emulate chunk allocator to get how many space we can
really use.
And we also need to take space usage factor into consideration.
Thanks,
Qu
>
> Josef
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]
prev parent reply other threads:[~2019-12-18 0:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-16 6:12 [PATCH] btrfs: super: Make btrfs_statfs() work with metadata over-commiting Qu Wenruo
2019-12-17 16:05 ` Josef Bacik
2019-12-18 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=556d6c05-9b6f-632b-561e-114b277d64ad@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mangoo@wpkg.org \
--cc=martin@urbackup.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