Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319865
b: refs/heads/master
c: 5a15322
h: refs/heads/master
i:
  319863: fa9c61c
v: v3
  • Loading branch information
Christoph Hellwig authored and Ben Myers committed Jul 29, 2012
1 parent a9fdb78 commit 5920528
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0b56185b0d64ef89dad1c85bb7403fa762cbe50d
refs/heads/master: 5a15322da1a51ad8f3af1962de355885b6c606f2
24 changes: 10 additions & 14 deletions trunk/fs/xfs/xfs_vnodeops.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ xfs_readlink(
return error;
}

/*
* Flags for xfs_free_eofblocks
*/
#define XFS_FREE_EOF_TRYLOCK (1<<0)

/*
* This is called by xfs_inactive to free any blocks beyond eof
* when the link count isn't zero and by xfs_dm_punch_hole() when
Expand All @@ -159,7 +154,7 @@ STATIC int
xfs_free_eofblocks(
xfs_mount_t *mp,
xfs_inode_t *ip,
int flags)
bool need_iolock)
{
xfs_trans_t *tp;
int error;
Expand Down Expand Up @@ -201,13 +196,11 @@ xfs_free_eofblocks(
*/
tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);

if (flags & XFS_FREE_EOF_TRYLOCK) {
if (need_iolock) {
if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) {
xfs_trans_cancel(tp, 0);
return 0;
}
} else {
xfs_ilock(ip, XFS_IOLOCK_EXCL);
}

error = xfs_trans_reserve(tp, 0,
Expand All @@ -217,7 +210,8 @@ xfs_free_eofblocks(
if (error) {
ASSERT(XFS_FORCED_SHUTDOWN(mp));
xfs_trans_cancel(tp, 0);
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
if (need_iolock)
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
return error;
}

Expand All @@ -244,7 +238,10 @@ xfs_free_eofblocks(
error = xfs_trans_commit(tp,
XFS_TRANS_RELEASE_LOG_RES);
}
xfs_iunlock(ip, XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL);

xfs_iunlock(ip, XFS_ILOCK_EXCL);
if (need_iolock)
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
}
return error;
}
Expand Down Expand Up @@ -466,8 +463,7 @@ xfs_release(
if (xfs_iflags_test(ip, XFS_IDIRTY_RELEASE))
return 0;

error = xfs_free_eofblocks(mp, ip,
XFS_FREE_EOF_TRYLOCK);
error = xfs_free_eofblocks(mp, ip, true);
if (error)
return error;

Expand Down Expand Up @@ -524,7 +520,7 @@ xfs_inactive(
(!(ip->i_d.di_flags &
(XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) ||
ip->i_delayed_blks != 0))) {
error = xfs_free_eofblocks(mp, ip, 0);
error = xfs_free_eofblocks(mp, ip, false);
if (error)
return VN_INACTIVE_CACHE;
}
Expand Down

0 comments on commit 5920528

Please sign in to comment.