diff options
author | Joe Perches <joe@perches.com> | 2013-07-01 08:12:37 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-07-01 08:12:37 -0400 |
commit | e7c96e8e47baf263d93a8dbbebca7216a912ca05 (patch) | |
tree | cec5ac7a66589437fe64708eb854fdc8b33250b7 /fs/ext4 | |
parent | d3922a777f9b4c4df898d326fa940f239af4f9b6 (diff) |
ext4: reduce object size when !CONFIG_PRINTK
Reduce the object size ~10% could be useful for embedded systems.
Add #ifdef CONFIG_PRINTK #else #endif blocks to hold formats and
arguments, passing " " to functions when !CONFIG_PRINTK and still
verifying format and arguments with no_printk.
$ size fs/ext4/built-in.o*
text data bss dec hex filename
239375 610 888 240873 3ace9 fs/ext4/built-in.o.new
264167 738 888 265793 40e41 fs/ext4/built-in.o.old
$ grep -E "CONFIG_EXT4|CONFIG_PRINTK" .config
# CONFIG_PRINTK is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT23=y
CONFIG_EXT4_FS_POSIX_ACL=y
# CONFIG_EXT4_FS_SECURITY is not set
# CONFIG_EXT4_DEBUG is not set
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 80 | ||||
-rw-r--r-- | fs/ext4/super.c | 15 |
2 files changed, 75 insertions, 20 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index f5f3b6c58240..7cc6b18230ec 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -2169,42 +2169,96 @@ extern int ext4_alloc_flex_bg_array(struct super_block *sb, | |||
2169 | ext4_group_t ngroup); | 2169 | ext4_group_t ngroup); |
2170 | extern const char *ext4_decode_error(struct super_block *sb, int errno, | 2170 | extern const char *ext4_decode_error(struct super_block *sb, int errno, |
2171 | char nbuf[16]); | 2171 | char nbuf[16]); |
2172 | |||
2172 | extern __printf(4, 5) | 2173 | extern __printf(4, 5) |
2173 | void __ext4_error(struct super_block *, const char *, unsigned int, | 2174 | void __ext4_error(struct super_block *, const char *, unsigned int, |
2174 | const char *, ...); | 2175 | const char *, ...); |
2175 | #define ext4_error(sb, message...) __ext4_error(sb, __func__, \ | ||
2176 | __LINE__, ## message) | ||
2177 | extern __printf(5, 6) | 2176 | extern __printf(5, 6) |
2178 | void ext4_error_inode(struct inode *, const char *, unsigned int, ext4_fsblk_t, | 2177 | void __ext4_error_inode(struct inode *, const char *, unsigned int, ext4_fsblk_t, |
2179 | const char *, ...); | 2178 | const char *, ...); |
2180 | extern __printf(5, 6) | 2179 | extern __printf(5, 6) |
2181 | void ext4_error_file(struct file *, const char *, unsigned int, ext4_fsblk_t, | 2180 | void __ext4_error_file(struct file *, const char *, unsigned int, ext4_fsblk_t, |
2182 | const char *, ...); | 2181 | const char *, ...); |
2183 | extern void __ext4_std_error(struct super_block *, const char *, | 2182 | extern void __ext4_std_error(struct super_block *, const char *, |
2184 | unsigned int, int); | 2183 | unsigned int, int); |
2185 | extern __printf(4, 5) | 2184 | extern __printf(4, 5) |
2186 | void __ext4_abort(struct super_block *, const char *, unsigned int, | 2185 | void __ext4_abort(struct super_block *, const char *, unsigned int, |
2187 | const char *, ...); | 2186 | const char *, ...); |
2188 | #define ext4_abort(sb, message...) __ext4_abort(sb, __func__, \ | ||
2189 | __LINE__, ## message) | ||
2190 | extern __printf(4, 5) | 2187 | extern __printf(4, 5) |
2191 | void __ext4_warning(struct super_block *, const char *, unsigned int, | 2188 | void __ext4_warning(struct super_block *, const char *, unsigned int, |
2192 | const char *, ...); | 2189 | const char *, ...); |
2193 | #define ext4_warning(sb, message...) __ext4_warning(sb, __func__, \ | ||
2194 | __LINE__, ## message) | ||
2195 | extern __printf(3, 4) | 2190 | extern __printf(3, 4) |
2196 | void ext4_msg(struct super_block *, const char *, const char *, ...); | 2191 | void __ext4_msg(struct super_block *, const char *, const char *, ...); |
2197 | extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp, | 2192 | extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp, |
2198 | const char *, unsigned int, const char *); | 2193 | const char *, unsigned int, const char *); |
2199 | #define dump_mmp_msg(sb, mmp, msg) __dump_mmp_msg(sb, mmp, __func__, \ | ||
2200 | __LINE__, msg) | ||
2201 | extern __printf(7, 8) | 2194 | extern __printf(7, 8) |
2202 | void __ext4_grp_locked_error(const char *, unsigned int, | 2195 | void __ext4_grp_locked_error(const char *, unsigned int, |
2203 | struct super_block *, ext4_group_t, | 2196 | struct super_block *, ext4_group_t, |
2204 | unsigned long, ext4_fsblk_t, | 2197 | unsigned long, ext4_fsblk_t, |
2205 | const char *, ...); | 2198 | const char *, ...); |
2206 | #define ext4_grp_locked_error(sb, grp, message...) \ | 2199 | |
2207 | __ext4_grp_locked_error(__func__, __LINE__, (sb), (grp), ## message) | 2200 | #ifdef CONFIG_PRINTK |
2201 | |||
2202 | #define ext4_error_inode(inode, func, line, block, fmt, ...) \ | ||
2203 | __ext4_error_inode(inode, func, line, block, fmt, ##__VA_ARGS__) | ||
2204 | #define ext4_error_file(file, func, line, block, fmt, ...) \ | ||
2205 | __ext4_error_file(file, func, line, block, fmt, ##__VA_ARGS__) | ||
2206 | #define ext4_error(sb, fmt, ...) \ | ||
2207 | __ext4_error(sb, __func__, __LINE__, fmt, ##__VA_ARGS__) | ||
2208 | #define ext4_abort(sb, fmt, ...) \ | ||
2209 | __ext4_abort(sb, __func__, __LINE__, fmt, ##__VA_ARGS__) | ||
2210 | #define ext4_warning(sb, fmt, ...) \ | ||
2211 | __ext4_warning(sb, __func__, __LINE__, fmt, ##__VA_ARGS__) | ||
2212 | #define ext4_msg(sb, level, fmt, ...) \ | ||
2213 | __ext4_msg(sb, level, fmt, ##__VA_ARGS__) | ||
2214 | #define dump_mmp_msg(sb, mmp, msg) \ | ||
2215 | __dump_mmp_msg(sb, mmp, __func__, __LINE__, msg) | ||
2216 | #define ext4_grp_locked_error(sb, grp, ino, block, fmt, ...) \ | ||
2217 | __ext4_grp_locked_error(__func__, __LINE__, sb, grp, ino, block, \ | ||
2218 | fmt, ##__VA_ARGS__) | ||
2219 | |||
2220 | #else | ||
2221 | |||
2222 | #define ext4_error_inode(inode, func, line, block, fmt, ...) \ | ||
2223 | do { \ | ||
2224 | no_printk(fmt, ##__VA_ARGS__); \ | ||
2225 | __ext4_error_inode(inode, "", 0, block, " "); \ | ||
2226 | } while (0) | ||
2227 | #define ext4_error_file(file, func, line, block, fmt, ...) \ | ||
2228 | do { \ | ||
2229 | no_printk(fmt, ##__VA_ARGS__); \ | ||
2230 | __ext4_error_file(file, "", 0, block, " "); \ | ||
2231 | } while (0) | ||
2232 | #define ext4_error(sb, fmt, ...) \ | ||
2233 | do { \ | ||
2234 | no_printk(fmt, ##__VA_ARGS__); \ | ||
2235 | __ext4_error(sb, "", 0, " "); \ | ||
2236 | } while (0) | ||
2237 | #define ext4_abort(sb, fmt, ...) \ | ||
2238 | do { \ | ||
2239 | no_printk(fmt, ##__VA_ARGS__); \ | ||
2240 | __ext4_abort(sb, "", 0, " "); \ | ||
2241 | } while (0) | ||
2242 | #define ext4_warning(sb, fmt, ...) \ | ||
2243 | do { \ | ||
2244 | no_printk(fmt, ##__VA_ARGS__); \ | ||
2245 | __ext4_warning(sb, "", 0, " "); \ | ||
2246 | } while (0) | ||
2247 | #define ext4_msg(sb, level, fmt, ...) \ | ||
2248 | do { \ | ||
2249 | no_printk(fmt, ##__VA_ARGS__); \ | ||
2250 | __ext4_msg(sb, "", " "); \ | ||
2251 | } while (0) | ||
2252 | #define dump_mmp_msg(sb, mmp, msg) \ | ||
2253 | __dump_mmp_msg(sb, mmp, "", 0, "") | ||
2254 | #define ext4_grp_locked_error(sb, grp, ino, block, fmt, ...) \ | ||
2255 | do { \ | ||
2256 | no_printk(fmt, ##__VA_ARGS__); \ | ||
2257 | __ext4_grp_locked_error("", 0, sb, grp, ino, block, " "); \ | ||
2258 | } while (0) | ||
2259 | |||
2260 | #endif | ||
2261 | |||
2208 | extern void ext4_update_dynamic_rev(struct super_block *sb); | 2262 | extern void ext4_update_dynamic_rev(struct super_block *sb); |
2209 | extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb, | 2263 | extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb, |
2210 | __u32 compat); | 2264 | __u32 compat); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index cc8201180b30..85b3dd60169b 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -428,9 +428,9 @@ void __ext4_error(struct super_block *sb, const char *function, | |||
428 | ext4_handle_error(sb); | 428 | ext4_handle_error(sb); |
429 | } | 429 | } |
430 | 430 | ||
431 | void ext4_error_inode(struct inode *inode, const char *function, | 431 | void __ext4_error_inode(struct inode *inode, const char *function, |
432 | unsigned int line, ext4_fsblk_t block, | 432 | unsigned int line, ext4_fsblk_t block, |
433 | const char *fmt, ...) | 433 | const char *fmt, ...) |
434 | { | 434 | { |
435 | va_list args; | 435 | va_list args; |
436 | struct va_format vaf; | 436 | struct va_format vaf; |
@@ -457,9 +457,9 @@ void ext4_error_inode(struct inode *inode, const char *function, | |||
457 | ext4_handle_error(inode->i_sb); | 457 | ext4_handle_error(inode->i_sb); |
458 | } | 458 | } |
459 | 459 | ||
460 | void ext4_error_file(struct file *file, const char *function, | 460 | void __ext4_error_file(struct file *file, const char *function, |
461 | unsigned int line, ext4_fsblk_t block, | 461 | unsigned int line, ext4_fsblk_t block, |
462 | const char *fmt, ...) | 462 | const char *fmt, ...) |
463 | { | 463 | { |
464 | va_list args; | 464 | va_list args; |
465 | struct va_format vaf; | 465 | struct va_format vaf; |
@@ -591,7 +591,8 @@ void __ext4_abort(struct super_block *sb, const char *function, | |||
591 | panic("EXT4-fs panic from previous error\n"); | 591 | panic("EXT4-fs panic from previous error\n"); |
592 | } | 592 | } |
593 | 593 | ||
594 | void ext4_msg(struct super_block *sb, const char *prefix, const char *fmt, ...) | 594 | void __ext4_msg(struct super_block *sb, |
595 | const char *prefix, const char *fmt, ...) | ||
595 | { | 596 | { |
596 | struct va_format vaf; | 597 | struct va_format vaf; |
597 | va_list args; | 598 | va_list args; |