linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What to do about df and btrfs fi df
@ 2014-02-10 16:41 Josef Bacik
  2014-02-10 17:06 ` Hugo Mills
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Josef Bacik @ 2014-02-10 16:41 UTC (permalink / raw)
  To: lin >> "linux-btrfs@vger.kernel.org"

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

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2014-02-18 16:43 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-10 16:41 What to do about df and btrfs fi df Josef Bacik
2014-02-10 17:06 ` 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

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).