diff options
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 3f2b9f2a7b94..bf57b75acb90 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -451,19 +451,14 @@ xfs_iomap_write_direct( | |||
451 | return XFS_ERROR(error); | 451 | return XFS_ERROR(error); |
452 | 452 | ||
453 | rt = XFS_IS_REALTIME_INODE(ip); | 453 | rt = XFS_IS_REALTIME_INODE(ip); |
454 | if (unlikely(rt)) { | 454 | extsz = xfs_get_extsz_hint(ip); |
455 | if (!(extsz = ip->i_d.di_extsize)) | ||
456 | extsz = mp->m_sb.sb_rextsize; | ||
457 | } else { | ||
458 | extsz = ip->i_d.di_extsize; | ||
459 | } | ||
460 | 455 | ||
461 | isize = ip->i_size; | 456 | isize = ip->i_size; |
462 | if (io->io_new_size > isize) | 457 | if (io->io_new_size > isize) |
463 | isize = io->io_new_size; | 458 | isize = io->io_new_size; |
464 | 459 | ||
465 | offset_fsb = XFS_B_TO_FSBT(mp, offset); | 460 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
466 | last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count))); | 461 | last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count))); |
467 | if ((offset + count) > isize) { | 462 | if ((offset + count) > isize) { |
468 | error = xfs_iomap_eof_align_last_fsb(mp, io, isize, extsz, | 463 | error = xfs_iomap_eof_align_last_fsb(mp, io, isize, extsz, |
469 | &last_fsb); | 464 | &last_fsb); |
@@ -489,13 +484,13 @@ xfs_iomap_write_direct( | |||
489 | if (unlikely(rt)) { | 484 | if (unlikely(rt)) { |
490 | resrtextents = qblocks = resaligned; | 485 | resrtextents = qblocks = resaligned; |
491 | resrtextents /= mp->m_sb.sb_rextsize; | 486 | resrtextents /= mp->m_sb.sb_rextsize; |
492 | resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0); | 487 | resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0); |
493 | quota_flag = XFS_QMOPT_RES_RTBLKS; | 488 | quota_flag = XFS_QMOPT_RES_RTBLKS; |
494 | } else { | 489 | } else { |
495 | resrtextents = 0; | 490 | resrtextents = 0; |
496 | resblks = qblocks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned); | 491 | resblks = qblocks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned); |
497 | quota_flag = XFS_QMOPT_RES_REGBLKS; | 492 | quota_flag = XFS_QMOPT_RES_REGBLKS; |
498 | } | 493 | } |
499 | 494 | ||
500 | /* | 495 | /* |
501 | * Allocate and setup the transaction | 496 | * Allocate and setup the transaction |
@@ -666,13 +661,7 @@ xfs_iomap_write_delay( | |||
666 | if (error) | 661 | if (error) |
667 | return XFS_ERROR(error); | 662 | return XFS_ERROR(error); |
668 | 663 | ||
669 | if (XFS_IS_REALTIME_INODE(ip)) { | 664 | extsz = xfs_get_extsz_hint(ip); |
670 | if (!(extsz = ip->i_d.di_extsize)) | ||
671 | extsz = mp->m_sb.sb_rextsize; | ||
672 | } else { | ||
673 | extsz = ip->i_d.di_extsize; | ||
674 | } | ||
675 | |||
676 | offset_fsb = XFS_B_TO_FSBT(mp, offset); | 665 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
677 | 666 | ||
678 | retry: | 667 | retry: |
@@ -788,18 +777,12 @@ xfs_iomap_write_allocate( | |||
788 | nimaps = 0; | 777 | nimaps = 0; |
789 | while (nimaps == 0) { | 778 | while (nimaps == 0) { |
790 | tp = xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE); | 779 | tp = xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE); |
780 | tp->t_flags |= XFS_TRANS_RESERVE; | ||
791 | nres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK); | 781 | nres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK); |
792 | error = xfs_trans_reserve(tp, nres, | 782 | error = xfs_trans_reserve(tp, nres, |
793 | XFS_WRITE_LOG_RES(mp), | 783 | XFS_WRITE_LOG_RES(mp), |
794 | 0, XFS_TRANS_PERM_LOG_RES, | 784 | 0, XFS_TRANS_PERM_LOG_RES, |
795 | XFS_WRITE_LOG_COUNT); | 785 | XFS_WRITE_LOG_COUNT); |
796 | if (error == ENOSPC) { | ||
797 | error = xfs_trans_reserve(tp, 0, | ||
798 | XFS_WRITE_LOG_RES(mp), | ||
799 | 0, | ||
800 | XFS_TRANS_PERM_LOG_RES, | ||
801 | XFS_WRITE_LOG_COUNT); | ||
802 | } | ||
803 | if (error) { | 786 | if (error) { |
804 | xfs_trans_cancel(tp, 0); | 787 | xfs_trans_cancel(tp, 0); |
805 | return XFS_ERROR(error); | 788 | return XFS_ERROR(error); |
@@ -917,8 +900,8 @@ xfs_iomap_write_unwritten( | |||
917 | * from unwritten to real. Do allocations in a loop until | 900 | * from unwritten to real. Do allocations in a loop until |
918 | * we have covered the range passed in. | 901 | * we have covered the range passed in. |
919 | */ | 902 | */ |
920 | |||
921 | tp = xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE); | 903 | tp = xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE); |
904 | tp->t_flags |= XFS_TRANS_RESERVE; | ||
922 | error = xfs_trans_reserve(tp, resblks, | 905 | error = xfs_trans_reserve(tp, resblks, |
923 | XFS_WRITE_LOG_RES(mp), 0, | 906 | XFS_WRITE_LOG_RES(mp), 0, |
924 | XFS_TRANS_PERM_LOG_RES, | 907 | XFS_TRANS_PERM_LOG_RES, |