]> git.hungrycats.org Git - linux/commitdiff
btrfs: Adjust commit-transaction condition to avoid NO_SPACE more
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 17 Feb 2015 09:25:51 +0000 (17:25 +0800)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Sun, 19 Apr 2015 15:55:22 +0000 (11:55 -0400)
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 <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit 264ca0f60becac34395f3b42171ad0cc2e53ea6e)

fs/btrfs/extent-tree.c

index 1293c2e100ab3e773ba327ebbebfa56f57cd32cf..4f4abe535cd0b16461f160d2cd9287877b2100e7 100644 (file)
@@ -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);