btrfs-progs: mkfs: add uuid and otime to ROOT_ITEM of, FS_TREE
[platform/upstream/btrfs-progs.git] / qgroup-verify.c
index f5760de..571b4d4 100644 (file)
@@ -27,7 +27,7 @@
 #include "disk-io.h"
 #include "print-tree.h"
 #include "utils.h"
-#include "ulist.h"
+#include "kernel-shared/ulist.h"
 #include "rbtree-utils.h"
 #include "transaction.h"
 #include "repair.h"
@@ -711,7 +711,7 @@ static int travel_tree(struct btrfs_fs_info *info, struct btrfs_root *root,
 //     printf("travel_tree: bytenr: %llu\tnum_bytes: %llu\tref_parent: %llu\n",
 //            bytenr, num_bytes, ref_parent);
 
-       eb = read_tree_block(root, bytenr, num_bytes, 0);
+       eb = read_tree_block(info, bytenr, 0);
        if (!extent_buffer_uptodate(eb))
                return -EIO;
 
@@ -736,7 +736,7 @@ static int travel_tree(struct btrfs_fs_info *info, struct btrfs_root *root,
        nr = btrfs_header_nritems(eb);
        for (i = 0; i < nr; i++) {
                new_bytenr = btrfs_node_blockptr(eb, i);
-               new_num_bytes = root->nodesize;
+               new_num_bytes = info->nodesize;
 
                ret = travel_tree(info, root, new_bytenr, new_num_bytes,
                                  ref_parent);
@@ -1185,7 +1185,7 @@ static int scan_extents(struct btrfs_fs_info *info,
                                bytenr = key.objectid;
                                num_bytes = key.offset;
                                if (key.type == BTRFS_METADATA_ITEM_KEY) {
-                                       num_bytes = info->extent_root->nodesize;
+                                       num_bytes = info->nodesize;
                                        meta = 1;
                                }
 
@@ -1496,7 +1496,7 @@ static int repair_qgroup_info(struct btrfs_fs_info *info,
        key.offset = count->qgroupid;
        ret = btrfs_search_slot(trans, root, &key, &path, 0, 1);
        if (ret) {
-               error("Could not find disk item for qgroup %llu/%llu.\n",
+               error("could not find disk item for qgroup %llu/%llu",
                      btrfs_qgroup_level(count->qgroupid),
                      btrfs_qgroup_subvid(count->qgroupid));
                if (ret > 0)
@@ -1534,53 +1534,48 @@ static int repair_qgroup_status(struct btrfs_fs_info *info)
        int ret;
        struct btrfs_root *root = info->quota_root;
        struct btrfs_trans_handle *trans;
-       struct btrfs_path *path;
+       struct btrfs_path path;
        struct btrfs_key key;
        struct btrfs_qgroup_status_item *status_item;
 
        printf("Repair qgroup status item\n");
 
-       path = btrfs_alloc_path();
-       if (!path)
-               return -ENOMEM;
-
        trans = btrfs_start_transaction(root, 1);
-       if (IS_ERR(trans)) {
-               btrfs_free_path(path);
+       if (IS_ERR(trans))
                return PTR_ERR(trans);
-       }
 
+       btrfs_init_path(&path);
        key.objectid = 0;
        key.type = BTRFS_QGROUP_STATUS_KEY;
        key.offset = 0;
-       ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
+       ret = btrfs_search_slot(trans, root, &key, &path, 0, 1);
        if (ret) {
-               error("Could not find qgroup status item\n");
+               error("could not find qgroup status item");
                if (ret > 0)
                        ret = -ENOENT;
                goto out;
        }
 
-       status_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
+       status_item = btrfs_item_ptr(path.nodes[0], path.slots[0],
                                     struct btrfs_qgroup_status_item);
-       btrfs_set_qgroup_status_flags(path->nodes[0], status_item,
+       btrfs_set_qgroup_status_flags(path.nodes[0], status_item,
                                      BTRFS_QGROUP_STATUS_FLAG_ON);
-       btrfs_set_qgroup_status_rescan(path->nodes[0], status_item, 0);
-       btrfs_set_qgroup_status_generation(path->nodes[0], status_item,
+       btrfs_set_qgroup_status_rescan(path.nodes[0], status_item, 0);
+       btrfs_set_qgroup_status_generation(path.nodes[0], status_item,
                                           trans->transid);
 
-       btrfs_mark_buffer_dirty(path->nodes[0]);
+       btrfs_mark_buffer_dirty(path.nodes[0]);
 
 out:
        btrfs_commit_transaction(trans, root);
-       btrfs_free_path(path);
+       btrfs_release_path(&path);
 
        return ret;
 }
 
 int repair_qgroups(struct btrfs_fs_info *info, int *repaired)
 {
-       int ret;
+       int ret = 0;
        struct qgroup_count *count, *tmpcount;
 
        *repaired = 0;