lkml.org 
[lkml]   [2008]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] xfs: #define out unused parameters for seven functions in xfs_trans.h
Date
[ resend: now with patch attached! :) ]

Hi David,

Seven xfs_trans_XXX functions declared in xfs_trans.h
are not using "tp" parameter in non-debug builds,
but it still takes stack space since these functions
are not static and gcc cannot optimize it out.

This patch removes these parameters using #define hack
which makes them "disappear" without the need of uglifying
every callsite with #ifdefs.

Code size difference on 32-bit x86:
 393441    2904    2952  399297   617c1 linux-2.6-xfs7-TEST/fs/xfs/xfs.o
 393289    2904    2952  399145   61729 linux-2.6-xfs8-TEST/fs/xfs/xfs.o

Compile tested only.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
--
vda
diff -urpN linux-2.6-xfs7/fs/xfs/xfs_trans_buf.c linux-2.6-xfs8/fs/xfs/xfs_trans_buf.c
--- linux-2.6-xfs7/fs/xfs/xfs_trans_buf.c 2008-04-22 04:06:44.000000000 +0200
+++ linux-2.6-xfs8/fs/xfs/xfs_trans_buf.c 2008-04-22 13:37:23.000000000 +0200
@@ -687,7 +687,6 @@ xfs_trans_bjoin(xfs_trans_t *tp,
* IOP_UNLOCK() routine is called. The buffer must already be locked
* and associated with the given transaction.
*/
-/* ARGSUSED */
void
xfs_trans_bhold(xfs_trans_t *tp,
xfs_buf_t *bp)
@@ -950,7 +949,6 @@ xfs_trans_stale_inode_buf(
* xfs_buf_item_committed() to ensure that the buffer remains in the
* AIL at its original location even after it has been relogged.
*/
-/* ARGSUSED */
void
xfs_trans_inode_alloc_buf(
xfs_trans_t *tp,
@@ -979,7 +977,6 @@ xfs_trans_inode_alloc_buf(
* between usr dquot bufs and grp dquot bufs, because usr and grp quotas
* can be turned off independently.
*/
-/* ARGSUSED */
void
xfs_trans_dquot_buf(
xfs_trans_t *tp,
diff -urpN linux-2.6-xfs7/fs/xfs/xfs_trans.h linux-2.6-xfs8/fs/xfs/xfs_trans.h
--- linux-2.6-xfs7/fs/xfs/xfs_trans.h 2008-04-22 13:10:36.000000000 +0200
+++ linux-2.6-xfs8/fs/xfs/xfs_trans.h 2008-04-22 13:41:38.000000000 +0200
@@ -961,6 +961,16 @@ struct xfs_buf *xfs_trans_getsb(xfs_tran

void xfs_trans_brelse(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_bjoin(xfs_trans_t *, struct xfs_buf *);
+#ifndef DEBUG
+/* "tp" is used only for debugging */
+#define xfs_trans_bhold(tp, bp) xfs_trans_bhold(bp)
+#define xfs_trans_bhold_release(tp, bp) xfs_trans_bhold_release(bp)
+#define xfs_trans_inode_buf(tp, bp) xfs_trans_inode_buf(bp)
+#define xfs_trans_stale_inode_buf(tp, bp) xfs_trans_stale_inode_buf(bp)
+#define xfs_trans_inode_alloc_buf(tp, bp) xfs_trans_inode_alloc_buf(bp)
+#define xfs_trans_dquot_buf(tp, bp, type) xfs_trans_dquot_buf(bp, type)
+#define xfs_trans_ihold(tp, bp) xfs_trans_ihold(bp)
+#endif
void xfs_trans_bhold(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_bhold_release(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_binval(xfs_trans_t *, struct xfs_buf *);
diff -urpN linux-2.6-xfs7/fs/xfs/xfs_trans_inode.c linux-2.6-xfs8/fs/xfs/xfs_trans_inode.c
--- linux-2.6-xfs7/fs/xfs/xfs_trans_inode.c 2008-04-22 04:12:18.000000000 +0200
+++ linux-2.6-xfs8/fs/xfs/xfs_trans_inode.c 2008-04-22 13:38:10.000000000 +0200
@@ -224,7 +224,6 @@ xfs_trans_ijoin(
* IOP_UNLOCK() routine is called. The inode must already be locked
* and associated with the given transaction.
*/
-/*ARGSUSED*/
void
xfs_trans_ihold(
xfs_trans_t *tp,
\
 
 \ /
  Last update: 2008-04-22 13:55    [W:0.235 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site