xfs
[Top] [All Lists]

Re: [PATCH 1/2] xfsprogs: remove unused argument in trans_iput

To: Mark Tinguely <tinguely@xxxxxxx>, xfs@xxxxxxxxxxx
Subject: Re: [PATCH 1/2] xfsprogs: remove unused argument in trans_iput
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Wed, 30 Apr 2014 09:47:50 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20140430135319.660238697@xxxxxxx>
References: <20140430134844.924376330@xxxxxxx> <20140430135319.660238697@xxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
On 4/30/14, 8:48 AM, Mark Tinguely wrote:
> Remove the unused second argument to xfs_iput() and
> xfs_trans_iput().
> 
> Introduce the define "IRELE()" and use in place of xfs_iput().

Why do this?  We had been moving away from the upper-case-macro-
redefined-to-a-function meme... what does this #define gain?

libxfs_iget/libxfs_iput pairs seem more obvious than
libxfs_iget/IRELE()...

Thanks,
-Eric

> Signed-off-by: Mark Tinguely <tinguely@xxxxxxx>
> ---
>  db/attrset.c     |    4 ++--
>  include/libxfs.h |    6 ++++--
>  libxfs/init.c    |    4 ++--
>  libxfs/rdwr.c    |    2 +-
>  libxfs/trans.c   |   11 +++++------
>  mkfs/proto.c     |    2 +-
>  repair/phase6.c  |    2 +-
>  repair/phase7.c  |    2 +-
>  8 files changed, 17 insertions(+), 16 deletions(-)
> 
> Index: b/db/attrset.c
> ===================================================================
> --- a/db/attrset.c
> +++ b/db/attrset.c
> @@ -170,7 +170,7 @@ attr_set_f(
>  out:
>       mp->m_flags &= ~LIBXFS_MOUNT_COMPAT_ATTR;
>       if (ip)
> -             libxfs_iput(ip, 0);
> +             IRELE(ip);
>       if (value)
>               free(value);
>       return 0;
> @@ -244,6 +244,6 @@ attr_remove_f(
>  out:
>       mp->m_flags &= ~LIBXFS_MOUNT_COMPAT_ATTR;
>       if (ip)
> -             libxfs_iput(ip, 0);
> +             IRELE(ip);
>       return 0;
>  }
> Index: b/include/libxfs.h
> ===================================================================
> --- a/include/libxfs.h
> +++ b/include/libxfs.h
> @@ -532,7 +532,7 @@ extern xfs_buf_t  *libxfs_trans_getsb (xf
>  
>  extern int   libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
>                               uint, uint, struct xfs_inode **);
> -extern void  libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint);
> +extern void  libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *);
>  extern void  libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint);
>  extern void  libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *);
>  extern void  libxfs_trans_ijoin_ref(xfs_trans_t *, struct xfs_inode *, int);
> @@ -653,7 +653,9 @@ extern int        libxfs_iflush_int (xfs_inode_
>  /* Inode Cache Interfaces */
>  extern int   libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
>                               uint, xfs_inode_t **, xfs_daddr_t);
> -extern void  libxfs_iput (xfs_inode_t *, uint);
> +extern void  libxfs_iput (xfs_inode_t *);
> +
> +#define IRELE(ip) libxfs_iput(ip)
>  
>  /* Shared utility routines */
>  extern unsigned int  libxfs_log2_roundup(unsigned int i);
> Index: b/libxfs/init.c
> ===================================================================
> --- a/libxfs/init.c
> +++ b/libxfs/init.c
> @@ -778,9 +778,9 @@ void
>  libxfs_rtmount_destroy(xfs_mount_t *mp)
>  {
>       if (mp->m_rsumip)
> -             libxfs_iput(mp->m_rsumip, 0);
> +             IRELE(mp->m_rsumip);
>       if (mp->m_rbmip)
> -             libxfs_iput(mp->m_rbmip, 0);
> +             IRELE(mp->m_rbmip);
>       mp->m_rsumip = mp->m_rbmip = NULL;
>  }
>  
> Index: b/libxfs/rdwr.c
> ===================================================================
> --- a/libxfs/rdwr.c
> +++ b/libxfs/rdwr.c
> @@ -1076,7 +1076,7 @@ libxfs_idestroy(xfs_inode_t *ip)
>  }
>  
>  void
> -libxfs_iput(xfs_inode_t *ip, uint lock_flags)
> +libxfs_iput(xfs_inode_t *ip)
>  {
>       if (ip->i_itemp)
>               kmem_zone_free(xfs_ili_zone, ip->i_itemp);
> Index: b/libxfs/trans.c
> ===================================================================
> --- a/libxfs/trans.c
> +++ b/libxfs/trans.c
> @@ -250,13 +250,12 @@ libxfs_trans_iget(
>  void
>  libxfs_trans_iput(
>       xfs_trans_t             *tp,
> -     xfs_inode_t             *ip,
> -     uint                    lock_flags)
> +     xfs_inode_t             *ip)
>  {
>       xfs_inode_log_item_t    *iip;
>  
>       if (tp == NULL) {
> -             libxfs_iput(ip, lock_flags);
> +             IRELE(ip);
>               return;
>       }
>  
> @@ -265,7 +264,7 @@ libxfs_trans_iput(
>       ASSERT(iip != NULL);
>       xfs_trans_del_item(&iip->ili_item);
>  
> -     libxfs_iput(ip, lock_flags);
> +     IRELE(ip);
>  }
>  
>  void
> @@ -737,7 +736,7 @@ ili_done:
>               return;
>       }
>       /* free the inode */
> -     libxfs_iput(ip, 0);
> +     IRELE(ip);
>  }
>  
>  static void
> @@ -819,7 +818,7 @@ inode_item_unlock(
>  
>       iip->ili_flags = 0;
>       if (!iip->ili_lock_flags)
> -             libxfs_iput(ip, 0);
> +             IRELE(ip);
>       else
>               iip->ili_lock_flags = 0;
>  }
> Index: b/mkfs/proto.c
> ===================================================================
> --- a/mkfs/proto.c
> +++ b/mkfs/proto.c
> @@ -589,7 +589,7 @@ parseproto(
>                               break;
>                       parseproto(mp, ip, fsxp, pp, name);
>               }
> -             libxfs_iput(ip, 0);
> +             IRELE(ip);
>               return;
>       default:
>               ASSERT(0);
> Index: b/repair/phase6.c
> ===================================================================
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -2873,7 +2873,7 @@ process_dir_inode(
>                                       |XFS_TRANS_SYNC);
>               }
>       }
> -     libxfs_iput(ip, 0);
> +     IRELE(ip);
>  }
>  
>  /*
> Index: b/repair/phase7.c
> ===================================================================
> --- a/repair/phase7.c
> +++ b/repair/phase7.c
> @@ -99,7 +99,7 @@ update_inode_nlinks(
>       set_nlinks(&ip->i_d, ino, nlinks, &dirty);
>  
>       if (!dirty)  {
> -             libxfs_trans_iput(tp, ip, 0);
> +             libxfs_trans_iput(tp, ip);
>               libxfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES);
>       } else  {
>               libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
> 
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
> 

<Prev in Thread] Current Thread [Next in Thread>