summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-05-25 13:10:16 -0400
committerJosef Bacik <josef@redhat.com>2011-06-08 15:08:31 -0400
commitf2bb8f5cfb3bce595b2de251ed7638047fc4e530 (patch)
tree705123220f4e1ae64f1f67b852f9e93b18db8e9a /fs/btrfs
parent3de85bb95cc50d0977cbb7a0c605e894be4c790d (diff)
downloadblackbird-op-linux-f2bb8f5cfb3bce595b2de251ed7638047fc4e530.tar.gz
blackbird-op-linux-f2bb8f5cfb3bce595b2de251ed7638047fc4e530.zip
Btrfs: don't commit the transaction if we dont have enough pinned bytes
I noticed when running an enospc test that we would get stuck committing the transaction in check_data_space even though we truly didn't have enough space. So check to see if bytes_pinned is bigger than num_bytes, if it's not don't commit the transaction. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent-tree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5b9b6b6df242..0d0a3fe77bb7 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3089,6 +3089,13 @@ alloc:
}
goto again;
}
+
+ /*
+ * If we have less pinned bytes than we want to allocate then
+ * don't bother committing the transaction, it won't help us.
+ */
+ if (data_sinfo->bytes_pinned < bytes)
+ committed = 1;
spin_unlock(&data_sinfo->lock);
/* commit the current transaction and try again */
OpenPOWER on IntegriCloud