move v_trace from bhv_vnode to xfs_inode
PATCH 6/17 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.
fs/xfs/linux-2.6/xfs_aops.c +1 -1
@@ -1525,7 +1525,7 @@ xfs_vm_bmap(struct inode *inode = (struct inode *)mapping->host;struct xfs_inode *ip =XFS_I (inode); -vn_trace_entry (vn_from_inode (inode), __FUNCTION__, +vn_trace_entry (XFS_I (inode), __FUNCTION__, (inst_t *)__return_address);xfs_rwlock (ip,VRWLOCK_READ );xfs_flush_pages (ip, (xfs_off_t )0 ,-1 ,0 ,FI_REMAPF );
fs/xfs/linux-2.6/xfs_ioctl.c +1 -1
@@ -733,7 +733,7 @@ xfs_ioctl(xfs_mount_t *mp = ip->i_mount;int error; -vn_trace_entry (vp,"xfs_ioctl" , (inst_t *)__return_address); +vn_trace_entry (XFS_I (inode),"xfs_ioctl" , (inst_t *)__return_address);switch (cmd) {
fs/xfs/linux-2.6/xfs_super.c +16 -22
@@ -412,7 +412,7 @@ xfs_fs_write_inode( {int error =0 , flags =FLUSH_INODE ; -vn_trace_entry (vn_from_inode (inode), __FUNCTION__, +vn_trace_entry (XFS_I (inode), __FUNCTION__, (inst_t *)__return_address);if (sync) flags |=FLUSH_SYNC ;
@@ -432,34 +432,27 @@ STATIC voidxfs_fs_clear_inode ( struct inode *inode) { -bhv_vnode_t *vp =vn_from_inode (inode); - -vn_trace_entry (vp, __FUNCTION__, (inst_t *)__return_address); - -XFS_STATS_INC (vn_rele); -XFS_STATS_INC (vn_remove); -XFS_STATS_INC (vn_reclaim); -XFS_STATS_DEC (vn_active); +xfs_inode_t *ip =XFS_I (inode);/* -* This can happen because xfs_iget_core calls xfs_idestroy if we +* ip can be null when xfs_iget_core calls xfs_idestroy if we * find an inode with di_mode == 0 but without IGET_CREATE set. */ -if (XFS_I (inode)) -xfs_inactive (XFS_I (inode)); - +if (ip) { +vn_trace_entry (ip, __FUNCTION__, (inst_t *)__return_address); -if (XFS_I (inode)) { -xfs_iflags_clear (XFS_I (inode),XFS_IMODIFIED ); -if (xfs_reclaim (XFS_I (inode))) -panic ("%s: cannot reclaim 0x%p\n" , __FUNCTION__, vp); +XFS_STATS_INC (vn_rele); +XFS_STATS_INC (vn_remove); +XFS_STATS_INC (vn_reclaim); +XFS_STATS_DEC (vn_active); + +xfs_inactive (ip); +xfs_iflags_clear (ip,XFS_IMODIFIED ); +if (xfs_reclaim (ip)) +panic ("%s: cannot reclaim 0x%p\n" , __FUNCTION__, inode); }ASSERT (XFS_I (inode) ==NULL ); - -#ifdef XFS_VNODE_TRACE -ktrace_free (vp->v_trace); -#endif }/*
@@ -846,7 +839,8 @@ xfs_fs_fill_super( }if ((error =xfs_fs_start_syncd (vfsp))) goto fail_vnrele; -vn_trace_exit (rootvp, __FUNCTION__, (inst_t *)__return_address); +vn_trace_exit (XFS_I (sb->s_root->d_inode), __FUNCTION__, + (inst_t *)__return_address);kmem_free (args,sizeof (*args));return 0 ;
fs/xfs/linux-2.6/xfs_vnode.c +13 -18
@@ -103,11 +103,6 @@ vn_initialize(ASSERT (VN_CACHED (vp) ==0 ); -#ifdef XFS_VNODE_TRACE - vp->v_trace =ktrace_alloc (VNODE_TRACE_SIZE ,KM_SLEEP ); -#endif /* XFS_VNODE_TRACE */ - -vn_trace_exit (vp, __FUNCTION__, (inst_t *)__return_address);return vp; }
@@ -158,7 +153,7 @@ __vn_revalidate( {int error; -vn_trace_entry (vp, __FUNCTION__, (inst_t *)__return_address); +vn_trace_entry (xfs_vtoi (vp), __FUNCTION__, (inst_t *)__return_address); vattr->va_mask =XFS_AT_STAT |XFS_AT_XFLAGS ; error =xfs_getattr (xfs_vtoi (vp), vattr,0 );if (likely (!error)) {
@@ -197,11 +192,11 @@ vn_hold(#ifdef XFS_VNODE_TRACE #define KTRACE_ENTER (vp, vk, s, line, ra) \ - ktrace_enter( (vp)->v_trace, \ + ktrace_enter( (ip)->i_trace, \/* 0 */ (void *)(__psint_t)(vk), \/* 1 */ (void *)(s), \/* 2 */ (void *)(__psint_t ) line, \ -/* 3 */ (void *)(__psint_t)(vn_count (vp)), \ +/* 3 */ NULL , \/* 4 */ (void *)(ra), \/* 5 */ NULL , \ /* 6 */ (void *)(__psint_t)current_cpu(), \
@@ -213,32 +208,32 @@ vn_hold(* Vnode tracing code. */ void -vn_trace_entry (bhv_vnode_t *vp,const char *func,inst_t *ra) +vn_trace_entry (xfs_inode_t *ip,const char *func,inst_t *ra) { -KTRACE_ENTER (vp,VNODE_KTRACE_ENTRY , func,0 , ra); +KTRACE_ENTER (ip,VNODE_KTRACE_ENTRY , func,0 , ra); }void -vn_trace_exit (bhv_vnode_t *vp,const char *func,inst_t *ra) +vn_trace_exit (xfs_inode_t *ip,const char *func,inst_t *ra) { -KTRACE_ENTER (vp,VNODE_KTRACE_EXIT , func,0 , ra); +KTRACE_ENTER (ip,VNODE_KTRACE_EXIT , func,0 , ra); }void -vn_trace_hold (bhv_vnode_t *vp,char *file,int line,inst_t *ra) +vn_trace_hold (xfs_inode_t *ip,char *file,int line,inst_t *ra) { -KTRACE_ENTER (vp,VNODE_KTRACE_HOLD , file, line, ra); +KTRACE_ENTER (ip,VNODE_KTRACE_HOLD , file, line, ra); }void -vn_trace_ref (bhv_vnode_t *vp,char *file,int line,inst_t *ra) +vn_trace_ref (xfs_inode_t *ip,char *file,int line,inst_t *ra) { -KTRACE_ENTER (vp,VNODE_KTRACE_REF , file, line, ra); +KTRACE_ENTER (ip,VNODE_KTRACE_REF , file, line, ra); }void -vn_trace_rele (bhv_vnode_t *vp,char *file,int line,inst_t *ra) +vn_trace_rele (xfs_inode_t *ip,char *file,int line,inst_t *ra) { -KTRACE_ENTER (vp,VNODE_KTRACE_RELE , file, line, ra); +KTRACE_ENTER (ip,VNODE_KTRACE_RELE , file, line, ra); }#endif /* XFS_VNODE_TRACE */
fs/xfs/linux-2.6/xfs_vnode.h +7 -14
@@ -29,9 +29,6 @@ typedef __u64 bhv_vnumber_t;typedef struct bhv_vnode {bhv_vnumber_t v_number;/* in-core vnode number */ -#ifdef XFS_VNODE_TRACE -struct ktrace *v_trace;/* trace header structure */ -#endif struct inode v_inode;/* Linux inode */ /* inode MUST be last */ }bhv_vnode_t ;
@@ -222,9 +219,9 @@ extern bhv_vnode_t *vn_hold(struct bhv_v#if defined(XFS_VNODE_TRACE )#define VN_HOLD (vp) \ ((void)vn_hold(vp), \ - vn_trace_hold(vp, __FILE__, __LINE__, (inst_t *)__return_address)) + vn_trace_hold(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address))#define VN_RELE (vp) \ - (vn_trace_rele(vp, __FILE__, __LINE__, (inst_t *)__return_address), \ + (vn_trace_rele(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address), \ iput(vn_to_inode(vp)))#else #define VN_HOLD (vp) ((void)vn_hold(vp))
@@ -314,21 +311,17 @@ static inline void vn_atime_to_time_t(bh#define VNODE_KTRACE_REF 4#define VNODE_KTRACE_RELE 5 -extern void vn_trace_entry (struct bhv_vnode *,const char *,inst_t *); -extern void vn_trace_exit (struct bhv_vnode *,const char *,inst_t *); -extern void vn_trace_hold (struct bhv_vnode *,char *,int ,inst_t *); -extern void vn_trace_ref (struct bhv_vnode *,char *,int ,inst_t *); -extern void vn_trace_rele (struct bhv_vnode *,char *,int ,inst_t *); - -#define VN_TRACE (vp) \ - vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address) +extern void vn_trace_entry (struct xfs_inode *,const char *,inst_t *); +extern void vn_trace_exit (struct xfs_inode *,const char *,inst_t *); +extern void vn_trace_hold (struct xfs_inode *,char *,int ,inst_t *); +extern void vn_trace_ref (struct xfs_inode *,char *,int ,inst_t *); +extern void vn_trace_rele (struct xfs_inode *,char *,int ,inst_t *);#else #define vn_trace_entry (a,b,c)#define vn_trace_exit (a,b,c)#define vn_trace_hold (a,b,c,d)#define vn_trace_ref (a,b,c,d)#define vn_trace_rele (a,b,c,d) -#define VN_TRACE (vp)#endif #endif /* __XFS_VNODE_H__ */
fs/xfs/xfs_dir2.c +1 -1
@@ -301,7 +301,7 @@ xfs_readdir(int rval;/* return value */ int v;/* type-checking value */ -vn_trace_entry (XFS_ITOV (dp), __FUNCTION__, (inst_t *)__return_address); +vn_trace_entry (dp, __FUNCTION__, (inst_t *)__return_address);if (XFS_FORCED_SHUTDOWN (dp->i_mount))return XFS_ERROR (EIO );
fs/xfs/xfs_iget.c +5 -5
@@ -157,7 +157,7 @@ again: goto again; } -vn_trace_exit (vp,"xfs_iget.alloc" , +vn_trace_exit (ip,"xfs_iget.alloc" , (inst_t *)__return_address);XFS_STATS_INC (xs_ig_found);
@@ -212,7 +212,7 @@ finish_inode:xfs_ilock (ip, lock_flags);xfs_iflags_clear (ip,XFS_ISTALE ); -vn_trace_exit (vp,"xfs_iget.found" , +vn_trace_exit (ip,"xfs_iget.found" , (inst_t *)__return_address); goto return_ip; }
@@ -234,7 +234,7 @@ finish_inode:return error; } -vn_trace_exit (vp,"xfs_iget.alloc" , (inst_t *)__return_address); +vn_trace_exit (ip,"xfs_iget.alloc" , (inst_t *)__return_address);xfs_inode_lock_init (ip, vp);xfs_iocore_inode_init (ip);
@@ -477,7 +477,7 @@ xfs_iput(xfs_inode_t *ip, {bhv_vnode_t *vp =XFS_ITOV (ip); -vn_trace_entry (vp,"xfs_iput" , (inst_t *)__return_address); +vn_trace_entry (ip,"xfs_iput" , (inst_t *)__return_address);xfs_iunlock (ip, lock_flags);VN_RELE (vp); }
@@ -492,7 +492,7 @@ xfs_iput_new(xfs_inode_t *ip,bhv_vnode_t *vp =XFS_ITOV (ip);struct inode *inode =vn_to_inode (vp); -vn_trace_entry (vp,"xfs_iput_new" , (inst_t *)__return_address); +vn_trace_entry (ip,"xfs_iput_new" , (inst_t *)__return_address);if ((ip->i_d.di_mode ==0 )) {ASSERT (!xfs_iflags_test (ip,XFS_IRECLAIMABLE ));
fs/xfs/xfs_inode.c +7 -0
@@ -884,6 +884,9 @@ xfs_iread(* Initialize inode's trace buffers. * Do this before xfs_iformat in case it adds entries. */ +#ifdef XFS_VNODE_TRACE + ip->i_trace =ktrace_alloc (VNODE_TRACE_SIZE ,KM_SLEEP ); +#endif #ifdef XFS_BMAP_TRACE ip->i_xtrace =ktrace_alloc (XFS_BMAP_KTRACE_SIZE ,KM_SLEEP );#endif
@@ -2729,6 +2732,10 @@ xfs_idestroy(mrfree (&ip->i_lock);mrfree (&ip->i_iolock);freesema (&ip->i_flock); + +#ifdef XFS_VNODE_TRACE +ktrace_free (ip->i_trace); +#endif #ifdef XFS_BMAP_TRACE ktrace_free (ip->i_xtrace);#endif
fs/xfs/xfs_inode.h +3 -0
@@ -302,6 +302,9 @@ typedef struct xfs_inode {xfs_fsize_t i_size;/* in-memory size */ atomic_t i_iocount;/* outstanding I/O count */ /* Trace buffers per inode. */ +#ifdef XFS_VNODE_TRACE +struct ktrace *i_trace;/* general inode trace */ +#endif #ifdef XFS_BMAP_TRACE struct ktrace *i_xtrace;/* inode extent list trace */ #endif
fs/xfs/xfs_rename.c +2 -2
@@ -247,8 +247,8 @@ xfs_rename(int src_namelen =VNAMELEN (src_vname);int target_namelen =VNAMELEN (target_vname); -vn_trace_entry (src_dir_vp,"xfs_rename" , (inst_t *)__return_address); -vn_trace_entry (target_dir_vp,"xfs_rename" , (inst_t *)__return_address); +vn_trace_entry (src_dp,"xfs_rename" , (inst_t *)__return_address); +vn_trace_entry (xfs_vtoi (target_dir_vp),"xfs_rename" , (inst_t *)__return_address);/* * Find the XFS behavior descriptor for the target directory
fs/xfs/xfs_utils.c +1 -1
@@ -73,7 +73,7 @@ xfs_dir_lookup_int( {int error; -vn_trace_entry (XFS_ITOV (dp), __FUNCTION__, (inst_t *)__return_address); +vn_trace_entry (dp, __FUNCTION__, (inst_t *)__return_address); error =xfs_dir_lookup (NULL , dp,VNAME (dentry),VNAMELEN (dentry), inum);if (!error) {
fs/xfs/xfs_utils.h +1 -1
@@ -20,7 +20,7 @@#define IRELE (ip) VN_RELE(XFS_ITOV(ip))#define IHOLD (ip) VN_HOLD(XFS_ITOV(ip)) -#define ITRACE (ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \ +#define ITRACE (ip) vn_trace_ref(ip, __FILE__, __LINE__, \ (inst_t *)__return_address)extern int xfs_get_dir_entry (bhv_vname_t *,xfs_inode_t **);
fs/xfs/xfs_vnodeops.c +21 -21
162 lines not on this page · raw message
fs/xfs/xfsidbg.c +36 -28
135 lines not on this page · raw message
Quoted 3 lines · Christoph Hellwig
struct
bhv_vnodeis 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.
....
fs/xfs/linux-2.6/xfs_vnode.c vn_hold( · line 199
Quoted 11 lines
fs/xfs/linux-2.6/xfs_vnode.c +2
-2@@ -197,11 +192,11 @@ vn_hold(#ifdef XFS_VNODE_TRACE #define KTRACE_ENTER (vp, vk, s, line, ra) \ - ktrace_enter( (vp)->v_trace, \ + ktrace_enter( (ip)->i_trace, \/* 0 */ (void *)(__psint_t)(vk), \/* 1 */ (void *)(s), \/* 2 */ (void *)(__psint_t ) line, \ -/* 3 */ (void *)(__psint_t)(vn_count(vp)), \ +/* 3 */ NULL, \
given that vn_count() returns the linux inode i_count, shouldn't we put that here as well rather than killing it? It is sometimes useful to see what is happening with the reference count in the traces....
fs/xfs/xfs_inode.c xfs_iread( · line 889
Quoted 3 lines
fs/xfs/xfs_inode.c +3
-0+#ifdef XFS_VNODE_TRACE + ip->i_trace =ktrace_alloc (VNODE_TRACE_SIZE ,KM_SLEEP ); +#endif
At some point we need to change that define as well. More cosmetic stuff, though.
Cheers,
Dave.
Signature · 3 lines
Dave Chinner Principal Engineer SGI Australian Software Group
Quoted 4 lines · David Chinner
given that
vn_count()returns the linux inodei_count, shouldn't we put that here as well rather than killing it? It is sometimes useful to see what is happening with the reference count in the traces....
True. It'll need a little helper because the linux inode might be zero in some places.