btrfs-progs: add btrfs_clear_free_space_tree() from the kernel
[platform/upstream/btrfs-progs.git] / cmds-inspect-dump-tree.c
index 4bf14b7..03aa0b2 100644 (file)
@@ -260,26 +260,27 @@ int cmd_inspect_dump_tree(int argc, char **argv)
                case 'b':
                        block_only = arg_strtou64(optarg);
                        break;
-               case 't':
-                       if (string_is_numerical(optarg)) {
-                               tree_id = arg_strtou64(optarg);
-                       } else {
-                               const char *end = NULL;
+               case 't': {
+                       const char *end = NULL;
 
+                       if (string_is_numerical(optarg))
+                               tree_id = arg_strtou64(optarg);
+                       else
                                tree_id = treeid_from_string(optarg, &end);
 
-                               if (*end) {
-                                       error("unexpected tree id suffix of '%s': %s\n",
-                                                       optarg, end);
-                                       exit(1);
-                               }
-                       }
                        if (!tree_id) {
                                error("unrecognized tree id: %s\n",
                                                optarg);
                                exit(1);
                        }
+
+                       if (end && *end) {
+                               error("unexpected tree id suffix of '%s': %s",
+                                               optarg, end);
+                               exit(1);
+                       }
                        break;
+                       }
                default:
                        usage(cmd_inspect_dump_tree_usage);
                }
@@ -408,7 +409,7 @@ again:
                }
                btrfs_item_key(leaf, &disk_key, path.slots[0]);
                btrfs_disk_key_to_cpu(&found_key, &disk_key);
-               if (btrfs_key_type(&found_key) == BTRFS_ROOT_ITEM_KEY) {
+               if (found_key.type == BTRFS_ROOT_ITEM_KEY) {
                        unsigned long offset;
                        struct extent_buffer *buf;
                        int skip = extent_only | device_only | uuid_tree_only;