aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2006-03-17 01:26:14 -0500
committerNathan Scott <nathans@sgi.com>2006-03-17 01:26:14 -0500
commita13828b167532a2145c9e3f563a99f810500c7b4 (patch)
tree77f86814197582a070a811ff06442ff5603a601a /fs/xfs
parentb12dd34298cf0cff9f337f667045335140873039 (diff)
[XFS] Cleanup references to i_sem.
SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:25480a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 2ede4bb7ecd0..ba07b83f988d 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -249,9 +249,8 @@ xfs_read(
249 if (n < size) 249 if (n < size)
250 size = n; 250 size = n;
251 251
252 if (XFS_FORCED_SHUTDOWN(mp)) { 252 if (XFS_FORCED_SHUTDOWN(mp))
253 return -EIO; 253 return -EIO;
254 }
255 254
256 if (unlikely(ioflags & IO_ISDIRECT)) 255 if (unlikely(ioflags & IO_ISDIRECT))
257 mutex_lock(&inode->i_mutex); 256 mutex_lock(&inode->i_mutex);
@@ -267,7 +266,7 @@ xfs_read(
267 dmflags, &locktype); 266 dmflags, &locktype);
268 if (ret) { 267 if (ret) {
269 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 268 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
270 goto unlock_isem; 269 goto unlock_mutex;
271 } 270 }
272 } 271 }
273 272
@@ -281,7 +280,7 @@ xfs_read(
281 280
282 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 281 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
283 282
284unlock_isem: 283unlock_mutex:
285 if (unlikely(ioflags & IO_ISDIRECT)) 284 if (unlikely(ioflags & IO_ISDIRECT))
286 mutex_unlock(&inode->i_mutex); 285 mutex_unlock(&inode->i_mutex);
287 return ret; 286 return ret;
@@ -573,7 +572,7 @@ xfs_write(
573 vrwlock_t locktype; 572 vrwlock_t locktype;
574 size_t ocount = 0, count; 573 size_t ocount = 0, count;
575 loff_t pos; 574 loff_t pos;
576 int need_isem = 1, need_flush = 0; 575 int need_i_mutex = 1, need_flush = 0;
577 576
578 XFS_STATS_INC(xs_write_calls); 577 XFS_STATS_INC(xs_write_calls);
579 578
@@ -622,14 +621,14 @@ xfs_write(
622 return XFS_ERROR(-EINVAL); 621 return XFS_ERROR(-EINVAL);
623 622
624 if (!VN_CACHED(vp) && pos < i_size_read(inode)) 623 if (!VN_CACHED(vp) && pos < i_size_read(inode))
625 need_isem = 0; 624 need_i_mutex = 0;
626 625
627 if (VN_CACHED(vp)) 626 if (VN_CACHED(vp))
628 need_flush = 1; 627 need_flush = 1;
629 } 628 }
630 629
631relock: 630relock:
632 if (need_isem) { 631 if (need_i_mutex) {
633 iolock = XFS_IOLOCK_EXCL; 632 iolock = XFS_IOLOCK_EXCL;
634 locktype = VRWLOCK_WRITE; 633 locktype = VRWLOCK_WRITE;
635 634
@@ -651,7 +650,7 @@ start:
651 S_ISBLK(inode->i_mode)); 650 S_ISBLK(inode->i_mode));
652 if (error) { 651 if (error) {
653 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock); 652 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
654 goto out_unlock_isem; 653 goto out_unlock_mutex;
655 } 654 }
656 655
657 new_size = pos + count; 656 new_size = pos + count;
@@ -663,7 +662,7 @@ start:
663 loff_t savedsize = pos; 662 loff_t savedsize = pos;
664 int dmflags = FILP_DELAY_FLAG(file); 663 int dmflags = FILP_DELAY_FLAG(file);
665 664
666 if (need_isem) 665 if (need_i_mutex)
667 dmflags |= DM_FLAGS_IMUX; 666 dmflags |= DM_FLAGS_IMUX;
668 667
669 xfs_iunlock(xip, XFS_ILOCK_EXCL); 668 xfs_iunlock(xip, XFS_ILOCK_EXCL);
@@ -672,7 +671,7 @@ start:
672 dmflags, &locktype); 671 dmflags, &locktype);
673 if (error) { 672 if (error) {
674 xfs_iunlock(xip, iolock); 673 xfs_iunlock(xip, iolock);
675 goto out_unlock_isem; 674 goto out_unlock_mutex;
676 } 675 }
677 xfs_ilock(xip, XFS_ILOCK_EXCL); 676 xfs_ilock(xip, XFS_ILOCK_EXCL);
678 eventsent = 1; 677 eventsent = 1;
@@ -710,7 +709,7 @@ start:
710 isize, pos + count); 709 isize, pos + count);
711 if (error) { 710 if (error) {
712 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock); 711 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
713 goto out_unlock_isem; 712 goto out_unlock_mutex;
714 } 713 }
715 } 714 }
716 xfs_iunlock(xip, XFS_ILOCK_EXCL); 715 xfs_iunlock(xip, XFS_ILOCK_EXCL);
@@ -731,7 +730,7 @@ start:
731 error = -remove_suid(file->f_dentry); 730 error = -remove_suid(file->f_dentry);
732 if (unlikely(error)) { 731 if (unlikely(error)) {
733 xfs_iunlock(xip, iolock); 732 xfs_iunlock(xip, iolock);
734 goto out_unlock_isem; 733 goto out_unlock_mutex;
735 } 734 }
736 } 735 }
737 736
@@ -747,14 +746,14 @@ retry:
747 -1, FI_REMAPF_LOCKED); 746 -1, FI_REMAPF_LOCKED);
748 } 747 }
749 748
750 if (need_isem) { 749 if (need_i_mutex) {
751 /* demote the lock now the cached pages are gone */ 750 /* demote the lock now the cached pages are gone */
752 XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL); 751 XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL);
753 mutex_unlock(&inode->i_mutex); 752 mutex_unlock(&inode->i_mutex);
754 753
755 iolock = XFS_IOLOCK_SHARED; 754 iolock = XFS_IOLOCK_SHARED;
756 locktype = VRWLOCK_WRITE_DIRECT; 755 locktype = VRWLOCK_WRITE_DIRECT;
757 need_isem = 0; 756 need_i_mutex = 0;
758 } 757 }
759 758
760 xfs_rw_enter_trace(XFS_DIOWR_ENTER, io, (void *)iovp, segs, 759 xfs_rw_enter_trace(XFS_DIOWR_ENTER, io, (void *)iovp, segs,
@@ -772,7 +771,7 @@ retry:
772 pos += ret; 771 pos += ret;
773 count -= ret; 772 count -= ret;
774 773
775 need_isem = 1; 774 need_i_mutex = 1;
776 ioflags &= ~IO_ISDIRECT; 775 ioflags &= ~IO_ISDIRECT;
777 xfs_iunlock(xip, iolock); 776 xfs_iunlock(xip, iolock);
778 goto relock; 777 goto relock;
@@ -794,14 +793,14 @@ retry:
794 !(ioflags & IO_INVIS)) { 793 !(ioflags & IO_INVIS)) {
795 794
796 xfs_rwunlock(bdp, locktype); 795 xfs_rwunlock(bdp, locktype);
797 if (need_isem) 796 if (need_i_mutex)
798 mutex_unlock(&inode->i_mutex); 797 mutex_unlock(&inode->i_mutex);
799 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, 798 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
800 DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL, 799 DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL,
801 0, 0, 0); /* Delay flag intentionally unused */ 800 0, 0, 0); /* Delay flag intentionally unused */
802 if (error) 801 if (error)
803 goto out_nounlocks; 802 goto out_nounlocks;
804 if (need_isem) 803 if (need_i_mutex)
805 mutex_lock(&inode->i_mutex); 804 mutex_lock(&inode->i_mutex);
806 xfs_rwlock(bdp, locktype); 805 xfs_rwlock(bdp, locktype);
807 pos = xip->i_d.di_size; 806 pos = xip->i_d.di_size;
@@ -905,9 +904,9 @@ retry:
905 if (error) 904 if (error)
906 goto out_unlock_internal; 905 goto out_unlock_internal;
907 } 906 }
908 907
909 xfs_rwunlock(bdp, locktype); 908 xfs_rwunlock(bdp, locktype);
910 if (need_isem) 909 if (need_i_mutex)
911 mutex_unlock(&inode->i_mutex); 910 mutex_unlock(&inode->i_mutex);
912 911
913 error = sync_page_range(inode, mapping, pos, ret); 912 error = sync_page_range(inode, mapping, pos, ret);
@@ -918,8 +917,8 @@ retry:
918 917
919 out_unlock_internal: 918 out_unlock_internal:
920 xfs_rwunlock(bdp, locktype); 919 xfs_rwunlock(bdp, locktype);
921 out_unlock_isem: 920 out_unlock_mutex:
922 if (need_isem) 921 if (need_i_mutex)
923 mutex_unlock(&inode->i_mutex); 922 mutex_unlock(&inode->i_mutex);
924 out_nounlocks: 923 out_nounlocks:
925 return -error; 924 return -error;