]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
btrfs: add more __cold annotations
authorDavid Sterba <dsterba@suse.com>
Mon, 19 Feb 2018 16:24:18 +0000 (17:24 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Mar 2018 13:09:39 +0000 (15:09 +0200)
The __cold functions are placed to a special section, as they're
expected to be called rarely. This could help i-cache prefetches or help
compiler to decide which branches are more/less likely to be taken
without any other annotations needed.

Though we can't add more __exit annotations, it's still possible to add
__cold (that's also added with __exit). That way the following function
categories are tagged:

- printf wrappers, error messages
- exit helpers

Signed-off-by: David Sterba <dsterba@suse.com>
23 files changed:
fs/btrfs/backref.c
fs/btrfs/backref.h
fs/btrfs/compression.c
fs/btrfs/compression.h
fs/btrfs/ctree.h
fs/btrfs/delayed-inode.c
fs/btrfs/delayed-inode.h
fs/btrfs/delayed-ref.c
fs/btrfs/delayed-ref.h
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/extent_map.c
fs/btrfs/extent_map.h
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ordered-data.c
fs/btrfs/ordered-data.h
fs/btrfs/send.c
fs/btrfs/super.c
fs/btrfs/sysfs.c
fs/btrfs/tree-checker.c

index 26484648d0903298cbb68bff095232873e94673a..4a33448cbb019c13e00c5599fb53a6929a75aeb2 100644 (file)
@@ -170,7 +170,7 @@ int __init btrfs_prelim_ref_init(void)
        return 0;
 }
 
-void btrfs_prelim_ref_exit(void)
+void __cold btrfs_prelim_ref_exit(void)
 {
        kmem_cache_destroy(btrfs_prelim_ref_cache);
 }
index 0c2fab8514ffa1fb22d0208f7a96617898866eb0..0a30028d51964812e0e30ec7f2eca76a2a60b4e6 100644 (file)
@@ -73,7 +73,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
 int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr);
 
 int __init btrfs_prelim_ref_init(void);
-void btrfs_prelim_ref_exit(void);
+void __cold btrfs_prelim_ref_exit(void);
 
 struct prelim_ref {
        struct rb_node rbnode;
index 07d049c0c20fdb3fb55fe4ebf265bfc531d59c71..562c3e633403d482efd5a90e00e07b25c78d3b2a 100644 (file)
@@ -1133,7 +1133,7 @@ int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
        return ret;
 }
 
-void btrfs_exit_compress(void)
+void __cold btrfs_exit_compress(void)
 {
        free_workspaces();
 }
index 677fa4aa0bd754e924da835ef650f2ea262b2522..ce796557a918ed8c1852b713750900f71e85f242 100644 (file)
@@ -76,7 +76,7 @@ struct compressed_bio {
 };
 
 void __init btrfs_init_compress(void);
-void btrfs_exit_compress(void);
+void __cold btrfs_exit_compress(void);
 
 int btrfs_compress_pages(unsigned int type_level, struct address_space *mapping,
                         u64 start, struct page **pages,
index 92b9db7186bb5d0430d73cfd9e1d3edcb75da819..d6a2fc311187953e6b252f9d895c2708735ec6d5 100644 (file)
@@ -3204,7 +3204,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb);
 void btrfs_destroy_inode(struct inode *inode);
 int btrfs_drop_inode(struct inode *inode);
 int __init btrfs_init_cachep(void);
-void btrfs_destroy_cachep(void);
+void __cold btrfs_destroy_cachep(void);
 long btrfs_ioctl_trans_end(struct file *file);
 struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
                         struct btrfs_root *root, int *was_new);
@@ -3255,7 +3255,7 @@ ssize_t btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen,
 
 /* file.c */
 int __init btrfs_auto_defrag_init(void);
-void btrfs_auto_defrag_exit(void);
+void __cold btrfs_auto_defrag_exit(void);
 int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
                           struct btrfs_inode *inode);
 int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info);
@@ -3290,7 +3290,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
 
 /* sysfs.c */
 int __init btrfs_init_sysfs(void);
-void btrfs_exit_sysfs(void);
+void __cold btrfs_exit_sysfs(void);
 int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info);
 void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info);
 
@@ -3302,13 +3302,14 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                        unsigned long new_flags);
 int btrfs_sync_fs(struct super_block *sb, int wait);
 
-static inline __printf(2, 3)
+static inline __printf(2, 3) __cold
 void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
 {
 }
 
 #ifdef CONFIG_PRINTK
 __printf(2, 3)
+__cold
 void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
 #else
 #define btrfs_printk(fs_info, fmt, args...) \
index 09939fc37f2ab895c0f90b80a34e3940e3c71073..d06bef16ebd5fc773fede8c00cbf91c0604c115d 100644 (file)
@@ -42,7 +42,7 @@ int __init btrfs_delayed_inode_init(void)
        return 0;
 }
 
-void btrfs_delayed_inode_exit(void)
+void __cold btrfs_delayed_inode_exit(void)
 {
        kmem_cache_destroy(delayed_node_cache);
 }
index ae893d85224f7f7a4b6723e951a9d32a8b9433cb..100a91e26b557d9ad86f40bc97f7f59028470aa1 100644 (file)
@@ -149,7 +149,7 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
 
 /* for init */
 int __init btrfs_delayed_inode_init(void);
-void btrfs_delayed_inode_exit(void);
+void __cold btrfs_delayed_inode_exit(void);
 
 /* for debugging */
 void btrfs_assert_delayed_root_empty(struct btrfs_fs_info *fs_info);
index 7ab5e0128f0ce823101f5623a0664c01208f89a7..03bdf355107abe2b191cecd5e4544cdaafe2473a 100644 (file)
@@ -930,7 +930,7 @@ btrfs_find_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs, u64 byt
        return find_ref_head(&delayed_refs->href_root, bytenr, 0);
 }
 
-void btrfs_delayed_ref_exit(void)
+void __cold btrfs_delayed_ref_exit(void)
 {
        kmem_cache_destroy(btrfs_delayed_ref_head_cachep);
        kmem_cache_destroy(btrfs_delayed_tree_ref_cachep);
index c4f625e5a691c74927d902d7de72cb93f8669ff9..9e3e5aff0937c44bbd1e291931087d4a272dd23b 100644 (file)
@@ -204,7 +204,7 @@ extern struct kmem_cache *btrfs_delayed_data_ref_cachep;
 extern struct kmem_cache *btrfs_delayed_extent_op_cachep;
 
 int __init btrfs_delayed_ref_init(void);
-void btrfs_delayed_ref_exit(void);
+void __cold btrfs_delayed_ref_exit(void);
 
 static inline struct btrfs_delayed_extent_op *
 btrfs_alloc_delayed_extent_op(void)
index c10c84640eeed12181531fdb2885083258e3f324..798e602c1834c60147f951540af98e3d0b8e39ad 100644 (file)
@@ -110,7 +110,7 @@ int __init btrfs_end_io_wq_init(void)
        return 0;
 }
 
-void btrfs_end_io_wq_exit(void)
+void __cold btrfs_end_io_wq_exit(void)
 {
        kmem_cache_destroy(btrfs_end_io_wq_cache);
 }
index e2ac6a14150a66f6c0a44ea7c1ef73785098e38a..aaf99529883db2f17ad7fcff20cadb4c1609af49 100644 (file)
@@ -153,7 +153,7 @@ struct extent_map *btree_get_extent(struct btrfs_inode *inode,
                int create);
 int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags);
 int __init btrfs_end_io_wq_init(void);
-void btrfs_end_io_wq_exit(void);
+void __cold btrfs_end_io_wq_exit(void);
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 void btrfs_init_lockdep(void);
index 4e73705b405ecb9ca1133851361cafdb61034385..da46e93722627933b752c35b509f549201d636a3 100644 (file)
@@ -187,7 +187,7 @@ free_state_cache:
        return -ENOMEM;
 }
 
-void extent_io_exit(void)
+void __cold extent_io_exit(void)
 {
        btrfs_leak_debug_check();
 
index da9be2fb050274364f2c24c32bd6341bb84326e7..e359c5d4305cd33d30445129f3fad2fdbddb0a93 100644 (file)
@@ -286,7 +286,7 @@ int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end);
 int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
                          get_extent_t *get_extent, int mirror_num);
 int __init extent_io_init(void);
-void extent_io_exit(void);
+void __cold extent_io_exit(void);
 
 u64 count_range_bits(struct extent_io_tree *tree,
                     u64 *start, u64 search_end,
index b8ead8dc2ebed9dc4aa3e74bad4d3e72aec909e8..53a0633c6ef731d2e16cec67a5338acb18937eb7 100644 (file)
@@ -19,7 +19,7 @@ int __init extent_map_init(void)
        return 0;
 }
 
-void extent_map_exit(void)
+void __cold extent_map_exit(void)
 {
        kmem_cache_destroy(extent_map_cache);
 }
index b29f77bc0732eecef20c83a65bf6e6d93ad5c635..f6f8ba114977efa9e2860f3e7f352820e21b79c1 100644 (file)
@@ -86,7 +86,7 @@ void replace_extent_mapping(struct extent_map_tree *tree,
 struct extent_map *alloc_extent_map(void);
 void free_extent_map(struct extent_map *em);
 int __init extent_map_init(void);
-void extent_map_exit(void);
+void __cold extent_map_exit(void);
 int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen);
 void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em);
 struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
index 41ab9073d1d4220efd68859a2c023c85f6a5393c..a335e2e6c84d9f30dc726a526dfc0a35aafe480d 100644 (file)
@@ -3378,7 +3378,7 @@ const struct file_operations btrfs_file_operations = {
        .dedupe_file_range = btrfs_dedupe_file_range,
 };
 
-void btrfs_auto_defrag_exit(void)
+void __cold btrfs_auto_defrag_exit(void)
 {
        kmem_cache_destroy(btrfs_inode_defrag_cachep);
 }
index 491a7397f6fadec0e757547d82f64b85835fb347..bb5de52cbc09babe21d8c8d6aa121a85386a873f 100644 (file)
@@ -9478,7 +9478,7 @@ static void init_once(void *foo)
        inode_init_once(&ei->vfs_inode);
 }
 
-void btrfs_destroy_cachep(void)
+void __cold btrfs_destroy_cachep(void)
 {
        /*
         * Make sure all delayed rcu free inodes are flushed before we
index 5b311aeddcc80d5b58b9c337c3e398483999deb2..9be98e42cfb68175cf28ac4d91ea1574b103c553 100644 (file)
@@ -1154,7 +1154,7 @@ int __init ordered_data_init(void)
        return 0;
 }
 
-void ordered_data_exit(void)
+void __cold ordered_data_exit(void)
 {
        kmem_cache_destroy(btrfs_ordered_extent_cache);
 }
index c53e2cfb72d9f6daaa8cd6cc346412369c8c7b2c..4a1672a13ba6c53a6187ad378056f53ad42a16c7 100644 (file)
@@ -217,5 +217,5 @@ void btrfs_wait_logged_extents(struct btrfs_trans_handle *trans,
                               struct btrfs_root *log, u64 transid);
 void btrfs_free_logged_extents(struct btrfs_root *log, u64 transid);
 int __init ordered_data_init(void);
-void ordered_data_exit(void);
+void __cold ordered_data_exit(void);
 #endif
index b0c5d710183e27491279c12df6f4c45f8146e525..085542832b9a9634a3d78e0f7e15bd49a4218e99 100644 (file)
@@ -270,6 +270,7 @@ struct name_cache_entry {
        char name[];
 };
 
+__cold
 static void inconsistent_snapshot_error(struct send_ctx *sctx,
                                        enum btrfs_compare_tree_result result,
                                        const char *what)
index 07bc2bfbdb9608959b0f32f57e3db33d359a7046..1dd2e785918ce3bbaa823ca9fafd8386673dd3d7 100644 (file)
@@ -2333,7 +2333,7 @@ static int __init btrfs_interface_init(void)
        return misc_register(&btrfs_misc);
 }
 
-static void btrfs_interface_exit(void)
+static __cold void btrfs_interface_exit(void)
 {
        misc_deregister(&btrfs_misc);
 }
index a8bafed931f44232e164793852ef1bbcae73c55c..6af7b58e1a904643448444430a00dc6d7b072aaf 100644 (file)
@@ -923,7 +923,7 @@ out1:
        return ret;
 }
 
-void btrfs_exit_sysfs(void)
+void __cold btrfs_exit_sysfs(void)
 {
        sysfs_remove_group(&btrfs_kset->kobj, &btrfs_feature_attr_group);
        kset_unregister(btrfs_kset);
index e96cfd93ae3feb32fb18e88b60146f2f63c44e59..8871286c1a912561d0c264e6dd00681b480fc7a6 100644 (file)
@@ -52,6 +52,7 @@
  * Allows callers to customize the output.
  */
 __printf(4, 5)
+__cold
 static void generic_err(const struct btrfs_fs_info *fs_info,
                        const struct extent_buffer *eb, int slot,
                        const char *fmt, ...)
@@ -76,6 +77,7 @@ static void generic_err(const struct btrfs_fs_info *fs_info,
  * offset has its own meaning.
  */
 __printf(4, 5)
+__cold
 static void file_extent_err(const struct btrfs_fs_info *fs_info,
                            const struct extent_buffer *eb, int slot,
                            const char *fmt, ...)
@@ -229,6 +231,7 @@ static int check_csum_item(struct btrfs_fs_info *fs_info,
  * which represents inode number
  */
 __printf(4, 5)
+__cold
 static void dir_item_err(const struct btrfs_fs_info *fs_info,
                         const struct extent_buffer *eb, int slot,
                         const char *fmt, ...)