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.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 091d82b94c4d..9afa282aa937 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -208,22 +208,20 @@ xfs_iomap_write_direct(
208 if (error) 208 if (error)
209 goto error1; 209 goto error1;
210 210
211 xfs_trans_ijoin(tp, ip); 211 xfs_trans_ijoin(tp, ip, 0);
212 212
213 bmapi_flag = XFS_BMAPI_WRITE; 213 bmapi_flag = 0;
214 if (offset < ip->i_size || extsz) 214 if (offset < ip->i_size || extsz)
215 bmapi_flag |= XFS_BMAPI_PREALLOC; 215 bmapi_flag |= XFS_BMAPI_PREALLOC;
216 216
217 /* 217 /*
218 * Issue the xfs_bmapi() call to allocate the blocks.
219 *
220 * From this point onwards we overwrite the imap pointer that the 218 * From this point onwards we overwrite the imap pointer that the
221 * caller gave to us. 219 * caller gave to us.
222 */ 220 */
223 xfs_bmap_init(&free_list, &firstfsb); 221 xfs_bmap_init(&free_list, &firstfsb);
224 nimaps = 1; 222 nimaps = 1;
225 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, bmapi_flag, 223 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, bmapi_flag,
226 &firstfsb, 0, imap, &nimaps, &free_list); 224 &firstfsb, 0, imap, &nimaps, &free_list);
227 if (error) 225 if (error)
228 goto error0; 226 goto error0;
229 227
@@ -300,8 +298,8 @@ xfs_iomap_eof_want_preallocate(
300 while (count_fsb > 0) { 298 while (count_fsb > 0) {
301 imaps = nimaps; 299 imaps = nimaps;
302 firstblock = NULLFSBLOCK; 300 firstblock = NULLFSBLOCK;
303 error = xfs_bmapi(NULL, ip, start_fsb, count_fsb, 0, 301 error = xfs_bmapi_read(ip, start_fsb, count_fsb, imap, &imaps,
304 &firstblock, 0, imap, &imaps, NULL); 302 0);
305 if (error) 303 if (error)
306 return error; 304 return error;
307 for (n = 0; n < imaps; n++) { 305 for (n = 0; n < imaps; n++) {
@@ -381,7 +379,6 @@ xfs_iomap_write_delay(
381 xfs_fileoff_t last_fsb; 379 xfs_fileoff_t last_fsb;
382 xfs_off_t aligned_offset; 380 xfs_off_t aligned_offset;
383 xfs_fileoff_t ioalign; 381 xfs_fileoff_t ioalign;
384 xfs_fsblock_t firstblock;
385 xfs_extlen_t extsz; 382 xfs_extlen_t extsz;
386 int nimaps; 383 int nimaps;
387 xfs_bmbt_irec_t imap[XFS_WRITE_IMAPS]; 384 xfs_bmbt_irec_t imap[XFS_WRITE_IMAPS];
@@ -425,12 +422,8 @@ retry:
425 } 422 }
426 423
427 nimaps = XFS_WRITE_IMAPS; 424 nimaps = XFS_WRITE_IMAPS;
428 firstblock = NULLFSBLOCK; 425 error = xfs_bmapi_delay(ip, offset_fsb, last_fsb - offset_fsb,
429 error = xfs_bmapi(NULL, ip, offset_fsb, 426 imap, &nimaps, XFS_BMAPI_ENTIRE);
430 (xfs_filblks_t)(last_fsb - offset_fsb),
431 XFS_BMAPI_DELAY | XFS_BMAPI_WRITE |
432 XFS_BMAPI_ENTIRE, &firstblock, 1, imap,
433 &nimaps, NULL);
434 switch (error) { 427 switch (error) {
435 case 0: 428 case 0:
436 case ENOSPC: 429 case ENOSPC:
@@ -535,7 +528,7 @@ xfs_iomap_write_allocate(
535 return XFS_ERROR(error); 528 return XFS_ERROR(error);
536 } 529 }
537 xfs_ilock(ip, XFS_ILOCK_EXCL); 530 xfs_ilock(ip, XFS_ILOCK_EXCL);
538 xfs_trans_ijoin(tp, ip); 531 xfs_trans_ijoin(tp, ip, 0);
539 532
540 xfs_bmap_init(&free_list, &first_block); 533 xfs_bmap_init(&free_list, &first_block);
541 534
@@ -587,14 +580,12 @@ xfs_iomap_write_allocate(
587 } 580 }
588 581
589 /* 582 /*
590 * Go get the actual blocks.
591 *
592 * From this point onwards we overwrite the imap 583 * From this point onwards we overwrite the imap
593 * pointer that the caller gave to us. 584 * pointer that the caller gave to us.
594 */ 585 */
595 error = xfs_bmapi(tp, ip, map_start_fsb, count_fsb, 586 error = xfs_bmapi_write(tp, ip, map_start_fsb,
596 XFS_BMAPI_WRITE, &first_block, 1, 587 count_fsb, 0, &first_block, 1,
597 imap, &nimaps, &free_list); 588 imap, &nimaps, &free_list);
598 if (error) 589 if (error)
599 goto trans_cancel; 590 goto trans_cancel;
600 591
@@ -701,15 +692,15 @@ xfs_iomap_write_unwritten(
701 } 692 }
702 693
703 xfs_ilock(ip, XFS_ILOCK_EXCL); 694 xfs_ilock(ip, XFS_ILOCK_EXCL);
704 xfs_trans_ijoin(tp, ip); 695 xfs_trans_ijoin(tp, ip, 0);
705 696
706 /* 697 /*
707 * Modify the unwritten extent state of the buffer. 698 * Modify the unwritten extent state of the buffer.
708 */ 699 */
709 xfs_bmap_init(&free_list, &firstfsb); 700 xfs_bmap_init(&free_list, &firstfsb);
710 nimaps = 1; 701 nimaps = 1;
711 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, 702 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
712 XFS_BMAPI_WRITE|XFS_BMAPI_CONVERT, &firstfsb, 703 XFS_BMAPI_CONVERT, &firstfsb,
713 1, &imap, &nimaps, &free_list); 704 1, &imap, &nimaps, &free_list);
714 if (error) 705 if (error)
715 goto error_on_bmapi_transaction; 706 goto error_on_bmapi_transaction;