btrfs: rename ->len to ->num_bytes in btrfs_ref

We consistently use ->num_bytes everywhere through the delayed ref code,
except in btrfs_ref.  Rename btrfs_ref to match all the other code.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2024-04-12 20:52:26 -04:00 committed by David Sterba
parent f75464f7bb
commit 12390e42b6
8 changed files with 27 additions and 27 deletions

View File

@ -874,7 +874,7 @@ static void init_delayed_ref_head(struct btrfs_delayed_ref_head *head_ref,
refcount_set(&head_ref->refs, 1); refcount_set(&head_ref->refs, 1);
head_ref->bytenr = generic_ref->bytenr; head_ref->bytenr = generic_ref->bytenr;
head_ref->num_bytes = generic_ref->len; head_ref->num_bytes = generic_ref->num_bytes;
head_ref->ref_mod = count_mod; head_ref->ref_mod = count_mod;
head_ref->reserved_bytes = reserved; head_ref->reserved_bytes = reserved;
head_ref->must_insert_reserved = must_insert_reserved; head_ref->must_insert_reserved = must_insert_reserved;
@ -895,7 +895,7 @@ static void init_delayed_ref_head(struct btrfs_delayed_ref_head *head_ref,
qrecord->data_rsv_refroot = generic_ref->ref_root; qrecord->data_rsv_refroot = generic_ref->ref_root;
} }
qrecord->bytenr = generic_ref->bytenr; qrecord->bytenr = generic_ref->bytenr;
qrecord->num_bytes = generic_ref->len; qrecord->num_bytes = generic_ref->num_bytes;
qrecord->old_roots = NULL; qrecord->old_roots = NULL;
} }
} }
@ -1000,7 +1000,7 @@ static void init_delayed_ref_common(struct btrfs_fs_info *fs_info,
refcount_set(&ref->refs, 1); refcount_set(&ref->refs, 1);
ref->bytenr = generic_ref->bytenr; ref->bytenr = generic_ref->bytenr;
ref->num_bytes = generic_ref->len; ref->num_bytes = generic_ref->num_bytes;
ref->ref_mod = 1; ref->ref_mod = 1;
ref->action = action; ref->action = action;
ref->seq = seq; ref->seq = seq;
@ -1155,7 +1155,7 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
.type = BTRFS_REF_METADATA, .type = BTRFS_REF_METADATA,
.action = BTRFS_UPDATE_DELAYED_HEAD, .action = BTRFS_UPDATE_DELAYED_HEAD,
.bytenr = bytenr, .bytenr = bytenr,
.len = num_bytes, .num_bytes = num_bytes,
}; };
head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS); head_ref = kmem_cache_alloc(btrfs_delayed_ref_head_cachep, GFP_NOFS);

View File

@ -260,7 +260,7 @@ struct btrfs_ref {
u64 real_root; u64 real_root;
#endif #endif
u64 bytenr; u64 bytenr;
u64 len; u64 num_bytes;
u64 owning_root; u64 owning_root;
/* /*

View File

@ -2542,7 +2542,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
if (ref.bytenr == 0) if (ref.bytenr == 0)
continue; continue;
ref.len = btrfs_file_extent_disk_num_bytes(buf, fi); ref.num_bytes = btrfs_file_extent_disk_num_bytes(buf, fi);
ref.owning_root = ref_root; ref.owning_root = ref_root;
key.offset -= btrfs_file_extent_offset(buf, fi); key.offset -= btrfs_file_extent_offset(buf, fi);
@ -2557,7 +2557,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
} else { } else {
/* We don't know the owning_root, leave as 0. */ /* We don't know the owning_root, leave as 0. */
ref.bytenr = btrfs_node_blockptr(buf, i); ref.bytenr = btrfs_node_blockptr(buf, i);
ref.len = fs_info->nodesize; ref.num_bytes = fs_info->nodesize;
btrfs_init_tree_ref(&ref, level - 1, btrfs_init_tree_ref(&ref, level - 1,
root->root_key.objectid, for_reloc); root->root_key.objectid, for_reloc);
@ -3466,7 +3466,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
struct btrfs_ref generic_ref = { struct btrfs_ref generic_ref = {
.action = BTRFS_DROP_DELAYED_REF, .action = BTRFS_DROP_DELAYED_REF,
.bytenr = buf->start, .bytenr = buf->start,
.len = buf->len, .num_bytes = buf->len,
.parent = parent, .parent = parent,
.owning_root = btrfs_header_owner(buf), .owning_root = btrfs_header_owner(buf),
.ref_root = root_id, .ref_root = root_id,
@ -3560,7 +3560,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref)
* tree, just update pinning info and exit early. * tree, just update pinning info and exit early.
*/ */
if (ref->ref_root == BTRFS_TREE_LOG_OBJECTID) { if (ref->ref_root == BTRFS_TREE_LOG_OBJECTID) {
btrfs_pin_extent(trans, ref->bytenr, ref->len, 1); btrfs_pin_extent(trans, ref->bytenr, ref->num_bytes, 1);
ret = 0; ret = 0;
} else if (ref->type == BTRFS_REF_METADATA) { } else if (ref->type == BTRFS_REF_METADATA) {
ret = btrfs_add_delayed_tree_ref(trans, ref, NULL); ret = btrfs_add_delayed_tree_ref(trans, ref, NULL);
@ -4967,7 +4967,7 @@ int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_ref generic_ref = { struct btrfs_ref generic_ref = {
.action = BTRFS_ADD_DELAYED_EXTENT, .action = BTRFS_ADD_DELAYED_EXTENT,
.bytenr = ins->objectid, .bytenr = ins->objectid,
.len = ins->offset, .num_bytes = ins->offset,
.owning_root = root->root_key.objectid, .owning_root = root->root_key.objectid,
.ref_root = root->root_key.objectid, .ref_root = root->root_key.objectid,
}; };
@ -5201,7 +5201,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
struct btrfs_ref generic_ref = { struct btrfs_ref generic_ref = {
.action = BTRFS_ADD_DELAYED_EXTENT, .action = BTRFS_ADD_DELAYED_EXTENT,
.bytenr = ins.objectid, .bytenr = ins.objectid,
.len = ins.offset, .num_bytes = ins.offset,
.parent = parent, .parent = parent,
.owning_root = owning_root, .owning_root = owning_root,
.ref_root = root_objectid, .ref_root = root_objectid,
@ -5586,7 +5586,7 @@ skip:
struct btrfs_ref ref = { struct btrfs_ref ref = {
.action = BTRFS_DROP_DELAYED_REF, .action = BTRFS_DROP_DELAYED_REF,
.bytenr = bytenr, .bytenr = bytenr,
.len = fs_info->nodesize, .num_bytes = fs_info->nodesize,
.owning_root = owner_root, .owning_root = owner_root,
.ref_root = root->root_key.objectid, .ref_root = root->root_key.objectid,
}; };

View File

@ -375,7 +375,7 @@ next_slot:
struct btrfs_ref ref = { struct btrfs_ref ref = {
.action = BTRFS_ADD_DELAYED_REF, .action = BTRFS_ADD_DELAYED_REF,
.bytenr = disk_bytenr, .bytenr = disk_bytenr,
.len = num_bytes, .num_bytes = num_bytes,
.parent = 0, .parent = 0,
.owning_root = root->root_key.objectid, .owning_root = root->root_key.objectid,
.ref_root = root->root_key.objectid, .ref_root = root->root_key.objectid,
@ -468,7 +468,7 @@ delete_extent_item:
struct btrfs_ref ref = { struct btrfs_ref ref = {
.action = BTRFS_DROP_DELAYED_REF, .action = BTRFS_DROP_DELAYED_REF,
.bytenr = disk_bytenr, .bytenr = disk_bytenr,
.len = num_bytes, .num_bytes = num_bytes,
.parent = 0, .parent = 0,
.owning_root = root->root_key.objectid, .owning_root = root->root_key.objectid,
.ref_root = root->root_key.objectid, .ref_root = root->root_key.objectid,
@ -753,7 +753,7 @@ again:
ref.action = BTRFS_ADD_DELAYED_REF; ref.action = BTRFS_ADD_DELAYED_REF;
ref.bytenr = bytenr; ref.bytenr = bytenr;
ref.len = num_bytes; ref.num_bytes = num_bytes;
ref.parent = 0; ref.parent = 0;
ref.owning_root = root->root_key.objectid; ref.owning_root = root->root_key.objectid;
ref.ref_root = root->root_key.objectid; ref.ref_root = root->root_key.objectid;
@ -783,7 +783,7 @@ again:
ref.action = BTRFS_DROP_DELAYED_REF; ref.action = BTRFS_DROP_DELAYED_REF;
ref.bytenr = bytenr; ref.bytenr = bytenr;
ref.len = num_bytes; ref.num_bytes = num_bytes;
ref.parent = 0; ref.parent = 0;
ref.owning_root = root->root_key.objectid; ref.owning_root = root->root_key.objectid;
ref.ref_root = root->root_key.objectid; ref.ref_root = root->root_key.objectid;
@ -2492,7 +2492,7 @@ static int btrfs_insert_replace_extent(struct btrfs_trans_handle *trans,
struct btrfs_ref ref = { struct btrfs_ref ref = {
.action = BTRFS_ADD_DELAYED_REF, .action = BTRFS_ADD_DELAYED_REF,
.bytenr = extent_info->disk_offset, .bytenr = extent_info->disk_offset,
.len = extent_info->disk_len, .num_bytes = extent_info->disk_len,
.owning_root = root->root_key.objectid, .owning_root = root->root_key.objectid,
.ref_root = root->root_key.objectid, .ref_root = root->root_key.objectid,
}; };

View File

@ -673,7 +673,7 @@ delete:
struct btrfs_ref ref = { struct btrfs_ref ref = {
.action = BTRFS_DROP_DELAYED_REF, .action = BTRFS_DROP_DELAYED_REF,
.bytenr = extent_start, .bytenr = extent_start,
.len = extent_num_bytes, .num_bytes = extent_num_bytes,
.owning_root = root->root_key.objectid, .owning_root = root->root_key.objectid,
.ref_root = btrfs_header_owner(leaf), .ref_root = btrfs_header_owner(leaf),
}; };

View File

@ -673,7 +673,7 @@ int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
int ret = 0; int ret = 0;
bool metadata; bool metadata;
u64 bytenr = generic_ref->bytenr; u64 bytenr = generic_ref->bytenr;
u64 num_bytes = generic_ref->len; u64 num_bytes = generic_ref->num_bytes;
u64 parent = generic_ref->parent; u64 parent = generic_ref->parent;
u64 ref_root = 0; u64 ref_root = 0;
u64 owner = 0; u64 owner = 0;

View File

@ -1106,7 +1106,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
key.offset -= btrfs_file_extent_offset(leaf, fi); key.offset -= btrfs_file_extent_offset(leaf, fi);
ref.action = BTRFS_ADD_DELAYED_REF; ref.action = BTRFS_ADD_DELAYED_REF;
ref.bytenr = new_bytenr; ref.bytenr = new_bytenr;
ref.len = num_bytes; ref.num_bytes = num_bytes;
ref.parent = parent; ref.parent = parent;
ref.owning_root = root->root_key.objectid; ref.owning_root = root->root_key.objectid;
ref.ref_root = btrfs_header_owner(leaf); ref.ref_root = btrfs_header_owner(leaf);
@ -1120,7 +1120,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
ref.action = BTRFS_DROP_DELAYED_REF; ref.action = BTRFS_DROP_DELAYED_REF;
ref.bytenr = bytenr; ref.bytenr = bytenr;
ref.len = num_bytes; ref.num_bytes = num_bytes;
ref.parent = parent; ref.parent = parent;
ref.owning_root = root->root_key.objectid; ref.owning_root = root->root_key.objectid;
ref.ref_root = btrfs_header_owner(leaf); ref.ref_root = btrfs_header_owner(leaf);
@ -1336,7 +1336,7 @@ again:
ref.action = BTRFS_ADD_DELAYED_REF; ref.action = BTRFS_ADD_DELAYED_REF;
ref.bytenr = old_bytenr; ref.bytenr = old_bytenr;
ref.len = blocksize; ref.num_bytes = blocksize;
ref.parent = path->nodes[level]->start; ref.parent = path->nodes[level]->start;
ref.owning_root = src->root_key.objectid; ref.owning_root = src->root_key.objectid;
ref.ref_root = src->root_key.objectid; ref.ref_root = src->root_key.objectid;
@ -1349,7 +1349,7 @@ again:
ref.action = BTRFS_ADD_DELAYED_REF; ref.action = BTRFS_ADD_DELAYED_REF;
ref.bytenr = new_bytenr; ref.bytenr = new_bytenr;
ref.len = blocksize; ref.num_bytes = blocksize;
ref.parent = 0; ref.parent = 0;
ref.owning_root = dest->root_key.objectid; ref.owning_root = dest->root_key.objectid;
ref.ref_root = dest->root_key.objectid; ref.ref_root = dest->root_key.objectid;
@ -1363,7 +1363,7 @@ again:
/* We don't know the real owning_root, use 0. */ /* We don't know the real owning_root, use 0. */
ref.action = BTRFS_DROP_DELAYED_REF; ref.action = BTRFS_DROP_DELAYED_REF;
ref.bytenr = new_bytenr; ref.bytenr = new_bytenr;
ref.len = blocksize; ref.num_bytes = blocksize;
ref.parent = path->nodes[level]->start; ref.parent = path->nodes[level]->start;
ref.owning_root = 0; ref.owning_root = 0;
ref.ref_root = src->root_key.objectid; ref.ref_root = src->root_key.objectid;
@ -1377,7 +1377,7 @@ again:
/* We don't know the real owning_root, use 0. */ /* We don't know the real owning_root, use 0. */
ref.action = BTRFS_DROP_DELAYED_REF; ref.action = BTRFS_DROP_DELAYED_REF;
ref.bytenr = old_bytenr; ref.bytenr = old_bytenr;
ref.len = blocksize; ref.num_bytes = blocksize;
ref.parent = 0; ref.parent = 0;
ref.owning_root = 0; ref.owning_root = 0;
ref.ref_root = dest->root_key.objectid; ref.ref_root = dest->root_key.objectid;
@ -2482,7 +2482,7 @@ static int do_relocation(struct btrfs_trans_handle *trans,
struct btrfs_ref ref = { struct btrfs_ref ref = {
.action = BTRFS_ADD_DELAYED_REF, .action = BTRFS_ADD_DELAYED_REF,
.bytenr = node->eb->start, .bytenr = node->eb->start,
.len = blocksize, .num_bytes = blocksize,
.parent = upper->eb->start, .parent = upper->eb->start,
.owning_root = btrfs_header_owner(upper->eb), .owning_root = btrfs_header_owner(upper->eb),
.ref_root = btrfs_header_owner(upper->eb), .ref_root = btrfs_header_owner(upper->eb),

View File

@ -764,7 +764,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
struct btrfs_ref ref = { struct btrfs_ref ref = {
.action = BTRFS_ADD_DELAYED_REF, .action = BTRFS_ADD_DELAYED_REF,
.bytenr = ins.objectid, .bytenr = ins.objectid,
.len = ins.offset, .num_bytes = ins.offset,
.owning_root = root->root_key.objectid, .owning_root = root->root_key.objectid,
.ref_root = root->root_key.objectid, .ref_root = root->root_key.objectid,
}; };