btrfs: add __cold attribute to more functions
authorDavid Sterba <dsterba@suse.com>
Tue, 1 Oct 2019 17:57:35 +0000 (19:57 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 11:46:52 +0000 (12:46 +0100)
The attribute can mark functions supposed to be called rarely if at all
and the text can be moved to sections far from the other code. The
attribute has been added to several functions already, this patch is
based on hints given by gcc -Wsuggest-attribute=cold.

The net effect of this patch is decrease of btrfs.ko by 1000-1300,
depending on the config options.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/super.c
fs/btrfs/volumes.c

index 00954c99d259a4cc2af3c6dfd7a2b39ad5093d50..307861d0a04090220fadbc5a9b38dfb3605a8544 100644 (file)
@@ -2577,7 +2577,7 @@ out:
        return ret;
 }
 
-int open_ctree(struct super_block *sb,
+int __cold open_ctree(struct super_block *sb,
               struct btrfs_fs_devices *fs_devices,
               char *options)
 {
@@ -3962,7 +3962,7 @@ int btrfs_commit_super(struct btrfs_fs_info *fs_info)
        return btrfs_commit_transaction(trans);
 }
 
-void close_ctree(struct btrfs_fs_info *fs_info)
+void __cold close_ctree(struct btrfs_fs_info *fs_info)
 {
        int ret;
 
index a6958103d87e74fc190770056e181940121e5185..76f123ebb292178ce4ce198c7ca706e5ae613891 100644 (file)
@@ -49,10 +49,10 @@ struct extent_buffer *btrfs_find_create_tree_block(
                                                struct btrfs_fs_info *fs_info,
                                                u64 bytenr);
 void btrfs_clean_tree_block(struct extent_buffer *buf);
-int open_ctree(struct super_block *sb,
+int __cold open_ctree(struct super_block *sb,
               struct btrfs_fs_devices *fs_devices,
               char *options);
-void close_ctree(struct btrfs_fs_info *fs_info);
+void __cold close_ctree(struct btrfs_fs_info *fs_info);
 int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors);
 struct buffer_head *btrfs_read_dev_super(struct block_device *bdev);
 int btrfs_read_dev_one_super(struct block_device *bdev, int copy_num,
index c7d78ac64b83270cab3802764148c0e765d31267..9c0c53e7d0fcfe122efd9ebc37d52b1fa8631161 100644 (file)
@@ -187,7 +187,7 @@ static struct ratelimit_state printk_limits[] = {
        RATELIMIT_STATE_INIT(printk_limits[7], DEFAULT_RATELIMIT_INTERVAL, 100),
 };
 
-void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
+void __cold btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
 {
        char lvl[PRINTK_MAX_SINGLE_HEADER_LEN + 1] = "\0";
        struct va_format vaf;
index 139b73dcfbcc644d87957204cc31d1e009a3b697..173427731a69bce1e895827ffd15d094c73116e6 100644 (file)
@@ -2052,7 +2052,7 @@ static struct btrfs_device * btrfs_find_next_active_device(
  * where this function called, there should be always be another device (or
  * this_dev) which is active.
  */
-void btrfs_assign_next_active_device(struct btrfs_device *device,
+void __cold btrfs_assign_next_active_device(struct btrfs_device *device,
                                     struct btrfs_device *this_dev)
 {
        struct btrfs_fs_info *fs_info = device->fs_info;