@@ -747,7 +747,7 @@ static u64 find_root_gen(int fd)
if (sh.objectid == ino_args.treeid &&
sh.type == BTRFS_ROOT_ITEM_KEY) {
max_found = max(max_found,
- btrfs_root_generation(item));
+ btrfs_stack_root_generation(item));
}
}
if (sk->min_offset < (u64)-1)
@@ -1023,7 +1023,7 @@ static int list_subvol_search(int fd, struct root_lookup *root_lookup)
u8 ruuid[BTRFS_UUID_SIZE];
ri = (struct btrfs_root_item *)(args.buf + off);
- gen = btrfs_root_generation(ri);
+ gen = btrfs_stack_root_generation(ri);
flags = btrfs_root_flags(ri);
if(sh.len >
sizeof(struct btrfs_root_item_v0)) {
@@ -13521,7 +13521,7 @@ init:
* same block bytenr here.
*/
if (old->start == c->start) {
- btrfs_set_root_generation(&root->root_item,
+ btrfs_set_stack_root_generation(&root->root_item,
trans->transid);
root->root_item.level = btrfs_header_level(root->node);
ret = btrfs_update_root(trans, root->fs_info->tree_root,
@@ -14378,7 +14378,7 @@ static int maybe_repair_root_item(struct btrfs_path *path,
if (btrfs_root_bytenr(&ri) != rii->bytenr ||
btrfs_root_level(&ri) != rii->level ||
- btrfs_root_generation(&ri) != rii->gen) {
+ btrfs_stack_root_generation(&ri) != rii->gen) {
/*
* If we're in repair mode but our caller told us to not update
@@ -14394,21 +14394,23 @@ static int maybe_repair_root_item(struct btrfs_path *path,
" new bytenr %llu, new gen %llu, new level %u\n",
(read_only_mode ? "" : "fixing "),
root_id,
- btrfs_root_bytenr(&ri), btrfs_root_generation(&ri),
+ btrfs_root_bytenr(&ri),
+ btrfs_stack_root_generation(&ri),
btrfs_root_level(&ri),
rii->bytenr, rii->gen, rii->level);
- if (btrfs_root_generation(&ri) > rii->gen) {
+ if (btrfs_stack_root_generation(&ri) > rii->gen) {
fprintf(stderr,
"root %llu has a root item with a more recent gen (%llu) compared to the found root node (%llu)\n",
- root_id, btrfs_root_generation(&ri), rii->gen);
+ root_id, btrfs_stack_root_generation(&ri),
+ rii->gen);
return -EINVAL;
}
if (!read_only_mode) {
btrfs_set_root_bytenr(&ri, rii->bytenr);
btrfs_set_root_level(&ri, rii->level);
- btrfs_set_root_generation(&ri, rii->gen);
+ btrfs_set_stack_root_generation(&ri, rii->gen);
write_extent_buffer(path->nodes[0], &ri,
offset, sizeof(ri));
}
@@ -194,7 +194,7 @@ static void insert_temp_root_item(struct extent_buffer *buf,
btrfs_set_stack_inode_mode(inode_item, S_IFDIR | 0755);
btrfs_set_root_refs(&root_item, 1);
btrfs_set_root_used(&root_item, cfg->nodesize);
- btrfs_set_root_generation(&root_item, 1);
+ btrfs_set_stack_root_generation(&root_item, 1);
btrfs_set_root_bytenr(&root_item, bytenr);
memset(&disk_key, 0, sizeof(disk_key));
@@ -855,7 +855,7 @@ static int create_subvol(struct btrfs_trans_handle *trans,
memcpy(&root_item, &root->root_item, sizeof(root_item));
btrfs_set_root_bytenr(&root_item, tmp->start);
btrfs_set_root_level(&root_item, btrfs_header_level(tmp));
- btrfs_set_root_generation(&root_item, trans->transid);
+ btrfs_set_stack_root_generation(&root_item, trans->transid);
free_extent_buffer(tmp);
key.objectid = root_objectid;
@@ -2051,7 +2051,7 @@ BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32);
BTRFS_SETGET_FUNCS(disk_root_bytenr, struct btrfs_root_item, bytenr, 64);
BTRFS_SETGET_FUNCS(disk_root_level, struct btrfs_root_item, level, 8);
-BTRFS_SETGET_STACK_FUNCS(root_generation, struct btrfs_root_item,
+BTRFS_SETGET_STACK_FUNCS(stack_root_generation, struct btrfs_root_item,
generation, 64);
BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64);
BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8);
@@ -494,7 +494,7 @@ static int find_and_setup_root(struct btrfs_root *tree_root,
if (ret)
return ret;
- generation = btrfs_root_generation(&root->root_item);
+ generation = btrfs_stack_root_generation(&root->root_item);
root->node = read_tree_block(fs_info,
btrfs_root_bytenr(&root->root_item), generation);
if (!extent_buffer_uptodate(root->node))
@@ -606,7 +606,7 @@ out:
free(root);
return ERR_PTR(ret);
}
- generation = btrfs_root_generation(&root->root_item);
+ generation = btrfs_stack_root_generation(&root->root_item);
root->node = read_tree_block(fs_info,
btrfs_root_bytenr(&root->root_item), generation);
if (!extent_buffer_uptodate(root->node)) {
@@ -59,7 +59,7 @@ static int btrfs_create_tree_root(int fd, struct btrfs_mkfs_config *cfg,
btrfs_set_stack_inode_mode(inode_item, S_IFDIR | 0755);
btrfs_set_root_refs(&root_item, 1);
btrfs_set_root_used(&root_item, cfg->nodesize);
- btrfs_set_root_generation(&root_item, 1);
+ btrfs_set_stack_root_generation(&root_item, 1);
btrfs_set_stack_disk_key_type(&disk_key, BTRFS_ROOT_ITEM_KEY);
btrfs_set_stack_disk_key_offset(&disk_key, 0);
@@ -204,7 +204,7 @@ static int __recow_root(struct btrfs_trans_handle *trans,
struct extent_buffer *tmp;
int ret;
- if (trans->transid != btrfs_root_generation(&root->root_item)) {
+ if (trans->transid != btrfs_stack_root_generation(&root->root_item)) {
extent_buffer_get(root->node);
ret = __btrfs_cow_block(trans, root, root->node,
NULL, 0, &tmp, 0, 0);
@@ -338,7 +338,7 @@ static int create_tree(struct btrfs_trans_handle *trans,
memcpy(&root_item, &root->root_item, sizeof(root_item));
btrfs_set_root_bytenr(&root_item, tmp->start);
btrfs_set_root_level(&root_item, btrfs_header_level(tmp));
- btrfs_set_root_generation(&root_item, trans->transid);
+ btrfs_set_stack_root_generation(&root_item, trans->transid);
free_extent_buffer(tmp);
location.objectid = objectid;
@@ -588,7 +588,7 @@ static void print_root_item(struct extent_buffer *leaf, int slot)
root_flags_to_str(btrfs_root_flags(&root_item), flags_str);
printf("\t\tgeneration %llu root_dirid %llu bytenr %llu level %hhu refs %u\n",
- (unsigned long long)btrfs_root_generation(&root_item),
+ (unsigned long long)btrfs_stack_root_generation(&root_item),
(unsigned long long)btrfs_root_dirid(&root_item),
(unsigned long long)btrfs_root_bytenr(&root_item),
btrfs_root_level(&root_item),
@@ -121,7 +121,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
* Update generation_v2 so at the next mount we know the new root
* fields are valid.
*/
- btrfs_set_root_generation_v2(item, btrfs_root_generation(item));
+ btrfs_set_root_generation_v2(item, btrfs_stack_root_generation(item));
write_extent_buffer(l, item, ptr, sizeof(*item));
btrfs_mark_buffer_dirty(path->nodes[0]);
@@ -139,7 +139,7 @@ int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
/*
* Make sure generation v1 and v2 match. See update_root for details.
*/
- btrfs_set_root_generation_v2(item, btrfs_root_generation(item));
+ btrfs_set_root_generation_v2(item, btrfs_stack_root_generation(item));
ret = btrfs_insert_item(trans, root, key, item, sizeof(*item));
return ret;
}
@@ -153,7 +153,7 @@ static int btrfs_read_root_item(int mnt_fd, u64 root_id,
return ret;
if (read_len < sizeof(*item) ||
- btrfs_root_generation(item) != btrfs_root_generation_v2(item))
+ btrfs_stack_root_generation(item) != btrfs_root_generation_v2(item))
memset(&item->generation_v2, 0,
sizeof(*item) - offsetof(struct btrfs_root_item,
generation_v2));
@@ -67,7 +67,7 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
break;
btrfs_set_root_bytenr(&root->root_item,
root->node->start);
- btrfs_set_root_generation(&root->root_item,
+ btrfs_set_stack_root_generation(&root->root_item,
trans->transid);
root->root_item.level = btrfs_header_level(root->node);
ret = btrfs_update_root(trans, tree_root,
@@ -158,7 +158,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
root->commit_root = NULL;
btrfs_set_root_bytenr(&root->root_item, root->node->start);
- btrfs_set_root_generation(&root->root_item, trans->transid);
+ btrfs_set_stack_root_generation(&root->root_item, trans->transid);
root->root_item.level = btrfs_header_level(root->node);
ret = btrfs_update_root(trans, root->fs_info->tree_root,
&root->root_key, &root->root_item);
The root_generation set/get function defined by BTRFS_SETGET_STACK_FUNCS macro is missing the prefix stack. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> --- btrfs-list.c | 4 ++-- cmds-check.c | 14 ++++++++------ convert/common.c | 2 +- convert/main.c | 2 +- ctree.h | 2 +- disk-io.c | 4 ++-- mkfs/common.c | 2 +- mkfs/main.c | 4 ++-- print-tree.c | 2 +- root-tree.c | 4 ++-- send-utils.c | 2 +- transaction.c | 4 ++-- 12 files changed, 24 insertions(+), 22 deletions(-)