diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-28 21:46:47 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 21:39:25 -0400 |
commit | 1543d79c45a374f934f95ca34d87e2eeeb2039b4 (patch) | |
tree | abe537e7c241f2a764687c54d805ebfdb5147e3c /fs/xfs/linux-2.6 | |
parent | b677c210cec0d6755335ffc01691982c417dd39e (diff) |
[XFS] move v_trace from bhv_vnode to xfs_inode
struct bhv_vnode is on it's way out, so move the trace buffer to the XFS
inode. Note that this makes the tracing macros rather misnamed, but this
kind of fallout will be fixed up incrementally later on.
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29498a
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/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 40 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.c | 46 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 21 |
5 files changed, 53 insertions, 58 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 1dd198ec2890..f766c7f74dc0 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -1526,7 +1526,7 @@ xfs_vm_bmap( | |||
1526 | struct inode *inode = (struct inode *)mapping->host; | 1526 | struct inode *inode = (struct inode *)mapping->host; |
1527 | struct xfs_inode *ip = XFS_I(inode); | 1527 | struct xfs_inode *ip = XFS_I(inode); |
1528 | 1528 | ||
1529 | vn_trace_entry(vn_from_inode(inode), __FUNCTION__, | 1529 | vn_trace_entry(XFS_I(inode), __FUNCTION__, |
1530 | (inst_t *)__return_address); | 1530 | (inst_t *)__return_address); |
1531 | xfs_rwlock(ip, VRWLOCK_READ); | 1531 | xfs_rwlock(ip, VRWLOCK_READ); |
1532 | xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF); | 1532 | xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF); |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index 8ff465db909b..4c38e27ed184 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -733,7 +733,7 @@ xfs_ioctl( | |||
733 | xfs_mount_t *mp = ip->i_mount; | 733 | xfs_mount_t *mp = ip->i_mount; |
734 | int error; | 734 | int error; |
735 | 735 | ||
736 | vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address); | 736 | vn_trace_entry(XFS_I(inode), "xfs_ioctl", (inst_t *)__return_address); |
737 | 737 | ||
738 | switch (cmd) { | 738 | switch (cmd) { |
739 | 739 | ||
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 47bca4e4696b..bb0c4a932fd7 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -403,7 +403,7 @@ xfs_fs_write_inode( | |||
403 | { | 403 | { |
404 | int error = 0, flags = FLUSH_INODE; | 404 | int error = 0, flags = FLUSH_INODE; |
405 | 405 | ||
406 | vn_trace_entry(vn_from_inode(inode), __FUNCTION__, | 406 | vn_trace_entry(XFS_I(inode), __FUNCTION__, |
407 | (inst_t *)__return_address); | 407 | (inst_t *)__return_address); |
408 | if (sync) { | 408 | if (sync) { |
409 | filemap_fdatawait(inode->i_mapping); | 409 | filemap_fdatawait(inode->i_mapping); |
@@ -425,34 +425,27 @@ STATIC void | |||
425 | xfs_fs_clear_inode( | 425 | xfs_fs_clear_inode( |
426 | struct inode *inode) | 426 | struct inode *inode) |
427 | { | 427 | { |
428 | bhv_vnode_t *vp = vn_from_inode(inode); | 428 | xfs_inode_t *ip = XFS_I(inode); |
429 | |||
430 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | ||
431 | |||
432 | XFS_STATS_INC(vn_rele); | ||
433 | XFS_STATS_INC(vn_remove); | ||
434 | XFS_STATS_INC(vn_reclaim); | ||
435 | XFS_STATS_DEC(vn_active); | ||
436 | 429 | ||
437 | /* | 430 | /* |
438 | * This can happen because xfs_iget_core calls xfs_idestroy if we | 431 | * ip can be null when xfs_iget_core calls xfs_idestroy if we |
439 | * find an inode with di_mode == 0 but without IGET_CREATE set. | 432 | * find an inode with di_mode == 0 but without IGET_CREATE set. |
440 | */ | 433 | */ |
441 | if (XFS_I(inode)) | 434 | if (ip) { |
442 | xfs_inactive(XFS_I(inode)); | 435 | vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address); |
443 | 436 | ||
444 | 437 | XFS_STATS_INC(vn_rele); | |
445 | if (XFS_I(inode)) { | 438 | XFS_STATS_INC(vn_remove); |
446 | xfs_iflags_clear(XFS_I(inode), XFS_IMODIFIED); | 439 | XFS_STATS_INC(vn_reclaim); |
447 | if (xfs_reclaim(XFS_I(inode))) | 440 | XFS_STATS_DEC(vn_active); |
448 | panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp); | 441 | |
442 | xfs_inactive(ip); | ||
443 | xfs_iflags_clear(ip, XFS_IMODIFIED); | ||
444 | if (xfs_reclaim(ip)) | ||
445 | panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, inode); | ||
449 | } | 446 | } |
450 | 447 | ||
451 | ASSERT(XFS_I(inode) == NULL); | 448 | ASSERT(XFS_I(inode) == NULL); |
452 | |||
453 | #ifdef XFS_VNODE_TRACE | ||
454 | ktrace_free(vp->v_trace); | ||
455 | #endif | ||
456 | } | 449 | } |
457 | 450 | ||
458 | /* | 451 | /* |
@@ -840,7 +833,8 @@ xfs_fs_fill_super( | |||
840 | } | 833 | } |
841 | if ((error = xfs_fs_start_syncd(vfsp))) | 834 | if ((error = xfs_fs_start_syncd(vfsp))) |
842 | goto fail_vnrele; | 835 | goto fail_vnrele; |
843 | vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address); | 836 | vn_trace_exit(XFS_I(sb->s_root->d_inode), __FUNCTION__, |
837 | (inst_t *)__return_address); | ||
844 | 838 | ||
845 | kmem_free(args, sizeof(*args)); | 839 | kmem_free(args, sizeof(*args)); |
846 | return 0; | 840 | return 0; |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c index bde8d2e7f559..9d9464cf8de4 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.c +++ b/fs/xfs/linux-2.6/xfs_vnode.c | |||
@@ -103,11 +103,6 @@ vn_initialize( | |||
103 | 103 | ||
104 | ASSERT(VN_CACHED(vp) == 0); | 104 | ASSERT(VN_CACHED(vp) == 0); |
105 | 105 | ||
106 | #ifdef XFS_VNODE_TRACE | ||
107 | vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP); | ||
108 | #endif /* XFS_VNODE_TRACE */ | ||
109 | |||
110 | vn_trace_exit(vp, __FUNCTION__, (inst_t *)__return_address); | ||
111 | return vp; | 106 | return vp; |
112 | } | 107 | } |
113 | 108 | ||
@@ -158,7 +153,7 @@ __vn_revalidate( | |||
158 | { | 153 | { |
159 | int error; | 154 | int error; |
160 | 155 | ||
161 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | 156 | vn_trace_entry(xfs_vtoi(vp), __FUNCTION__, (inst_t *)__return_address); |
162 | vattr->va_mask = XFS_AT_STAT | XFS_AT_XFLAGS; | 157 | vattr->va_mask = XFS_AT_STAT | XFS_AT_XFLAGS; |
163 | error = xfs_getattr(xfs_vtoi(vp), vattr, 0); | 158 | error = xfs_getattr(xfs_vtoi(vp), vattr, 0); |
164 | if (likely(!error)) { | 159 | if (likely(!error)) { |
@@ -196,12 +191,25 @@ vn_hold( | |||
196 | 191 | ||
197 | #ifdef XFS_VNODE_TRACE | 192 | #ifdef XFS_VNODE_TRACE |
198 | 193 | ||
199 | #define KTRACE_ENTER(vp, vk, s, line, ra) \ | 194 | /* |
200 | ktrace_enter( (vp)->v_trace, \ | 195 | * Reference count of Linux inode if present, -1 if the xfs_inode |
196 | * has no associated Linux inode. | ||
197 | */ | ||
198 | static inline int xfs_icount(struct xfs_inode *ip) | ||
199 | { | ||
200 | bhv_vnode_t *vp = XFS_ITOV_NULL(ip); | ||
201 | |||
202 | if (vp) | ||
203 | return vn_count(vp); | ||
204 | return -1; | ||
205 | } | ||
206 | |||
207 | #define KTRACE_ENTER(ip, vk, s, line, ra) \ | ||
208 | ktrace_enter( (ip)->i_trace, \ | ||
201 | /* 0 */ (void *)(__psint_t)(vk), \ | 209 | /* 0 */ (void *)(__psint_t)(vk), \ |
202 | /* 1 */ (void *)(s), \ | 210 | /* 1 */ (void *)(s), \ |
203 | /* 2 */ (void *)(__psint_t) line, \ | 211 | /* 2 */ (void *)(__psint_t) line, \ |
204 | /* 3 */ (void *)(__psint_t)(vn_count(vp)), \ | 212 | /* 3 */ (void *)(__psint_t)xfs_icount(ip), \ |
205 | /* 4 */ (void *)(ra), \ | 213 | /* 4 */ (void *)(ra), \ |
206 | /* 5 */ NULL, \ | 214 | /* 5 */ NULL, \ |
207 | /* 6 */ (void *)(__psint_t)current_cpu(), \ | 215 | /* 6 */ (void *)(__psint_t)current_cpu(), \ |
@@ -213,32 +221,32 @@ vn_hold( | |||
213 | * Vnode tracing code. | 221 | * Vnode tracing code. |
214 | */ | 222 | */ |
215 | void | 223 | void |
216 | vn_trace_entry(bhv_vnode_t *vp, const char *func, inst_t *ra) | 224 | vn_trace_entry(xfs_inode_t *ip, const char *func, inst_t *ra) |
217 | { | 225 | { |
218 | KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra); | 226 | KTRACE_ENTER(ip, VNODE_KTRACE_ENTRY, func, 0, ra); |
219 | } | 227 | } |
220 | 228 | ||
221 | void | 229 | void |
222 | vn_trace_exit(bhv_vnode_t *vp, const char *func, inst_t *ra) | 230 | vn_trace_exit(xfs_inode_t *ip, const char *func, inst_t *ra) |
223 | { | 231 | { |
224 | KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra); | 232 | KTRACE_ENTER(ip, VNODE_KTRACE_EXIT, func, 0, ra); |
225 | } | 233 | } |
226 | 234 | ||
227 | void | 235 | void |
228 | vn_trace_hold(bhv_vnode_t *vp, char *file, int line, inst_t *ra) | 236 | vn_trace_hold(xfs_inode_t *ip, char *file, int line, inst_t *ra) |
229 | { | 237 | { |
230 | KTRACE_ENTER(vp, VNODE_KTRACE_HOLD, file, line, ra); | 238 | KTRACE_ENTER(ip, VNODE_KTRACE_HOLD, file, line, ra); |
231 | } | 239 | } |
232 | 240 | ||
233 | void | 241 | void |
234 | vn_trace_ref(bhv_vnode_t *vp, char *file, int line, inst_t *ra) | 242 | vn_trace_ref(xfs_inode_t *ip, char *file, int line, inst_t *ra) |
235 | { | 243 | { |
236 | KTRACE_ENTER(vp, VNODE_KTRACE_REF, file, line, ra); | 244 | KTRACE_ENTER(ip, VNODE_KTRACE_REF, file, line, ra); |
237 | } | 245 | } |
238 | 246 | ||
239 | void | 247 | void |
240 | vn_trace_rele(bhv_vnode_t *vp, char *file, int line, inst_t *ra) | 248 | vn_trace_rele(xfs_inode_t *ip, char *file, int line, inst_t *ra) |
241 | { | 249 | { |
242 | KTRACE_ENTER(vp, VNODE_KTRACE_RELE, file, line, ra); | 250 | KTRACE_ENTER(ip, VNODE_KTRACE_RELE, file, line, ra); |
243 | } | 251 | } |
244 | #endif /* XFS_VNODE_TRACE */ | 252 | #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 321346d95267..2b161361c1a0 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -29,9 +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 | #ifdef XFS_VNODE_TRACE | ||
33 | struct ktrace *v_trace; /* trace header structure */ | ||
34 | #endif | ||
35 | struct inode v_inode; /* Linux inode */ | 32 | struct inode v_inode; /* Linux inode */ |
36 | /* inode MUST be last */ | 33 | /* inode MUST be last */ |
37 | } bhv_vnode_t; | 34 | } bhv_vnode_t; |
@@ -222,9 +219,9 @@ extern bhv_vnode_t *vn_hold(struct bhv_vnode *); | |||
222 | #if defined(XFS_VNODE_TRACE) | 219 | #if defined(XFS_VNODE_TRACE) |
223 | #define VN_HOLD(vp) \ | 220 | #define VN_HOLD(vp) \ |
224 | ((void)vn_hold(vp), \ | 221 | ((void)vn_hold(vp), \ |
225 | vn_trace_hold(vp, __FILE__, __LINE__, (inst_t *)__return_address)) | 222 | vn_trace_hold(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address)) |
226 | #define VN_RELE(vp) \ | 223 | #define VN_RELE(vp) \ |
227 | (vn_trace_rele(vp, __FILE__, __LINE__, (inst_t *)__return_address), \ | 224 | (vn_trace_rele(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address), \ |
228 | iput(vn_to_inode(vp))) | 225 | iput(vn_to_inode(vp))) |
229 | #else | 226 | #else |
230 | #define VN_HOLD(vp) ((void)vn_hold(vp)) | 227 | #define VN_HOLD(vp) ((void)vn_hold(vp)) |
@@ -314,21 +311,17 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt) | |||
314 | #define VNODE_KTRACE_REF 4 | 311 | #define VNODE_KTRACE_REF 4 |
315 | #define VNODE_KTRACE_RELE 5 | 312 | #define VNODE_KTRACE_RELE 5 |
316 | 313 | ||
317 | extern void vn_trace_entry(struct bhv_vnode *, const char *, inst_t *); | 314 | extern void vn_trace_entry(struct xfs_inode *, const char *, inst_t *); |
318 | extern void vn_trace_exit(struct bhv_vnode *, const char *, inst_t *); | 315 | extern void vn_trace_exit(struct xfs_inode *, const char *, inst_t *); |
319 | extern void vn_trace_hold(struct bhv_vnode *, char *, int, inst_t *); | 316 | extern void vn_trace_hold(struct xfs_inode *, char *, int, inst_t *); |
320 | extern void vn_trace_ref(struct bhv_vnode *, char *, int, inst_t *); | 317 | extern void vn_trace_ref(struct xfs_inode *, char *, int, inst_t *); |
321 | extern void vn_trace_rele(struct bhv_vnode *, char *, int, inst_t *); | 318 | extern void vn_trace_rele(struct xfs_inode *, char *, int, inst_t *); |
322 | |||
323 | #define VN_TRACE(vp) \ | ||
324 | vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address) | ||
325 | #else | 319 | #else |
326 | #define vn_trace_entry(a,b,c) | 320 | #define vn_trace_entry(a,b,c) |
327 | #define vn_trace_exit(a,b,c) | 321 | #define vn_trace_exit(a,b,c) |
328 | #define vn_trace_hold(a,b,c,d) | 322 | #define vn_trace_hold(a,b,c,d) |
329 | #define vn_trace_ref(a,b,c,d) | 323 | #define vn_trace_ref(a,b,c,d) |
330 | #define vn_trace_rele(a,b,c,d) | 324 | #define vn_trace_rele(a,b,c,d) |
331 | #define VN_TRACE(vp) | ||
332 | #endif | 325 | #endif |
333 | 326 | ||
334 | #endif /* __XFS_VNODE_H__ */ | 327 | #endif /* __XFS_VNODE_H__ */ |