All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert White <rwhite@pobox.com>
To: Shriramana Sharma <samjnaa@gmail.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Why is the actual disk usage of btrfs considered unknowable?
Date: Sun, 07 Dec 2014 20:59:30 -0800	[thread overview]
Message-ID: <54853032.2080107@pobox.com> (raw)
In-Reply-To: <CAH-HCWU9GEjvZLH=rwYev_O0S4_Cs9FJvRiJgBiOK8gdxqK5CQ@mail.gmail.com>

On 12/07/2014 07:15 AM, Shriramana Sharma wrote:
> IIUC:
>
> 1) btrfs fi df already shows the alloc-ed space and the space used out of that.
>
> 2) Despite snapshots, CoW and compression, the tree knows how many
> extents of data and metadata there are, and how many bytes on disk
> these occcupy, no matter what is the total (uncompressed,
> "unsnapshotted") size of all the directories and files on the disk.
>

I tried to answer this last time. So lets do a thought experiment...

You have an essentially full filesystem. Then the last two extents are 
allocated. One a 1Gb extent for data and the other is a 256Mb extent for 
metadata.

How much space on the disk is "free"? Is 1Gb for data, is it 256Mb for 
free space or is it 1280Mb for the combination of data and metadata or 
is it _zero_ for the complete absence of blocks that can be allocated 
into extents?

How about if I allocate 1Gb of data space and there is 512Mb of 
unallocated space, which is enough room for two more metadata extents 
but not enough room for another data extent. Is the drive "full" when 
you fill that last 1Gb? After all, you cannot write more data to the 
disk, but you can write more metadata.

If I start deleting files, and thereby create gaps in the previously 
allocated extents, are those gaps "free"? They are purposed but 
available for their respective uses.

Subtracting blocks allocated from blocks on media doesn't give you the 
"real" answer to what is or isnt "free".

If there is a leftover two-dozen sectors that won't fit in _any_ kind of 
extent are those sectors "Free" or are they just leftovers?

In real property terms, If I hold an easment on your driveway and you 
want to expand your house, how much of your property is can be used for 
the expansion of your house? My rights to your driveway don't count 
against you for meeting the "undeveloped land" caluclation of your local 
zoning board, but you can't build any house-bits on that driveway since 
I hold a right to use it, so it does count against your available square 
feet that you can design over.

"Free space" isn't the simple proposition you imagine because "free for 
what purpose" and "free in what sense" both have to be answered.

So the system estimates, and it does so in different ways for different 
purposes.

If you have a means in mind to resolve these conflicts we'd love to see 
the rationale and even the code...

  parent reply	other threads:[~2014-12-08  4:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 15:15 Why is the actual disk usage of btrfs considered unknowable? Shriramana Sharma
2014-12-07 15:33 ` Martin Steigerwald
2014-12-07 15:37   ` Shriramana Sharma
2014-12-07 15:40   ` Martin Steigerwald
2014-12-08  5:32     ` Robert White
2014-12-08  6:20       ` ashford
2014-12-08  7:06         ` Robert White
2014-12-08 14:47       ` Martin Steigerwald
2014-12-08 14:57         ` Austin S Hemmelgarn
2014-12-08 15:52           ` Martin Steigerwald
2014-12-08 23:14         ` Zygo Blaxell
2014-12-07 18:20   ` ashford
2014-12-07 18:34     ` Hugo Mills
2014-12-07 18:48       ` Martin Steigerwald
2014-12-07 19:39       ` ashford
2014-12-08  5:17       ` Chris Murphy
2014-12-07 18:38     ` Martin Steigerwald
2014-12-07 19:44       ` ashford
2014-12-07 19:19   ` Goffredo Baroncelli
2014-12-07 20:32     ` ashford
2014-12-07 23:01       ` Goffredo Baroncelli
2014-12-08  0:12         ` ashford
2014-12-08  2:42           ` Qu Wenruo
2014-12-08  8:12             ` ashford
2014-12-08 14:34           ` Goffredo Baroncelli
2014-12-08  8:18       ` Chris Murphy
2014-12-08  4:59 ` Robert White [this message]
2014-12-08  6:43 ` Zygo Blaxell

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=54853032.2080107@pobox.com \
    --to=rwhite@pobox.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=samjnaa@gmail.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.