btrfs-progs: alias btrfs device delete to btrfs device remove
[platform/upstream/btrfs-progs.git] / qgroup-verify.c
index 2e1716d..f7a94bf 100644 (file)
@@ -28,6 +28,7 @@
 #include "print-tree.h"
 #include "utils.h"
 #include "ulist.h"
+#include "rbtree-utils.h"
 
 #include "qgroup-verify.h"
 
@@ -63,9 +64,9 @@ struct rb_root by_bytenr = RB_ROOT;
  * finding roots to account against.
  *
  * An implied ref is when a tree block has refs on it that may not
- * exist in any of it's child nodes. Even though the refs might not
+ * exist in any of its child nodes. Even though the refs might not
  * exist further down the tree, the fact that our interior node has a
- * ref means we need to account anything below it to all it's roots.
+ * ref means we need to account anything below it to all its roots.
  */
 struct ulist *tree_blocks = NULL;      /* unode->val = bytenr, ->aux
                                         * = tree_block pointer */
@@ -390,7 +391,7 @@ static u64 resolve_one_root(u64 bytenr)
 
 static inline struct tree_block *unode_tree_block(struct ulist_node *unode)
 {
-       return (struct tree_block *)unode->aux;
+       return u64_to_ptr(unode->aux);
 }
 static inline u64 unode_bytenr(struct ulist_node *unode)
 {
@@ -404,7 +405,7 @@ static int alloc_tree_block(u64 bytenr, u64 num_bytes, int level)
        if (block) {
                block->num_bytes = num_bytes;
                block->level = level;
-               if (ulist_add(tree_blocks, bytenr, (unsigned long long)block, 0) >= 0)
+               if (ulist_add(tree_blocks, bytenr, ptr_to_u64(block), 0) >= 0)
                        return 0;
                free(block);
        }
@@ -512,7 +513,7 @@ static int travel_tree(struct btrfs_fs_info *info, struct btrfs_root *root,
 //            bytenr, num_bytes, ref_parent);
 
        eb = read_tree_block(root, bytenr, num_bytes, 0);
-       if (!eb)
+       if (!extent_buffer_uptodate(eb))
                return -EIO;
 
        ret = 0;
@@ -552,11 +553,11 @@ static int add_refs_for_implied(struct btrfs_fs_info *info, u64 bytenr,
                                struct tree_block *block)
 {
        int ret;
-       u64 root_bytenr = resolve_one_root(bytenr);
+       u64 root_id = resolve_one_root(bytenr);
        struct btrfs_root *root;
        struct btrfs_key key;
 
-       key.objectid = root_bytenr;
+       key.objectid = root_id;
        key.type = BTRFS_ROOT_ITEM_KEY;
        key.offset = (u64)-1;