Re: [PATCH] xfs: #define out unused parameters of xfs_bmap_add_free and xfs_btree_read_bufl

From: Denys Vlasenko
Date: Tue Apr 22 2008 - 07:21:48 EST


Hi David,

xfs_bmap_add_free and xfs_btree_read_bufl functions
use some of their parameters only in some cases
(e.g. if DEBUG is defined, or on non-Linux OS :)

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:
393457 2904 2952 399313 617d1 linux-2.6-xfs6-TEST/fs/xfs/xfs.o
393441 2904 2952 399297 617c1 linux-2.6-xfs7-TEST/fs/xfs/xfs.o

Compile tested only.

Signed-off-by: Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx>
--
vda
diff -urpN linux-2.6-xfs6/fs/xfs/xfs_bmap.h linux-2.6-xfs7/fs/xfs/xfs_bmap.h
--- linux-2.6-xfs6/fs/xfs/xfs_bmap.h 2008-04-22 04:06:43.000000000 +0200
+++ linux-2.6-xfs7/fs/xfs/xfs_bmap.h 2008-04-22 13:10:36.000000000 +0200
@@ -170,6 +170,10 @@ xfs_bmap_add_attrfork(
* Add the extent to the list of extents to be free at transaction end.
* The list is maintained sorted (by block number).
*/
+#ifndef DEBUG
+/* "mp" is used only for debugging */
+#define xfs_bmap_add_free(bno, len, flist, mp) xfs_bmap_add_free(bno, len, flist)
+#endif
void
xfs_bmap_add_free(
xfs_fsblock_t bno, /* fs block number of extent */
diff -urpN linux-2.6-xfs6/fs/xfs/xfs_btree.h linux-2.6-xfs7/fs/xfs/xfs_btree.h
--- linux-2.6-xfs6/fs/xfs/xfs_btree.h 2008-04-22 04:06:43.000000000 +0200
+++ linux-2.6-xfs7/fs/xfs/xfs_btree.h 2008-04-22 13:10:36.000000000 +0200
@@ -363,6 +363,9 @@ xfs_btree_offsets(
* Get a buffer for the block, return it read in.
* Long-form addressing.
*/
+/* In Linux, "refval" is not used */
+#define xfs_btree_read_bufl(mp, tp, fsbno, lock, bpp, refval) \
+ xfs_btree_read_bufl(mp, tp, fsbno, lock, bpp)
int /* error */
xfs_btree_read_bufl(
struct xfs_mount *mp, /* file system mount point */