switch simple cases of fget_light to fdget
[linux-2.6-block.git] / fs / xfs / xfs_dfrag.c
index e00de08dc8aca858f8715691c2e0d20046194104..b9b8646e62db7357ae882bae00f3a74036c3da81 100644 (file)
@@ -48,44 +48,44 @@ xfs_swapext(
        xfs_swapext_t   *sxp)
 {
        xfs_inode_t     *ip, *tip;
-       struct file     *file, *tmp_file;
+       struct fd       f, tmp;
        int             error = 0;
 
        /* Pull information for the target fd */
-       file = fget((int)sxp->sx_fdtarget);
-       if (!file) {
+       f = fdget((int)sxp->sx_fdtarget);
+       if (!f.file) {
                error = XFS_ERROR(EINVAL);
                goto out;
        }
 
-       if (!(file->f_mode & FMODE_WRITE) ||
-           !(file->f_mode & FMODE_READ) ||
-           (file->f_flags & O_APPEND)) {
+       if (!(f.file->f_mode & FMODE_WRITE) ||
+           !(f.file->f_mode & FMODE_READ) ||
+           (f.file->f_flags & O_APPEND)) {
                error = XFS_ERROR(EBADF);
                goto out_put_file;
        }
 
-       tmp_file = fget((int)sxp->sx_fdtmp);
-       if (!tmp_file) {
+       tmp = fdget((int)sxp->sx_fdtmp);
+       if (!tmp.file) {
                error = XFS_ERROR(EINVAL);
                goto out_put_file;
        }
 
-       if (!(tmp_file->f_mode & FMODE_WRITE) ||
-           !(tmp_file->f_mode & FMODE_READ) ||
-           (tmp_file->f_flags & O_APPEND)) {
+       if (!(tmp.file->f_mode & FMODE_WRITE) ||
+           !(tmp.file->f_mode & FMODE_READ) ||
+           (tmp.file->f_flags & O_APPEND)) {
                error = XFS_ERROR(EBADF);
                goto out_put_tmp_file;
        }
 
-       if (IS_SWAPFILE(file->f_path.dentry->d_inode) ||
-           IS_SWAPFILE(tmp_file->f_path.dentry->d_inode)) {
+       if (IS_SWAPFILE(f.file->f_path.dentry->d_inode) ||
+           IS_SWAPFILE(tmp.file->f_path.dentry->d_inode)) {
                error = XFS_ERROR(EINVAL);
                goto out_put_tmp_file;
        }
 
-       ip = XFS_I(file->f_path.dentry->d_inode);
-       tip = XFS_I(tmp_file->f_path.dentry->d_inode);
+       ip = XFS_I(f.file->f_path.dentry->d_inode);
+       tip = XFS_I(tmp.file->f_path.dentry->d_inode);
 
        if (ip->i_mount != tip->i_mount) {
                error = XFS_ERROR(EINVAL);
@@ -105,9 +105,9 @@ xfs_swapext(
        error = xfs_swap_extents(ip, tip, sxp);
 
  out_put_tmp_file:
-       fput(tmp_file);
+       fdput(tmp);
  out_put_file:
-       fput(file);
+       fdput(f);
  out:
        return error;
 }