diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_lrw.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 0abc7d0586c9..459d36480b16 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -58,14 +58,12 @@ | |||
58 | void | 58 | void |
59 | xfs_rw_enter_trace( | 59 | xfs_rw_enter_trace( |
60 | int tag, | 60 | int tag, |
61 | xfs_iocore_t *io, | 61 | xfs_inode_t *ip, |
62 | void *data, | 62 | void *data, |
63 | size_t segs, | 63 | size_t segs, |
64 | loff_t offset, | 64 | loff_t offset, |
65 | int ioflags) | 65 | int ioflags) |
66 | { | 66 | { |
67 | xfs_inode_t *ip = XFS_IO_INODE(io); | ||
68 | |||
69 | if (ip->i_rwtrace == NULL) | 67 | if (ip->i_rwtrace == NULL) |
70 | return; | 68 | return; |
71 | ktrace_enter(ip->i_rwtrace, | 69 | ktrace_enter(ip->i_rwtrace, |
@@ -78,8 +76,8 @@ xfs_rw_enter_trace( | |||
78 | (void *)((unsigned long)((offset >> 32) & 0xffffffff)), | 76 | (void *)((unsigned long)((offset >> 32) & 0xffffffff)), |
79 | (void *)((unsigned long)(offset & 0xffffffff)), | 77 | (void *)((unsigned long)(offset & 0xffffffff)), |
80 | (void *)((unsigned long)ioflags), | 78 | (void *)((unsigned long)ioflags), |
81 | (void *)((unsigned long)((io->io_new_size >> 32) & 0xffffffff)), | 79 | (void *)((unsigned long)((ip->i_new_size >> 32) & 0xffffffff)), |
82 | (void *)((unsigned long)(io->io_new_size & 0xffffffff)), | 80 | (void *)((unsigned long)(ip->i_new_size & 0xffffffff)), |
83 | (void *)((unsigned long)current_pid()), | 81 | (void *)((unsigned long)current_pid()), |
84 | (void *)NULL, | 82 | (void *)NULL, |
85 | (void *)NULL, | 83 | (void *)NULL, |
@@ -89,13 +87,12 @@ xfs_rw_enter_trace( | |||
89 | 87 | ||
90 | void | 88 | void |
91 | xfs_inval_cached_trace( | 89 | xfs_inval_cached_trace( |
92 | xfs_iocore_t *io, | 90 | xfs_inode_t *ip, |
93 | xfs_off_t offset, | 91 | xfs_off_t offset, |
94 | xfs_off_t len, | 92 | xfs_off_t len, |
95 | xfs_off_t first, | 93 | xfs_off_t first, |
96 | xfs_off_t last) | 94 | xfs_off_t last) |
97 | { | 95 | { |
98 | xfs_inode_t *ip = XFS_IO_INODE(io); | ||
99 | 96 | ||
100 | if (ip->i_rwtrace == NULL) | 97 | if (ip->i_rwtrace == NULL) |
101 | return; | 98 | return; |
@@ -256,7 +253,7 @@ xfs_read( | |||
256 | } | 253 | } |
257 | } | 254 | } |
258 | 255 | ||
259 | xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, | 256 | xfs_rw_enter_trace(XFS_READ_ENTER, ip, |
260 | (void *)iovp, segs, *offset, ioflags); | 257 | (void *)iovp, segs, *offset, ioflags); |
261 | 258 | ||
262 | iocb->ki_pos = *offset; | 259 | iocb->ki_pos = *offset; |
@@ -301,7 +298,7 @@ xfs_splice_read( | |||
301 | return -error; | 298 | return -error; |
302 | } | 299 | } |
303 | } | 300 | } |
304 | xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, &ip->i_iocore, | 301 | xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, ip, |
305 | pipe, count, *ppos, ioflags); | 302 | pipe, count, *ppos, ioflags); |
306 | ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); | 303 | ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); |
307 | if (ret > 0) | 304 | if (ret > 0) |
@@ -323,7 +320,6 @@ xfs_splice_write( | |||
323 | { | 320 | { |
324 | bhv_vnode_t *vp = XFS_ITOV(ip); | 321 | bhv_vnode_t *vp = XFS_ITOV(ip); |
325 | xfs_mount_t *mp = ip->i_mount; | 322 | xfs_mount_t *mp = ip->i_mount; |
326 | xfs_iocore_t *io = &ip->i_iocore; | ||
327 | ssize_t ret; | 323 | ssize_t ret; |
328 | struct inode *inode = outfilp->f_mapping->host; | 324 | struct inode *inode = outfilp->f_mapping->host; |
329 | xfs_fsize_t isize, new_size; | 325 | xfs_fsize_t isize, new_size; |
@@ -350,10 +346,10 @@ xfs_splice_write( | |||
350 | 346 | ||
351 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 347 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
352 | if (new_size > ip->i_size) | 348 | if (new_size > ip->i_size) |
353 | io->io_new_size = new_size; | 349 | ip->i_new_size = new_size; |
354 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 350 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
355 | 351 | ||
356 | xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, &ip->i_iocore, | 352 | xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, ip, |
357 | pipe, count, *ppos, ioflags); | 353 | pipe, count, *ppos, ioflags); |
358 | ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags); | 354 | ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags); |
359 | if (ret > 0) | 355 | if (ret > 0) |
@@ -370,9 +366,9 @@ xfs_splice_write( | |||
370 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 366 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
371 | } | 367 | } |
372 | 368 | ||
373 | if (io->io_new_size) { | 369 | if (ip->i_new_size) { |
374 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 370 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
375 | io->io_new_size = 0; | 371 | ip->i_new_size = 0; |
376 | if (ip->i_d.di_size > ip->i_size) | 372 | if (ip->i_d.di_size > ip->i_size) |
377 | ip->i_d.di_size = ip->i_size; | 373 | ip->i_d.di_size = ip->i_size; |
378 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 374 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
@@ -461,20 +457,19 @@ xfs_zero_eof( | |||
461 | xfs_off_t offset, /* starting I/O offset */ | 457 | xfs_off_t offset, /* starting I/O offset */ |
462 | xfs_fsize_t isize) /* current inode size */ | 458 | xfs_fsize_t isize) /* current inode size */ |
463 | { | 459 | { |
464 | xfs_iocore_t *io = &ip->i_iocore; | 460 | xfs_mount_t *mp = ip->i_mount; |
465 | xfs_fileoff_t start_zero_fsb; | 461 | xfs_fileoff_t start_zero_fsb; |
466 | xfs_fileoff_t end_zero_fsb; | 462 | xfs_fileoff_t end_zero_fsb; |
467 | xfs_fileoff_t zero_count_fsb; | 463 | xfs_fileoff_t zero_count_fsb; |
468 | xfs_fileoff_t last_fsb; | 464 | xfs_fileoff_t last_fsb; |
469 | xfs_fileoff_t zero_off; | 465 | xfs_fileoff_t zero_off; |
470 | xfs_fsize_t zero_len; | 466 | xfs_fsize_t zero_len; |
471 | xfs_mount_t *mp = io->io_mount; | ||
472 | int nimaps; | 467 | int nimaps; |
473 | int error = 0; | 468 | int error = 0; |
474 | xfs_bmbt_irec_t imap; | 469 | xfs_bmbt_irec_t imap; |
475 | 470 | ||
476 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 471 | ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE)); |
477 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 472 | ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE)); |
478 | ASSERT(offset > isize); | 473 | ASSERT(offset > isize); |
479 | 474 | ||
480 | /* | 475 | /* |
@@ -483,8 +478,8 @@ xfs_zero_eof( | |||
483 | */ | 478 | */ |
484 | error = xfs_zero_last_block(ip, offset, isize); | 479 | error = xfs_zero_last_block(ip, offset, isize); |
485 | if (error) { | 480 | if (error) { |
486 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 481 | ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE)); |
487 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 482 | ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE)); |
488 | return error; | 483 | return error; |
489 | } | 484 | } |
490 | 485 | ||
@@ -515,8 +510,8 @@ xfs_zero_eof( | |||
515 | error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb, | 510 | error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb, |
516 | 0, NULL, 0, &imap, &nimaps, NULL, NULL); | 511 | 0, NULL, 0, &imap, &nimaps, NULL, NULL); |
517 | if (error) { | 512 | if (error) { |
518 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 513 | ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE)); |
519 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 514 | ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE)); |
520 | return error; | 515 | return error; |
521 | } | 516 | } |
522 | ASSERT(nimaps > 0); | 517 | ASSERT(nimaps > 0); |
@@ -584,7 +579,6 @@ xfs_write( | |||
584 | xfs_mount_t *mp; | 579 | xfs_mount_t *mp; |
585 | ssize_t ret = 0, error = 0; | 580 | ssize_t ret = 0, error = 0; |
586 | xfs_fsize_t isize, new_size; | 581 | xfs_fsize_t isize, new_size; |
587 | xfs_iocore_t *io; | ||
588 | int iolock; | 582 | int iolock; |
589 | int eventsent = 0; | 583 | int eventsent = 0; |
590 | bhv_vrwlock_t locktype; | 584 | bhv_vrwlock_t locktype; |
@@ -604,8 +598,7 @@ xfs_write( | |||
604 | if (count == 0) | 598 | if (count == 0) |
605 | return 0; | 599 | return 0; |
606 | 600 | ||
607 | io = &xip->i_iocore; | 601 | mp = xip->i_mount; |
608 | mp = io->io_mount; | ||
609 | 602 | ||
610 | xfs_wait_for_freeze(mp, SB_FREEZE_WRITE); | 603 | xfs_wait_for_freeze(mp, SB_FREEZE_WRITE); |
611 | 604 | ||
@@ -685,7 +678,7 @@ start: | |||
685 | 678 | ||
686 | new_size = pos + count; | 679 | new_size = pos + count; |
687 | if (new_size > xip->i_size) | 680 | if (new_size > xip->i_size) |
688 | io->io_new_size = new_size; | 681 | xip->i_new_size = new_size; |
689 | 682 | ||
690 | if (likely(!(ioflags & IO_INVIS))) { | 683 | if (likely(!(ioflags & IO_INVIS))) { |
691 | file_update_time(file); | 684 | file_update_time(file); |
@@ -737,7 +730,7 @@ retry: | |||
737 | if ((ioflags & IO_ISDIRECT)) { | 730 | if ((ioflags & IO_ISDIRECT)) { |
738 | if (VN_CACHED(vp)) { | 731 | if (VN_CACHED(vp)) { |
739 | WARN_ON(need_i_mutex == 0); | 732 | WARN_ON(need_i_mutex == 0); |
740 | xfs_inval_cached_trace(io, pos, -1, | 733 | xfs_inval_cached_trace(xip, pos, -1, |
741 | ctooff(offtoct(pos)), -1); | 734 | ctooff(offtoct(pos)), -1); |
742 | error = xfs_flushinval_pages(xip, | 735 | error = xfs_flushinval_pages(xip, |
743 | ctooff(offtoct(pos)), | 736 | ctooff(offtoct(pos)), |
@@ -756,7 +749,7 @@ retry: | |||
756 | need_i_mutex = 0; | 749 | need_i_mutex = 0; |
757 | } | 750 | } |
758 | 751 | ||
759 | xfs_rw_enter_trace(XFS_DIOWR_ENTER, io, (void *)iovp, segs, | 752 | xfs_rw_enter_trace(XFS_DIOWR_ENTER, xip, (void *)iovp, segs, |
760 | *offset, ioflags); | 753 | *offset, ioflags); |
761 | ret = generic_file_direct_write(iocb, iovp, | 754 | ret = generic_file_direct_write(iocb, iovp, |
762 | &segs, pos, offset, count, ocount); | 755 | &segs, pos, offset, count, ocount); |
@@ -776,7 +769,7 @@ retry: | |||
776 | goto relock; | 769 | goto relock; |
777 | } | 770 | } |
778 | } else { | 771 | } else { |
779 | xfs_rw_enter_trace(XFS_WRITE_ENTER, io, (void *)iovp, segs, | 772 | xfs_rw_enter_trace(XFS_WRITE_ENTER, xip, (void *)iovp, segs, |
780 | *offset, ioflags); | 773 | *offset, ioflags); |
781 | ret = generic_file_buffered_write(iocb, iovp, segs, | 774 | ret = generic_file_buffered_write(iocb, iovp, segs, |
782 | pos, offset, count, ret); | 775 | pos, offset, count, ret); |
@@ -840,9 +833,9 @@ retry: | |||
840 | } | 833 | } |
841 | 834 | ||
842 | out_unlock_internal: | 835 | out_unlock_internal: |
843 | if (io->io_new_size) { | 836 | if (xip->i_new_size) { |
844 | xfs_ilock(xip, XFS_ILOCK_EXCL); | 837 | xfs_ilock(xip, XFS_ILOCK_EXCL); |
845 | io->io_new_size = 0; | 838 | xip->i_new_size = 0; |
846 | /* | 839 | /* |
847 | * If this was a direct or synchronous I/O that failed (such | 840 | * If this was a direct or synchronous I/O that failed (such |
848 | * as ENOSPC) then part of the I/O may have been written to | 841 | * as ENOSPC) then part of the I/O may have been written to |