linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugo Mills <hugo@carfax.org.uk>
To: Btrfs mailing list <linux-btrfs@vger.kernel.org>
Subject: Re: The *right* algorithm for determining the amount of free space
Date: Fri, 11 Mar 2016 22:18:40 +0000	[thread overview]
Message-ID: <20160311221840.GK17196@carfax.org.uk> (raw)
In-Reply-To: <20160311221703.GJ17196@carfax.org.uk>

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

On Fri, Mar 11, 2016 at 10:17:03PM +0000, Hugo Mills wrote:
>    I know I promised this a while ago and didn't get round to it, but
> Henk's tinkering reminded me of it. I note specifically that the
> algorithm used to give the free space to plain old df gives incorrect
> results -- probably because it's not using the algorithm below.
> 
>    There is an algorithm that (seems to) give the correct number of
> block groups which can be allocated, given a current allocation state
> of the FS. I haven't been able to prove it correct, but it seems to
> work. Here's some pseudocode for it:

   I forgot to mention, there's a JavaScript implementation of this
algorithm at:

http://carfax.org.uk/btrfs-usage/js/btrfs-usage.js

   Hugo.

-- 
Hugo Mills             | You can play with your friends' privates, but you
hugo@... carfax.org.uk | can't play with your friends' childrens' privates.
http://carfax.org.uk/  |
PGP: E2AB1DE4          |                                       C++ coding rule

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2016-03-11 22:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 22:17 The *right* algorithm for determining the amount of free space Hugo Mills
2016-03-11 22:18 ` Hugo Mills [this message]
2016-03-18 17:58 ` David Sterba
2016-03-18 18:03   ` Hugo Mills

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=20160311221840.GK17196@carfax.org.uk \
    --to=hugo@carfax.org.uk \
    --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).