[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <14427e90798e11d5a51dff663278bd10df081554.1370388945.git.joe@perches.com>
Date: Tue, 4 Jun 2013 16:39:16 -0700
From: Joe Perches <joe@...ches.com>
To: Dave Kleikamp <dave.kleikamp@...cle.com>
Cc: Dave Kleikamp <shaggy@...nel.org>,
jfs-discussion@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] jfs: Reduce object size when CONFIG_PRINTK=n
Allow the jfs_error format and arguments to be
optimized away when not using printk.
Reduces object size ~3KB
$ grep -E "CONFIG_PRINTK|CONFIG_JFS" .config
# CONFIG_PRINTK is not set
CONFIG_JFS_FS=y
CONFIG_JFS_POSIX_ACL=y
CONFIG_JFS_SECURITY=y
# CONFIG_JFS_DEBUG is not set
CONFIG_JFS_STATISTICS=y
$ size fs/jfs/built-in.o*
text data bss dec hex filename
136521 1408 520 138449 21cd1 fs/jfs/built-in.o.new
139834 1408 552 141794 229e2 fs/jfs/built-in.o.old
Signed-off-by: Joe Perches <joe@...ches.com>
---
fs/jfs/jfs_superblock.h | 16 +++++++++++++++-
fs/jfs/super.c | 4 ++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/fs/jfs/jfs_superblock.h b/fs/jfs/jfs_superblock.h
index 04847b8..85b1b31 100644
--- a/fs/jfs/jfs_superblock.h
+++ b/fs/jfs/jfs_superblock.h
@@ -108,8 +108,22 @@ struct jfs_superblock {
extern int readSuper(struct super_block *, struct buffer_head **);
extern int updateSuper(struct super_block *, uint);
+extern void jfs_handle_error(struct super_block *sb);
__printf(2, 3)
-extern void jfs_error(struct super_block *, const char *, ...);
+extern void _jfs_error(struct super_block *, const char *, ...);
+
+#ifdef CONFIG_PRINTK
+#define jfs_error(sb, fmt, ...) \
+ _jfs_error(sb, fmt, ##__VA_ARGS__)
+#else
+#define jfs_error(sb, fmt, ...) \
+do { \
+ if (0) \
+ printk(fmt, ##__VA_ARGS__); \
+ jfs_handle_error(sb); \
+} while (0)
+#endif
+
extern int jfs_mount(struct super_block *);
extern int jfs_mount_rw(struct super_block *, int);
extern int jfs_umount(struct super_block *);
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 6669aa2..08a826e 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -70,7 +70,7 @@ module_param(jfsloglevel, int, 0644);
MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)");
#endif
-static void jfs_handle_error(struct super_block *sb)
+void jfs_handle_error(struct super_block *sb)
{
struct jfs_sb_info *sbi = JFS_SBI(sb);
@@ -92,7 +92,7 @@ static void jfs_handle_error(struct super_block *sb)
/* nothing is done for continue beyond marking the superblock dirty */
}
-void jfs_error(struct super_block *sb, const char *fmt, ...)
+void _jfs_error(struct super_block *sb, const char *fmt, ...)
{
struct va_format vaf;
va_list args;
--
1.8.1.2.459.gbcd45b4.dirty
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists