On Fri, Feb 15, 2019 at 10:40:56AM -0500, Brian B wrote: > It looks like the btrfs code currently uses the total space available on > a disk to determine where it should place the two copies of a file in > RAID1 mode. Wouldn't it make more sense to use the _percentage_ of free > space instead of the number of free bytes? I don't think it'll make much difference. I spent a long time a couple of years ago trying to prove (mathematically) that the current strategy always produces an optimal usage of the available space -- I wasn't able to complete the theorem, but a lot of playing around with it convinced me that at least if there are cases where it's non-optimal, they're bizarre corner cases. > For example, I have two disks in my array that are 8 TB, plus an > assortment of 3,4, and 1 TB disks. With the current allocation code, > btrfs will use my two 8 TB drives exclusively until I've written 4 TB of > files, then it will start using the 4 TB disks, then eventually the 3, > and finally the 1 TB disks. If the code used a percentage figure > instead, it would spread the allocations much more evenly across the > drives, ideally spreading load and reducing drive wear. > > Is there a reason this is done this way, or is it just something that > hasn't had time for development? I'd guess it's the easiest algorithm to use, plus it seems to provide optimal space usage (almost?) all of the time. Hugo. -- Hugo Mills | Be pure. hugo@... carfax.org.uk | Be vigilant. http://carfax.org.uk/ | Behave. PGP: E2AB1DE4 | Torquemada, Nemesis
Attachment:
signature.asc
Description: Digital signature
