diff options
Diffstat (limited to 'fs/xfs/xfs_file.c')
-rw-r--r-- | fs/xfs/xfs_file.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 52c91e143725..64b48eade91d 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -261,7 +261,8 @@ xfs_file_aio_read( | |||
261 | xfs_buftarg_t *target = | 261 | xfs_buftarg_t *target = |
262 | XFS_IS_REALTIME_INODE(ip) ? | 262 | XFS_IS_REALTIME_INODE(ip) ? |
263 | mp->m_rtdev_targp : mp->m_ddev_targp; | 263 | mp->m_rtdev_targp : mp->m_ddev_targp; |
264 | if ((pos & target->bt_smask) || (size & target->bt_smask)) { | 264 | /* DIO must be aligned to device logical sector size */ |
265 | if ((pos | size) & target->bt_logical_sectormask) { | ||
265 | if (pos == i_size_read(inode)) | 266 | if (pos == i_size_read(inode)) |
266 | return 0; | 267 | return 0; |
267 | return -XFS_ERROR(EINVAL); | 268 | return -XFS_ERROR(EINVAL); |
@@ -641,9 +642,11 @@ xfs_file_dio_aio_write( | |||
641 | struct xfs_buftarg *target = XFS_IS_REALTIME_INODE(ip) ? | 642 | struct xfs_buftarg *target = XFS_IS_REALTIME_INODE(ip) ? |
642 | mp->m_rtdev_targp : mp->m_ddev_targp; | 643 | mp->m_rtdev_targp : mp->m_ddev_targp; |
643 | 644 | ||
644 | if ((pos & target->bt_smask) || (count & target->bt_smask)) | 645 | /* DIO must be aligned to device logical sector size */ |
646 | if ((pos | count) & target->bt_logical_sectormask) | ||
645 | return -XFS_ERROR(EINVAL); | 647 | return -XFS_ERROR(EINVAL); |
646 | 648 | ||
649 | /* "unaligned" here means not aligned to a filesystem block */ | ||
647 | if ((pos & mp->m_blockmask) || ((pos + count) & mp->m_blockmask)) | 650 | if ((pos & mp->m_blockmask) || ((pos + count) & mp->m_blockmask)) |
648 | unaligned_io = 1; | 651 | unaligned_io = 1; |
649 | 652 | ||
@@ -796,7 +799,7 @@ xfs_file_aio_write( | |||
796 | XFS_STATS_ADD(xs_write_bytes, ret); | 799 | XFS_STATS_ADD(xs_write_bytes, ret); |
797 | 800 | ||
798 | /* Handle various SYNC-type writes */ | 801 | /* Handle various SYNC-type writes */ |
799 | err = generic_write_sync(file, pos, ret); | 802 | err = generic_write_sync(file, iocb->ki_pos - ret, ret); |
800 | if (err < 0) | 803 | if (err < 0) |
801 | ret = err; | 804 | ret = err; |
802 | } | 805 | } |
@@ -912,7 +915,7 @@ xfs_dir_open( | |||
912 | * If there are any blocks, read-ahead block 0 as we're almost | 915 | * If there are any blocks, read-ahead block 0 as we're almost |
913 | * certain to have the next operation be a read there. | 916 | * certain to have the next operation be a read there. |
914 | */ | 917 | */ |
915 | mode = xfs_ilock_map_shared(ip); | 918 | mode = xfs_ilock_data_map_shared(ip); |
916 | if (ip->i_d.di_nextents > 0) | 919 | if (ip->i_d.di_nextents > 0) |
917 | xfs_dir3_data_readahead(NULL, ip, 0, -1); | 920 | xfs_dir3_data_readahead(NULL, ip, 0, -1); |
918 | xfs_iunlock(ip, mode); | 921 | xfs_iunlock(ip, mode); |
@@ -1215,7 +1218,7 @@ xfs_seek_data( | |||
1215 | uint lock; | 1218 | uint lock; |
1216 | int error; | 1219 | int error; |
1217 | 1220 | ||
1218 | lock = xfs_ilock_map_shared(ip); | 1221 | lock = xfs_ilock_data_map_shared(ip); |
1219 | 1222 | ||
1220 | isize = i_size_read(inode); | 1223 | isize = i_size_read(inode); |
1221 | if (start >= isize) { | 1224 | if (start >= isize) { |
@@ -1294,7 +1297,7 @@ out: | |||
1294 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); | 1297 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); |
1295 | 1298 | ||
1296 | out_unlock: | 1299 | out_unlock: |
1297 | xfs_iunlock_map_shared(ip, lock); | 1300 | xfs_iunlock(ip, lock); |
1298 | 1301 | ||
1299 | if (error) | 1302 | if (error) |
1300 | return -error; | 1303 | return -error; |
@@ -1319,7 +1322,7 @@ xfs_seek_hole( | |||
1319 | if (XFS_FORCED_SHUTDOWN(mp)) | 1322 | if (XFS_FORCED_SHUTDOWN(mp)) |
1320 | return -XFS_ERROR(EIO); | 1323 | return -XFS_ERROR(EIO); |
1321 | 1324 | ||
1322 | lock = xfs_ilock_map_shared(ip); | 1325 | lock = xfs_ilock_data_map_shared(ip); |
1323 | 1326 | ||
1324 | isize = i_size_read(inode); | 1327 | isize = i_size_read(inode); |
1325 | if (start >= isize) { | 1328 | if (start >= isize) { |
@@ -1402,7 +1405,7 @@ out: | |||
1402 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); | 1405 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); |
1403 | 1406 | ||
1404 | out_unlock: | 1407 | out_unlock: |
1405 | xfs_iunlock_map_shared(ip, lock); | 1408 | xfs_iunlock(ip, lock); |
1406 | 1409 | ||
1407 | if (error) | 1410 | if (error) |
1408 | return -error; | 1411 | return -error; |