diff options
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 3826e8f0e28a..469e1a7939d4 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -278,7 +278,9 @@ phase2: | |||
278 | switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) { | 278 | switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) { |
279 | case BMAPI_WRITE: | 279 | case BMAPI_WRITE: |
280 | /* If we found an extent, return it */ | 280 | /* If we found an extent, return it */ |
281 | if (nimaps && (imap.br_startblock != HOLESTARTBLOCK)) { | 281 | if (nimaps && |
282 | (imap.br_startblock != HOLESTARTBLOCK) && | ||
283 | (imap.br_startblock != DELAYSTARTBLOCK)) { | ||
282 | xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, io, | 284 | xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, io, |
283 | offset, count, iomapp, &imap, flags); | 285 | offset, count, iomapp, &imap, flags); |
284 | break; | 286 | break; |
@@ -308,7 +310,8 @@ phase2: | |||
308 | break; | 310 | break; |
309 | } | 311 | } |
310 | 312 | ||
311 | error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps); | 313 | error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count, |
314 | &imap, &nimaps); | ||
312 | break; | 315 | break; |
313 | case BMAPI_UNWRITTEN: | 316 | case BMAPI_UNWRITTEN: |
314 | lockmode = 0; | 317 | lockmode = 0; |
@@ -365,7 +368,7 @@ xfs_flush_space( | |||
365 | int | 368 | int |
366 | xfs_iomap_write_direct( | 369 | xfs_iomap_write_direct( |
367 | xfs_inode_t *ip, | 370 | xfs_inode_t *ip, |
368 | loff_t offset, | 371 | xfs_off_t offset, |
369 | size_t count, | 372 | size_t count, |
370 | int flags, | 373 | int flags, |
371 | xfs_bmbt_irec_t *ret_imap, | 374 | xfs_bmbt_irec_t *ret_imap, |
@@ -541,7 +544,7 @@ error_out: | |||
541 | int | 544 | int |
542 | xfs_iomap_write_delay( | 545 | xfs_iomap_write_delay( |
543 | xfs_inode_t *ip, | 546 | xfs_inode_t *ip, |
544 | loff_t offset, | 547 | xfs_off_t offset, |
545 | size_t count, | 548 | size_t count, |
546 | int ioflag, | 549 | int ioflag, |
547 | xfs_bmbt_irec_t *ret_imap, | 550 | xfs_bmbt_irec_t *ret_imap, |
@@ -746,6 +749,8 @@ write_map: | |||
746 | int | 749 | int |
747 | xfs_iomap_write_allocate( | 750 | xfs_iomap_write_allocate( |
748 | xfs_inode_t *ip, | 751 | xfs_inode_t *ip, |
752 | xfs_off_t offset, | ||
753 | size_t count, | ||
749 | xfs_bmbt_irec_t *map, | 754 | xfs_bmbt_irec_t *map, |
750 | int *retmap) | 755 | int *retmap) |
751 | { | 756 | { |
@@ -770,9 +775,9 @@ xfs_iomap_write_allocate( | |||
770 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 775 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) |
771 | return XFS_ERROR(error); | 776 | return XFS_ERROR(error); |
772 | 777 | ||
773 | offset_fsb = map->br_startoff; | 778 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
774 | count_fsb = map->br_blockcount; | 779 | count_fsb = map->br_blockcount; |
775 | map_start_fsb = offset_fsb; | 780 | map_start_fsb = map->br_startoff; |
776 | 781 | ||
777 | XFS_STATS_ADD(xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb)); | 782 | XFS_STATS_ADD(xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb)); |
778 | 783 | ||
@@ -868,9 +873,9 @@ xfs_iomap_write_allocate( | |||
868 | imap[i].br_startoff, | 873 | imap[i].br_startoff, |
869 | imap[i].br_blockcount,imap[i].br_state); | 874 | imap[i].br_blockcount,imap[i].br_state); |
870 | } | 875 | } |
871 | if ((map->br_startoff >= imap[i].br_startoff) && | 876 | if ((offset_fsb >= imap[i].br_startoff) && |
872 | (map->br_startoff < (imap[i].br_startoff + | 877 | (offset_fsb < (imap[i].br_startoff + |
873 | imap[i].br_blockcount))) { | 878 | imap[i].br_blockcount))) { |
874 | *map = imap[i]; | 879 | *map = imap[i]; |
875 | *retmap = 1; | 880 | *retmap = 1; |
876 | XFS_STATS_INC(xs_xstrat_quick); | 881 | XFS_STATS_INC(xs_xstrat_quick); |
@@ -883,9 +888,8 @@ xfs_iomap_write_allocate( | |||
883 | * file, just surrounding data, try again. | 888 | * file, just surrounding data, try again. |
884 | */ | 889 | */ |
885 | nimaps--; | 890 | nimaps--; |
886 | offset_fsb = imap[nimaps].br_startoff + | 891 | map_start_fsb = imap[nimaps].br_startoff + |
887 | imap[nimaps].br_blockcount; | 892 | imap[nimaps].br_blockcount; |
888 | map_start_fsb = offset_fsb; | ||
889 | } | 893 | } |
890 | 894 | ||
891 | trans_cancel: | 895 | trans_cancel: |
@@ -899,7 +903,7 @@ error0: | |||
899 | int | 903 | int |
900 | xfs_iomap_write_unwritten( | 904 | xfs_iomap_write_unwritten( |
901 | xfs_inode_t *ip, | 905 | xfs_inode_t *ip, |
902 | loff_t offset, | 906 | xfs_off_t offset, |
903 | size_t count) | 907 | size_t count) |
904 | { | 908 | { |
905 | xfs_mount_t *mp = ip->i_mount; | 909 | xfs_mount_t *mp = ip->i_mount; |