aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 08:34:30 -0400
committerChristoph Hellwig <hch@lst.de>2011-07-08 08:34:30 -0400
commit857b9778d86ccba7d7b42c9d8aeecde794ec8a6b (patch)
tree8e336f66e4e712da3f6d3f9a2f87bd2e0a8ca781 /fs/xfs/xfs_vnodeops.c
parent681b120018e3c7e2680c93e8188c5ee34215df2f (diff)
xfs: kill xfs_itruncate_start
xfs_itruncate_start is a rather length wrapper that evaluates to a call to xfs_ioend_wait and xfs_tosspages, and only has two callers. Instead of using the complicated checks left over from IRIX where we can to truncate the pagecache just call xfs_tosspages (aka truncate_inode_pages) directly as we want to get rid of all data after i_size, and truncate_inode_pages handles incorrect alignments and too large offsets just fine. 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.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index a4f56a42ef90..45b8ac662aee 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -197,13 +197,6 @@ xfs_free_eofblocks(
197 */ 197 */
198 tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); 198 tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
199 199
200 /*
201 * Do the xfs_itruncate_start() call before
202 * reserving any log space because
203 * itruncate_start will call into the buffer
204 * cache and we can't
205 * do that within a transaction.
206 */
207 if (flags & XFS_FREE_EOF_TRYLOCK) { 200 if (flags & XFS_FREE_EOF_TRYLOCK) {
208 if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { 201 if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) {
209 xfs_trans_cancel(tp, 0); 202 xfs_trans_cancel(tp, 0);
@@ -212,13 +205,6 @@ xfs_free_eofblocks(
212 } else { 205 } else {
213 xfs_ilock(ip, XFS_IOLOCK_EXCL); 206 xfs_ilock(ip, XFS_IOLOCK_EXCL);
214 } 207 }
215 error = xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE,
216 ip->i_size);
217 if (error) {
218 xfs_trans_cancel(tp, 0);
219 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
220 return error;
221 }
222 208
223 error = xfs_trans_reserve(tp, 0, 209 error = xfs_trans_reserve(tp, 0,
224 XFS_ITRUNCATE_LOG_RES(mp), 210 XFS_ITRUNCATE_LOG_RES(mp),
@@ -660,20 +646,9 @@ xfs_inactive(
660 646
661 tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); 647 tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
662 if (truncate) { 648 if (truncate) {
663 /*
664 * Do the xfs_itruncate_start() call before
665 * reserving any log space because itruncate_start
666 * will call into the buffer cache and we can't
667 * do that within a transaction.
668 */
669 xfs_ilock(ip, XFS_IOLOCK_EXCL); 649 xfs_ilock(ip, XFS_IOLOCK_EXCL);
670 650
671 error = xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, 0); 651 xfs_ioend_wait(ip);
672 if (error) {
673 xfs_trans_cancel(tp, 0);
674 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
675 return VN_INACTIVE_CACHE;
676 }
677 652
678 error = xfs_trans_reserve(tp, 0, 653 error = xfs_trans_reserve(tp, 0,
679 XFS_ITRUNCATE_LOG_RES(mp), 654 XFS_ITRUNCATE_LOG_RES(mp),