public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: 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: Tue, 17 Dec 2019 11:05:51 -0500	[thread overview]
Message-ID: <488111c4-03e3-2211-a8fe-5bab7c0f030b@toxicpanda.com> (raw)
In-Reply-To: <20191216061226.40454-1-wqu@suse.com>

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,

Josef

  reply	other threads:[~2019-12-17 16:05 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 [this message]
2019-12-18  0:38   ` Qu Wenruo

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=488111c4-03e3-2211-a8fe-5bab7c0f030b@toxicpanda.com \
    --to=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