Btrfs: avoid double free of fs_info->qgroup_ulist
[deliverable/linux.git] / fs / btrfs / tree-defrag.c
index 3b580ee8ab1ddc01eb06028c8790c815562c977a..94e05c1f118a7045b4bd40e2b03546347371b461 100644 (file)
 #include "transaction.h"
 #include "locking.h"
 
-/* defrag all the leaves in a given btree.  If cache_only == 1, don't read
- * things from disk, otherwise read all the leaves and try to get key order to
+/*
+ * Defrag all the leaves in a given btree.
+ * Read all the leaves and try to get key order to
  * better reflect disk order
  */
 
 int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
-                       struct btrfs_root *root, int cache_only)
+                       struct btrfs_root *root)
 {
        struct btrfs_path *path = NULL;
        struct btrfs_key key;
@@ -41,9 +42,6 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
        u64 last_ret = 0;
        u64 min_trans = 0;
 
-       if (cache_only)
-               goto out;
-
        if (root->fs_info->extent_root == root) {
                /*
                 * there's recursion here right now in the tree locking,
@@ -86,11 +84,8 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
        }
 
        path->keep_locks = 1;
-       if (cache_only)
-               min_trans = root->defrag_trans_start;
 
-       ret = btrfs_search_forward(root, &key, NULL, path,
-                                  cache_only, min_trans);
+       ret = btrfs_search_forward(root, &key, NULL, path, min_trans);
        if (ret < 0)
                goto out;
        if (ret > 0) {
@@ -109,11 +104,11 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
                goto out;
        }
        path->slots[1] = btrfs_header_nritems(path->nodes[1]);
-       next_key_ret = btrfs_find_next_key(root, path, &key, 1, cache_only,
+       next_key_ret = btrfs_find_next_key(root, path, &key, 1,
                                           min_trans);
        ret = btrfs_realloc_node(trans, root,
                                 path->nodes[1], 0,
-                                cache_only, &last_ret,
+                                &last_ret,
                                 &root->defrag_progress);
        if (ret) {
                WARN_ON(ret == -EAGAIN);
This page took 0.024841 seconds and 5 git commands to generate.