aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iget.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_iget.c')
-rw-r--r--fs/xfs/xfs_iget.c111
1 files changed, 14 insertions, 97 deletions
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 073bb4a26b19..f5c904a10c11 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -43,7 +43,7 @@
43#include "xfs_inode_item.h" 43#include "xfs_inode_item.h"
44#include "xfs_bmap.h" 44#include "xfs_bmap.h"
45#include "xfs_btree_trace.h" 45#include "xfs_btree_trace.h"
46#include "xfs_dir2_trace.h" 46#include "xfs_trace.h"
47 47
48 48
49/* 49/*
@@ -90,28 +90,6 @@ xfs_inode_alloc(
90 ip->i_size = 0; 90 ip->i_size = 0;
91 ip->i_new_size = 0; 91 ip->i_new_size = 0;
92 92
93 /*
94 * Initialize inode's trace buffers.
95 */
96#ifdef XFS_INODE_TRACE
97 ip->i_trace = ktrace_alloc(INODE_TRACE_SIZE, KM_NOFS);
98#endif
99#ifdef XFS_BMAP_TRACE
100 ip->i_xtrace = ktrace_alloc(XFS_BMAP_KTRACE_SIZE, KM_NOFS);
101#endif
102#ifdef XFS_BTREE_TRACE
103 ip->i_btrace = ktrace_alloc(XFS_BMBT_KTRACE_SIZE, KM_NOFS);
104#endif
105#ifdef XFS_RW_TRACE
106 ip->i_rwtrace = ktrace_alloc(XFS_RW_KTRACE_SIZE, KM_NOFS);
107#endif
108#ifdef XFS_ILOCK_TRACE
109 ip->i_lock_trace = ktrace_alloc(XFS_ILOCK_KTRACE_SIZE, KM_NOFS);
110#endif
111#ifdef XFS_DIR2_TRACE
112 ip->i_dir_trace = ktrace_alloc(XFS_DIR2_KTRACE_SIZE, KM_NOFS);
113#endif
114
115 /* prevent anyone from using this yet */ 93 /* prevent anyone from using this yet */
116 VFS_I(ip)->i_state = I_NEW|I_LOCK; 94 VFS_I(ip)->i_state = I_NEW|I_LOCK;
117 95
@@ -133,25 +111,6 @@ xfs_inode_free(
133 if (ip->i_afp) 111 if (ip->i_afp)
134 xfs_idestroy_fork(ip, XFS_ATTR_FORK); 112 xfs_idestroy_fork(ip, XFS_ATTR_FORK);
135 113
136#ifdef XFS_INODE_TRACE
137 ktrace_free(ip->i_trace);
138#endif
139#ifdef XFS_BMAP_TRACE
140 ktrace_free(ip->i_xtrace);
141#endif
142#ifdef XFS_BTREE_TRACE
143 ktrace_free(ip->i_btrace);
144#endif
145#ifdef XFS_RW_TRACE
146 ktrace_free(ip->i_rwtrace);
147#endif
148#ifdef XFS_ILOCK_TRACE
149 ktrace_free(ip->i_lock_trace);
150#endif
151#ifdef XFS_DIR2_TRACE
152 ktrace_free(ip->i_dir_trace);
153#endif
154
155 if (ip->i_itemp) { 114 if (ip->i_itemp) {
156 /* 115 /*
157 * Only if we are shutting down the fs will we see an 116 * Only if we are shutting down the fs will we see an
@@ -210,6 +169,7 @@ xfs_iget_cache_hit(
210 * instead of polling for it. 169 * instead of polling for it.
211 */ 170 */
212 if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) { 171 if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) {
172 trace_xfs_iget_skip(ip);
213 XFS_STATS_INC(xs_ig_frecycle); 173 XFS_STATS_INC(xs_ig_frecycle);
214 error = EAGAIN; 174 error = EAGAIN;
215 goto out_error; 175 goto out_error;
@@ -228,7 +188,7 @@ xfs_iget_cache_hit(
228 * Need to carefully get it back into useable state. 188 * Need to carefully get it back into useable state.
229 */ 189 */
230 if (ip->i_flags & XFS_IRECLAIMABLE) { 190 if (ip->i_flags & XFS_IRECLAIMABLE) {
231 xfs_itrace_exit_tag(ip, "xfs_iget.alloc"); 191 trace_xfs_iget_reclaim(ip);
232 192
233 /* 193 /*
234 * We need to set XFS_INEW atomically with clearing the 194 * We need to set XFS_INEW atomically with clearing the
@@ -254,6 +214,7 @@ xfs_iget_cache_hit(
254 ip->i_flags &= ~XFS_INEW; 214 ip->i_flags &= ~XFS_INEW;
255 ip->i_flags |= XFS_IRECLAIMABLE; 215 ip->i_flags |= XFS_IRECLAIMABLE;
256 __xfs_inode_set_reclaim_tag(pag, ip); 216 __xfs_inode_set_reclaim_tag(pag, ip);
217 trace_xfs_iget_reclaim(ip);
257 goto out_error; 218 goto out_error;
258 } 219 }
259 inode->i_state = I_LOCK|I_NEW; 220 inode->i_state = I_LOCK|I_NEW;
@@ -273,8 +234,9 @@ xfs_iget_cache_hit(
273 xfs_ilock(ip, lock_flags); 234 xfs_ilock(ip, lock_flags);
274 235
275 xfs_iflags_clear(ip, XFS_ISTALE); 236 xfs_iflags_clear(ip, XFS_ISTALE);
276 xfs_itrace_exit_tag(ip, "xfs_iget.found");
277 XFS_STATS_INC(xs_ig_found); 237 XFS_STATS_INC(xs_ig_found);
238
239 trace_xfs_iget_found(ip);
278 return 0; 240 return 0;
279 241
280out_error: 242out_error:
@@ -308,7 +270,7 @@ xfs_iget_cache_miss(
308 if (error) 270 if (error)
309 goto out_destroy; 271 goto out_destroy;
310 272
311 xfs_itrace_exit_tag(ip, "xfs_iget.alloc"); 273 xfs_itrace_entry(ip);
312 274
313 if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) { 275 if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) {
314 error = ENOENT; 276 error = ENOENT;
@@ -353,6 +315,8 @@ xfs_iget_cache_miss(
353 315
354 write_unlock(&pag->pag_ici_lock); 316 write_unlock(&pag->pag_ici_lock);
355 radix_tree_preload_end(); 317 radix_tree_preload_end();
318
319 trace_xfs_iget_alloc(ip);
356 *ipp = ip; 320 *ipp = ip;
357 return 0; 321 return 0;
358 322
@@ -639,7 +603,7 @@ xfs_ilock(
639 else if (lock_flags & XFS_ILOCK_SHARED) 603 else if (lock_flags & XFS_ILOCK_SHARED)
640 mraccess_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags)); 604 mraccess_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags));
641 605
642 xfs_ilock_trace(ip, 1, lock_flags, (inst_t *)__return_address); 606 trace_xfs_ilock(ip, lock_flags, _RET_IP_);
643} 607}
644 608
645/* 609/*
@@ -684,7 +648,7 @@ xfs_ilock_nowait(
684 if (!mrtryaccess(&ip->i_lock)) 648 if (!mrtryaccess(&ip->i_lock))
685 goto out_undo_iolock; 649 goto out_undo_iolock;
686 } 650 }
687 xfs_ilock_trace(ip, 2, lock_flags, (inst_t *)__return_address); 651 trace_xfs_ilock_nowait(ip, lock_flags, _RET_IP_);
688 return 1; 652 return 1;
689 653
690 out_undo_iolock: 654 out_undo_iolock:
@@ -746,7 +710,7 @@ xfs_iunlock(
746 xfs_trans_unlocked_item(ip->i_itemp->ili_item.li_ailp, 710 xfs_trans_unlocked_item(ip->i_itemp->ili_item.li_ailp,
747 (xfs_log_item_t*)(ip->i_itemp)); 711 (xfs_log_item_t*)(ip->i_itemp));
748 } 712 }
749 xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address); 713 trace_xfs_iunlock(ip, lock_flags, _RET_IP_);
750} 714}
751 715
752/* 716/*
@@ -765,6 +729,8 @@ xfs_ilock_demote(
765 mrdemote(&ip->i_lock); 729 mrdemote(&ip->i_lock);
766 if (lock_flags & XFS_IOLOCK_EXCL) 730 if (lock_flags & XFS_IOLOCK_EXCL)
767 mrdemote(&ip->i_iolock); 731 mrdemote(&ip->i_iolock);
732
733 trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_);
768} 734}
769 735
770#ifdef DEBUG 736#ifdef DEBUG
@@ -795,52 +761,3 @@ xfs_isilocked(
795 return 1; 761 return 1;
796} 762}
797#endif 763#endif
798
799#ifdef XFS_INODE_TRACE
800
801#define KTRACE_ENTER(ip, vk, s, line, ra) \
802 ktrace_enter((ip)->i_trace, \
803/* 0 */ (void *)(__psint_t)(vk), \
804/* 1 */ (void *)(s), \
805/* 2 */ (void *)(__psint_t) line, \
806/* 3 */ (void *)(__psint_t)atomic_read(&VFS_I(ip)->i_count), \
807/* 4 */ (void *)(ra), \
808/* 5 */ NULL, \
809/* 6 */ (void *)(__psint_t)current_cpu(), \
810/* 7 */ (void *)(__psint_t)current_pid(), \
811/* 8 */ (void *)__return_address, \
812/* 9 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL)
813
814/*
815 * Vnode tracing code.
816 */
817void
818_xfs_itrace_entry(xfs_inode_t *ip, const char *func, inst_t *ra)
819{
820 KTRACE_ENTER(ip, INODE_KTRACE_ENTRY, func, 0, ra);
821}
822
823void
824_xfs_itrace_exit(xfs_inode_t *ip, const char *func, inst_t *ra)
825{
826 KTRACE_ENTER(ip, INODE_KTRACE_EXIT, func, 0, ra);
827}
828
829void
830xfs_itrace_hold(xfs_inode_t *ip, char *file, int line, inst_t *ra)
831{
832 KTRACE_ENTER(ip, INODE_KTRACE_HOLD, file, line, ra);
833}
834
835void
836_xfs_itrace_ref(xfs_inode_t *ip, char *file, int line, inst_t *ra)
837{
838 KTRACE_ENTER(ip, INODE_KTRACE_REF, file, line, ra);
839}
840
841void
842xfs_itrace_rele(xfs_inode_t *ip, char *file, int line, inst_t *ra)
843{
844 KTRACE_ENTER(ip, INODE_KTRACE_RELE, file, line, ra);
845}
846#endif /* XFS_INODE_TRACE */