From: Josef Bacik <jbacik@fb.com>
To: "lin >> \"linux-btrfs@vger.kernel.org\"" <linux-btrfs@vger.kernel.org>
Subject: What to do about df and btrfs fi df
Date: Mon, 10 Feb 2014 11:41:51 -0500 [thread overview]
Message-ID: <52F9014F.6070901@fb.com> (raw)
Hello,
So first of all this is going to get a lot of responses, so straight
away I'm only going to consider your opinion if I recognize your name
and think you are a sane person. This basically means any big
contributors and we'll make sanity exceptions for cwillu.
These are just broad strokes, let us not get bogged down in the details,
I just want to come to a consensus on how things _generally_ should be
portrayed to the user. We can worry about implementation details once
we agree on the direction we want to go.
We all know space is a loaded question with btrfs, so I'm just going to
explain the reasoning of why we chose what we chose originally and then
offer the direction we should go in. If you agree say yay, if not
please provide a very concise alternative suggestion with a very short
explanation of why it is better than I'm suggesting. I'm not looking to
spend a whole lot of time this problem.
Also this isn't going to address b_avail, cause frankly that is some
fucking voodoo right there, suffice it to say we will just adjust
b_avail based on how we should represent total and used.
===== ye olde df =====
I don't remember what we did originally, but IIRC we would only show
used space from the block groups and would show the entire size of the
fs. So for example with two 1 tb drives in RAID1 you'd see ENOSPC and
look at df and it would show total of 2TB and used at 1TB. Obviously
not good, so we switched to the mechanism we have today, which is you
see 2TB for total, you see 2TB for used and you see 0 for available. We
just scaled up the used and available based on your raid multiplier.
===== btrfs fi df =====
I made this for me because of ENOSPC issues but of course it's also
really useful for users. It is just a dump of the block group
information and their flags, so really just spits out bytes_used and
total_bytes and flags. Because at the block_group/space_info level in
btrfs we don't care about how much actual space is taken up this number
is not adjusted for RAID values, and these numbers are reflected in the
tools output. So if you have RAID1 you need to mentally multiply the
Total and Used values by 2 because that is how much actual space is
being used.
===== What to do moving forward =====
Flip what both of these do. Do not multiply for normal df, and multiply
for btrfs fi df.
===== New and improved df =====
Since this is the lowest common denominator we should just spit out how
much space is used based on the block groups and then divide the
remaining space that hasn't been allocated yet by the raid multiplier.
This is going to be kind of tricky once we do per-subvolume RAID levels,
but this falls under the b_avail voodoo which is just a guess anyway, so
for this we will probably take the biggest multiplier and use that to
show how much available space you have.
This way with RAID1 it shows you have 1tb of total space and you've used
1tb of space.
===== New and improved btrfs fi df =====
Since people using this tool are already going to be better informed and
since we are already given the block group flags we can go ahead and do
the raid multiplier in btrfs-progs and spit out the adjusted numbers
rather than the raw numbers we get from the ioctl. This will just be a
progs thing and that way we can possibly add an option to not apply the
multipliers and just get the raw output.
===== Conclusion =====
Let me know if this is acceptable to everybody. Remember this is just
broad strokes, keep your responses short and simple or I simply won't
read them. Thanks,
Josef
next reply other threads:[~2014-02-10 16:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-10 16:41 Josef Bacik [this message]
2014-02-10 17:06 ` What to do about df and btrfs fi df Hugo Mills
2014-02-10 18:24 ` cwillu
2014-02-10 18:28 ` Josef Bacik
2014-02-10 18:36 ` cwillu
2014-02-10 18:41 ` Josef Bacik
2014-02-10 18:54 ` cwillu
2014-02-10 19:05 ` Hugo Mills
2014-02-11 17:36 ` David Sterba
2014-02-17 17:08 ` David Sterba
2014-02-18 8:33 ` Goswin von Brederlow
2014-02-18 16:43 ` David Sterba
2014-02-11 1:02 ` Roger Binns
2014-02-11 3:13 ` cwillu
2014-02-11 3:35 ` ronnie sahlberg
2014-02-11 19:58 ` Roger Binns
2014-02-10 22:14 ` Goffredo Baroncelli
2014-02-10 22:26 ` Goffredo Baroncelli
2014-02-10 22:56 ` cwillu
2014-02-11 13:14 ` Josef Bacik
2014-02-11 18:20 ` Goffredo Baroncelli
2014-02-11 18:33 ` Josef Bacik
2014-02-11 18:46 ` Goffredo Baroncelli
2014-02-11 18:56 ` Hugo Mills
2014-02-12 21:03 ` Goffredo Baroncelli
2014-02-11 20:53 ` Sandy McArthur
2014-02-12 3:09 ` Kostia Khlebopros
2014-02-12 21:12 ` Goffredo Baroncelli
2014-02-12 3:55 ` Anand Jain
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=52F9014F.6070901@fb.com \
--to=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.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).