aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iomap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r--fs/xfs/xfs_iomap.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 9afa282aa937..246c7d57c6f9 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -57,26 +57,26 @@ xfs_iomap_eof_align_last_fsb(
57 xfs_fileoff_t *last_fsb) 57 xfs_fileoff_t *last_fsb)
58{ 58{
59 xfs_fileoff_t new_last_fsb = 0; 59 xfs_fileoff_t new_last_fsb = 0;
60 xfs_extlen_t align; 60 xfs_extlen_t align = 0;
61 int eof, error; 61 int eof, error;
62 62
63 if (XFS_IS_REALTIME_INODE(ip)) 63 if (!XFS_IS_REALTIME_INODE(ip)) {
64 ; 64 /*
65 /* 65 * Round up the allocation request to a stripe unit
66 * If mounted with the "-o swalloc" option, roundup the allocation 66 * (m_dalign) boundary if the file size is >= stripe unit
67 * request to a stripe width boundary if the file size is >= 67 * size, and we are allocating past the allocation eof.
68 * stripe width and we are allocating past the allocation eof. 68 *
69 */ 69 * If mounted with the "-o swalloc" option the alignment is
70 else if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC) && 70 * increased from the strip unit size to the stripe width.
71 (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_swidth))) 71 */
72 new_last_fsb = roundup_64(*last_fsb, mp->m_swidth); 72 if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
73 /* 73 align = mp->m_swidth;
74 * Roundup the allocation request to a stripe unit (m_dalign) boundary 74 else if (mp->m_dalign)
75 * if the file size is >= stripe unit size, and we are allocating past 75 align = mp->m_dalign;
76 * the allocation eof. 76
77 */ 77 if (align && XFS_ISIZE(ip) >= XFS_FSB_TO_B(mp, align))
78 else if (mp->m_dalign && (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_dalign))) 78 new_last_fsb = roundup_64(*last_fsb, align);
79 new_last_fsb = roundup_64(*last_fsb, mp->m_dalign); 79 }
80 80
81 /* 81 /*
82 * Always round up the allocation request to an extent boundary 82 * Always round up the allocation request to an extent boundary
@@ -154,7 +154,7 @@ xfs_iomap_write_direct(
154 154
155 offset_fsb = XFS_B_TO_FSBT(mp, offset); 155 offset_fsb = XFS_B_TO_FSBT(mp, offset);
156 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count))); 156 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count)));
157 if ((offset + count) > ip->i_size) { 157 if ((offset + count) > XFS_ISIZE(ip)) {
158 error = xfs_iomap_eof_align_last_fsb(mp, ip, extsz, &last_fsb); 158 error = xfs_iomap_eof_align_last_fsb(mp, ip, extsz, &last_fsb);
159 if (error) 159 if (error)
160 goto error_out; 160 goto error_out;
@@ -211,7 +211,7 @@ xfs_iomap_write_direct(
211 xfs_trans_ijoin(tp, ip, 0); 211 xfs_trans_ijoin(tp, ip, 0);
212 212
213 bmapi_flag = 0; 213 bmapi_flag = 0;
214 if (offset < ip->i_size || extsz) 214 if (offset < XFS_ISIZE(ip) || extsz)
215 bmapi_flag |= XFS_BMAPI_PREALLOC; 215 bmapi_flag |= XFS_BMAPI_PREALLOC;
216 216
217 /* 217 /*
@@ -286,7 +286,7 @@ xfs_iomap_eof_want_preallocate(
286 int found_delalloc = 0; 286 int found_delalloc = 0;
287 287
288 *prealloc = 0; 288 *prealloc = 0;
289 if ((offset + count) <= ip->i_size) 289 if (offset + count <= XFS_ISIZE(ip))
290 return 0; 290 return 0;
291 291
292 /* 292 /*
@@ -340,7 +340,7 @@ xfs_iomap_prealloc_size(
340 * if we pass in alloc_blocks = 0. Hence the "+ 1" to 340 * if we pass in alloc_blocks = 0. Hence the "+ 1" to
341 * ensure we always pass in a non-zero value. 341 * ensure we always pass in a non-zero value.
342 */ 342 */
343 alloc_blocks = XFS_B_TO_FSB(mp, ip->i_size) + 1; 343 alloc_blocks = XFS_B_TO_FSB(mp, XFS_ISIZE(ip)) + 1;
344 alloc_blocks = XFS_FILEOFF_MIN(MAXEXTLEN, 344 alloc_blocks = XFS_FILEOFF_MIN(MAXEXTLEN,
345 rounddown_pow_of_two(alloc_blocks)); 345 rounddown_pow_of_two(alloc_blocks));
346 346
@@ -564,7 +564,7 @@ xfs_iomap_write_allocate(
564 * back.... 564 * back....
565 */ 565 */
566 nimaps = 1; 566 nimaps = 1;
567 end_fsb = XFS_B_TO_FSB(mp, ip->i_size); 567 end_fsb = XFS_B_TO_FSB(mp, XFS_ISIZE(ip));
568 error = xfs_bmap_last_offset(NULL, ip, &last_block, 568 error = xfs_bmap_last_offset(NULL, ip, &last_block,
569 XFS_DATA_FORK); 569 XFS_DATA_FORK);
570 if (error) 570 if (error)