Skip to content

Commit c207adc

Browse files
committed
btrfs: uninline some static inline helpers from tree-log.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>
1 parent 2be1f2b commit c207adc

2 files changed

Lines changed: 49 additions & 45 deletions

File tree

fs/btrfs/tree-log.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,52 @@ static void wait_for_writer(struct btrfs_root *root)
28182818
finish_wait(&root->log_writer_wait, &wait);
28192819
}
28202820

2821+
void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx, struct inode *inode)
2822+
{
2823+
ctx->log_ret = 0;
2824+
ctx->log_transid = 0;
2825+
ctx->log_new_dentries = false;
2826+
ctx->logging_new_name = false;
2827+
ctx->logging_new_delayed_dentries = false;
2828+
ctx->logged_before = false;
2829+
ctx->inode = inode;
2830+
INIT_LIST_HEAD(&ctx->list);
2831+
INIT_LIST_HEAD(&ctx->ordered_extents);
2832+
INIT_LIST_HEAD(&ctx->conflict_inodes);
2833+
ctx->num_conflict_inodes = 0;
2834+
ctx->logging_conflict_inodes = false;
2835+
ctx->scratch_eb = NULL;
2836+
}
2837+
2838+
void btrfs_init_log_ctx_scratch_eb(struct btrfs_log_ctx *ctx)
2839+
{
2840+
struct btrfs_inode *inode = BTRFS_I(ctx->inode);
2841+
2842+
if (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags) &&
2843+
!test_bit(BTRFS_INODE_COPY_EVERYTHING, &inode->runtime_flags))
2844+
return;
2845+
2846+
/*
2847+
* Don't care about allocation failure. This is just for optimization,
2848+
* if we fail to allocate here, we will try again later if needed.
2849+
*/
2850+
ctx->scratch_eb = alloc_dummy_extent_buffer(inode->root->fs_info, 0);
2851+
}
2852+
2853+
void btrfs_release_log_ctx_extents(struct btrfs_log_ctx *ctx)
2854+
{
2855+
struct btrfs_ordered_extent *ordered;
2856+
struct btrfs_ordered_extent *tmp;
2857+
2858+
ASSERT(inode_is_locked(ctx->inode));
2859+
2860+
list_for_each_entry_safe(ordered, tmp, &ctx->ordered_extents, log_list) {
2861+
list_del_init(&ordered->log_list);
2862+
btrfs_put_ordered_extent(ordered);
2863+
}
2864+
}
2865+
2866+
28212867
static inline void btrfs_remove_log_ctx(struct btrfs_root *root,
28222868
struct btrfs_log_ctx *ctx)
28232869
{

fs/btrfs/tree-log.h

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -55,51 +55,9 @@ struct btrfs_log_ctx {
5555
struct extent_buffer *scratch_eb;
5656
};
5757

58-
static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx,
59-
struct inode *inode)
60-
{
61-
ctx->log_ret = 0;
62-
ctx->log_transid = 0;
63-
ctx->log_new_dentries = false;
64-
ctx->logging_new_name = false;
65-
ctx->logging_new_delayed_dentries = false;
66-
ctx->logged_before = false;
67-
ctx->inode = inode;
68-
INIT_LIST_HEAD(&ctx->list);
69-
INIT_LIST_HEAD(&ctx->ordered_extents);
70-
INIT_LIST_HEAD(&ctx->conflict_inodes);
71-
ctx->num_conflict_inodes = 0;
72-
ctx->logging_conflict_inodes = false;
73-
ctx->scratch_eb = NULL;
74-
}
75-
76-
static inline void btrfs_init_log_ctx_scratch_eb(struct btrfs_log_ctx *ctx)
77-
{
78-
struct btrfs_inode *inode = BTRFS_I(ctx->inode);
79-
80-
if (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags) &&
81-
!test_bit(BTRFS_INODE_COPY_EVERYTHING, &inode->runtime_flags))
82-
return;
83-
84-
/*
85-
* Don't care about allocation failure. This is just for optimization,
86-
* if we fail to allocate here, we will try again later if needed.
87-
*/
88-
ctx->scratch_eb = alloc_dummy_extent_buffer(inode->root->fs_info, 0);
89-
}
90-
91-
static inline void btrfs_release_log_ctx_extents(struct btrfs_log_ctx *ctx)
92-
{
93-
struct btrfs_ordered_extent *ordered;
94-
struct btrfs_ordered_extent *tmp;
95-
96-
ASSERT(inode_is_locked(ctx->inode));
97-
98-
list_for_each_entry_safe(ordered, tmp, &ctx->ordered_extents, log_list) {
99-
list_del_init(&ordered->log_list);
100-
btrfs_put_ordered_extent(ordered);
101-
}
102-
}
58+
void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx, struct inode *inode);
59+
void btrfs_init_log_ctx_scratch_eb(struct btrfs_log_ctx *ctx);
60+
void btrfs_release_log_ctx_extents(struct btrfs_log_ctx *ctx);
10361

10462
static inline void btrfs_set_log_full_commit(struct btrfs_trans_handle *trans)
10563
{

0 commit comments

Comments
 (0)