[PATCH] xfs: remove unused params from functions in xfs_dir2_leaf.h
From: Denys Vlasenko
Date: Tue Apr 22 2008 - 09:33:21 EST
Hi David,
Inline functions xfs_dir2_dataptr_to_byte and xfs_dir2_byte_to_dataptr
are not using their 1st argument. gcc is able to optimize that out.
I still want to delete these parameters, as they serve no useful purpose
and by removing them I can make gcc to notice some additional
unused variables in the callers of these inlines, and warn me
about that.
There is no object code size difference from this change.
Compile tested only.
Signed-off-by: Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx>
--
vda
diff -urpN linux-2.6-xfs5/fs/xfs/xfs_dir2_block.c linux-2.6-xfs6/fs/xfs/xfs_dir2_block.c
--- linux-2.6-xfs5/fs/xfs/xfs_dir2_block.c 2008-04-22 04:19:32.000000000 +0200
+++ linux-2.6-xfs6/fs/xfs/xfs_dir2_block.c 2008-04-22 12:19:44.000000000 +0200
@@ -397,7 +397,7 @@ xfs_dir2_block_addname(
* Fill in the leaf entry.
*/
blp[mid].hashval = cpu_to_be32(args->hashval);
- blp[mid].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
+ blp[mid].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
(char *)dep - (char *)block));
xfs_dir2_block_log_leaf(tp, bp, lfloglow, lfloghigh);
/*
@@ -1124,7 +1124,7 @@ xfs_dir2_sf_to_block(
*tagp = cpu_to_be16((char *)dep - (char *)block);
xfs_dir2_data_log_entry(tp, bp, dep);
blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
- blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
+ blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
(char *)dep - (char *)block));
/*
* Create entry for ..
@@ -1138,7 +1138,7 @@ xfs_dir2_sf_to_block(
*tagp = cpu_to_be16((char *)dep - (char *)block);
xfs_dir2_data_log_entry(tp, bp, dep);
blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
- blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
+ blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
(char *)dep - (char *)block));
offset = XFS_DIR2_DATA_FIRST_OFFSET;
/*
@@ -1189,7 +1189,7 @@ xfs_dir2_sf_to_block(
xfs_dir2_data_log_entry(tp, bp, dep);
blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname(
(char *)sfep->name, sfep->namelen));
- blp[2 + i].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
+ blp[2 + i].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
(char *)dep - (char *)block));
offset = (int)((char *)(tagp + 1) - (char *)block);
if (++i == sfp->hdr.count)
diff -urpN linux-2.6-xfs5/fs/xfs/xfs_dir2_leaf.c linux-2.6-xfs6/fs/xfs/xfs_dir2_leaf.c
--- linux-2.6-xfs5/fs/xfs/xfs_dir2_leaf.c 2008-04-22 04:18:27.000000000 +0200
+++ linux-2.6-xfs6/fs/xfs/xfs_dir2_leaf.c 2008-04-22 12:19:21.000000000 +0200
@@ -804,7 +804,7 @@ xfs_dir2_leaf_getdents(
* Inside the loop we keep the main offset value as a byte offset
* in the directory file.
*/
- curoff = xfs_dir2_dataptr_to_byte(mp, *offset);
+ curoff = xfs_dir2_dataptr_to_byte(*offset);
/*
* Force this conversion through db so we truncate the offset
@@ -1091,7 +1091,7 @@ xfs_dir2_leaf_getdents(
* Won't fit. Return to caller.
*/
if (filldir(dirent, dep->name, dep->namelen,
- xfs_dir2_byte_to_dataptr(mp, curoff),
+ xfs_dir2_byte_to_dataptr(curoff),
ino, DT_UNKNOWN))
break;
@@ -1106,10 +1106,10 @@ xfs_dir2_leaf_getdents(
/*
* All done. Set output offset value to current offset.
*/
- if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR))
+ if (curoff > xfs_dir2_dataptr_to_byte(XFS_DIR2_MAX_DATAPTR))
*offset = XFS_DIR2_MAX_DATAPTR;
else
- *offset = xfs_dir2_byte_to_dataptr(mp, curoff);
+ *offset = xfs_dir2_byte_to_dataptr(curoff);
kmem_free(map);
if (bp)
xfs_da_brelse(NULL, bp);
diff -urpN linux-2.6-xfs5/fs/xfs/xfs_dir2_leaf.h linux-2.6-xfs6/fs/xfs/xfs_dir2_leaf.h
--- linux-2.6-xfs5/fs/xfs/xfs_dir2_leaf.h 2008-04-22 04:06:43.000000000 +0200
+++ linux-2.6-xfs6/fs/xfs/xfs_dir2_leaf.h 2008-04-22 12:19:29.000000000 +0200
@@ -112,7 +112,7 @@ xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail
* Convert dataptr to byte in file space
*/
static inline xfs_dir2_off_t
-xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
+xfs_dir2_dataptr_to_byte(xfs_dir2_dataptr_t dp)
{
return (xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG;
}
@@ -121,7 +121,7 @@ xfs_dir2_dataptr_to_byte(struct xfs_moun
* Convert byte in file space to dataptr. It had better be aligned.
*/
static inline xfs_dir2_dataptr_t
-xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by)
+xfs_dir2_byte_to_dataptr(xfs_dir2_off_t by)
{
return (xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG);
}
@@ -142,7 +142,7 @@ xfs_dir2_byte_to_db(struct xfs_mount *mp
static inline xfs_dir2_db_t
xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
{
- return xfs_dir2_byte_to_db(mp, xfs_dir2_dataptr_to_byte(mp, dp));
+ return xfs_dir2_byte_to_db(mp, xfs_dir2_dataptr_to_byte(dp));
}
/*
@@ -161,7 +161,7 @@ xfs_dir2_byte_to_off(struct xfs_mount *m
static inline xfs_dir2_data_aoff_t
xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
{
- return xfs_dir2_byte_to_off(mp, xfs_dir2_dataptr_to_byte(mp, dp));
+ return xfs_dir2_byte_to_off(mp, xfs_dir2_dataptr_to_byte(dp));
}
/*
@@ -200,7 +200,7 @@ static inline xfs_dir2_dataptr_t
xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
xfs_dir2_data_aoff_t o)
{
- return xfs_dir2_byte_to_dataptr(mp, xfs_dir2_db_off_to_byte(mp, db, o));
+ return xfs_dir2_byte_to_dataptr(xfs_dir2_db_off_to_byte(mp, db, o));
}
/*