linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: remove unused transaction pointer args
@ 2014-03-29  2:01 Eric Sandeen
  2014-03-31 13:09 ` Brian Foster
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2014-03-29  2:01 UTC (permalink / raw)
  To: xfs-oss

Several functions pass a transaction pointer around,
but it's never used in those callchains.  Remove it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 152543c..b308097 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -1675,7 +1675,6 @@ xfs_bmap_isaeof(
  */
 int
 xfs_bmap_last_offset(
-	struct xfs_trans	*tp,
 	struct xfs_inode	*ip,
 	xfs_fileoff_t		*last_block,
 	int			whichfork)
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index 33b41f3..52ad38d 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -146,8 +146,8 @@ int	xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
 		xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
 int	xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip,
 		xfs_fileoff_t *last_block, int whichfork);
-int	xfs_bmap_last_offset(struct xfs_trans *tp, struct xfs_inode *ip,
-		xfs_fileoff_t *unused, int whichfork);
+int	xfs_bmap_last_offset(struct xfs_inode *ip, xfs_fileoff_t *unused,
+		int whichfork);
 int	xfs_bmap_one_block(struct xfs_inode *ip, int whichfork);
 int	xfs_bmap_read_extents(struct xfs_trans *tp, struct xfs_inode *ip,
 		int whichfork);
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index ce16ef0..7575a3b 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -230,11 +230,11 @@ xfs_dir_createname(
 
 	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
 		rval = xfs_dir2_sf_addname(&args);
-	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isblock(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_block_addname(&args);
-	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isleaf(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_leaf_addname(&args);
@@ -303,11 +303,11 @@ xfs_dir_lookup(
 
 	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
 		rval = xfs_dir2_sf_lookup(&args);
-	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isblock(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_block_lookup(&args);
-	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isleaf(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_leaf_lookup(&args);
@@ -360,11 +360,11 @@ xfs_dir_removename(
 
 	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
 		rval = xfs_dir2_sf_removename(&args);
-	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isblock(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_block_removename(&args);
-	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isleaf(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_leaf_removename(&args);
@@ -410,11 +410,11 @@ xfs_dir_replace(
 
 	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
 		rval = xfs_dir2_sf_replace(&args);
-	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isblock(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_block_replace(&args);
-	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isleaf(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_leaf_replace(&args);
@@ -456,11 +456,11 @@ xfs_dir_canenter(
 
 	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
 		rval = xfs_dir2_sf_addname(&args);
-	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isblock(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_block_addname(&args);
-	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
+	else if ((rval = xfs_dir2_isleaf(dp, &v)))
 		return rval;
 	else if (v)
 		rval = xfs_dir2_leaf_addname(&args);
@@ -525,7 +525,6 @@ xfs_dir2_grow_inode(
  */
 int
 xfs_dir2_isblock(
-	xfs_trans_t	*tp,
 	xfs_inode_t	*dp,
 	int		*vp)		/* out: 1 is block, 0 is not block */
 {
@@ -534,7 +533,7 @@ xfs_dir2_isblock(
 	int		rval;
 
 	mp = dp->i_mount;
-	if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)))
+	if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK)))
 		return rval;
 	rval = XFS_FSB_TO_B(mp, last) == mp->m_dirblksize;
 	ASSERT(rval == 0 || dp->i_d.di_size == mp->m_dirblksize);
@@ -547,7 +546,6 @@ xfs_dir2_isblock(
  */
 int
 xfs_dir2_isleaf(
-	xfs_trans_t	*tp,
 	xfs_inode_t	*dp,
 	int		*vp)		/* out: 1 is leaf, 0 is not leaf */
 {
@@ -556,7 +554,7 @@ xfs_dir2_isleaf(
 	int		rval;
 
 	mp = dp->i_mount;
-	if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)))
+	if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK)))
 		return rval;
 	*vp = last == mp->m_dirleafblk + (1 << mp->m_sb.sb_dirblklog);
 	return 0;
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h
index cec70e0..64a6b19 100644
--- a/fs/xfs/xfs_dir2.h
+++ b/fs/xfs/xfs_dir2.h
@@ -142,8 +142,8 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
 /*
  * Interface routines used by userspace utilities
  */
-extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
-extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
+extern int xfs_dir2_isblock(struct xfs_inode *dp, int *r);
+extern int xfs_dir2_isleaf(struct xfs_inode *dp, int *r);
 extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
 				struct xfs_buf *bp);
 
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index ae47ec6..f8170bc 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -1707,7 +1707,7 @@ xfs_dir2_node_to_leaf(
 	/*
 	 * Get the last offset in the file.
 	 */
-	if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK))) {
+	if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) {
 		return error;
 	}
 	fo -= mp->m_dirblkfsbs;
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 48c7d18..807946d 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -1726,7 +1726,7 @@ xfs_dir2_node_addname_int(
 	if (dbno == -1) {
 		xfs_fileoff_t	fo;		/* freespace block number */
 
-		if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK)))
+		if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK)))
 			return error;
 		lastfbno = xfs_dir2_da_to_db(mp, (xfs_dablk_t)fo);
 		fbno = ifbno;
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index aead369..a18000f 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -687,7 +687,7 @@ xfs_readdir(
 	lock_mode = xfs_ilock_data_map_shared(dp);
 	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
 		rval = xfs_dir2_sf_getdents(dp, ctx);
-	else if ((rval = xfs_dir2_isblock(NULL, dp, &v)))
+	else if ((rval = xfs_dir2_isblock(dp, &v)))
 		;
 	else if (v)
 		rval = xfs_dir2_block_getdents(dp, ctx);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 22d1cbe..2b2739c 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -734,7 +734,7 @@ xfs_iomap_write_allocate(
 			 */
 			nimaps = 1;
 			end_fsb = XFS_B_TO_FSB(mp, XFS_ISIZE(ip));
-			error = xfs_bmap_last_offset(NULL, ip, &last_block,
+			error = xfs_bmap_last_offset(ip, &last_block,
 							XFS_DATA_FORK);
 			if (error)
 				goto trans_cancel;


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: remove unused transaction pointer args
  2014-03-29  2:01 [PATCH] xfs: remove unused transaction pointer args Eric Sandeen
@ 2014-03-31 13:09 ` Brian Foster
  2014-03-31 14:24   ` Eric Sandeen
  2014-04-03 22:19   ` Eric Sandeen
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Foster @ 2014-03-31 13:09 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Fri, Mar 28, 2014 at 09:01:26PM -0500, Eric Sandeen wrote:
> Several functions pass a transaction pointer around,
> but it's never used in those callchains.  Remove it.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
> index 152543c..b308097 100644
> --- a/fs/xfs/xfs_bmap.c
> +++ b/fs/xfs/xfs_bmap.c
> @@ -1675,7 +1675,6 @@ xfs_bmap_isaeof(
>   */
>  int
>  xfs_bmap_last_offset(
> -	struct xfs_trans	*tp,
>  	struct xfs_inode	*ip,
>  	xfs_fileoff_t		*last_block,
>  	int			whichfork)

Seems Ok to me, but it looks like you could also kill the tp param for
xfs_bmap_last_extent(). I don't see any callers that don't pass NULL...

Brian

> diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
> index 33b41f3..52ad38d 100644
> --- a/fs/xfs/xfs_bmap.h
> +++ b/fs/xfs/xfs_bmap.h
> @@ -146,8 +146,8 @@ int	xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
>  		xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
>  int	xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip,
>  		xfs_fileoff_t *last_block, int whichfork);
> -int	xfs_bmap_last_offset(struct xfs_trans *tp, struct xfs_inode *ip,
> -		xfs_fileoff_t *unused, int whichfork);
> +int	xfs_bmap_last_offset(struct xfs_inode *ip, xfs_fileoff_t *unused,
> +		int whichfork);
>  int	xfs_bmap_one_block(struct xfs_inode *ip, int whichfork);
>  int	xfs_bmap_read_extents(struct xfs_trans *tp, struct xfs_inode *ip,
>  		int whichfork);
> diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
> index ce16ef0..7575a3b 100644
> --- a/fs/xfs/xfs_dir2.c
> +++ b/fs/xfs/xfs_dir2.c
> @@ -230,11 +230,11 @@ xfs_dir_createname(
>  
>  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>  		rval = xfs_dir2_sf_addname(&args);
> -	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isblock(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_block_addname(&args);
> -	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isleaf(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_leaf_addname(&args);
> @@ -303,11 +303,11 @@ xfs_dir_lookup(
>  
>  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>  		rval = xfs_dir2_sf_lookup(&args);
> -	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isblock(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_block_lookup(&args);
> -	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isleaf(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_leaf_lookup(&args);
> @@ -360,11 +360,11 @@ xfs_dir_removename(
>  
>  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>  		rval = xfs_dir2_sf_removename(&args);
> -	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isblock(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_block_removename(&args);
> -	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isleaf(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_leaf_removename(&args);
> @@ -410,11 +410,11 @@ xfs_dir_replace(
>  
>  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>  		rval = xfs_dir2_sf_replace(&args);
> -	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isblock(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_block_replace(&args);
> -	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isleaf(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_leaf_replace(&args);
> @@ -456,11 +456,11 @@ xfs_dir_canenter(
>  
>  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>  		rval = xfs_dir2_sf_addname(&args);
> -	else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isblock(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_block_addname(&args);
> -	else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
> +	else if ((rval = xfs_dir2_isleaf(dp, &v)))
>  		return rval;
>  	else if (v)
>  		rval = xfs_dir2_leaf_addname(&args);
> @@ -525,7 +525,6 @@ xfs_dir2_grow_inode(
>   */
>  int
>  xfs_dir2_isblock(
> -	xfs_trans_t	*tp,
>  	xfs_inode_t	*dp,
>  	int		*vp)		/* out: 1 is block, 0 is not block */
>  {
> @@ -534,7 +533,7 @@ xfs_dir2_isblock(
>  	int		rval;
>  
>  	mp = dp->i_mount;
> -	if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)))
> +	if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK)))
>  		return rval;
>  	rval = XFS_FSB_TO_B(mp, last) == mp->m_dirblksize;
>  	ASSERT(rval == 0 || dp->i_d.di_size == mp->m_dirblksize);
> @@ -547,7 +546,6 @@ xfs_dir2_isblock(
>   */
>  int
>  xfs_dir2_isleaf(
> -	xfs_trans_t	*tp,
>  	xfs_inode_t	*dp,
>  	int		*vp)		/* out: 1 is leaf, 0 is not leaf */
>  {
> @@ -556,7 +554,7 @@ xfs_dir2_isleaf(
>  	int		rval;
>  
>  	mp = dp->i_mount;
> -	if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)))
> +	if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK)))
>  		return rval;
>  	*vp = last == mp->m_dirleafblk + (1 << mp->m_sb.sb_dirblklog);
>  	return 0;
> diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h
> index cec70e0..64a6b19 100644
> --- a/fs/xfs/xfs_dir2.h
> +++ b/fs/xfs/xfs_dir2.h
> @@ -142,8 +142,8 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
>  /*
>   * Interface routines used by userspace utilities
>   */
> -extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
> -extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
> +extern int xfs_dir2_isblock(struct xfs_inode *dp, int *r);
> +extern int xfs_dir2_isleaf(struct xfs_inode *dp, int *r);
>  extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
>  				struct xfs_buf *bp);
>  
> diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
> index ae47ec6..f8170bc 100644
> --- a/fs/xfs/xfs_dir2_leaf.c
> +++ b/fs/xfs/xfs_dir2_leaf.c
> @@ -1707,7 +1707,7 @@ xfs_dir2_node_to_leaf(
>  	/*
>  	 * Get the last offset in the file.
>  	 */
> -	if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK))) {
> +	if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) {
>  		return error;
>  	}
>  	fo -= mp->m_dirblkfsbs;
> diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
> index 48c7d18..807946d 100644
> --- a/fs/xfs/xfs_dir2_node.c
> +++ b/fs/xfs/xfs_dir2_node.c
> @@ -1726,7 +1726,7 @@ xfs_dir2_node_addname_int(
>  	if (dbno == -1) {
>  		xfs_fileoff_t	fo;		/* freespace block number */
>  
> -		if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK)))
> +		if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK)))
>  			return error;
>  		lastfbno = xfs_dir2_da_to_db(mp, (xfs_dablk_t)fo);
>  		fbno = ifbno;
> diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
> index aead369..a18000f 100644
> --- a/fs/xfs/xfs_dir2_readdir.c
> +++ b/fs/xfs/xfs_dir2_readdir.c
> @@ -687,7 +687,7 @@ xfs_readdir(
>  	lock_mode = xfs_ilock_data_map_shared(dp);
>  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>  		rval = xfs_dir2_sf_getdents(dp, ctx);
> -	else if ((rval = xfs_dir2_isblock(NULL, dp, &v)))
> +	else if ((rval = xfs_dir2_isblock(dp, &v)))
>  		;
>  	else if (v)
>  		rval = xfs_dir2_block_getdents(dp, ctx);
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index 22d1cbe..2b2739c 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -734,7 +734,7 @@ xfs_iomap_write_allocate(
>  			 */
>  			nimaps = 1;
>  			end_fsb = XFS_B_TO_FSB(mp, XFS_ISIZE(ip));
> -			error = xfs_bmap_last_offset(NULL, ip, &last_block,
> +			error = xfs_bmap_last_offset(ip, &last_block,
>  							XFS_DATA_FORK);
>  			if (error)
>  				goto trans_cancel;
> 
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: remove unused transaction pointer args
  2014-03-31 13:09 ` Brian Foster
@ 2014-03-31 14:24   ` Eric Sandeen
  2014-04-03 22:19   ` Eric Sandeen
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2014-03-31 14:24 UTC (permalink / raw)
  To: Brian Foster; +Cc: xfs-oss


> On Mar 31, 2014, at 7:09 AM, Brian Foster <bfoster@redhat.com> wrote:
> 
>> On Fri, Mar 28, 2014 at 09:01:26PM -0500, Eric Sandeen wrote:
>> Several functions pass a transaction pointer around,
>> but it's never used in those callchains.  Remove it.
>> 
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>> 
>> diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
>> index 152543c..b308097 100644
>> --- a/fs/xfs/xfs_bmap.c
>> +++ b/fs/xfs/xfs_bmap.c
>> @@ -1675,7 +1675,6 @@ xfs_bmap_isaeof(
>>  */
>> int
>> xfs_bmap_last_offset(
>> -    struct xfs_trans    *tp,
>>    struct xfs_inode    *ip,
>>    xfs_fileoff_t        *last_block,
>>    int            whichfork)
> 
> Seems Ok to me, but it looks like you could also kill the tp param for
> xfs_bmap_last_extent(). I don't see any callers that don't pass NULL...
> 
Ok thanks will resend.  Actually have a big batch of unused param removals from some mindless work on the plane...

Eric

> Brian
> 
>> diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
>> index 33b41f3..52ad38d 100644
>> --- a/fs/xfs/xfs_bmap.h
>> +++ b/fs/xfs/xfs_bmap.h
>> @@ -146,8 +146,8 @@ int    xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
>>        xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
>> int    xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip,
>>        xfs_fileoff_t *last_block, int whichfork);
>> -int    xfs_bmap_last_offset(struct xfs_trans *tp, struct xfs_inode *ip,
>> -        xfs_fileoff_t *unused, int whichfork);
>> +int    xfs_bmap_last_offset(struct xfs_inode *ip, xfs_fileoff_t *unused,
>> +        int whichfork);
>> int    xfs_bmap_one_block(struct xfs_inode *ip, int whichfork);
>> int    xfs_bmap_read_extents(struct xfs_trans *tp, struct xfs_inode *ip,
>>        int whichfork);
>> diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
>> index ce16ef0..7575a3b 100644
>> --- a/fs/xfs/xfs_dir2.c
>> +++ b/fs/xfs/xfs_dir2.c
>> @@ -230,11 +230,11 @@ xfs_dir_createname(
>> 
>>    if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>>        rval = xfs_dir2_sf_addname(&args);
>> -    else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isblock(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_block_addname(&args);
>> -    else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isleaf(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_leaf_addname(&args);
>> @@ -303,11 +303,11 @@ xfs_dir_lookup(
>> 
>>    if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>>        rval = xfs_dir2_sf_lookup(&args);
>> -    else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isblock(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_block_lookup(&args);
>> -    else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isleaf(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_leaf_lookup(&args);
>> @@ -360,11 +360,11 @@ xfs_dir_removename(
>> 
>>    if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>>        rval = xfs_dir2_sf_removename(&args);
>> -    else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isblock(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_block_removename(&args);
>> -    else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isleaf(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_leaf_removename(&args);
>> @@ -410,11 +410,11 @@ xfs_dir_replace(
>> 
>>    if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>>        rval = xfs_dir2_sf_replace(&args);
>> -    else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isblock(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_block_replace(&args);
>> -    else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isleaf(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_leaf_replace(&args);
>> @@ -456,11 +456,11 @@ xfs_dir_canenter(
>> 
>>    if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>>        rval = xfs_dir2_sf_addname(&args);
>> -    else if ((rval = xfs_dir2_isblock(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isblock(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_block_addname(&args);
>> -    else if ((rval = xfs_dir2_isleaf(tp, dp, &v)))
>> +    else if ((rval = xfs_dir2_isleaf(dp, &v)))
>>        return rval;
>>    else if (v)
>>        rval = xfs_dir2_leaf_addname(&args);
>> @@ -525,7 +525,6 @@ xfs_dir2_grow_inode(
>>  */
>> int
>> xfs_dir2_isblock(
>> -    xfs_trans_t    *tp,
>>    xfs_inode_t    *dp,
>>    int        *vp)        /* out: 1 is block, 0 is not block */
>> {
>> @@ -534,7 +533,7 @@ xfs_dir2_isblock(
>>    int        rval;
>> 
>>    mp = dp->i_mount;
>> -    if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)))
>> +    if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK)))
>>        return rval;
>>    rval = XFS_FSB_TO_B(mp, last) == mp->m_dirblksize;
>>    ASSERT(rval == 0 || dp->i_d.di_size == mp->m_dirblksize);
>> @@ -547,7 +546,6 @@ xfs_dir2_isblock(
>>  */
>> int
>> xfs_dir2_isleaf(
>> -    xfs_trans_t    *tp,
>>    xfs_inode_t    *dp,
>>    int        *vp)        /* out: 1 is leaf, 0 is not leaf */
>> {
>> @@ -556,7 +554,7 @@ xfs_dir2_isleaf(
>>    int        rval;
>> 
>>    mp = dp->i_mount;
>> -    if ((rval = xfs_bmap_last_offset(tp, dp, &last, XFS_DATA_FORK)))
>> +    if ((rval = xfs_bmap_last_offset(dp, &last, XFS_DATA_FORK)))
>>        return rval;
>>    *vp = last == mp->m_dirleafblk + (1 << mp->m_sb.sb_dirblklog);
>>    return 0;
>> diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h
>> index cec70e0..64a6b19 100644
>> --- a/fs/xfs/xfs_dir2.h
>> +++ b/fs/xfs/xfs_dir2.h
>> @@ -142,8 +142,8 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
>> /*
>>  * Interface routines used by userspace utilities
>>  */
>> -extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
>> -extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
>> +extern int xfs_dir2_isblock(struct xfs_inode *dp, int *r);
>> +extern int xfs_dir2_isleaf(struct xfs_inode *dp, int *r);
>> extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
>>                struct xfs_buf *bp);
>> 
>> diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
>> index ae47ec6..f8170bc 100644
>> --- a/fs/xfs/xfs_dir2_leaf.c
>> +++ b/fs/xfs/xfs_dir2_leaf.c
>> @@ -1707,7 +1707,7 @@ xfs_dir2_node_to_leaf(
>>    /*
>>     * Get the last offset in the file.
>>     */
>> -    if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK))) {
>> +    if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK))) {
>>        return error;
>>    }
>>    fo -= mp->m_dirblkfsbs;
>> diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
>> index 48c7d18..807946d 100644
>> --- a/fs/xfs/xfs_dir2_node.c
>> +++ b/fs/xfs/xfs_dir2_node.c
>> @@ -1726,7 +1726,7 @@ xfs_dir2_node_addname_int(
>>    if (dbno == -1) {
>>        xfs_fileoff_t    fo;        /* freespace block number */
>> 
>> -        if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK)))
>> +        if ((error = xfs_bmap_last_offset(dp, &fo, XFS_DATA_FORK)))
>>            return error;
>>        lastfbno = xfs_dir2_da_to_db(mp, (xfs_dablk_t)fo);
>>        fbno = ifbno;
>> diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
>> index aead369..a18000f 100644
>> --- a/fs/xfs/xfs_dir2_readdir.c
>> +++ b/fs/xfs/xfs_dir2_readdir.c
>> @@ -687,7 +687,7 @@ xfs_readdir(
>>    lock_mode = xfs_ilock_data_map_shared(dp);
>>    if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
>>        rval = xfs_dir2_sf_getdents(dp, ctx);
>> -    else if ((rval = xfs_dir2_isblock(NULL, dp, &v)))
>> +    else if ((rval = xfs_dir2_isblock(dp, &v)))
>>        ;
>>    else if (v)
>>        rval = xfs_dir2_block_getdents(dp, ctx);
>> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
>> index 22d1cbe..2b2739c 100644
>> --- a/fs/xfs/xfs_iomap.c
>> +++ b/fs/xfs/xfs_iomap.c
>> @@ -734,7 +734,7 @@ xfs_iomap_write_allocate(
>>             */
>>            nimaps = 1;
>>            end_fsb = XFS_B_TO_FSB(mp, XFS_ISIZE(ip));
>> -            error = xfs_bmap_last_offset(NULL, ip, &last_block,
>> +            error = xfs_bmap_last_offset(ip, &last_block,
>>                            XFS_DATA_FORK);
>>            if (error)
>>                goto trans_cancel;
>> 
>> 
>> _______________________________________________
>> xfs mailing list
>> xfs@oss.sgi.com
>> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: remove unused transaction pointer args
  2014-03-31 13:09 ` Brian Foster
  2014-03-31 14:24   ` Eric Sandeen
@ 2014-04-03 22:19   ` Eric Sandeen
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2014-04-03 22:19 UTC (permalink / raw)
  To: Brian Foster; +Cc: xfs-oss

On 3/31/14, 7:09 AM, Brian Foster wrote:
> On Fri, Mar 28, 2014 at 09:01:26PM -0500, Eric Sandeen wrote:
>> Several functions pass a transaction pointer around,
>> but it's never used in those callchains.  Remove it.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
>> index 152543c..b308097 100644
>> --- a/fs/xfs/xfs_bmap.c
>> +++ b/fs/xfs/xfs_bmap.c
>> @@ -1675,7 +1675,6 @@ xfs_bmap_isaeof(
>>   */
>>  int
>>  xfs_bmap_last_offset(
>> -	struct xfs_trans	*tp,
>>  	struct xfs_inode	*ip,
>>  	xfs_fileoff_t		*last_block,
>>  	int			whichfork)
> 
> Seems Ok to me, but it looks like you could also kill the tp param for
> xfs_bmap_last_extent(). I don't see any callers that don't pass NULL...
> 
> Brian

Actually I think that'd be a separate change, and not totally obvious
that it's one we should make - I'm (lazily) not sure if someone might
need to pass in a tp to be used in xfs_iread_extents() some time
in the future...

-Eric

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-03 22:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-29  2:01 [PATCH] xfs: remove unused transaction pointer args Eric Sandeen
2014-03-31 13:09 ` Brian Foster
2014-03-31 14:24   ` Eric Sandeen
2014-04-03 22:19   ` Eric Sandeen

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).