diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-28 21:46:28 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 21:38:56 -0400 |
commit | b677c210cec0d6755335ffc01691982c417dd39e (patch) | |
tree | 9a61fdd81e48aac948346a096bed9c72e5f34114 /fs | |
parent | 09262b4339de5417a10803fbfac277eebb38ca5a (diff) |
[XFS] move v_iocount from bhv_vnode to xfs_inode
struct bhv_vnode is on it's way out, so move the I/O count to the XFS
inode.
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29497a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 23 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.h | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.c | 29 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 6 |
8 files changed, 44 insertions, 34 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 22a40bd0cce2..1dd198ec2890 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -140,9 +140,11 @@ xfs_destroy_ioend( | |||
140 | next = bh->b_private; | 140 | next = bh->b_private; |
141 | bh->b_end_io(bh, !ioend->io_error); | 141 | bh->b_end_io(bh, !ioend->io_error); |
142 | } | 142 | } |
143 | if (unlikely(ioend->io_error)) | 143 | if (unlikely(ioend->io_error)) { |
144 | vn_ioerror(ioend->io_vnode, ioend->io_error, __FILE__,__LINE__); | 144 | vn_ioerror(XFS_I(ioend->io_inode), ioend->io_error, |
145 | vn_iowake(ioend->io_vnode); | 145 | __FILE__,__LINE__); |
146 | } | ||
147 | vn_iowake(XFS_I(ioend->io_inode)); | ||
146 | mempool_free(ioend, xfs_ioend_pool); | 148 | mempool_free(ioend, xfs_ioend_pool); |
147 | } | 149 | } |
148 | 150 | ||
@@ -157,14 +159,10 @@ STATIC void | |||
157 | xfs_setfilesize( | 159 | xfs_setfilesize( |
158 | xfs_ioend_t *ioend) | 160 | xfs_ioend_t *ioend) |
159 | { | 161 | { |
160 | xfs_inode_t *ip; | 162 | xfs_inode_t *ip = XFS_I(ioend->io_inode); |
161 | xfs_fsize_t isize; | 163 | xfs_fsize_t isize; |
162 | xfs_fsize_t bsize; | 164 | xfs_fsize_t bsize; |
163 | 165 | ||
164 | ip = xfs_vtoi(ioend->io_vnode); | ||
165 | if (!ip) | ||
166 | return; | ||
167 | |||
168 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); | 166 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); |
169 | ASSERT(ioend->io_type != IOMAP_READ); | 167 | ASSERT(ioend->io_type != IOMAP_READ); |
170 | 168 | ||
@@ -228,12 +226,11 @@ xfs_end_bio_unwritten( | |||
228 | { | 226 | { |
229 | xfs_ioend_t *ioend = | 227 | xfs_ioend_t *ioend = |
230 | container_of(work, xfs_ioend_t, io_work); | 228 | container_of(work, xfs_ioend_t, io_work); |
231 | bhv_vnode_t *vp = ioend->io_vnode; | ||
232 | xfs_off_t offset = ioend->io_offset; | 229 | xfs_off_t offset = ioend->io_offset; |
233 | size_t size = ioend->io_size; | 230 | size_t size = ioend->io_size; |
234 | 231 | ||
235 | if (likely(!ioend->io_error)) { | 232 | if (likely(!ioend->io_error)) { |
236 | xfs_bmap(xfs_vtoi(vp), offset, size, | 233 | xfs_bmap(XFS_I(ioend->io_inode), offset, size, |
237 | BMAPI_UNWRITTEN, NULL, NULL); | 234 | BMAPI_UNWRITTEN, NULL, NULL); |
238 | xfs_setfilesize(ioend); | 235 | xfs_setfilesize(ioend); |
239 | } | 236 | } |
@@ -277,10 +274,10 @@ xfs_alloc_ioend( | |||
277 | ioend->io_error = 0; | 274 | ioend->io_error = 0; |
278 | ioend->io_list = NULL; | 275 | ioend->io_list = NULL; |
279 | ioend->io_type = type; | 276 | ioend->io_type = type; |
280 | ioend->io_vnode = vn_from_inode(inode); | 277 | ioend->io_inode = inode; |
281 | ioend->io_buffer_head = NULL; | 278 | ioend->io_buffer_head = NULL; |
282 | ioend->io_buffer_tail = NULL; | 279 | ioend->io_buffer_tail = NULL; |
283 | atomic_inc(&ioend->io_vnode->v_iocount); | 280 | atomic_inc(&XFS_I(ioend->io_inode)->i_iocount); |
284 | ioend->io_offset = 0; | 281 | ioend->io_offset = 0; |
285 | ioend->io_size = 0; | 282 | ioend->io_size = 0; |
286 | 283 | ||
@@ -506,7 +503,7 @@ xfs_cancel_ioend( | |||
506 | unlock_buffer(bh); | 503 | unlock_buffer(bh); |
507 | } while ((bh = next_bh) != NULL); | 504 | } while ((bh = next_bh) != NULL); |
508 | 505 | ||
509 | vn_iowake(ioend->io_vnode); | 506 | vn_iowake(XFS_I(ioend->io_inode)); |
510 | mempool_free(ioend, xfs_ioend_pool); | 507 | mempool_free(ioend, xfs_ioend_pool); |
511 | } while ((ioend = next) != NULL); | 508 | } while ((ioend = next) != NULL); |
512 | } | 509 | } |
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h index 2244e516b66a..3ba0631a3818 100644 --- a/fs/xfs/linux-2.6/xfs_aops.h +++ b/fs/xfs/linux-2.6/xfs_aops.h | |||
@@ -32,7 +32,7 @@ typedef struct xfs_ioend { | |||
32 | unsigned int io_type; /* delalloc / unwritten */ | 32 | unsigned int io_type; /* delalloc / unwritten */ |
33 | int io_error; /* I/O error code */ | 33 | int io_error; /* I/O error code */ |
34 | atomic_t io_remaining; /* hold count */ | 34 | atomic_t io_remaining; /* hold count */ |
35 | struct bhv_vnode *io_vnode; /* file being written to */ | 35 | struct inode *io_inode; /* file being written to */ |
36 | struct buffer_head *io_buffer_head;/* buffer linked list head */ | 36 | struct buffer_head *io_buffer_head;/* buffer linked list head */ |
37 | struct buffer_head *io_buffer_tail;/* buffer linked list tail */ | 37 | struct buffer_head *io_buffer_tail;/* buffer linked list tail */ |
38 | size_t io_size; /* size of the extent */ | 38 | size_t io_size; /* size of the extent */ |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c index e6c559aee446..bde8d2e7f559 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.c +++ b/fs/xfs/linux-2.6/xfs_vnode.c | |||
@@ -20,6 +20,17 @@ | |||
20 | #include "xfs_bmap_btree.h" | 20 | #include "xfs_bmap_btree.h" |
21 | #include "xfs_inode.h" | 21 | #include "xfs_inode.h" |
22 | 22 | ||
23 | /* | ||
24 | * And this gunk is needed for xfs_mount.h" | ||
25 | */ | ||
26 | #include "xfs_log.h" | ||
27 | #include "xfs_trans.h" | ||
28 | #include "xfs_sb.h" | ||
29 | #include "xfs_dmapi.h" | ||
30 | #include "xfs_inum.h" | ||
31 | #include "xfs_ag.h" | ||
32 | #include "xfs_mount.h" | ||
33 | |||
23 | uint64_t vn_generation; /* vnode generation number */ | 34 | uint64_t vn_generation; /* vnode generation number */ |
24 | DEFINE_SPINLOCK(vnumber_lock); | 35 | DEFINE_SPINLOCK(vnumber_lock); |
25 | 36 | ||
@@ -42,19 +53,19 @@ vn_init(void) | |||
42 | 53 | ||
43 | void | 54 | void |
44 | vn_iowait( | 55 | vn_iowait( |
45 | bhv_vnode_t *vp) | 56 | xfs_inode_t *ip) |
46 | { | 57 | { |
47 | wait_queue_head_t *wq = vptosync(vp); | 58 | wait_queue_head_t *wq = vptosync(ip); |
48 | 59 | ||
49 | wait_event(*wq, (atomic_read(&vp->v_iocount) == 0)); | 60 | wait_event(*wq, (atomic_read(&ip->i_iocount) == 0)); |
50 | } | 61 | } |
51 | 62 | ||
52 | void | 63 | void |
53 | vn_iowake( | 64 | vn_iowake( |
54 | bhv_vnode_t *vp) | 65 | xfs_inode_t *ip) |
55 | { | 66 | { |
56 | if (atomic_dec_and_test(&vp->v_iocount)) | 67 | if (atomic_dec_and_test(&ip->i_iocount)) |
57 | wake_up(vptosync(vp)); | 68 | wake_up(vptosync(ip)); |
58 | } | 69 | } |
59 | 70 | ||
60 | /* | 71 | /* |
@@ -64,12 +75,12 @@ vn_iowake( | |||
64 | */ | 75 | */ |
65 | void | 76 | void |
66 | vn_ioerror( | 77 | vn_ioerror( |
67 | bhv_vnode_t *vp, | 78 | xfs_inode_t *ip, |
68 | int error, | 79 | int error, |
69 | char *f, | 80 | char *f, |
70 | int l) | 81 | int l) |
71 | { | 82 | { |
72 | bhv_vfs_t *vfsp = vfs_from_sb(vp->v_inode.i_sb); | 83 | bhv_vfs_t *vfsp = XFS_MTOVFS(ip->i_mount); |
73 | 84 | ||
74 | if (unlikely(error == -ENODEV)) | 85 | if (unlikely(error == -ENODEV)) |
75 | bhv_vfs_force_shutdown(vfsp, SHUTDOWN_DEVICE_REQ, f, l); | 86 | bhv_vfs_force_shutdown(vfsp, SHUTDOWN_DEVICE_REQ, f, l); |
@@ -92,8 +103,6 @@ vn_initialize( | |||
92 | 103 | ||
93 | ASSERT(VN_CACHED(vp) == 0); | 104 | ASSERT(VN_CACHED(vp) == 0); |
94 | 105 | ||
95 | atomic_set(&vp->v_iocount, 0); | ||
96 | |||
97 | #ifdef XFS_VNODE_TRACE | 106 | #ifdef XFS_VNODE_TRACE |
98 | vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP); | 107 | vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP); |
99 | #endif /* XFS_VNODE_TRACE */ | 108 | #endif /* XFS_VNODE_TRACE */ |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index c8af208a73dc..321346d95267 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -29,7 +29,6 @@ typedef __u64 bhv_vnumber_t; | |||
29 | 29 | ||
30 | typedef struct bhv_vnode { | 30 | typedef struct bhv_vnode { |
31 | bhv_vnumber_t v_number; /* in-core vnode number */ | 31 | bhv_vnumber_t v_number; /* in-core vnode number */ |
32 | atomic_t v_iocount; /* outstanding I/O count */ | ||
33 | #ifdef XFS_VNODE_TRACE | 32 | #ifdef XFS_VNODE_TRACE |
34 | struct ktrace *v_trace; /* trace header structure */ | 33 | struct ktrace *v_trace; /* trace header structure */ |
35 | #endif | 34 | #endif |
@@ -202,10 +201,13 @@ extern int vn_revalidate(struct bhv_vnode *); | |||
202 | extern int __vn_revalidate(struct bhv_vnode *, bhv_vattr_t *); | 201 | extern int __vn_revalidate(struct bhv_vnode *, bhv_vattr_t *); |
203 | extern void vn_revalidate_core(struct bhv_vnode *, bhv_vattr_t *); | 202 | extern void vn_revalidate_core(struct bhv_vnode *, bhv_vattr_t *); |
204 | 203 | ||
205 | extern void vn_iowait(struct bhv_vnode *vp); | 204 | /* |
206 | extern void vn_iowake(struct bhv_vnode *vp); | 205 | * Yeah, these don't take vnode anymore at all, all this should be |
207 | 206 | * cleaned up at some point. | |
208 | extern void vn_ioerror(struct bhv_vnode *vp, int error, char *f, int l); | 207 | */ |
208 | extern void vn_iowait(struct xfs_inode *ip); | ||
209 | extern void vn_iowake(struct xfs_inode *ip); | ||
210 | extern void vn_ioerror(struct xfs_inode *ip, int error, char *f, int l); | ||
209 | 211 | ||
210 | static inline int vn_count(struct bhv_vnode *vp) | 212 | static inline int vn_count(struct bhv_vnode *vp) |
211 | { | 213 | { |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index c07553bbcdb4..0349e714dc30 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -864,6 +864,7 @@ xfs_iread( | |||
864 | ip = kmem_zone_zalloc(xfs_inode_zone, KM_SLEEP); | 864 | ip = kmem_zone_zalloc(xfs_inode_zone, KM_SLEEP); |
865 | ip->i_ino = ino; | 865 | ip->i_ino = ino; |
866 | ip->i_mount = mp; | 866 | ip->i_mount = mp; |
867 | atomic_set(&ip->i_iocount, 0); | ||
867 | spin_lock_init(&ip->i_flags_lock); | 868 | spin_lock_init(&ip->i_flags_lock); |
868 | 869 | ||
869 | /* | 870 | /* |
@@ -1455,7 +1456,7 @@ xfs_itruncate_start( | |||
1455 | mp = ip->i_mount; | 1456 | mp = ip->i_mount; |
1456 | vp = XFS_ITOV(ip); | 1457 | vp = XFS_ITOV(ip); |
1457 | 1458 | ||
1458 | vn_iowait(vp); /* wait for the completion of any pending DIOs */ | 1459 | vn_iowait(ip); /* wait for the completion of any pending DIOs */ |
1459 | 1460 | ||
1460 | /* | 1461 | /* |
1461 | * Call toss_pages or flushinval_pages to get rid of pages | 1462 | * Call toss_pages or flushinval_pages to get rid of pages |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index ea1e24effd49..c8bb1a818a52 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -299,6 +299,7 @@ typedef struct xfs_inode { | |||
299 | struct hlist_node i_cnode; /* cluster link node */ | 299 | struct hlist_node i_cnode; /* cluster link node */ |
300 | 300 | ||
301 | xfs_fsize_t i_size; /* in-memory size */ | 301 | xfs_fsize_t i_size; /* in-memory size */ |
302 | atomic_t i_iocount; /* outstanding I/O count */ | ||
302 | /* Trace buffers per inode. */ | 303 | /* Trace buffers per inode. */ |
303 | #ifdef XFS_BMAP_TRACE | 304 | #ifdef XFS_BMAP_TRACE |
304 | struct ktrace *i_xtrace; /* inode extent list trace */ | 305 | struct ktrace *i_xtrace; /* inode extent list trace */ |
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index a9cebcb0b33b..3fe64a3a77a9 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -1209,7 +1209,7 @@ xfs_sync_inodes( | |||
1209 | * place after this point | 1209 | * place after this point |
1210 | */ | 1210 | */ |
1211 | if (flags & SYNC_IOWAIT) | 1211 | if (flags & SYNC_IOWAIT) |
1212 | vn_iowait(vp); | 1212 | vn_iowait(ip); |
1213 | 1213 | ||
1214 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 1214 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
1215 | } | 1215 | } |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 8ed7af3c5d63..e7ef78fb4da3 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -598,7 +598,7 @@ xfs_setattr( | |||
598 | } | 598 | } |
599 | 599 | ||
600 | /* wait for all I/O to complete */ | 600 | /* wait for all I/O to complete */ |
601 | vn_iowait(vp); | 601 | vn_iowait(ip); |
602 | 602 | ||
603 | if (!code) | 603 | if (!code) |
604 | code = xfs_itruncate_data(ip, vap->va_size); | 604 | code = xfs_itruncate_data(ip, vap->va_size); |
@@ -3683,7 +3683,7 @@ xfs_reclaim( | |||
3683 | return 0; | 3683 | return 0; |
3684 | } | 3684 | } |
3685 | 3685 | ||
3686 | vn_iowait(vp); | 3686 | vn_iowait(ip); |
3687 | 3687 | ||
3688 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); | 3688 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); |
3689 | 3689 | ||
@@ -4189,7 +4189,7 @@ xfs_free_file_space( | |||
4189 | need_iolock = 0; | 4189 | need_iolock = 0; |
4190 | if (need_iolock) { | 4190 | if (need_iolock) { |
4191 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 4191 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
4192 | vn_iowait(vp); /* wait for the completion of any pending DIOs */ | 4192 | vn_iowait(ip); /* wait for the completion of any pending DIOs */ |
4193 | } | 4193 | } |
4194 | 4194 | ||
4195 | rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP); | 4195 | rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP); |