]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: don't commit instead of overcommitting
authorJosef Bacik <jbacik@fusionio.com>
Fri, 28 Sep 2012 20:04:19 +0000 (16:04 -0400)
committerChris Mason <chris.mason@fusionio.com>
Mon, 1 Oct 2012 19:35:07 +0000 (15:35 -0400)
I don't think we have the same problem that this was supposed to fix
originally since we can allocate chunks in the enospc path now.  This code
is causing us to constantly commit the transaction as we get close to using
all of our available space in our currently allocated chunks, instead of
allocating another chunk and carrying on with life, which is not nice for
performance.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/extent-tree.c

index 65941d736c4cff198718e4a1053dfc2a2378ac96..7563db782abf6e5f896442565fed4aa8dc0db8aa 100644 (file)
@@ -3890,7 +3890,6 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
        int flush_state = FLUSH_DELAYED_ITEMS_NR;
        int ret = 0;
        bool flushing = false;
-       bool committed = false;
 
 again:
        ret = 0;
@@ -3953,33 +3952,12 @@ again:
                        (orig_bytes * 2);
        }
 
-       if (ret) {
-               u64 avail;
-
-               /*
-                * If we have a lot of space that's pinned, don't bother doing
-                * the overcommit dance yet and just commit the transaction.
-                */
-               avail = (space_info->total_bytes - space_info->bytes_used) * 8;
-               do_div(avail, 10);
-               if (space_info->bytes_pinned >= avail && flush && !committed) {
-                       space_info->flush = 1;
-                       flushing = true;
-                       spin_unlock(&space_info->lock);
-                       ret = may_commit_transaction(root, space_info,
-                                                    orig_bytes, 1);
-                       if (ret)
-                               goto out;
-                       committed = true;
-                       goto again;
-               }
-
-               if (can_overcommit(root, space_info, orig_bytes, flush)) {
-                       space_info->bytes_may_use += orig_bytes;
-                       trace_btrfs_space_reservation(root->fs_info,
-                               "space_info", space_info->flags, orig_bytes, 1);
-                       ret = 0;
-               }
+       if (ret && can_overcommit(root, space_info, orig_bytes, flush)) {
+               space_info->bytes_may_use += orig_bytes;
+               trace_btrfs_space_reservation(root->fs_info, "space_info",
+                                             space_info->flags, orig_bytes,
+                                             1);
+               ret = 0;
        }
 
        /*