Merge branch 'for-chris' of git://github.com/idryomov/btrfs-progs into 0.20
This commit is contained in:
commit
2588b4f8be
106
btrfs-list.c
106
btrfs-list.c
|
@ -202,7 +202,7 @@ static int add_root(struct root_lookup *root_lookup,
|
||||||
* in by lookup_ino_path
|
* in by lookup_ino_path
|
||||||
*/
|
*/
|
||||||
static int resolve_root(struct root_lookup *rl, struct root_info *ri,
|
static int resolve_root(struct root_lookup *rl, struct root_info *ri,
|
||||||
u64 *root_id, u64 *parent_id, u64 *top_id, char **path)
|
u64 *parent_id, u64 *top_id, char **path)
|
||||||
{
|
{
|
||||||
char *full_path = NULL;
|
char *full_path = NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -256,7 +256,6 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*root_id = ri->root_id;
|
|
||||||
*path = full_path;
|
*path = full_path;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -555,6 +554,60 @@ build:
|
||||||
return full;
|
return full;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_default_subvolid(int fd, u64 *default_id)
|
||||||
|
{
|
||||||
|
struct btrfs_ioctl_search_args args;
|
||||||
|
struct btrfs_ioctl_search_key *sk = &args.key;
|
||||||
|
struct btrfs_ioctl_search_header *sh;
|
||||||
|
u64 found = 0;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
memset(&args, 0, sizeof(args));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* search for a dir item with a name 'default' in the tree of
|
||||||
|
* tree roots, it should point us to a default root
|
||||||
|
*/
|
||||||
|
sk->tree_id = 1;
|
||||||
|
|
||||||
|
/* don't worry about ancient format and request only one item */
|
||||||
|
sk->nr_items = 1;
|
||||||
|
|
||||||
|
sk->max_objectid = BTRFS_ROOT_TREE_DIR_OBJECTID;
|
||||||
|
sk->min_objectid = BTRFS_ROOT_TREE_DIR_OBJECTID;
|
||||||
|
sk->max_type = BTRFS_DIR_ITEM_KEY;
|
||||||
|
sk->min_type = BTRFS_DIR_ITEM_KEY;
|
||||||
|
sk->max_offset = (u64)-1;
|
||||||
|
sk->max_transid = (u64)-1;
|
||||||
|
|
||||||
|
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* the ioctl returns the number of items it found in nr_items */
|
||||||
|
if (sk->nr_items == 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
sh = (struct btrfs_ioctl_search_header *)args.buf;
|
||||||
|
|
||||||
|
if (sh->type == BTRFS_DIR_ITEM_KEY) {
|
||||||
|
struct btrfs_dir_item *di;
|
||||||
|
int name_len;
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
di = (struct btrfs_dir_item *)(sh + 1);
|
||||||
|
name_len = btrfs_stack_dir_name_len(di);
|
||||||
|
name = (char *)(di + 1);
|
||||||
|
|
||||||
|
if (!strncmp("default", name, name_len))
|
||||||
|
found = btrfs_disk_key_objectid(&di->location);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
*default_id = found;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int __list_subvol_search(int fd, struct root_lookup *root_lookup)
|
static int __list_subvol_search(int fd, struct root_lookup *root_lookup)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -571,10 +624,6 @@ static int __list_subvol_search(int fd, struct root_lookup *root_lookup)
|
||||||
root_lookup_init(root_lookup);
|
root_lookup_init(root_lookup);
|
||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
|
|
||||||
root_lookup_init(root_lookup);
|
|
||||||
|
|
||||||
memset(&args, 0, sizeof(args));
|
|
||||||
|
|
||||||
/* search in the tree of tree roots */
|
/* search in the tree of tree roots */
|
||||||
sk->tree_id = 1;
|
sk->tree_id = 1;
|
||||||
|
|
||||||
|
@ -670,12 +719,32 @@ static int __list_subvol_fill_paths(int fd, struct root_lookup *root_lookup)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int list_subvols(int fd, int print_parent)
|
int list_subvols(int fd, int print_parent, int get_default)
|
||||||
{
|
{
|
||||||
struct root_lookup root_lookup;
|
struct root_lookup root_lookup;
|
||||||
struct rb_node *n;
|
struct rb_node *n;
|
||||||
|
u64 default_id;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (get_default) {
|
||||||
|
ret = get_default_subvolid(fd, &default_id);
|
||||||
|
if (ret) {
|
||||||
|
fprintf(stderr, "ERROR: can't perform the search - %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if (default_id == 0) {
|
||||||
|
fprintf(stderr, "ERROR: 'default' dir item not found\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no need to resolve roots if FS_TREE is default */
|
||||||
|
if (default_id == BTRFS_FS_TREE_OBJECTID) {
|
||||||
|
printf("ID 5 (FS_TREE)\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = __list_subvol_search(fd, &root_lookup);
|
ret = __list_subvol_search(fd, &root_lookup);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fprintf(stderr, "ERROR: can't perform the search - %s\n",
|
fprintf(stderr, "ERROR: can't perform the search - %s\n",
|
||||||
|
@ -698,23 +767,28 @@ int list_subvols(int fd, int print_parent)
|
||||||
n = rb_last(&root_lookup.root);
|
n = rb_last(&root_lookup.root);
|
||||||
while (n) {
|
while (n) {
|
||||||
struct root_info *entry;
|
struct root_info *entry;
|
||||||
u64 root_id;
|
|
||||||
u64 level;
|
u64 level;
|
||||||
u64 parent_id;
|
u64 parent_id;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
entry = rb_entry(n, struct root_info, rb_node);
|
entry = rb_entry(n, struct root_info, rb_node);
|
||||||
resolve_root(&root_lookup, entry, &root_id, &parent_id,
|
if (get_default && entry->root_id != default_id) {
|
||||||
&level, &path);
|
n = rb_prev(n);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve_root(&root_lookup, entry, &parent_id, &level, &path);
|
||||||
if (print_parent) {
|
if (print_parent) {
|
||||||
printf("ID %llu parent %llu top level %llu path %s\n",
|
printf("ID %llu parent %llu top level %llu path %s\n",
|
||||||
(unsigned long long)root_id,
|
(unsigned long long)entry->root_id,
|
||||||
(unsigned long long)parent_id,
|
(unsigned long long)parent_id,
|
||||||
(unsigned long long)level, path);
|
(unsigned long long)level, path);
|
||||||
} else {
|
} else {
|
||||||
printf("ID %llu top level %llu path %s\n",
|
printf("ID %llu top level %llu path %s\n",
|
||||||
(unsigned long long)root_id,
|
(unsigned long long)entry->root_id,
|
||||||
(unsigned long long)level, path);
|
(unsigned long long)level, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(path);
|
free(path);
|
||||||
n = rb_prev(n);
|
n = rb_prev(n);
|
||||||
}
|
}
|
||||||
|
@ -920,17 +994,17 @@ char *path_for_root(int fd, u64 root)
|
||||||
n = rb_last(&root_lookup.root);
|
n = rb_last(&root_lookup.root);
|
||||||
while (n) {
|
while (n) {
|
||||||
struct root_info *entry;
|
struct root_info *entry;
|
||||||
u64 root_id;
|
|
||||||
u64 parent_id;
|
u64 parent_id;
|
||||||
u64 level;
|
u64 level;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
entry = rb_entry(n, struct root_info, rb_node);
|
entry = rb_entry(n, struct root_info, rb_node);
|
||||||
resolve_root(&root_lookup, entry, &root_id, &parent_id, &level,
|
resolve_root(&root_lookup, entry, &parent_id, &level, &path);
|
||||||
&path);
|
if (entry->root_id == root)
|
||||||
if (root_id == root)
|
|
||||||
ret_path = path;
|
ret_path = path;
|
||||||
else
|
else
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
n = rb_prev(n);
|
n = rb_prev(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
31
ctree.h
31
ctree.h
|
@ -252,6 +252,13 @@ struct btrfs_chunk {
|
||||||
/* additional stripes go here */
|
/* additional stripes go here */
|
||||||
} __attribute__ ((__packed__));
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
struct btrfs_free_space_header {
|
||||||
|
struct btrfs_disk_key location;
|
||||||
|
__le64 generation;
|
||||||
|
__le64 num_entries;
|
||||||
|
__le64 num_bitmaps;
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
static inline unsigned long btrfs_chunk_item_size(int num_stripes)
|
static inline unsigned long btrfs_chunk_item_size(int num_stripes)
|
||||||
{
|
{
|
||||||
BUG_ON(num_stripes == 0);
|
BUG_ON(num_stripes == 0);
|
||||||
|
@ -1427,6 +1434,8 @@ BTRFS_SETGET_FUNCS(dir_type, struct btrfs_dir_item, type, 8);
|
||||||
BTRFS_SETGET_FUNCS(dir_name_len, struct btrfs_dir_item, name_len, 16);
|
BTRFS_SETGET_FUNCS(dir_name_len, struct btrfs_dir_item, name_len, 16);
|
||||||
BTRFS_SETGET_FUNCS(dir_transid, struct btrfs_dir_item, transid, 64);
|
BTRFS_SETGET_FUNCS(dir_transid, struct btrfs_dir_item, transid, 64);
|
||||||
|
|
||||||
|
BTRFS_SETGET_STACK_FUNCS(stack_dir_name_len, struct btrfs_dir_item, name_len, 16);
|
||||||
|
|
||||||
static inline void btrfs_dir_item_key(struct extent_buffer *eb,
|
static inline void btrfs_dir_item_key(struct extent_buffer *eb,
|
||||||
struct btrfs_dir_item *item,
|
struct btrfs_dir_item *item,
|
||||||
struct btrfs_disk_key *key)
|
struct btrfs_disk_key *key)
|
||||||
|
@ -1441,6 +1450,28 @@ static inline void btrfs_set_dir_item_key(struct extent_buffer *eb,
|
||||||
write_eb_member(eb, item, struct btrfs_dir_item, location, key);
|
write_eb_member(eb, item, struct btrfs_dir_item, location, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* struct btrfs_free_space_header */
|
||||||
|
BTRFS_SETGET_FUNCS(free_space_entries, struct btrfs_free_space_header,
|
||||||
|
num_entries, 64);
|
||||||
|
BTRFS_SETGET_FUNCS(free_space_bitmaps, struct btrfs_free_space_header,
|
||||||
|
num_bitmaps, 64);
|
||||||
|
BTRFS_SETGET_FUNCS(free_space_generation, struct btrfs_free_space_header,
|
||||||
|
generation, 64);
|
||||||
|
|
||||||
|
static inline void btrfs_free_space_key(struct extent_buffer *eb,
|
||||||
|
struct btrfs_free_space_header *h,
|
||||||
|
struct btrfs_disk_key *key)
|
||||||
|
{
|
||||||
|
read_eb_member(eb, h, struct btrfs_free_space_header, location, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void btrfs_set_free_space_key(struct extent_buffer *eb,
|
||||||
|
struct btrfs_free_space_header *h,
|
||||||
|
struct btrfs_disk_key *key)
|
||||||
|
{
|
||||||
|
write_eb_member(eb, h, struct btrfs_free_space_header, location, key);
|
||||||
|
}
|
||||||
|
|
||||||
/* struct btrfs_disk_key */
|
/* struct btrfs_disk_key */
|
||||||
BTRFS_SETGET_STACK_FUNCS(disk_key_objectid, struct btrfs_disk_key,
|
BTRFS_SETGET_STACK_FUNCS(disk_key_objectid, struct btrfs_disk_key,
|
||||||
objectid, 64);
|
objectid, 64);
|
||||||
|
|
16
mkfs.c
16
mkfs.c
|
@ -263,17 +263,23 @@ static int create_raid_groups(struct btrfs_trans_handle *trans,
|
||||||
|
|
||||||
if (metadata_profile & ~allowed) {
|
if (metadata_profile & ~allowed) {
|
||||||
fprintf(stderr, "unable to create FS with metadata "
|
fprintf(stderr, "unable to create FS with metadata "
|
||||||
"profile %llu (%llu devices)\n", metadata_profile,
|
"profile %llu (have %llu devices)\n", metadata_profile,
|
||||||
num_devices);
|
num_devices);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (data_profile & ~allowed) {
|
if (data_profile & ~allowed) {
|
||||||
fprintf(stderr, "unable to create FS with data "
|
fprintf(stderr, "unable to create FS with data "
|
||||||
"profile %llu (%llu devices)\n", data_profile,
|
"profile %llu (have %llu devices)\n", data_profile,
|
||||||
num_devices);
|
num_devices);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* allow dup'ed data chunks only in mixed mode */
|
||||||
|
if (!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP)) {
|
||||||
|
fprintf(stderr, "dup for data is allowed only in mixed mode\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (allowed & metadata_profile) {
|
if (allowed & metadata_profile) {
|
||||||
u64 meta_flags = BTRFS_BLOCK_GROUP_METADATA;
|
u64 meta_flags = BTRFS_BLOCK_GROUP_METADATA;
|
||||||
|
|
||||||
|
@ -334,7 +340,7 @@ static void print_usage(void)
|
||||||
fprintf(stderr, "options:\n");
|
fprintf(stderr, "options:\n");
|
||||||
fprintf(stderr, "\t -A --alloc-start the offset to start the FS\n");
|
fprintf(stderr, "\t -A --alloc-start the offset to start the FS\n");
|
||||||
fprintf(stderr, "\t -b --byte-count total number of bytes in the FS\n");
|
fprintf(stderr, "\t -b --byte-count total number of bytes in the FS\n");
|
||||||
fprintf(stderr, "\t -d --data data profile, raid0, raid1, raid10 or single\n");
|
fprintf(stderr, "\t -d --data data profile, raid0, raid1, raid10, dup or single\n");
|
||||||
fprintf(stderr, "\t -l --leafsize size of btree leaves\n");
|
fprintf(stderr, "\t -l --leafsize size of btree leaves\n");
|
||||||
fprintf(stderr, "\t -L --label set a label\n");
|
fprintf(stderr, "\t -L --label set a label\n");
|
||||||
fprintf(stderr, "\t -m --metadata metadata profile, values like data profile\n");
|
fprintf(stderr, "\t -m --metadata metadata profile, values like data profile\n");
|
||||||
|
@ -360,10 +366,12 @@ static u64 parse_profile(char *s)
|
||||||
return BTRFS_BLOCK_GROUP_RAID1;
|
return BTRFS_BLOCK_GROUP_RAID1;
|
||||||
} else if (strcmp(s, "raid10") == 0) {
|
} else if (strcmp(s, "raid10") == 0) {
|
||||||
return BTRFS_BLOCK_GROUP_RAID10;
|
return BTRFS_BLOCK_GROUP_RAID10;
|
||||||
|
} else if (strcmp(s, "dup") == 0) {
|
||||||
|
return BTRFS_BLOCK_GROUP_DUP;
|
||||||
} else if (strcmp(s, "single") == 0) {
|
} else if (strcmp(s, "single") == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Unknown option %s\n", s);
|
fprintf(stderr, "Unknown profile %s\n", s);
|
||||||
print_usage();
|
print_usage();
|
||||||
}
|
}
|
||||||
/* not reached */
|
/* not reached */
|
||||||
|
|
52
print-tree.c
52
print-tree.c
|
@ -94,6 +94,7 @@ static void print_chunk(struct extent_buffer *eb, struct btrfs_chunk *chunk)
|
||||||
(unsigned long long)btrfs_stripe_offset_nr(eb, chunk, i));
|
(unsigned long long)btrfs_stripe_offset_nr(eb, chunk, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_dev_item(struct extent_buffer *eb,
|
static void print_dev_item(struct extent_buffer *eb,
|
||||||
struct btrfs_dev_item *dev_item)
|
struct btrfs_dev_item *dev_item)
|
||||||
{
|
{
|
||||||
|
@ -276,8 +277,29 @@ static void print_root_ref(struct extent_buffer *leaf, int slot, char *tag)
|
||||||
namelen, namebuf);
|
namelen, namebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_key_type(u8 type)
|
static void print_free_space_header(struct extent_buffer *leaf, int slot)
|
||||||
{
|
{
|
||||||
|
struct btrfs_free_space_header *header;
|
||||||
|
struct btrfs_disk_key location;
|
||||||
|
|
||||||
|
header = btrfs_item_ptr(leaf, slot, struct btrfs_free_space_header);
|
||||||
|
btrfs_free_space_key(leaf, header, &location);
|
||||||
|
printf("\t\tlocation ");
|
||||||
|
btrfs_print_key(&location);
|
||||||
|
printf("\n");
|
||||||
|
printf("\t\tcache generation %llu entries %llu bitmaps %llu\n",
|
||||||
|
(unsigned long long)btrfs_free_space_generation(leaf, header),
|
||||||
|
(unsigned long long)btrfs_free_space_entries(leaf, header),
|
||||||
|
(unsigned long long)btrfs_free_space_bitmaps(leaf, header));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void print_key_type(u64 objectid, u8 type)
|
||||||
|
{
|
||||||
|
if (type == 0 && objectid == BTRFS_FREE_SPACE_OBJECTID) {
|
||||||
|
printf("UNTYPED");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BTRFS_INODE_ITEM_KEY:
|
case BTRFS_INODE_ITEM_KEY:
|
||||||
printf("INODE_ITEM");
|
printf("INODE_ITEM");
|
||||||
|
@ -362,10 +384,10 @@ static void print_key_type(u8 type)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_objectid(unsigned long long objectid, u8 type)
|
static void print_objectid(u64 objectid, u8 type)
|
||||||
{
|
{
|
||||||
if (type == BTRFS_DEV_EXTENT_KEY) {
|
if (type == BTRFS_DEV_EXTENT_KEY) {
|
||||||
printf("%llu", objectid); /* device id */
|
printf("%llu", (unsigned long long)objectid); /* device id */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,6 +437,12 @@ static void print_objectid(unsigned long long objectid, u8 type)
|
||||||
case BTRFS_EXTENT_CSUM_OBJECTID:
|
case BTRFS_EXTENT_CSUM_OBJECTID:
|
||||||
printf("EXTENT_CSUM");
|
printf("EXTENT_CSUM");
|
||||||
break;
|
break;
|
||||||
|
case BTRFS_FREE_SPACE_OBJECTID:
|
||||||
|
printf("FREE_SPACE");
|
||||||
|
break;
|
||||||
|
case BTRFS_FREE_INO_OBJECTID:
|
||||||
|
printf("FREE_INO");
|
||||||
|
break;
|
||||||
case BTRFS_MULTIPLE_OBJECTIDS:
|
case BTRFS_MULTIPLE_OBJECTIDS:
|
||||||
printf("MULTIPLE");
|
printf("MULTIPLE");
|
||||||
break;
|
break;
|
||||||
|
@ -425,19 +453,19 @@ static void print_objectid(unsigned long long objectid, u8 type)
|
||||||
}
|
}
|
||||||
/* fall-thru */
|
/* fall-thru */
|
||||||
default:
|
default:
|
||||||
printf("%llu", objectid);
|
printf("%llu", (unsigned long long)objectid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void btrfs_print_key(struct btrfs_disk_key *disk_key)
|
void btrfs_print_key(struct btrfs_disk_key *disk_key)
|
||||||
{
|
{
|
||||||
u8 type;
|
u64 objectid = btrfs_disk_key_objectid(disk_key);
|
||||||
|
u8 type = btrfs_disk_key_type(disk_key);
|
||||||
|
|
||||||
printf("key (");
|
printf("key (");
|
||||||
type = btrfs_disk_key_type(disk_key);
|
print_objectid(objectid, type);
|
||||||
print_objectid((unsigned long long)btrfs_disk_key_objectid(disk_key),
|
|
||||||
type);
|
|
||||||
printf(" ");
|
printf(" ");
|
||||||
print_key_type(type);
|
print_key_type(objectid, type);
|
||||||
printf(" %llu)", (unsigned long long)btrfs_disk_key_offset(disk_key));
|
printf(" %llu)", (unsigned long long)btrfs_disk_key_offset(disk_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,6 +488,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
|
||||||
struct btrfs_block_group_item bg_item;
|
struct btrfs_block_group_item bg_item;
|
||||||
struct btrfs_dir_log_item *dlog;
|
struct btrfs_dir_log_item *dlog;
|
||||||
u32 nr = btrfs_header_nritems(l);
|
u32 nr = btrfs_header_nritems(l);
|
||||||
|
u64 objectid;
|
||||||
u32 type;
|
u32 type;
|
||||||
|
|
||||||
printf("leaf %llu items %d free space %d generation %llu owner %llu\n",
|
printf("leaf %llu items %d free space %d generation %llu owner %llu\n",
|
||||||
|
@ -472,12 +501,17 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
|
||||||
for (i = 0 ; i < nr ; i++) {
|
for (i = 0 ; i < nr ; i++) {
|
||||||
item = btrfs_item_nr(l, i);
|
item = btrfs_item_nr(l, i);
|
||||||
btrfs_item_key(l, &disk_key, i);
|
btrfs_item_key(l, &disk_key, i);
|
||||||
|
objectid = btrfs_disk_key_objectid(&disk_key);
|
||||||
type = btrfs_disk_key_type(&disk_key);
|
type = btrfs_disk_key_type(&disk_key);
|
||||||
printf("\titem %d ", i);
|
printf("\titem %d ", i);
|
||||||
btrfs_print_key(&disk_key);
|
btrfs_print_key(&disk_key);
|
||||||
printf(" itemoff %d itemsize %d\n",
|
printf(" itemoff %d itemsize %d\n",
|
||||||
btrfs_item_offset(l, item),
|
btrfs_item_offset(l, item),
|
||||||
btrfs_item_size(l, item));
|
btrfs_item_size(l, item));
|
||||||
|
|
||||||
|
if (type == 0 && objectid == BTRFS_FREE_SPACE_OBJECTID)
|
||||||
|
print_free_space_header(l, i);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BTRFS_INODE_ITEM_KEY:
|
case BTRFS_INODE_ITEM_KEY:
|
||||||
ii = btrfs_item_ptr(l, i, struct btrfs_inode_item);
|
ii = btrfs_item_ptr(l, i, struct btrfs_inode_item);
|
||||||
|
|
Loading…
Reference in New Issue