linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Martin Raiber <martin@urbackup.org>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: df shows no available space in 5.4.1
Date: Fri, 13 Dec 2019 17:02:31 +0100	[thread overview]
Message-ID: <20191213160231.GZ3929@twin.jikos.cz> (raw)
In-Reply-To: <0102016edd1b0184-848d9b6d-6b80-4ce3-8428-e472a224e554-000000@eu-west-1.amazonses.com>

On Fri, Dec 06, 2019 at 09:26:05PM +0000, Martin Raiber wrote:
> # df -h
> Filesystem                                            Size  Used Avail
> Use% Mounted on
> ...
> /dev/loop0                                            7.4T  623G     0
> 100% /media/backup
> ...
> 
> statfs("/media/backup", {f_type=BTRFS_SUPER_MAGIC, f_bsize=4096,
> f_blocks=1985810876, f_bfree=1822074245, f_bavail=0, f_files=0,
> f_ffree=0, f_fsid={val=[3667078581, 2813298474]}, f_namelen=255,
> f_frsize=4096, f_flags=ST_VALID|ST_NOATIME}) = 0
> 
> # btrfs fi usage /media/backup
> Overall:
>     Device size:                   7.40TiB
>     Device allocated:            671.02GiB
>     Device unallocated:            6.74TiB
>     Device missing:                  0.00B
>     Used:                        622.49GiB
>     Free (estimated):              6.79TiB      (min: 6.79TiB)
>     Data ratio:                       1.00
>     Metadata ratio:                   1.00
>     Global reserve:              512.00MiB      (used: 0.00B)
> 
> Data,single: Size:666.01GiB, Used:617.95GiB
>    /dev/loop0    666.01GiB
> 
> Metadata,single: Size:5.01GiB, Used:4.54GiB
>    /dev/loop0      5.01GiB

Here's the cause for 0 for available data: there's a special case in
statfs that checks for remaining metadata space and if thre's less than
some threshold then the value becomes 0.

The global block reserve needs to be accounted there to so

4.54G + 512M ~ 5.01G

> System,single: Size:4.00MiB, Used:96.00KiB
>    /dev/loop0      4.00MiB
> 
> Unallocated:
>    /dev/loop0      6.74TiB

Enough unallocated data for more metadata chunks, that are usually
allocated in advance so the above should not happen.

> # btrfs fi df /media/backup
> Data, single: total=666.01GiB, used=617.95GiB
> System, single: total=4.00MiB, used=96.00KiB
> Metadata, single: total=5.01GiB, used=4.54GiB
> GlobalReserve, single: total=512.00MiB, used=0.00B
> 
> # mount
> 
> ...
> /dev/loop0 on /media/backup type btrfs
> (rw,noatime,nossd,discard,space_cache=v2,enospc_debug,skip_balance,commit=86400,subvolid=5,subvol=/)

commit=86400 is kind extreme but this should affect only unwritten data
possibly buffered in memory before write and sync/commit can be started
for other reasons too.

So it looks to me that metadata chunks don't get allocated as before. A
workaround could be the mount option metadata_ratio, but finding the
root cause is desired as this looks like a regression.

  parent reply	other threads:[~2019-12-13 20:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 21:26 df shows no available space in 5.4.1 Martin Raiber
2019-12-06 22:35 ` Chris Murphy
2019-12-06 22:51   ` Martin Raiber
2019-12-08 18:12   ` Zygo Blaxell
2019-12-07  7:28 ` Qu Wenruo
2019-12-09 18:56   ` Martin Raiber
2019-12-09 19:26     ` Martin Raiber
2019-12-10  0:52     ` Qu Wenruo
2019-12-10  1:19       ` Qu Wenruo
2019-12-11 13:11         ` Martin Raiber
2019-12-16  5:04           ` Qu Wenruo
2019-12-13 16:02 ` David Sterba [this message]
2019-12-13 20:03 ` Chris Murphy

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=20191213160231.GZ3929@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=martin@urbackup.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;
as well as URLs for NNTP newsgroup(s).