diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_lrw.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 122 |
1 files changed, 46 insertions, 76 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 6f614f35f650..166353388490 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; |
@@ -131,7 +128,7 @@ xfs_inval_cached_trace( | |||
131 | */ | 128 | */ |
132 | STATIC int | 129 | STATIC int |
133 | xfs_iozero( | 130 | xfs_iozero( |
134 | struct inode *ip, /* inode */ | 131 | struct xfs_inode *ip, /* inode */ |
135 | loff_t pos, /* offset in file */ | 132 | loff_t pos, /* offset in file */ |
136 | size_t count) /* size of data to zero */ | 133 | size_t count) /* size of data to zero */ |
137 | { | 134 | { |
@@ -139,7 +136,7 @@ xfs_iozero( | |||
139 | struct address_space *mapping; | 136 | struct address_space *mapping; |
140 | int status; | 137 | int status; |
141 | 138 | ||
142 | mapping = ip->i_mapping; | 139 | mapping = ip->i_vnode->i_mapping; |
143 | do { | 140 | do { |
144 | unsigned offset, bytes; | 141 | unsigned offset, bytes; |
145 | void *fsdata; | 142 | void *fsdata; |
@@ -205,7 +202,7 @@ xfs_read( | |||
205 | 202 | ||
206 | if (unlikely(ioflags & IO_ISDIRECT)) { | 203 | if (unlikely(ioflags & IO_ISDIRECT)) { |
207 | xfs_buftarg_t *target = | 204 | xfs_buftarg_t *target = |
208 | (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? | 205 | XFS_IS_REALTIME_INODE(ip) ? |
209 | mp->m_rtdev_targp : mp->m_ddev_targp; | 206 | mp->m_rtdev_targp : mp->m_ddev_targp; |
210 | if ((*offset & target->bt_smask) || | 207 | if ((*offset & target->bt_smask) || |
211 | (size & target->bt_smask)) { | 208 | (size & target->bt_smask)) { |
@@ -246,9 +243,8 @@ xfs_read( | |||
246 | 243 | ||
247 | if (unlikely(ioflags & IO_ISDIRECT)) { | 244 | if (unlikely(ioflags & IO_ISDIRECT)) { |
248 | if (VN_CACHED(vp)) | 245 | if (VN_CACHED(vp)) |
249 | ret = xfs_flushinval_pages(ip, | 246 | ret = xfs_flushinval_pages(ip, (*offset & PAGE_CACHE_MASK), |
250 | ctooff(offtoct(*offset)), | 247 | -1, FI_REMAPF_LOCKED); |
251 | -1, FI_REMAPF_LOCKED); | ||
252 | mutex_unlock(&inode->i_mutex); | 248 | mutex_unlock(&inode->i_mutex); |
253 | if (ret) { | 249 | if (ret) { |
254 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | 250 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); |
@@ -256,7 +252,7 @@ xfs_read( | |||
256 | } | 252 | } |
257 | } | 253 | } |
258 | 254 | ||
259 | xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, | 255 | xfs_rw_enter_trace(XFS_READ_ENTER, ip, |
260 | (void *)iovp, segs, *offset, ioflags); | 256 | (void *)iovp, segs, *offset, ioflags); |
261 | 257 | ||
262 | iocb->ki_pos = *offset; | 258 | iocb->ki_pos = *offset; |
@@ -301,7 +297,7 @@ xfs_splice_read( | |||
301 | return -error; | 297 | return -error; |
302 | } | 298 | } |
303 | } | 299 | } |
304 | xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, &ip->i_iocore, | 300 | xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, ip, |
305 | pipe, count, *ppos, ioflags); | 301 | pipe, count, *ppos, ioflags); |
306 | ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); | 302 | ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); |
307 | if (ret > 0) | 303 | if (ret > 0) |
@@ -323,7 +319,6 @@ xfs_splice_write( | |||
323 | { | 319 | { |
324 | bhv_vnode_t *vp = XFS_ITOV(ip); | 320 | bhv_vnode_t *vp = XFS_ITOV(ip); |
325 | xfs_mount_t *mp = ip->i_mount; | 321 | xfs_mount_t *mp = ip->i_mount; |
326 | xfs_iocore_t *io = &ip->i_iocore; | ||
327 | ssize_t ret; | 322 | ssize_t ret; |
328 | struct inode *inode = outfilp->f_mapping->host; | 323 | struct inode *inode = outfilp->f_mapping->host; |
329 | xfs_fsize_t isize, new_size; | 324 | xfs_fsize_t isize, new_size; |
@@ -350,10 +345,10 @@ xfs_splice_write( | |||
350 | 345 | ||
351 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 346 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
352 | if (new_size > ip->i_size) | 347 | if (new_size > ip->i_size) |
353 | io->io_new_size = new_size; | 348 | ip->i_new_size = new_size; |
354 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 349 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
355 | 350 | ||
356 | xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, &ip->i_iocore, | 351 | xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, ip, |
357 | pipe, count, *ppos, ioflags); | 352 | pipe, count, *ppos, ioflags); |
358 | ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags); | 353 | ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags); |
359 | if (ret > 0) | 354 | if (ret > 0) |
@@ -370,9 +365,9 @@ xfs_splice_write( | |||
370 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 365 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
371 | } | 366 | } |
372 | 367 | ||
373 | if (io->io_new_size) { | 368 | if (ip->i_new_size) { |
374 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 369 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
375 | io->io_new_size = 0; | 370 | ip->i_new_size = 0; |
376 | if (ip->i_d.di_size > ip->i_size) | 371 | if (ip->i_d.di_size > ip->i_size) |
377 | ip->i_d.di_size = ip->i_size; | 372 | ip->i_d.di_size = ip->i_size; |
378 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 373 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
@@ -389,20 +384,19 @@ xfs_splice_write( | |||
389 | */ | 384 | */ |
390 | STATIC int /* error (positive) */ | 385 | STATIC int /* error (positive) */ |
391 | xfs_zero_last_block( | 386 | xfs_zero_last_block( |
392 | struct inode *ip, | 387 | xfs_inode_t *ip, |
393 | xfs_iocore_t *io, | ||
394 | xfs_fsize_t offset, | 388 | xfs_fsize_t offset, |
395 | xfs_fsize_t isize) | 389 | xfs_fsize_t isize) |
396 | { | 390 | { |
397 | xfs_fileoff_t last_fsb; | 391 | xfs_fileoff_t last_fsb; |
398 | xfs_mount_t *mp = io->io_mount; | 392 | xfs_mount_t *mp = ip->i_mount; |
399 | int nimaps; | 393 | int nimaps; |
400 | int zero_offset; | 394 | int zero_offset; |
401 | int zero_len; | 395 | int zero_len; |
402 | int error = 0; | 396 | int error = 0; |
403 | xfs_bmbt_irec_t imap; | 397 | xfs_bmbt_irec_t imap; |
404 | 398 | ||
405 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0); | 399 | ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE) != 0); |
406 | 400 | ||
407 | zero_offset = XFS_B_FSB_OFFSET(mp, isize); | 401 | zero_offset = XFS_B_FSB_OFFSET(mp, isize); |
408 | if (zero_offset == 0) { | 402 | if (zero_offset == 0) { |
@@ -415,7 +409,7 @@ xfs_zero_last_block( | |||
415 | 409 | ||
416 | last_fsb = XFS_B_TO_FSBT(mp, isize); | 410 | last_fsb = XFS_B_TO_FSBT(mp, isize); |
417 | nimaps = 1; | 411 | nimaps = 1; |
418 | error = XFS_BMAPI(mp, NULL, io, last_fsb, 1, 0, NULL, 0, &imap, | 412 | error = xfs_bmapi(NULL, ip, last_fsb, 1, 0, NULL, 0, &imap, |
419 | &nimaps, NULL, NULL); | 413 | &nimaps, NULL, NULL); |
420 | if (error) { | 414 | if (error) { |
421 | return error; | 415 | return error; |
@@ -433,14 +427,14 @@ xfs_zero_last_block( | |||
433 | * out sync. We need to drop the ilock while we do this so we | 427 | * out sync. We need to drop the ilock while we do this so we |
434 | * don't deadlock when the buffer cache calls back to us. | 428 | * don't deadlock when the buffer cache calls back to us. |
435 | */ | 429 | */ |
436 | XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD); | 430 | xfs_iunlock(ip, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD); |
437 | 431 | ||
438 | zero_len = mp->m_sb.sb_blocksize - zero_offset; | 432 | zero_len = mp->m_sb.sb_blocksize - zero_offset; |
439 | if (isize + zero_len > offset) | 433 | if (isize + zero_len > offset) |
440 | zero_len = offset - isize; | 434 | zero_len = offset - isize; |
441 | error = xfs_iozero(ip, isize, zero_len); | 435 | error = xfs_iozero(ip, isize, zero_len); |
442 | 436 | ||
443 | XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); | 437 | xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); |
444 | ASSERT(error >= 0); | 438 | ASSERT(error >= 0); |
445 | return error; | 439 | return error; |
446 | } | 440 | } |
@@ -458,35 +452,33 @@ xfs_zero_last_block( | |||
458 | 452 | ||
459 | int /* error (positive) */ | 453 | int /* error (positive) */ |
460 | xfs_zero_eof( | 454 | xfs_zero_eof( |
461 | bhv_vnode_t *vp, | 455 | xfs_inode_t *ip, |
462 | xfs_iocore_t *io, | ||
463 | xfs_off_t offset, /* starting I/O offset */ | 456 | xfs_off_t offset, /* starting I/O offset */ |
464 | xfs_fsize_t isize) /* current inode size */ | 457 | xfs_fsize_t isize) /* current inode size */ |
465 | { | 458 | { |
466 | struct inode *ip = vn_to_inode(vp); | 459 | xfs_mount_t *mp = ip->i_mount; |
467 | xfs_fileoff_t start_zero_fsb; | 460 | xfs_fileoff_t start_zero_fsb; |
468 | xfs_fileoff_t end_zero_fsb; | 461 | xfs_fileoff_t end_zero_fsb; |
469 | xfs_fileoff_t zero_count_fsb; | 462 | xfs_fileoff_t zero_count_fsb; |
470 | xfs_fileoff_t last_fsb; | 463 | xfs_fileoff_t last_fsb; |
471 | xfs_fileoff_t zero_off; | 464 | xfs_fileoff_t zero_off; |
472 | xfs_fsize_t zero_len; | 465 | xfs_fsize_t zero_len; |
473 | xfs_mount_t *mp = io->io_mount; | ||
474 | int nimaps; | 466 | int nimaps; |
475 | int error = 0; | 467 | int error = 0; |
476 | xfs_bmbt_irec_t imap; | 468 | xfs_bmbt_irec_t imap; |
477 | 469 | ||
478 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 470 | ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE)); |
479 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 471 | ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE)); |
480 | ASSERT(offset > isize); | 472 | ASSERT(offset > isize); |
481 | 473 | ||
482 | /* | 474 | /* |
483 | * First handle zeroing the block on which isize resides. | 475 | * First handle zeroing the block on which isize resides. |
484 | * We only zero a part of that block so it is handled specially. | 476 | * We only zero a part of that block so it is handled specially. |
485 | */ | 477 | */ |
486 | error = xfs_zero_last_block(ip, io, offset, isize); | 478 | error = xfs_zero_last_block(ip, offset, isize); |
487 | if (error) { | 479 | if (error) { |
488 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 480 | ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE)); |
489 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 481 | ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE)); |
490 | return error; | 482 | return error; |
491 | } | 483 | } |
492 | 484 | ||
@@ -514,11 +506,11 @@ xfs_zero_eof( | |||
514 | while (start_zero_fsb <= end_zero_fsb) { | 506 | while (start_zero_fsb <= end_zero_fsb) { |
515 | nimaps = 1; | 507 | nimaps = 1; |
516 | zero_count_fsb = end_zero_fsb - start_zero_fsb + 1; | 508 | zero_count_fsb = end_zero_fsb - start_zero_fsb + 1; |
517 | error = XFS_BMAPI(mp, NULL, io, start_zero_fsb, zero_count_fsb, | 509 | error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb, |
518 | 0, NULL, 0, &imap, &nimaps, NULL, NULL); | 510 | 0, NULL, 0, &imap, &nimaps, NULL, NULL); |
519 | if (error) { | 511 | if (error) { |
520 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 512 | ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE)); |
521 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 513 | ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE)); |
522 | return error; | 514 | return error; |
523 | } | 515 | } |
524 | ASSERT(nimaps > 0); | 516 | ASSERT(nimaps > 0); |
@@ -542,7 +534,7 @@ xfs_zero_eof( | |||
542 | * Drop the inode lock while we're doing the I/O. | 534 | * Drop the inode lock while we're doing the I/O. |
543 | * We'll still have the iolock to protect us. | 535 | * We'll still have the iolock to protect us. |
544 | */ | 536 | */ |
545 | XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); | 537 | xfs_iunlock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); |
546 | 538 | ||
547 | zero_off = XFS_FSB_TO_B(mp, start_zero_fsb); | 539 | zero_off = XFS_FSB_TO_B(mp, start_zero_fsb); |
548 | zero_len = XFS_FSB_TO_B(mp, imap.br_blockcount); | 540 | zero_len = XFS_FSB_TO_B(mp, imap.br_blockcount); |
@@ -558,14 +550,13 @@ xfs_zero_eof( | |||
558 | start_zero_fsb = imap.br_startoff + imap.br_blockcount; | 550 | start_zero_fsb = imap.br_startoff + imap.br_blockcount; |
559 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); | 551 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); |
560 | 552 | ||
561 | XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); | 553 | xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); |
562 | } | 554 | } |
563 | 555 | ||
564 | return 0; | 556 | return 0; |
565 | 557 | ||
566 | out_lock: | 558 | out_lock: |
567 | 559 | xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); | |
568 | XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); | ||
569 | ASSERT(error >= 0); | 560 | ASSERT(error >= 0); |
570 | return error; | 561 | return error; |
571 | } | 562 | } |
@@ -587,7 +578,6 @@ xfs_write( | |||
587 | xfs_mount_t *mp; | 578 | xfs_mount_t *mp; |
588 | ssize_t ret = 0, error = 0; | 579 | ssize_t ret = 0, error = 0; |
589 | xfs_fsize_t isize, new_size; | 580 | xfs_fsize_t isize, new_size; |
590 | xfs_iocore_t *io; | ||
591 | int iolock; | 581 | int iolock; |
592 | int eventsent = 0; | 582 | int eventsent = 0; |
593 | bhv_vrwlock_t locktype; | 583 | bhv_vrwlock_t locktype; |
@@ -607,8 +597,7 @@ xfs_write( | |||
607 | if (count == 0) | 597 | if (count == 0) |
608 | return 0; | 598 | return 0; |
609 | 599 | ||
610 | io = &xip->i_iocore; | 600 | mp = xip->i_mount; |
611 | mp = io->io_mount; | ||
612 | 601 | ||
613 | xfs_wait_for_freeze(mp, SB_FREEZE_WRITE); | 602 | xfs_wait_for_freeze(mp, SB_FREEZE_WRITE); |
614 | 603 | ||
@@ -667,7 +656,7 @@ start: | |||
667 | 656 | ||
668 | if (ioflags & IO_ISDIRECT) { | 657 | if (ioflags & IO_ISDIRECT) { |
669 | xfs_buftarg_t *target = | 658 | xfs_buftarg_t *target = |
670 | (xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? | 659 | XFS_IS_REALTIME_INODE(xip) ? |
671 | mp->m_rtdev_targp : mp->m_ddev_targp; | 660 | mp->m_rtdev_targp : mp->m_ddev_targp; |
672 | 661 | ||
673 | if ((pos & target->bt_smask) || (count & target->bt_smask)) { | 662 | if ((pos & target->bt_smask) || (count & target->bt_smask)) { |
@@ -688,7 +677,7 @@ start: | |||
688 | 677 | ||
689 | new_size = pos + count; | 678 | new_size = pos + count; |
690 | if (new_size > xip->i_size) | 679 | if (new_size > xip->i_size) |
691 | io->io_new_size = new_size; | 680 | xip->i_new_size = new_size; |
692 | 681 | ||
693 | if (likely(!(ioflags & IO_INVIS))) { | 682 | if (likely(!(ioflags & IO_INVIS))) { |
694 | file_update_time(file); | 683 | file_update_time(file); |
@@ -706,7 +695,7 @@ start: | |||
706 | */ | 695 | */ |
707 | 696 | ||
708 | if (pos > xip->i_size) { | 697 | if (pos > xip->i_size) { |
709 | error = xfs_zero_eof(vp, io, pos, xip->i_size); | 698 | error = xfs_zero_eof(xip, pos, xip->i_size); |
710 | if (error) { | 699 | if (error) { |
711 | xfs_iunlock(xip, XFS_ILOCK_EXCL); | 700 | xfs_iunlock(xip, XFS_ILOCK_EXCL); |
712 | goto out_unlock_internal; | 701 | goto out_unlock_internal; |
@@ -740,10 +729,10 @@ retry: | |||
740 | if ((ioflags & IO_ISDIRECT)) { | 729 | if ((ioflags & IO_ISDIRECT)) { |
741 | if (VN_CACHED(vp)) { | 730 | if (VN_CACHED(vp)) { |
742 | WARN_ON(need_i_mutex == 0); | 731 | WARN_ON(need_i_mutex == 0); |
743 | xfs_inval_cached_trace(io, pos, -1, | 732 | xfs_inval_cached_trace(xip, pos, -1, |
744 | ctooff(offtoct(pos)), -1); | 733 | (pos & PAGE_CACHE_MASK), -1); |
745 | error = xfs_flushinval_pages(xip, | 734 | error = xfs_flushinval_pages(xip, |
746 | ctooff(offtoct(pos)), | 735 | (pos & PAGE_CACHE_MASK), |
747 | -1, FI_REMAPF_LOCKED); | 736 | -1, FI_REMAPF_LOCKED); |
748 | if (error) | 737 | if (error) |
749 | goto out_unlock_internal; | 738 | goto out_unlock_internal; |
@@ -751,7 +740,7 @@ retry: | |||
751 | 740 | ||
752 | if (need_i_mutex) { | 741 | if (need_i_mutex) { |
753 | /* demote the lock now the cached pages are gone */ | 742 | /* demote the lock now the cached pages are gone */ |
754 | XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL); | 743 | xfs_ilock_demote(xip, XFS_IOLOCK_EXCL); |
755 | mutex_unlock(&inode->i_mutex); | 744 | mutex_unlock(&inode->i_mutex); |
756 | 745 | ||
757 | iolock = XFS_IOLOCK_SHARED; | 746 | iolock = XFS_IOLOCK_SHARED; |
@@ -759,7 +748,7 @@ retry: | |||
759 | need_i_mutex = 0; | 748 | need_i_mutex = 0; |
760 | } | 749 | } |
761 | 750 | ||
762 | xfs_rw_enter_trace(XFS_DIOWR_ENTER, io, (void *)iovp, segs, | 751 | xfs_rw_enter_trace(XFS_DIOWR_ENTER, xip, (void *)iovp, segs, |
763 | *offset, ioflags); | 752 | *offset, ioflags); |
764 | ret = generic_file_direct_write(iocb, iovp, | 753 | ret = generic_file_direct_write(iocb, iovp, |
765 | &segs, pos, offset, count, ocount); | 754 | &segs, pos, offset, count, ocount); |
@@ -779,7 +768,7 @@ retry: | |||
779 | goto relock; | 768 | goto relock; |
780 | } | 769 | } |
781 | } else { | 770 | } else { |
782 | xfs_rw_enter_trace(XFS_WRITE_ENTER, io, (void *)iovp, segs, | 771 | xfs_rw_enter_trace(XFS_WRITE_ENTER, xip, (void *)iovp, segs, |
783 | *offset, ioflags); | 772 | *offset, ioflags); |
784 | ret = generic_file_buffered_write(iocb, iovp, segs, | 773 | ret = generic_file_buffered_write(iocb, iovp, segs, |
785 | pos, offset, count, ret); | 774 | pos, offset, count, ret); |
@@ -843,9 +832,9 @@ retry: | |||
843 | } | 832 | } |
844 | 833 | ||
845 | out_unlock_internal: | 834 | out_unlock_internal: |
846 | if (io->io_new_size) { | 835 | if (xip->i_new_size) { |
847 | xfs_ilock(xip, XFS_ILOCK_EXCL); | 836 | xfs_ilock(xip, XFS_ILOCK_EXCL); |
848 | io->io_new_size = 0; | 837 | xip->i_new_size = 0; |
849 | /* | 838 | /* |
850 | * If this was a direct or synchronous I/O that failed (such | 839 | * If this was a direct or synchronous I/O that failed (such |
851 | * as ENOSPC) then part of the I/O may have been written to | 840 | * as ENOSPC) then part of the I/O may have been written to |
@@ -894,25 +883,6 @@ xfs_bdstrat_cb(struct xfs_buf *bp) | |||
894 | } | 883 | } |
895 | } | 884 | } |
896 | 885 | ||
897 | |||
898 | int | ||
899 | xfs_bmap( | ||
900 | xfs_inode_t *ip, | ||
901 | xfs_off_t offset, | ||
902 | ssize_t count, | ||
903 | int flags, | ||
904 | xfs_iomap_t *iomapp, | ||
905 | int *niomaps) | ||
906 | { | ||
907 | xfs_iocore_t *io = &ip->i_iocore; | ||
908 | |||
909 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); | ||
910 | ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) == | ||
911 | ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0)); | ||
912 | |||
913 | return xfs_iomap(io, offset, count, flags, iomapp, niomaps); | ||
914 | } | ||
915 | |||
916 | /* | 886 | /* |
917 | * Wrapper around bdstrat so that we can stop data | 887 | * Wrapper around bdstrat so that we can stop data |
918 | * from going to disk in case we are shutting down the filesystem. | 888 | * from going to disk in case we are shutting down the filesystem. |