]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: find smallest available device extent during chunk allocation
authorChris Mason <chris.mason@oracle.com>
Fri, 24 Jul 2009 20:41:41 +0000 (16:41 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 24 Jul 2009 20:41:41 +0000 (16:41 -0400)
commit9166fa0a0a0227847381672642bfdc89827a30a6
treefc05718a138dbcf64069e0a2b4ffc84bf9abf5e7
parentfc58901a1075229f99e4752c41eb4f8068c74bf5
Btrfs: find smallest available device extent during chunk allocation

Allocating new block group is easy when the disk has plenty of space.
But things get difficult as the disk fills up, especially if
the FS has been run through btrfs-vol -b.  The balance operation
is likely to make the total bytes available on the device greater
than the largest extent we'll actually be able to allocate.

But the device extent allocation code incorrectly assumes that a device
with 5G free will be able to allocate a 5G extent.  It isn't normally a
problem because device extents don't get freed unless btrfs-vol -b
is run.

This fixes the device extent allocator to remember the largest free
extent it can find, and then uses that value as a fallback.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/volumes.c