Btrfs: don't commit the transaction if we dont have enough pinned bytes
[pandora-kernel.git] / fs / btrfs / extent-tree.c
index 5b9b6b6..0d0a3fe 100644 (file)
@@ -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 */