btrfs-progs: docs: add missing short option for qroup-report
[platform/upstream/btrfs-progs.git] / backref.c
index 8f41f82..ce12bbd 100644 (file)
--- a/backref.c
+++ b/backref.c
@@ -20,8 +20,9 @@
 #include "ctree.h"
 #include "disk-io.h"
 #include "backref.h"
-#include "ulist.h"
+#include "kernel-shared/ulist.h"
 #include "transaction.h"
+#include "internal.h"
 
 #define pr_debug(...) do { } while (0)
 
@@ -449,8 +450,8 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
                if (ref->key_for_search.type)
                        continue;
                BUG_ON(!ref->wanted_disk_byte);
-               eb = read_tree_block(fs_info->tree_root, ref->wanted_disk_byte,
-                                    fs_info->tree_root->leafsize, 0);
+               eb = read_tree_block(fs_info, ref->wanted_disk_byte,
+                                    fs_info->nodesize, 0);
                if (!extent_buffer_uptodate(eb)) {
                        free_extent_buffer(eb);
                        return -EIO;
@@ -738,8 +739,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
 
        key.objectid = bytenr;
        key.offset = (u64)-1;
-       if (btrfs_fs_incompat(fs_info,
-                             BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA))
+       if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
                key.type = BTRFS_METADATA_ITEM_KEY;
        else
                key.type = BTRFS_EXTENT_ITEM_KEY;
@@ -804,10 +804,9 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
                            ref->level == 0) {
                                u32 bsz;
                                struct extent_buffer *eb;
-                               bsz = btrfs_level_size(fs_info->extent_root,
-                                                       ref->level);
-                               eb = read_tree_block(fs_info->extent_root,
-                                                          ref->parent, bsz, 0);
+                               bsz = fs_info->nodesize;
+                               eb = read_tree_block(fs_info,
+                                               ref->parent, bsz, 0);
                                if (!extent_buffer_uptodate(eb)) {
                                        free_extent_buffer(eb);
                                        ret = -EIO;
@@ -990,7 +989,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
        unsigned long ptr;
 
        key.objectid = inode_objectid;
-       btrfs_set_key_type(&key, BTRFS_INODE_EXTREF_KEY);
+       key.type = BTRFS_INODE_EXTREF_KEY;
        key.offset = start_off;
 
        ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
@@ -1030,7 +1029,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
                ret = -ENOENT;
                if (found_key.objectid != inode_objectid)
                        break;
-               if (btrfs_key_type(&found_key) != BTRFS_INODE_EXTREF_KEY)
+               if (found_key.type != BTRFS_INODE_EXTREF_KEY)
                        break;
 
                ret = 0;
@@ -1136,8 +1135,7 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
        struct btrfs_extent_item *ei;
        struct btrfs_key key;
 
-       if (btrfs_fs_incompat(fs_info,
-                             BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA))
+       if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
                key.type = BTRFS_METADATA_ITEM_KEY;
        else
                key.type = BTRFS_EXTENT_ITEM_KEY;
@@ -1156,7 +1154,7 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
        }
        btrfs_item_key_to_cpu(path->nodes[0], found_key, path->slots[0]);
        if (found_key->type == BTRFS_METADATA_ITEM_KEY)
-               size = fs_info->extent_root->leafsize;
+               size = fs_info->nodesize;
        else if (found_key->type == BTRFS_EXTENT_ITEM_KEY)
                size = found_key->offset;
 
@@ -1578,8 +1576,8 @@ static int inode_to_path(u64 inum, u32 name_len, unsigned long name_off,
  * is has been created large enough. each path is zero-terminated and accessed
  * from ipath->fspath->val[i].
  * when it returns, there are ipath->fspath->elem_cnt number of paths available
- * in ipath->fspath->val[]. when the allocated space wasn't sufficient, the
- * number of missed paths in recored in ipath->fspath->elem_missed, otherwise,
+ * in ipath->fspath->val[]. When the allocated space wasn't sufficient, the
+ * number of missed paths is recorded in ipath->fspath->elem_missed, otherwise,
  * it's zero. ipath->fspath->bytes_missing holds the number of bytes that would
  * have been needed to return all paths.
  */