Btrfs: Fix extent code to use merge during delete
Remove implicit commit in del_item and insert_item
Add implicit commit to close()
Add commit op in random-test
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 57fa505..3c5f4c2 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1065,11 +1065,7 @@
ret = search_slot(root, key, &path, data_size);
if (ret == 0) {
release_path(root, &path);
- ret = -EEXIST;
- wret = commit_transaction(root);
- if (wret)
- ret = wret;
- return ret;
+ return -EEXIST;
}
if (ret < 0)
goto out;
@@ -1127,9 +1123,6 @@
check_leaf(&path, 0);
out:
release_path(root, &path);
- wret = commit_transaction(root);
- if (wret)
- ret = wret;
return ret;
}
@@ -1245,7 +1238,8 @@
wret = push_leaf_left(root, path, 1);
if (wret < 0)
ret = wret;
- if (leaf->header.nritems) {
+ if (path->nodes[0] == leaf_buf &&
+ leaf->header.nritems) {
wret = push_leaf_right(root, path, 1);
if (wret < 0)
ret = wret;
@@ -1265,9 +1259,6 @@
}
}
}
- wret = commit_transaction(root);
- if (wret)
- ret = wret;
return ret;
}