aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index eaab355f5a89..de49601919c1 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -615,6 +615,7 @@ xfs_setattr(
615 code = xfs_igrow_start(ip, vap->va_size, credp); 615 code = xfs_igrow_start(ip, vap->va_size, credp);
616 } 616 }
617 xfs_iunlock(ip, XFS_ILOCK_EXCL); 617 xfs_iunlock(ip, XFS_ILOCK_EXCL);
618 vn_iowait(vp); /* wait for the completion of any pending DIOs */
618 if (!code) 619 if (!code)
619 code = xfs_itruncate_data(ip, vap->va_size); 620 code = xfs_itruncate_data(ip, vap->va_size);
620 if (code) { 621 if (code) {
@@ -847,7 +848,7 @@ xfs_setattr(
847 * If this is a synchronous mount, make sure that the 848 * If this is a synchronous mount, make sure that the
848 * transaction goes to disk before returning to the user. 849 * transaction goes to disk before returning to the user.
849 * This is slightly sub-optimal in that truncates require 850 * This is slightly sub-optimal in that truncates require
850 * two sync transactions instead of one for wsync filesytems. 851 * two sync transactions instead of one for wsync filesystems.
851 * One for the truncate and one for the timestamps since we 852 * One for the truncate and one for the timestamps since we
852 * don't want to change the timestamps unless we're sure the 853 * don't want to change the timestamps unless we're sure the
853 * truncate worked. Truncates are less than 1% of the laddis 854 * truncate worked. Truncates are less than 1% of the laddis
@@ -1169,7 +1170,7 @@ xfs_fsync(
1169 1170
1170 /* 1171 /*
1171 * If this inode is on the RT dev we need to flush that 1172 * If this inode is on the RT dev we need to flush that
1172 * cache aswell. 1173 * cache as well.
1173 */ 1174 */
1174 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) 1175 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
1175 xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp); 1176 xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp);
@@ -1334,7 +1335,7 @@ xfs_inactive_symlink_rmt(
1334 */ 1335 */
1335 done = 0; 1336 done = 0;
1336 XFS_BMAP_INIT(&free_list, &first_block); 1337 XFS_BMAP_INIT(&free_list, &first_block);
1337 nmaps = sizeof(mval) / sizeof(mval[0]); 1338 nmaps = ARRAY_SIZE(mval);
1338 if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), 1339 if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size),
1339 XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, 1340 XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps,
1340 &free_list))) 1341 &free_list)))
@@ -1379,7 +1380,7 @@ xfs_inactive_symlink_rmt(
1379 */ 1380 */
1380 ntp = xfs_trans_dup(tp); 1381 ntp = xfs_trans_dup(tp);
1381 /* 1382 /*
1382 * Commit the transaction containing extent freeing and EFD's. 1383 * Commit the transaction containing extent freeing and EFDs.
1383 * If we get an error on the commit here or on the reserve below, 1384 * If we get an error on the commit here or on the reserve below,
1384 * we need to unlock the inode since the new transaction doesn't 1385 * we need to unlock the inode since the new transaction doesn't
1385 * have the inode attached. 1386 * have the inode attached.
@@ -1556,7 +1557,7 @@ xfs_release(
1556 if ((error = xfs_inactive_free_eofblocks(mp, ip))) 1557 if ((error = xfs_inactive_free_eofblocks(mp, ip)))
1557 return error; 1558 return error;
1558 /* Update linux inode block count after free above */ 1559 /* Update linux inode block count after free above */
1559 LINVFS_GET_IP(vp)->i_blocks = XFS_FSB_TO_BB(mp, 1560 vn_to_inode(vp)->i_blocks = XFS_FSB_TO_BB(mp,
1560 ip->i_d.di_nblocks + ip->i_delayed_blks); 1561 ip->i_d.di_nblocks + ip->i_delayed_blks);
1561 } 1562 }
1562 } 1563 }
@@ -1637,7 +1638,7 @@ xfs_inactive(
1637 if ((error = xfs_inactive_free_eofblocks(mp, ip))) 1638 if ((error = xfs_inactive_free_eofblocks(mp, ip)))
1638 return VN_INACTIVE_CACHE; 1639 return VN_INACTIVE_CACHE;
1639 /* Update linux inode block count after free above */ 1640 /* Update linux inode block count after free above */
1640 LINVFS_GET_IP(vp)->i_blocks = XFS_FSB_TO_BB(mp, 1641 vn_to_inode(vp)->i_blocks = XFS_FSB_TO_BB(mp,
1641 ip->i_d.di_nblocks + ip->i_delayed_blks); 1642 ip->i_d.di_nblocks + ip->i_delayed_blks);
1642 } 1643 }
1643 goto out; 1644 goto out;
@@ -2022,7 +2023,7 @@ xfs_create(
2022 XFS_QM_DQRELE(mp, gdqp); 2023 XFS_QM_DQRELE(mp, gdqp);
2023 2024
2024 /* 2025 /*
2025 * Propogate the fact that the vnode changed after the 2026 * Propagate the fact that the vnode changed after the
2026 * xfs_inode locks have been released. 2027 * xfs_inode locks have been released.
2027 */ 2028 */
2028 VOP_VNODE_CHANGE(vp, VCHANGE_FLAGS_TRUNCATED, 3); 2029 VOP_VNODE_CHANGE(vp, VCHANGE_FLAGS_TRUNCATED, 3);
@@ -2369,7 +2370,7 @@ xfs_remove(
2369 * for a log reservation. Since we'll have to wait for the 2370 * for a log reservation. Since we'll have to wait for the
2370 * inactive code to complete before returning from xfs_iget, 2371 * inactive code to complete before returning from xfs_iget,
2371 * we need to make sure that we don't have log space reserved 2372 * we need to make sure that we don't have log space reserved
2372 * when we call xfs_iget. Instead we get an unlocked referece 2373 * when we call xfs_iget. Instead we get an unlocked reference
2373 * to the inode before getting our log reservation. 2374 * to the inode before getting our log reservation.
2374 */ 2375 */
2375 error = xfs_get_dir_entry(dentry, &ip); 2376 error = xfs_get_dir_entry(dentry, &ip);
@@ -3019,7 +3020,7 @@ xfs_rmdir(
3019 * for a log reservation. Since we'll have to wait for the 3020 * for a log reservation. Since we'll have to wait for the
3020 * inactive code to complete before returning from xfs_iget, 3021 * inactive code to complete before returning from xfs_iget,
3021 * we need to make sure that we don't have log space reserved 3022 * we need to make sure that we don't have log space reserved
3022 * when we call xfs_iget. Instead we get an unlocked referece 3023 * when we call xfs_iget. Instead we get an unlocked reference
3023 * to the inode before getting our log reservation. 3024 * to the inode before getting our log reservation.
3024 */ 3025 */
3025 error = xfs_get_dir_entry(dentry, &cdp); 3026 error = xfs_get_dir_entry(dentry, &cdp);
@@ -3186,7 +3187,7 @@ xfs_rmdir(
3186 3187
3187 /* Fall through to std_return with error = 0 or the errno 3188 /* Fall through to std_return with error = 0 or the errno
3188 * from xfs_trans_commit. */ 3189 * from xfs_trans_commit. */
3189std_return: 3190 std_return:
3190 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_POSTREMOVE)) { 3191 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_POSTREMOVE)) {
3191 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, 3192 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
3192 dir_vp, DM_RIGHT_NULL, 3193 dir_vp, DM_RIGHT_NULL,
@@ -3196,12 +3197,12 @@ std_return:
3196 } 3197 }
3197 return error; 3198 return error;
3198 3199
3199error1: 3200 error1:
3200 xfs_bmap_cancel(&free_list); 3201 xfs_bmap_cancel(&free_list);
3201 cancel_flags |= XFS_TRANS_ABORT; 3202 cancel_flags |= XFS_TRANS_ABORT;
3202 /* FALLTHROUGH */ 3203 /* FALLTHROUGH */
3203 3204
3204error_return: 3205 error_return:
3205 xfs_trans_cancel(tp, cancel_flags); 3206 xfs_trans_cancel(tp, cancel_flags);
3206 goto std_return; 3207 goto std_return;
3207} 3208}
@@ -4310,8 +4311,10 @@ xfs_free_file_space(
4310 ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1); 4311 ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1);
4311 if (attr_flags & ATTR_NOLOCK) 4312 if (attr_flags & ATTR_NOLOCK)
4312 need_iolock = 0; 4313 need_iolock = 0;
4313 if (need_iolock) 4314 if (need_iolock) {
4314 xfs_ilock(ip, XFS_IOLOCK_EXCL); 4315 xfs_ilock(ip, XFS_IOLOCK_EXCL);
4316 vn_iowait(vp); /* wait for the completion of any pending DIOs */
4317 }
4315 4318
4316 rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog), 4319 rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog),
4317 (__uint8_t)NBPP); 4320 (__uint8_t)NBPP);