From: Zhao Lei Date: Tue, 17 Feb 2015 09:25:51 +0000 (+0800) Subject: btrfs: Adjust commit-transaction condition to avoid NO_SPACE more X-Git-Tag: firefly_0821_release~176^2~1735^2~43 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=264ca0f60becac34395f3b42171ad0cc2e53ea6e;p=firefly-linux-kernel-4.4.55.git btrfs: Adjust commit-transaction condition to avoid NO_SPACE more If we have any chance to make a successful write, we should not give up. This patch adjust commit-transaction condition from: pinned >= wanted to left + pinned >= wanted Signed-off-by: Zhao Lei Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7b227a65078c..01f4db6554a1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3931,7 +3931,8 @@ alloc: * don't bother committing the transaction. */ if (percpu_counter_compare(&data_sinfo->total_bytes_pinned, - bytes) < 0) + used + bytes - + data_sinfo->total_bytes) < 0) have_pinned_space = 0; spin_unlock(&data_sinfo->lock);