All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Hugo Mills <hugo-lkml@carfax.org.uk>,
	helmut@hullen.de, linux-btrfs@vger.kernel.org
Subject: Re: wrong values in "df" and "btrfs filesystem df"
Date: Tue, 12 Apr 2011 09:17:21 +0100	[thread overview]
Message-ID: <chaz20110412081721.GA3982@seebyte.com> (raw)
In-Reply-To: <4DA3FDD1.2090804@cn.fujitsu.com>

2011-04-12 15:22:57 +0800, Miao Xie:
[...]
> But the algorithm of df command doesn't simulate the above allocation correctly, this
> simulated allocation just allocates the stripes from two disks, and then, these two disks
> have no free space, but the third disk still has 1.2TB free space, df command thinks
> this space can be used to make a new RAID0 block group and ignores it. This is a bug,
> I think.
[...]

Thanks a lot Miao for the detailed explanation. So, the disk
space is not lost, it's just df not reporting the available
space correctly. That's me relieved.

It explains why I'm getting:

# blockdev --getsize64 /dev/sda4
2967698087424
# blockdev --getsize64 /dev/sdb
3000592982016
# blockdev --getsize64 /dev/sdc
3000592982016
# truncate -s 2967698087424 a
# truncate -s 3000592982016 b
# truncate -s 3000592982016 c
# losetup /dev/loop0 ./a
# losetup /dev/loop1 ./b
# losetup /dev/loop2 ./c
# mkfs.btrfs a b c
# btrfs device scan /dev/loop[0-2]
Scanning for Btrfs filesystems in '/dev/loop0'
Scanning for Btrfs filesystems in '/dev/loop1'
Scanning for Btrfs filesystems in '/dev/loop2'
# mount  /dev/loop0 /mnt/1
# df -k /mnt/1
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/loop0           8758675828        56 5859474304   1% /mnt/1
# echo $(((8758675828 - 5859474304)*2**10))
2968782360576

One disk worth of space lost according to df.

While it should have been more something like
$(((3000592982016-2967698087424)*2)) (about 60GB), or about 0
after the quasi-round-robin allocation patch, right?

Best regards,
Stephane

  reply	other threads:[~2011-04-12  8:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09  6:25 wrong values in "df" and "btrfs filesystem df" Helmut Hullen
2011-04-09  9:11 ` Hugo Mills
2011-04-09  9:46   ` Stephane Chazelas
2011-04-09 12:28   ` Helmut Hullen
2011-04-09 16:36   ` Calvin Walton
2011-04-09 17:05     ` Helmut Hullen
2011-04-09 17:26       ` Calvin Walton
2011-04-09 18:15         ` Helmut Hullen
2011-04-09 19:35           ` Peter Stuge
2011-04-09 20:38             ` Hugo Mills
2011-04-10 10:13   ` Miao Xie
2011-04-11  7:29     ` Stephane Chazelas
2011-04-11  7:56       ` Arne Jansen
2011-04-11  9:06       ` Helmut Hullen
2011-04-12  7:22       ` Miao Xie
2011-04-12  8:17         ` Stephane Chazelas [this message]
2011-04-13  5:35           ` Miao Xie

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=chaz20110412081721.GA3982@seebyte.com \
    --to=stephane.chazelas@gmail.com \
    --cc=helmut@hullen.de \
    --cc=hugo-lkml@carfax.org.uk \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.