mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
btrfs: uninline some static inline helpers from delayed-ref.h
The helpers are doing an initialization or release work, none of which is performance critical that it would require a static inline, so move them to the .c file. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
e925671666
commit
d57dd52a85
@ -1004,6 +1004,52 @@ static void init_delayed_ref_common(struct btrfs_fs_info *fs_info,
|
||||
INIT_LIST_HEAD(&ref->add_list);
|
||||
}
|
||||
|
||||
void btrfs_init_generic_ref(struct btrfs_ref *generic_ref, int action, u64 bytenr,
|
||||
u64 len, u64 parent, u64 owning_root)
|
||||
{
|
||||
generic_ref->action = action;
|
||||
generic_ref->bytenr = bytenr;
|
||||
generic_ref->len = len;
|
||||
generic_ref->parent = parent;
|
||||
generic_ref->owning_root = owning_root;
|
||||
}
|
||||
|
||||
void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, int level, u64 root,
|
||||
u64 mod_root, bool skip_qgroup)
|
||||
{
|
||||
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
|
||||
/* If @real_root not set, use @root as fallback */
|
||||
generic_ref->real_root = mod_root ?: root;
|
||||
#endif
|
||||
generic_ref->tree_ref.level = level;
|
||||
generic_ref->tree_ref.ref_root = root;
|
||||
generic_ref->type = BTRFS_REF_METADATA;
|
||||
if (skip_qgroup || !(is_fstree(root) &&
|
||||
(!mod_root || is_fstree(mod_root))))
|
||||
generic_ref->skip_qgroup = true;
|
||||
else
|
||||
generic_ref->skip_qgroup = false;
|
||||
|
||||
}
|
||||
|
||||
void btrfs_init_data_ref(struct btrfs_ref *generic_ref, u64 ref_root, u64 ino,
|
||||
u64 offset, u64 mod_root, bool skip_qgroup)
|
||||
{
|
||||
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
|
||||
/* If @real_root not set, use @root as fallback */
|
||||
generic_ref->real_root = mod_root ?: ref_root;
|
||||
#endif
|
||||
generic_ref->data_ref.ref_root = ref_root;
|
||||
generic_ref->data_ref.ino = ino;
|
||||
generic_ref->data_ref.offset = offset;
|
||||
generic_ref->type = BTRFS_REF_DATA;
|
||||
if (skip_qgroup || !(is_fstree(ref_root) &&
|
||||
(!mod_root || is_fstree(mod_root))))
|
||||
generic_ref->skip_qgroup = true;
|
||||
else
|
||||
generic_ref->skip_qgroup = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* add a delayed tree ref. This does all of the accounting required
|
||||
* to make sure the delayed ref is eventually processed before this
|
||||
@ -1220,6 +1266,25 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btrfs_put_delayed_ref(struct btrfs_delayed_ref_node *ref)
|
||||
{
|
||||
if (refcount_dec_and_test(&ref->refs)) {
|
||||
WARN_ON(!RB_EMPTY_NODE(&ref->ref_node));
|
||||
switch (ref->type) {
|
||||
case BTRFS_TREE_BLOCK_REF_KEY:
|
||||
case BTRFS_SHARED_BLOCK_REF_KEY:
|
||||
kmem_cache_free(btrfs_delayed_tree_ref_cachep, ref);
|
||||
break;
|
||||
case BTRFS_EXTENT_DATA_REF_KEY:
|
||||
case BTRFS_SHARED_DATA_REF_KEY:
|
||||
kmem_cache_free(btrfs_delayed_data_ref_cachep, ref);
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This does a simple search for the head node for a given extent. Returns the
|
||||
* head node if found, or NULL if not.
|
||||
|
@ -318,53 +318,12 @@ static inline u64 btrfs_calc_delayed_ref_csum_bytes(const struct btrfs_fs_info *
|
||||
return btrfs_calc_metadata_size(fs_info, num_csum_items);
|
||||
}
|
||||
|
||||
static inline void btrfs_init_generic_ref(struct btrfs_ref *generic_ref,
|
||||
int action, u64 bytenr, u64 len,
|
||||
u64 parent, u64 owning_root)
|
||||
{
|
||||
generic_ref->action = action;
|
||||
generic_ref->bytenr = bytenr;
|
||||
generic_ref->len = len;
|
||||
generic_ref->parent = parent;
|
||||
generic_ref->owning_root = owning_root;
|
||||
}
|
||||
|
||||
static inline void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, int level,
|
||||
u64 root, u64 mod_root, bool skip_qgroup)
|
||||
{
|
||||
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
|
||||
/* If @real_root not set, use @root as fallback */
|
||||
generic_ref->real_root = mod_root ?: root;
|
||||
#endif
|
||||
generic_ref->tree_ref.level = level;
|
||||
generic_ref->tree_ref.ref_root = root;
|
||||
generic_ref->type = BTRFS_REF_METADATA;
|
||||
if (skip_qgroup || !(is_fstree(root) &&
|
||||
(!mod_root || is_fstree(mod_root))))
|
||||
generic_ref->skip_qgroup = true;
|
||||
else
|
||||
generic_ref->skip_qgroup = false;
|
||||
|
||||
}
|
||||
|
||||
static inline void btrfs_init_data_ref(struct btrfs_ref *generic_ref,
|
||||
u64 ref_root, u64 ino, u64 offset, u64 mod_root,
|
||||
bool skip_qgroup)
|
||||
{
|
||||
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
|
||||
/* If @real_root not set, use @root as fallback */
|
||||
generic_ref->real_root = mod_root ?: ref_root;
|
||||
#endif
|
||||
generic_ref->data_ref.ref_root = ref_root;
|
||||
generic_ref->data_ref.ino = ino;
|
||||
generic_ref->data_ref.offset = offset;
|
||||
generic_ref->type = BTRFS_REF_DATA;
|
||||
if (skip_qgroup || !(is_fstree(ref_root) &&
|
||||
(!mod_root || is_fstree(mod_root))))
|
||||
generic_ref->skip_qgroup = true;
|
||||
else
|
||||
generic_ref->skip_qgroup = false;
|
||||
}
|
||||
void btrfs_init_generic_ref(struct btrfs_ref *generic_ref, int action, u64 bytenr,
|
||||
u64 len, u64 parent, u64 owning_root);
|
||||
void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, int level, u64 root,
|
||||
u64 mod_root, bool skip_qgroup);
|
||||
void btrfs_init_data_ref(struct btrfs_ref *generic_ref, u64 ref_root, u64 ino,
|
||||
u64 offset, u64 mod_root, bool skip_qgroup);
|
||||
|
||||
static inline struct btrfs_delayed_extent_op *
|
||||
btrfs_alloc_delayed_extent_op(void)
|
||||
@ -379,24 +338,7 @@ btrfs_free_delayed_extent_op(struct btrfs_delayed_extent_op *op)
|
||||
kmem_cache_free(btrfs_delayed_extent_op_cachep, op);
|
||||
}
|
||||
|
||||
static inline void btrfs_put_delayed_ref(struct btrfs_delayed_ref_node *ref)
|
||||
{
|
||||
if (refcount_dec_and_test(&ref->refs)) {
|
||||
WARN_ON(!RB_EMPTY_NODE(&ref->ref_node));
|
||||
switch (ref->type) {
|
||||
case BTRFS_TREE_BLOCK_REF_KEY:
|
||||
case BTRFS_SHARED_BLOCK_REF_KEY:
|
||||
kmem_cache_free(btrfs_delayed_tree_ref_cachep, ref);
|
||||
break;
|
||||
case BTRFS_EXTENT_DATA_REF_KEY:
|
||||
case BTRFS_SHARED_DATA_REF_KEY:
|
||||
kmem_cache_free(btrfs_delayed_data_ref_cachep, ref);
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
}
|
||||
void btrfs_put_delayed_ref(struct btrfs_delayed_ref_node *ref);
|
||||
|
||||
static inline u64 btrfs_ref_head_to_space_flags(
|
||||
struct btrfs_delayed_ref_head *head_ref)
|
||||
|
Loading…
Reference in New Issue
Block a user