Btrfs: rework how we reserve metadata bytes
authorJosef Bacik <josef@redhat.com>
Fri, 15 Oct 2010 20:52:49 +0000 (16:52 -0400)
committerJosef Bacik <josef@redhat.com>
Fri, 22 Oct 2010 19:55:01 +0000 (15:55 -0400)
commit8bb8ab2e93f9c3c9453e13be0f37d344a32a3a6d
tree619600c7458a3af18555f189d53efc4c092b9280
parent14ed0ca6e8236f2d264c4a8faec9e3a2b3d04377
Btrfs: rework how we reserve metadata bytes

With multi-threaded writes we were getting ENOSPC early because somebody would
come in, start flushing delalloc because they couldn't make their reservation,
and in the meantime other threads would come in and use the space that was
getting freed up, so when the original thread went to check to see if they had
space they didn't and they'd return ENOSPC.  So instead if we have some free
space but not enough for our reservation, take the reservation and then start
doing the flushing.  The only time we don't take reservations is when we've
already overcommitted our space, that way we don't have people who come late to
the party way overcommitting ourselves.  This also moves all of the retrying and
flushing code into reserve_metdata_bytes so it's all uniform.  This keeps my
fs_mark test from returning -ENOSPC as soon as it starts and actually lets me
fill up the disk.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/relocation.c
fs/btrfs/transaction.c