diff options
author | Christoph Hellwig <hch@lst.de> | 2011-07-08 08:34:34 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2011-07-08 08:34:34 -0400 |
commit | 8f04c47aa9712874af2c8816c2ca2a332cba80e4 (patch) | |
tree | 56f76e7d1443759ed68c6720e7f242950e220f8c /fs/xfs/xfs_vnodeops.c | |
parent | 857b9778d86ccba7d7b42c9d8aeecde794ec8a6b (diff) |
xfs: split xfs_itruncate_finish
Split the guts of xfs_itruncate_finish that loop over the existing extents
and calls xfs_bunmapi on them into a new helper, xfs_itruncate_externs.
Make xfs_attr_inactive call it directly instead of xfs_itruncate_finish,
which allows to simplify the latter a lot, by only letting it deal with
the data fork. As a result xfs_itruncate_finish is renamed to
xfs_itruncate_data to make its use case more obvious.
Also remove the sync parameter from xfs_itruncate_data, which has been
unessecary since the introduction of the busy extent list in 2002, and
completely dead code since 2003 when the XFS_BMAPI_ASYNC parameter was
made a no-op.
I can't actually see why the xfs_attr_inactive needs to set the transaction
sync, but let's keep this patch simple and without changes in behaviour.
Also avoid passing a useless argument to xfs_isize_check, and make it
private to xfs_inode.c.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 45b8ac662aee..11242c482771 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -220,15 +220,12 @@ xfs_free_eofblocks( | |||
220 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 220 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
221 | xfs_trans_ijoin(tp, ip); | 221 | xfs_trans_ijoin(tp, ip); |
222 | 222 | ||
223 | error = xfs_itruncate_finish(&tp, ip, | 223 | error = xfs_itruncate_data(&tp, ip, ip->i_size); |
224 | ip->i_size, | ||
225 | XFS_DATA_FORK, | ||
226 | 0); | ||
227 | /* | ||
228 | * If we get an error at this point we | ||
229 | * simply don't bother truncating the file. | ||
230 | */ | ||
231 | if (error) { | 224 | if (error) { |
225 | /* | ||
226 | * If we get an error at this point we simply don't | ||
227 | * bother truncating the file. | ||
228 | */ | ||
232 | xfs_trans_cancel(tp, | 229 | xfs_trans_cancel(tp, |
233 | (XFS_TRANS_RELEASE_LOG_RES | | 230 | (XFS_TRANS_RELEASE_LOG_RES | |
234 | XFS_TRANS_ABORT)); | 231 | XFS_TRANS_ABORT)); |
@@ -665,16 +662,7 @@ xfs_inactive( | |||
665 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 662 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
666 | xfs_trans_ijoin(tp, ip); | 663 | xfs_trans_ijoin(tp, ip); |
667 | 664 | ||
668 | /* | 665 | error = xfs_itruncate_data(&tp, ip, 0); |
669 | * normally, we have to run xfs_itruncate_finish sync. | ||
670 | * But if filesystem is wsync and we're in the inactive | ||
671 | * path, then we know that nlink == 0, and that the | ||
672 | * xaction that made nlink == 0 is permanently committed | ||
673 | * since xfs_remove runs as a synchronous transaction. | ||
674 | */ | ||
675 | error = xfs_itruncate_finish(&tp, ip, 0, XFS_DATA_FORK, | ||
676 | (!(mp->m_flags & XFS_MOUNT_WSYNC) ? 1 : 0)); | ||
677 | |||
678 | if (error) { | 666 | if (error) { |
679 | xfs_trans_cancel(tp, | 667 | xfs_trans_cancel(tp, |
680 | XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); | 668 | XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); |