aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-03-05 21:44:57 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-04-17 21:39:25 -0400
commit126468b1156211e26d97f74b2f1767acd141005a (patch)
tree0bf60d932dad0b4e7bc7c092782b531e550a11b2 /fs/xfs/linux-2.6
parent43973964a386348af0a392266f008ba24170aa30 (diff)
[XFS] kill xfs_rwlock/xfs_rwunlock
We can just use xfs_ilock/xfs_iunlock instead and get rid of the ugly bhv_vrwlock_t. SGI-PV: 976035 SGI-Modid: xfs-linux-melb:xfs-kern:30533a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c31
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h12
3 files changed, 15 insertions, 32 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index e0519529c26c..169e6c062794 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1532,9 +1532,9 @@ xfs_vm_bmap(
1532 struct xfs_inode *ip = XFS_I(inode); 1532 struct xfs_inode *ip = XFS_I(inode);
1533 1533
1534 xfs_itrace_entry(XFS_I(inode)); 1534 xfs_itrace_entry(XFS_I(inode));
1535 xfs_rwlock(ip, VRWLOCK_READ); 1535 xfs_ilock(ip, XFS_IOLOCK_SHARED);
1536 xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF); 1536 xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF);
1537 xfs_rwunlock(ip, VRWLOCK_READ); 1537 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1538 return generic_block_bmap(mapping, block, xfs_get_blocks); 1538 return generic_block_bmap(mapping, block, xfs_get_blocks);
1539} 1539}
1540 1540
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 166353388490..3c20007ab48f 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -228,11 +228,11 @@ xfs_read(
228 xfs_ilock(ip, XFS_IOLOCK_SHARED); 228 xfs_ilock(ip, XFS_IOLOCK_SHARED);
229 229
230 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) { 230 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
231 bhv_vrwlock_t locktype = VRWLOCK_READ;
232 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); 231 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
232 int iolock = XFS_IOLOCK_SHARED;
233 233
234 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *offset, size, 234 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *offset, size,
235 dmflags, &locktype); 235 dmflags, &iolock);
236 if (ret) { 236 if (ret) {
237 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 237 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
238 if (unlikely(ioflags & IO_ISDIRECT)) 238 if (unlikely(ioflags & IO_ISDIRECT))
@@ -287,11 +287,11 @@ xfs_splice_read(
287 xfs_ilock(ip, XFS_IOLOCK_SHARED); 287 xfs_ilock(ip, XFS_IOLOCK_SHARED);
288 288
289 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) { 289 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
290 bhv_vrwlock_t locktype = VRWLOCK_READ; 290 int iolock = XFS_IOLOCK_SHARED;
291 int error; 291 int error;
292 292
293 error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *ppos, count, 293 error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *ppos, count,
294 FILP_DELAY_FLAG(infilp), &locktype); 294 FILP_DELAY_FLAG(infilp), &iolock);
295 if (error) { 295 if (error) {
296 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 296 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
297 return -error; 297 return -error;
@@ -330,11 +330,11 @@ xfs_splice_write(
330 xfs_ilock(ip, XFS_IOLOCK_EXCL); 330 xfs_ilock(ip, XFS_IOLOCK_EXCL);
331 331
332 if (DM_EVENT_ENABLED(ip, DM_EVENT_WRITE) && !(ioflags & IO_INVIS)) { 332 if (DM_EVENT_ENABLED(ip, DM_EVENT_WRITE) && !(ioflags & IO_INVIS)) {
333 bhv_vrwlock_t locktype = VRWLOCK_WRITE; 333 int iolock = XFS_IOLOCK_EXCL;
334 int error; 334 int error;
335 335
336 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, *ppos, count, 336 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, *ppos, count,
337 FILP_DELAY_FLAG(outfilp), &locktype); 337 FILP_DELAY_FLAG(outfilp), &iolock);
338 if (error) { 338 if (error) {
339 xfs_iunlock(ip, XFS_IOLOCK_EXCL); 339 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
340 return -error; 340 return -error;
@@ -580,7 +580,6 @@ xfs_write(
580 xfs_fsize_t isize, new_size; 580 xfs_fsize_t isize, new_size;
581 int iolock; 581 int iolock;
582 int eventsent = 0; 582 int eventsent = 0;
583 bhv_vrwlock_t locktype;
584 size_t ocount = 0, count; 583 size_t ocount = 0, count;
585 loff_t pos; 584 loff_t pos;
586 int need_i_mutex; 585 int need_i_mutex;
@@ -607,11 +606,9 @@ xfs_write(
607relock: 606relock:
608 if (ioflags & IO_ISDIRECT) { 607 if (ioflags & IO_ISDIRECT) {
609 iolock = XFS_IOLOCK_SHARED; 608 iolock = XFS_IOLOCK_SHARED;
610 locktype = VRWLOCK_WRITE_DIRECT;
611 need_i_mutex = 0; 609 need_i_mutex = 0;
612 } else { 610 } else {
613 iolock = XFS_IOLOCK_EXCL; 611 iolock = XFS_IOLOCK_EXCL;
614 locktype = VRWLOCK_WRITE;
615 need_i_mutex = 1; 612 need_i_mutex = 1;
616 mutex_lock(&inode->i_mutex); 613 mutex_lock(&inode->i_mutex);
617 } 614 }
@@ -635,8 +632,7 @@ start:
635 632
636 xfs_iunlock(xip, XFS_ILOCK_EXCL); 633 xfs_iunlock(xip, XFS_ILOCK_EXCL);
637 error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp, 634 error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp,
638 pos, count, 635 pos, count, dmflags, &iolock);
639 dmflags, &locktype);
640 if (error) { 636 if (error) {
641 goto out_unlock_internal; 637 goto out_unlock_internal;
642 } 638 }
@@ -667,7 +663,6 @@ start:
667 if (!need_i_mutex && (VN_CACHED(vp) || pos > xip->i_size)) { 663 if (!need_i_mutex && (VN_CACHED(vp) || pos > xip->i_size)) {
668 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock); 664 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
669 iolock = XFS_IOLOCK_EXCL; 665 iolock = XFS_IOLOCK_EXCL;
670 locktype = VRWLOCK_WRITE;
671 need_i_mutex = 1; 666 need_i_mutex = 1;
672 mutex_lock(&inode->i_mutex); 667 mutex_lock(&inode->i_mutex);
673 xfs_ilock(xip, XFS_ILOCK_EXCL|iolock); 668 xfs_ilock(xip, XFS_ILOCK_EXCL|iolock);
@@ -744,7 +739,6 @@ retry:
744 mutex_unlock(&inode->i_mutex); 739 mutex_unlock(&inode->i_mutex);
745 740
746 iolock = XFS_IOLOCK_SHARED; 741 iolock = XFS_IOLOCK_SHARED;
747 locktype = VRWLOCK_WRITE_DIRECT;
748 need_i_mutex = 0; 742 need_i_mutex = 0;
749 } 743 }
750 744
@@ -781,7 +775,7 @@ retry:
781 775
782 if (ret == -ENOSPC && 776 if (ret == -ENOSPC &&
783 DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) { 777 DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) {
784 xfs_rwunlock(xip, locktype); 778 xfs_iunlock(xip, iolock);
785 if (need_i_mutex) 779 if (need_i_mutex)
786 mutex_unlock(&inode->i_mutex); 780 mutex_unlock(&inode->i_mutex);
787 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, 781 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
@@ -789,7 +783,7 @@ retry:
789 0, 0, 0); /* Delay flag intentionally unused */ 783 0, 0, 0); /* Delay flag intentionally unused */
790 if (need_i_mutex) 784 if (need_i_mutex)
791 mutex_lock(&inode->i_mutex); 785 mutex_lock(&inode->i_mutex);
792 xfs_rwlock(xip, locktype); 786 xfs_ilock(xip, iolock);
793 if (error) 787 if (error)
794 goto out_unlock_internal; 788 goto out_unlock_internal;
795 pos = xip->i_size; 789 pos = xip->i_size;
@@ -817,7 +811,8 @@ retry:
817 /* Handle various SYNC-type writes */ 811 /* Handle various SYNC-type writes */
818 if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) { 812 if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) {
819 int error2; 813 int error2;
820 xfs_rwunlock(xip, locktype); 814
815 xfs_iunlock(xip, iolock);
821 if (need_i_mutex) 816 if (need_i_mutex)
822 mutex_unlock(&inode->i_mutex); 817 mutex_unlock(&inode->i_mutex);
823 error2 = sync_page_range(inode, mapping, pos, ret); 818 error2 = sync_page_range(inode, mapping, pos, ret);
@@ -825,7 +820,7 @@ retry:
825 error = error2; 820 error = error2;
826 if (need_i_mutex) 821 if (need_i_mutex)
827 mutex_lock(&inode->i_mutex); 822 mutex_lock(&inode->i_mutex);
828 xfs_rwlock(xip, locktype); 823 xfs_ilock(xip, iolock);
829 error2 = xfs_write_sync_logforce(mp, xip); 824 error2 = xfs_write_sync_logforce(mp, xip);
830 if (!error) 825 if (!error)
831 error = error2; 826 error = error2;
@@ -846,7 +841,7 @@ retry:
846 xip->i_d.di_size = xip->i_size; 841 xip->i_d.di_size = xip->i_size;
847 xfs_iunlock(xip, XFS_ILOCK_EXCL); 842 xfs_iunlock(xip, XFS_ILOCK_EXCL);
848 } 843 }
849 xfs_rwunlock(xip, locktype); 844 xfs_iunlock(xip, iolock);
850 out_unlock_mutex: 845 out_unlock_mutex:
851 if (need_i_mutex) 846 if (need_i_mutex)
852 mutex_unlock(&inode->i_mutex); 847 mutex_unlock(&inode->i_mutex);
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 202231828283..4ed5914adefb 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -46,18 +46,6 @@ static inline struct inode *vn_to_inode(bhv_vnode_t *vnode)
46} 46}
47 47
48/* 48/*
49 * Values for the vop_rwlock/rwunlock flags parameter.
50 */
51typedef enum bhv_vrwlock {
52 VRWLOCK_NONE,
53 VRWLOCK_READ,
54 VRWLOCK_WRITE,
55 VRWLOCK_WRITE_DIRECT,
56 VRWLOCK_TRY_READ,
57 VRWLOCK_TRY_WRITE
58} bhv_vrwlock_t;
59
60/*
61 * Return values for xfs_inactive. A return value of 49 * Return values for xfs_inactive. A return value of
62 * VN_INACTIVE_NOCACHE implies that the file system behavior 50 * VN_INACTIVE_NOCACHE implies that the file system behavior
63 * has disassociated its state and bhv_desc_t from the vnode. 51 * has disassociated its state and bhv_desc_t from the vnode.