Commit f5c29bd9 authored by Liu Bo's avatar Liu Bo Committed by David Sterba

Btrfs: add __init macro to btrfs init functions

Adding __init macro gives kernel a hint that this function is only used
during the initialization phase and its memory resources can be freed up
after.
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c74a0b02
...@@ -75,7 +75,7 @@ struct compressed_bio { ...@@ -75,7 +75,7 @@ struct compressed_bio {
u32 sums; u32 sums;
}; };
void btrfs_init_compress(void); void __init btrfs_init_compress(void);
void btrfs_exit_compress(void); void btrfs_exit_compress(void);
int btrfs_compress_pages(unsigned int type_level, struct address_space *mapping, int btrfs_compress_pages(unsigned int type_level, struct address_space *mapping,
......
...@@ -3197,7 +3197,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); ...@@ -3197,7 +3197,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
struct inode *btrfs_alloc_inode(struct super_block *sb); struct inode *btrfs_alloc_inode(struct super_block *sb);
void btrfs_destroy_inode(struct inode *inode); void btrfs_destroy_inode(struct inode *inode);
int btrfs_drop_inode(struct inode *inode); int btrfs_drop_inode(struct inode *inode);
int btrfs_init_cachep(void); int __init btrfs_init_cachep(void);
void btrfs_destroy_cachep(void); void btrfs_destroy_cachep(void);
long btrfs_ioctl_trans_end(struct file *file); long btrfs_ioctl_trans_end(struct file *file);
struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
...@@ -3248,7 +3248,7 @@ ssize_t btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen, ...@@ -3248,7 +3248,7 @@ ssize_t btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen,
struct file *dst_file, u64 dst_loff); struct file *dst_file, u64 dst_loff);
/* file.c */ /* file.c */
int btrfs_auto_defrag_init(void); int __init btrfs_auto_defrag_init(void);
void btrfs_auto_defrag_exit(void); void btrfs_auto_defrag_exit(void);
int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
struct btrfs_inode *inode); struct btrfs_inode *inode);
...@@ -3283,7 +3283,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, ...@@ -3283,7 +3283,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
struct btrfs_root *root); struct btrfs_root *root);
/* sysfs.c */ /* sysfs.c */
int btrfs_init_sysfs(void); int __init btrfs_init_sysfs(void);
void btrfs_exit_sysfs(void); void btrfs_exit_sysfs(void);
int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info); int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info);
void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info); void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info);
......
...@@ -937,7 +937,7 @@ void btrfs_delayed_ref_exit(void) ...@@ -937,7 +937,7 @@ void btrfs_delayed_ref_exit(void)
kmem_cache_destroy(btrfs_delayed_extent_op_cachep); kmem_cache_destroy(btrfs_delayed_extent_op_cachep);
} }
int btrfs_delayed_ref_init(void) int __init btrfs_delayed_ref_init(void)
{ {
btrfs_delayed_ref_head_cachep = kmem_cache_create( btrfs_delayed_ref_head_cachep = kmem_cache_create(
"btrfs_delayed_ref_head", "btrfs_delayed_ref_head",
......
...@@ -203,7 +203,7 @@ extern struct kmem_cache *btrfs_delayed_tree_ref_cachep; ...@@ -203,7 +203,7 @@ extern struct kmem_cache *btrfs_delayed_tree_ref_cachep;
extern struct kmem_cache *btrfs_delayed_data_ref_cachep; extern struct kmem_cache *btrfs_delayed_data_ref_cachep;
extern struct kmem_cache *btrfs_delayed_extent_op_cachep; extern struct kmem_cache *btrfs_delayed_extent_op_cachep;
int btrfs_delayed_ref_init(void); int __init btrfs_delayed_ref_init(void);
void btrfs_delayed_ref_exit(void); void btrfs_delayed_ref_exit(void);
static inline struct btrfs_delayed_extent_op * static inline struct btrfs_delayed_extent_op *
......
...@@ -3143,7 +3143,7 @@ void btrfs_auto_defrag_exit(void) ...@@ -3143,7 +3143,7 @@ void btrfs_auto_defrag_exit(void)
kmem_cache_destroy(btrfs_inode_defrag_cachep); kmem_cache_destroy(btrfs_inode_defrag_cachep);
} }
int btrfs_auto_defrag_init(void) int __init btrfs_auto_defrag_init(void)
{ {
btrfs_inode_defrag_cachep = kmem_cache_create("btrfs_inode_defrag", btrfs_inode_defrag_cachep = kmem_cache_create("btrfs_inode_defrag",
sizeof(struct inode_defrag), 0, sizeof(struct inode_defrag), 0,
......
...@@ -9569,7 +9569,7 @@ void btrfs_destroy_cachep(void) ...@@ -9569,7 +9569,7 @@ void btrfs_destroy_cachep(void)
kmem_cache_destroy(btrfs_free_space_cachep); kmem_cache_destroy(btrfs_free_space_cachep);
} }
int btrfs_init_cachep(void) int __init btrfs_init_cachep(void)
{ {
btrfs_inode_cachep = kmem_cache_create("btrfs_inode", btrfs_inode_cachep = kmem_cache_create("btrfs_inode",
sizeof(struct btrfs_inode), 0, sizeof(struct btrfs_inode), 0,
......
...@@ -2324,7 +2324,7 @@ static struct miscdevice btrfs_misc = { ...@@ -2324,7 +2324,7 @@ static struct miscdevice btrfs_misc = {
MODULE_ALIAS_MISCDEV(BTRFS_MINOR); MODULE_ALIAS_MISCDEV(BTRFS_MINOR);
MODULE_ALIAS("devname:btrfs-control"); MODULE_ALIAS("devname:btrfs-control");
static int btrfs_interface_init(void) static int __init btrfs_interface_init(void)
{ {
return misc_register(&btrfs_misc); return misc_register(&btrfs_misc);
} }
...@@ -2334,7 +2334,7 @@ static void btrfs_interface_exit(void) ...@@ -2334,7 +2334,7 @@ static void btrfs_interface_exit(void)
misc_deregister(&btrfs_misc); misc_deregister(&btrfs_misc);
} }
static void btrfs_print_mod_info(void) static void __init btrfs_print_mod_info(void)
{ {
pr_info("Btrfs loaded, crc32c=%s" pr_info("Btrfs loaded, crc32c=%s"
#ifdef CONFIG_BTRFS_DEBUG #ifdef CONFIG_BTRFS_DEBUG
......
...@@ -897,7 +897,7 @@ static int btrfs_init_debugfs(void) ...@@ -897,7 +897,7 @@ static int btrfs_init_debugfs(void)
return 0; return 0;
} }
int btrfs_init_sysfs(void) int __init btrfs_init_sysfs(void)
{ {
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment