Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=35fec8df65217546f6d9d508b203c1d135a67fbc
Commit:     35fec8df65217546f6d9d508b203c1d135a67fbc
Parent:     199037c598daf5f3602dace68c331665a4f4f0c1
Author:     Christoph Hellwig <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 5 12:13:07 2008 +1100
Committer:  Lachlan McIlroy <[EMAIL PROTECTED]>
CommitDate: Thu Feb 7 18:22:02 2008 +1100

    [XFS] clean up xfs_swapext
    
    - stop using vnodes
    - use proper multiple label goto unwinding
    - give the struct file * variables saner names
    
    SGI-PV: 971186
    SGI-Modid: xfs-linux-melb:xfs-kern:30366a
    
    Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Lachlan McIlroy <[EMAIL PROTECTED]>
---
 fs/xfs/xfs_dfrag.c |   67 ++++++++++++++++++++-------------------------------
 1 files changed, 26 insertions(+), 41 deletions(-)

diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 03a42d2..5d32859 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -52,76 +52,61 @@ xfs_swapext(
        xfs_swapext_t   __user *sxu)
 {
        xfs_swapext_t   *sxp;
-       xfs_inode_t     *ip=NULL, *tip=NULL;
-       xfs_mount_t     *mp;
-       struct file     *fp = NULL, *tfp = NULL;
-       bhv_vnode_t     *vp, *tvp;
+       xfs_inode_t     *ip, *tip;
+       struct file     *file, *target_file;
        int             error = 0;
 
        sxp = kmem_alloc(sizeof(xfs_swapext_t), KM_MAYFAIL);
        if (!sxp) {
                error = XFS_ERROR(ENOMEM);
-               goto error0;
+               goto out;
        }
 
        if (copy_from_user(sxp, sxu, sizeof(xfs_swapext_t))) {
                error = XFS_ERROR(EFAULT);
-               goto error0;
+               goto out_free_sxp;
        }
 
        /* Pull information for the target fd */
-       if (((fp = fget((int)sxp->sx_fdtarget)) == NULL) ||
-           ((vp = vn_from_inode(fp->f_path.dentry->d_inode)) == NULL))  {
+       file = fget((int)sxp->sx_fdtarget);
+       if (!file) {
                error = XFS_ERROR(EINVAL);
-               goto error0;
-       }
-
-       ip = xfs_vtoi(vp);
-       if (ip == NULL) {
-               error = XFS_ERROR(EBADF);
-               goto error0;
+               goto out_free_sxp;
        }
 
-       if (((tfp = fget((int)sxp->sx_fdtmp)) == NULL) ||
-           ((tvp = vn_from_inode(tfp->f_path.dentry->d_inode)) == NULL)) {
+       target_file = fget((int)sxp->sx_fdtmp);
+       if (!target_file) {
                error = XFS_ERROR(EINVAL);
-               goto error0;
+               goto out_put_file;
        }
 
-       tip = xfs_vtoi(tvp);
-       if (tip == NULL) {
-               error = XFS_ERROR(EBADF);
-               goto error0;
-       }
+       ip = XFS_I(file->f_path.dentry->d_inode);
+       tip = XFS_I(target_file->f_path.dentry->d_inode);
 
        if (ip->i_mount != tip->i_mount) {
-               error =  XFS_ERROR(EINVAL);
-               goto error0;
+               error = XFS_ERROR(EINVAL);
+               goto out_put_target_file;
        }
 
        if (ip->i_ino == tip->i_ino) {
-               error =  XFS_ERROR(EINVAL);
-               goto error0;
+               error = XFS_ERROR(EINVAL);
+               goto out_put_target_file;
        }
 
-       mp = ip->i_mount;
-
-       if (XFS_FORCED_SHUTDOWN(mp)) {
-               error =  XFS_ERROR(EIO);
-               goto error0;
+       if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
+               error = XFS_ERROR(EIO);
+               goto out_put_target_file;
        }
 
        error = xfs_swap_extents(ip, tip, sxp);
 
- error0:
-       if (fp != NULL)
-               fput(fp);
-       if (tfp != NULL)
-               fput(tfp);
-
-       if (sxp != NULL)
-               kmem_free(sxp, sizeof(xfs_swapext_t));
-
+ out_put_target_file:
+       fput(target_file);
+ out_put_file:
+       fput(file);
+ out_free_sxp:
+       kmem_free(sxp, sizeof(xfs_swapext_t));
+ out:
        return error;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to