diff options
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 4 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 31 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 41 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.h | 2 |
6 files changed, 16 insertions, 76 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( | |||
607 | relock: | 606 | relock: |
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 | */ | ||
51 | typedef 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. |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 1d8a4728d847..110ee83fcbec 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -67,7 +67,7 @@ struct xfs_mru_cache; | |||
67 | */ | 67 | */ |
68 | 68 | ||
69 | typedef int (*xfs_send_data_t)(int, bhv_vnode_t *, | 69 | typedef int (*xfs_send_data_t)(int, bhv_vnode_t *, |
70 | xfs_off_t, size_t, int, bhv_vrwlock_t *); | 70 | xfs_off_t, size_t, int, int *); |
71 | typedef int (*xfs_send_mmap_t)(struct vm_area_struct *, uint); | 71 | typedef int (*xfs_send_mmap_t)(struct vm_area_struct *, uint); |
72 | typedef int (*xfs_send_destroy_t)(bhv_vnode_t *, dm_right_t); | 72 | typedef int (*xfs_send_destroy_t)(bhv_vnode_t *, dm_right_t); |
73 | typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *, | 73 | typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *, |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 4765e7c4b75d..811ee874d868 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -3375,47 +3375,6 @@ std_return: | |||
3375 | } | 3375 | } |
3376 | 3376 | ||
3377 | int | 3377 | int |
3378 | xfs_rwlock( | ||
3379 | xfs_inode_t *ip, | ||
3380 | bhv_vrwlock_t locktype) | ||
3381 | { | ||
3382 | if (S_ISDIR(ip->i_d.di_mode)) | ||
3383 | return 1; | ||
3384 | if (locktype == VRWLOCK_WRITE) { | ||
3385 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | ||
3386 | } else if (locktype == VRWLOCK_TRY_READ) { | ||
3387 | return xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED); | ||
3388 | } else if (locktype == VRWLOCK_TRY_WRITE) { | ||
3389 | return xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL); | ||
3390 | } else { | ||
3391 | ASSERT((locktype == VRWLOCK_READ) || | ||
3392 | (locktype == VRWLOCK_WRITE_DIRECT)); | ||
3393 | xfs_ilock(ip, XFS_IOLOCK_SHARED); | ||
3394 | } | ||
3395 | |||
3396 | return 1; | ||
3397 | } | ||
3398 | |||
3399 | |||
3400 | void | ||
3401 | xfs_rwunlock( | ||
3402 | xfs_inode_t *ip, | ||
3403 | bhv_vrwlock_t locktype) | ||
3404 | { | ||
3405 | if (S_ISDIR(ip->i_d.di_mode)) | ||
3406 | return; | ||
3407 | if (locktype == VRWLOCK_WRITE) { | ||
3408 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | ||
3409 | } else { | ||
3410 | ASSERT((locktype == VRWLOCK_READ) || | ||
3411 | (locktype == VRWLOCK_WRITE_DIRECT)); | ||
3412 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | ||
3413 | } | ||
3414 | return; | ||
3415 | } | ||
3416 | |||
3417 | |||
3418 | int | ||
3419 | xfs_inode_flush( | 3378 | xfs_inode_flush( |
3420 | xfs_inode_t *ip, | 3379 | xfs_inode_t *ip, |
3421 | int flags) | 3380 | int flags) |
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h index 4e3970f0e5e3..85340bafd42d 100644 --- a/fs/xfs/xfs_vnodeops.h +++ b/fs/xfs/xfs_vnodeops.h | |||
@@ -38,8 +38,6 @@ int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, | |||
38 | int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, | 38 | int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, |
39 | char *target_path, mode_t mode, bhv_vnode_t **vpp, | 39 | char *target_path, mode_t mode, bhv_vnode_t **vpp, |
40 | struct cred *credp); | 40 | struct cred *credp); |
41 | int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); | ||
42 | void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); | ||
43 | int xfs_inode_flush(struct xfs_inode *ip, int flags); | 41 | int xfs_inode_flush(struct xfs_inode *ip, int flags); |
44 | int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); | 42 | int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); |
45 | int xfs_reclaim(struct xfs_inode *ip); | 43 | int xfs_reclaim(struct xfs_inode *ip); |