diff options
author | Christoph Hellwig <hch@sgi.com> | 2005-09-02 02:58:38 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-09-02 02:58:38 -0400 |
commit | 51c91ed52b8a9a30fcb2a465b40c20a1f11735ba (patch) | |
tree | edebb01cbfe550a2edb066d5b4185445cfff11ba /fs/xfs/linux-2.6/xfs_vnode.c | |
parent | 592cb26bda6fe69838529acf71e50a6dee7acbb4 (diff) |
[XFS] add infrastructure for waiting on I/O completion at inode reclaim
time
SGI-PV: 934766
SGI-Modid: xfs-linux:xfs-kern:196854a
Signed-off-by: Christoph Hellwig <hch@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_vnode.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c index 654da98de2a5..46afc86a2862 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.c +++ b/fs/xfs/linux-2.6/xfs_vnode.c | |||
@@ -42,17 +42,33 @@ DEFINE_SPINLOCK(vnumber_lock); | |||
42 | */ | 42 | */ |
43 | #define NVSYNC 37 | 43 | #define NVSYNC 37 |
44 | #define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) | 44 | #define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) |
45 | sv_t vsync[NVSYNC]; | 45 | STATIC wait_queue_head_t vsync[NVSYNC]; |
46 | 46 | ||
47 | 47 | ||
48 | void | 48 | void |
49 | vn_init(void) | 49 | vn_init(void) |
50 | { | 50 | { |
51 | register sv_t *svp; | 51 | int i; |
52 | register int i; | ||
53 | 52 | ||
54 | for (svp = vsync, i = 0; i < NVSYNC; i++, svp++) | 53 | for (i = 0; i < NVSYNC; i++) |
55 | init_sv(svp, SV_DEFAULT, "vsy", i); | 54 | init_waitqueue_head(&vsync[i]); |
55 | } | ||
56 | |||
57 | void | ||
58 | vn_iowait( | ||
59 | struct vnode *vp) | ||
60 | { | ||
61 | wait_queue_head_t *wq = vptosync(vp); | ||
62 | |||
63 | wait_event(*wq, (atomic_read(&vp->v_iocount) == 0)); | ||
64 | } | ||
65 | |||
66 | void | ||
67 | vn_iowake( | ||
68 | struct vnode *vp) | ||
69 | { | ||
70 | if (atomic_dec_and_test(&vp->v_iocount)) | ||
71 | wake_up(vptosync(vp)); | ||
56 | } | 72 | } |
57 | 73 | ||
58 | /* | 74 | /* |
@@ -111,6 +127,8 @@ vn_initialize( | |||
111 | /* Initialize the first behavior and the behavior chain head. */ | 127 | /* Initialize the first behavior and the behavior chain head. */ |
112 | vn_bhv_head_init(VN_BHV_HEAD(vp), "vnode"); | 128 | vn_bhv_head_init(VN_BHV_HEAD(vp), "vnode"); |
113 | 129 | ||
130 | atomic_set(&vp->v_iocount, 0); | ||
131 | |||
114 | #ifdef XFS_VNODE_TRACE | 132 | #ifdef XFS_VNODE_TRACE |
115 | vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP); | 133 | vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP); |
116 | #endif /* XFS_VNODE_TRACE */ | 134 | #endif /* XFS_VNODE_TRACE */ |