]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Btrfs: only reserve space in fallocate if we have to do a preallocate
authorJosef Bacik <josef@redhat.com>
Wed, 17 Aug 2011 14:19:52 +0000 (10:19 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 02:20:16 +0000 (21:20 -0500)
commit1b8db5d366d5490fd1e4bcb3f81064b8d3f83317
treed0fa631a2992f2bdf1d187dad8a7a12b1fe3ff20
parent47a47e2d1dcbfedec97af4dbef13161ef501e7b6
Btrfs: only reserve space in fallocate if we have to do a preallocate

Lukas found a problem where if he tries to fallocate over the same region twice
and the first fallocate took up all the space we would fail with ENOSPC.  This
is because we reserve the total space we want to use for fallocate, regardless
of wether or not we will have to actually preallocate.  So instead move the
check into the loop where we actually have to do the preallocate.  Thanks,

Tested-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Josef Bacik <josef@redhat.com>
(cherry picked from commit 1b9c332b6c92e992b1971a08412c6f460a54b514)
fs/btrfs/file.c