linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: don't commit the transaction if we dont have enough pinned bytes
@ 2011-05-25 17:11 Josef Bacik
  2011-05-25 19:30 ` [PATCH] Btrfs: don't commit the transaction if we dont have enough pinned bytes V2 Josef Bacik
  0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2011-05-25 17:11 UTC (permalink / raw)
  To: linux-btrfs

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>
---
 fs/btrfs/extent-tree.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index c8c3184..adb6696 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3199,6 +3199,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 < num_bytes)
+			committed = 1;
 		spin_unlock(&data_sinfo->lock);
 
 		/* commit the current transaction and try again */
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-26 13:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-25 17:11 [PATCH] Btrfs: don't commit the transaction if we dont have enough pinned bytes Josef Bacik
2011-05-25 19:30 ` [PATCH] Btrfs: don't commit the transaction if we dont have enough pinned bytes V2 Josef Bacik
2011-05-26  8:57   ` Adrian Hunter
2011-05-26 13:25     ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).