]> 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>
Mon, 4 May 2015 00:44:23 +0000 (20:44 -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 b6344f5f0ae86a00d0f626c8e6dba1b03bb634d6..9b068c77b285748d009ab518498e78e1f921433f 100644 (file)
@@ -3794,7 +3794,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);