From: Jan Kara <jack@suse.cz>
To: Joe Perches <joe@perches.com>
Cc: linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Jan Kara <jack@suse.cz>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] ext2: Reduce object size when !CONFIG_PRINTK
Date: Fri, 21 Jun 2013 18:50:49 +0200 [thread overview]
Message-ID: <20130621165049.GP13932@quack.suse.cz> (raw)
In-Reply-To: <2e70d518b9f6b8eea33c01a36983a1ccb1839282.1371575536.git.joe@perches.com>
On Tue 18-06-13 10:14:39, Joe Perches wrote:
> Reducing the object size ~5kb/15% 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/ext2/built-in.o*
> text data bss dec hex filename
> 31297 44 4 31345 7a71 fs/ext2/built-in.o.ext2.new
> 36288 44 4 36336 8df0 fs/ext2/built-in.o.ext2.old
>
> $ grep -E "CONFIG_EXT2|CONFIG_PRINTK" .config
> # CONFIG_PRINTK is not set
> CONFIG_EXT2_FS=y
> # CONFIG_EXT2_FS_XATTR is not set
> # CONFIG_EXT2_FS_XIP is not set
I'm somewhat reluctant to merge this unless I know someone really
cares. It looks a bit ugly to ifdef every function doing some printing just
to reduce object size when CONFIG_PRINTK is disabled... And in future LTO
might help us ;)
Honza
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> fs/ext2/ext2.h | 22 ++++++++++++++++++++--
> fs/ext2/super.c | 6 +++---
> 2 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
> index d9a17d0..888ae31 100644
> --- a/fs/ext2/ext2.h
> +++ b/fs/ext2/ext2.h
> @@ -767,12 +767,30 @@ struct dentry *ext2_get_parent(struct dentry *child);
>
> /* super.c */
> extern __printf(3, 4)
> -void ext2_error(struct super_block *, const char *, const char *, ...);
> +void __ext2_error(struct super_block *, const char *, const char *, ...);
> extern __printf(3, 4)
> -void ext2_msg(struct super_block *, const char *, const char *, ...);
> +void __ext2_msg(struct super_block *, const char *, const char *, ...);
> extern void ext2_update_dynamic_rev (struct super_block *sb);
> extern void ext2_write_super (struct super_block *);
>
> +#ifdef CONFIG_PRINTK
> +#define ext2_error(sb, func, fmt, ...) \
> + __ext2_error(sb, func, fmt, ##__VA_ARGS__)
> +#define ext2_msg(sb, prefix, fmt, ...) \
> + __ext2_msg(sb, prefix, fmt, ##__VA_ARGS__)
> +#else
> +#define ext2_error(sb, func, fmt, ...) \
> +do { \
> + no_printk(fmt, ##__VA_ARGS__); \
> + __ext2_error(sb, func, " "); \
> +} while (0)
> +#define ext2_msg(sb, prefix, fmt, ...) \
> +do { \
> + no_printk(fmt, ##__VA_ARGS__); \
> + __ext2_msg(sb, prefix, " "); \
> +} while (0)
> +#endif
> +
> /*
> * Inodes and files operations
> */
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 2885349..61ffb3f 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -45,8 +45,8 @@ static int ext2_sync_fs(struct super_block *sb, int wait);
> static int ext2_freeze(struct super_block *sb);
> static int ext2_unfreeze(struct super_block *sb);
>
> -void ext2_error(struct super_block *sb, const char *function,
> - const char *fmt, ...)
> +void __ext2_error(struct super_block *sb, const char *function,
> + const char *fmt, ...)
> {
> struct va_format vaf;
> va_list args;
> @@ -80,7 +80,7 @@ void ext2_error(struct super_block *sb, const char *function,
> }
> }
>
> -void ext2_msg(struct super_block *sb, const char *prefix,
> +void __ext2_msg(struct super_block *sb, const char *prefix,
> const char *fmt, ...)
> {
> struct va_format vaf;
> --
> 1.8.1.2.459.gbcd45b4.dirty
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2013-06-21 16:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-18 17:14 [PATCH 1/2] ext2: Reduce object size when !CONFIG_PRINTK Joe Perches
2013-06-18 17:14 ` [PATCH 2/2] ext3: " Joe Perches
2013-06-21 16:50 ` Jan Kara [this message]
2013-06-21 17:06 ` [PATCH 1/2] ext2: " Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130621165049.GP13932@quack.suse.cz \
--to=jack@suse.cz \
--cc=joe@perches.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).