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:
signature.asc
Description: Digital signature
