ext4: move `ext4_count_free` to ext4.h so it can be easily inlined
PATCH 1/1 ext4: move `ext4_count_free` to ext4.h so it can be easily inlined
ext4_count_free is a one-line helper that is clearly better off being inlined. This saves a handful instructions in vmlinux on x86.
Instruction estimates use wc -l on objdump
Before: 8539271
After : 8539248
So saves roughly 20 instructions
--- fs/ext4/bitmap.c | 5 ----- fs/ext4/ext4.h | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-)
fs/ext4/bitmap.c +0 -5
@@ -11,11 +11,6 @@#include <linux/buffer_head.h> #include "ext4.h" -unsigned int ext4_count_free (char *bitmap,unsigned int numchars) -{ -return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); -} -int ext4_inode_bitmap_csum_verify (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz)
fs/ext4/ext4.h +5 -1
@@ -2675,7 +2675,11 @@ struct mmpd_data {# define NORET_AND noreturn,/* bitmap.c */ -extern unsigned int ext4_count_free (char *bitmap,unsigned numchars); +static inline unsigned int ext4_count_free (char *bitmap,unsigned int numchars) +{ +return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); +} +void ext4_inode_bitmap_csum_set (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz);
Signature · 1 line
2.34.1
Quoted 10 lines · Noah Goldstein
ext4_count_freeis a one-line helper that is clearly better off being inlined. This saves a handful instructions invmlinuxon x86.Instruction estimates use
wc -lonobjdump
Before: 8539271
After : 8539248So saves roughly 20 instructions
Signed-off-by Noah Goldstein <[email protected]>
Looks fine. Feel free to add:
Honza
Quoted 41 lines
--- fs/ext4/bitmap.c | 5 ----- fs/ext4/ext4.h | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-)fs/ext4/bitmap.c +0
-5@@ -11,11 +11,6 @@#include <linux/buffer_head.h> #include "ext4.h" -unsigned int ext4_count_free (char *bitmap,unsigned int numchars) -{ -return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); -} -int ext4_inode_bitmap_csum_verify (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz)fs/ext4/ext4.h +5
-1@@ -2675,7 +2675,11 @@ struct mmpd_data {# define NORET_AND noreturn,/* bitmap.c */ -extern unsigned int ext4_count_free (char *bitmap,unsigned numchars); +static inline unsigned int ext4_count_free (char *bitmap,unsigned int numchars) +{ +return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); +} +void ext4_inode_bitmap_csum_set (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz);Signature · 1 line
2.34.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 9 lines · Jan Kara
Quoted 7 lines · Noah Goldstein
ext4_count_freeis a one-line helper that is clearly better off being inlined. This saves a handful instructions invmlinuxon x86.Instruction estimates use
wc -lonobjdump
Before: 8539271
After : 8539248
Quoted 8 lines
Quoted 3 lines
So saves roughly 20 instructions
Signed-off-by Noah Goldstein <[email protected]>Looks fine. Feel free to add:
Reviewed-by Jan Kara <[email protected]>
Done, thank you.
Quoted 46 lines
Honza
Quoted 39 lines
--- fs/ext4/bitmap.c | 5 ----- fs/ext4/ext4.h | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-)fs/ext4/bitmap.c +0
-5@@ -11,11 +11,6 @@#include <linux/buffer_head.h> #include "ext4.h" -unsigned int ext4_count_free (char *bitmap,unsigned int numchars) -{ -return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); -} -int ext4_inode_bitmap_csum_verify (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz)fs/ext4/ext4.h +5
-2@@ -2675,7 +2675,11 @@ struct mmpd_data {# define NORET_AND noreturn,/* bitmap.c */ -extern unsigned int ext4_count_free (char *bitmap,unsigned numchars); +static inline unsigned int ext4_count_free (char *bitmap,unsigned int numchars) +{ +return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); +} +void ext4_inode_bitmap_csum_set (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz); --Quoted 2 lines
2.34.1
--
Jan Kara <[email protected]>
SUSE Labs, CR
PATCH v2 1/1 ext4: move `ext4_count_free` to ext4.h so it can be easily inlined
In reply to Noah Goldsteinext4_count_free is a one-line helper that is clearly better off being inlined. This saves a handful instructions in vmlinux on x86.
Instruction estimates use wc -l on objdump
Before: 8539271
After : 8539248
So saves roughly 20 instructions
--- fs/ext4/bitmap.c | 5 ----- fs/ext4/ext4.h | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-)
fs/ext4/bitmap.c +0 -5
@@ -11,11 +11,6 @@#include <linux/buffer_head.h> #include "ext4.h" -unsigned int ext4_count_free (char *bitmap,unsigned int numchars) -{ -return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); -} -int ext4_inode_bitmap_csum_verify (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz)
fs/ext4/ext4.h +5 -1
@@ -2675,7 +2675,11 @@ struct mmpd_data {# define NORET_AND noreturn,/* bitmap.c */ -extern unsigned int ext4_count_free (char *bitmap,unsigned numchars); +static inline unsigned int ext4_count_free (char *bitmap,unsigned int numchars) +{ +return numchars *BITS_PER_BYTE -memweight (bitmap, numchars); +} +void ext4_inode_bitmap_csum_set (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz);
Signature · 1 line
2.34.1