aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2009-12-14 18:14:59 -0500
committerAlex Elder <aelder@sgi.com>2009-12-15 00:08:16 -0500
commit0b1b213fcf3a8486ada99a2bab84ab8c6f51b264 (patch)
tree661fd8da7487231224c77b95c33986cb7d7b41ef /fs/xfs/linux-2.6
parent6ef3554422e2c7e7aa424ba63737da498881dff4 (diff)
xfs: event tracing support
Convert the old xfs tracing support that could only be used with the out of tree kdb and xfsidbg patches to use the generic event tracer. To use it make sure CONFIG_EVENT_TRACING is enabled and then enable all xfs trace channels by: echo 1 > /sys/kernel/debug/tracing/events/xfs/enable or alternatively enable single events by just doing the same in one event subdirectory, e.g. echo 1 > /sys/kernel/debug/tracing/events/xfs/xfs_ihold/enable or set more complex filters, etc. In Documentation/trace/events.txt all this is desctribed in more detail. To reads the events do a cat /sys/kernel/debug/tracing/trace Compared to the last posting this patch converts the tracing mostly to the one tracepoint per callsite model that other users of the new tracing facility also employ. This allows a very fine-grained control of the tracing, a cleaner output of the traces and also enables the perf tool to use each tracepoint as a virtual performance counter, allowing us to e.g. count how often certain workloads git various spots in XFS. Take a look at http://lwn.net/Articles/346470/ for some examples. Also the btree tracing isn't included at all yet, as it will require additional core tracing features not in mainline yet, I plan to deliver it later. And the really nice thing about this patch is that it actually removes many lines of code while adding this nice functionality: fs/xfs/Makefile | 8 fs/xfs/linux-2.6/xfs_acl.c | 1 fs/xfs/linux-2.6/xfs_aops.c | 52 - fs/xfs/linux-2.6/xfs_aops.h | 2 fs/xfs/linux-2.6/xfs_buf.c | 117 +-- fs/xfs/linux-2.6/xfs_buf.h | 33 fs/xfs/linux-2.6/xfs_fs_subr.c | 3 fs/xfs/linux-2.6/xfs_ioctl.c | 1 fs/xfs/linux-2.6/xfs_ioctl32.c | 1 fs/xfs/linux-2.6/xfs_iops.c | 1 fs/xfs/linux-2.6/xfs_linux.h | 1 fs/xfs/linux-2.6/xfs_lrw.c | 87 -- fs/xfs/linux-2.6/xfs_lrw.h | 45 - fs/xfs/linux-2.6/xfs_super.c | 104 --- fs/xfs/linux-2.6/xfs_super.h | 7 fs/xfs/linux-2.6/xfs_sync.c | 1 fs/xfs/linux-2.6/xfs_trace.c | 75 ++ fs/xfs/linux-2.6/xfs_trace.h | 1369 +++++++++++++++++++++++++++++++++++++++++ fs/xfs/linux-2.6/xfs_vnode.h | 4 fs/xfs/quota/xfs_dquot.c | 110 --- fs/xfs/quota/xfs_dquot.h | 21 fs/xfs/quota/xfs_qm.c | 40 - fs/xfs/quota/xfs_qm_syscalls.c | 4 fs/xfs/support/ktrace.c | 323 --------- fs/xfs/support/ktrace.h | 85 -- fs/xfs/xfs.h | 16 fs/xfs/xfs_ag.h | 14 fs/xfs/xfs_alloc.c | 230 +----- fs/xfs/xfs_alloc.h | 27 fs/xfs/xfs_alloc_btree.c | 1 fs/xfs/xfs_attr.c | 107 --- fs/xfs/xfs_attr.h | 10 fs/xfs/xfs_attr_leaf.c | 14 fs/xfs/xfs_attr_sf.h | 40 - fs/xfs/xfs_bmap.c | 507 +++------------ fs/xfs/xfs_bmap.h | 49 - fs/xfs/xfs_bmap_btree.c | 6 fs/xfs/xfs_btree.c | 5 fs/xfs/xfs_btree_trace.h | 17 fs/xfs/xfs_buf_item.c | 87 -- fs/xfs/xfs_buf_item.h | 20 fs/xfs/xfs_da_btree.c | 3 fs/xfs/xfs_da_btree.h | 7 fs/xfs/xfs_dfrag.c | 2 fs/xfs/xfs_dir2.c | 8 fs/xfs/xfs_dir2_block.c | 20 fs/xfs/xfs_dir2_leaf.c | 21 fs/xfs/xfs_dir2_node.c | 27 fs/xfs/xfs_dir2_sf.c | 26 fs/xfs/xfs_dir2_trace.c | 216 ------ fs/xfs/xfs_dir2_trace.h | 72 -- fs/xfs/xfs_filestream.c | 8 fs/xfs/xfs_fsops.c | 2 fs/xfs/xfs_iget.c | 111 --- fs/xfs/xfs_inode.c | 67 -- fs/xfs/xfs_inode.h | 76 -- fs/xfs/xfs_inode_item.c | 5 fs/xfs/xfs_iomap.c | 85 -- fs/xfs/xfs_iomap.h | 8 fs/xfs/xfs_log.c | 181 +---- fs/xfs/xfs_log_priv.h | 20 fs/xfs/xfs_log_recover.c | 1 fs/xfs/xfs_mount.c | 2 fs/xfs/xfs_quota.h | 8 fs/xfs/xfs_rename.c | 1 fs/xfs/xfs_rtalloc.c | 1 fs/xfs/xfs_rw.c | 3 fs/xfs/xfs_trans.h | 47 + fs/xfs/xfs_trans_buf.c | 62 - fs/xfs/xfs_vnodeops.c | 8 70 files changed, 2151 insertions(+), 2592 deletions(-) Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_acl.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c52
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c117
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h33
-rw-r--r--fs/xfs/linux-2.6/xfs_fs_subr.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_linux.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c87
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h45
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c104
-rw-r--r--fs/xfs/linux-2.6/xfs_super.h7
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_trace.c75
-rw-r--r--fs/xfs/linux-2.6/xfs_trace.h1369
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h4
18 files changed, 1540 insertions, 364 deletions
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c
index b23a54506446..69e598b6986f 100644
--- a/fs/xfs/linux-2.6/xfs_acl.c
+++ b/fs/xfs/linux-2.6/xfs_acl.c
@@ -21,6 +21,7 @@
21#include "xfs_bmap_btree.h" 21#include "xfs_bmap_btree.h"
22#include "xfs_inode.h" 22#include "xfs_inode.h"
23#include "xfs_vnodeops.h" 23#include "xfs_vnodeops.h"
24#include "xfs_trace.h"
24#include <linux/xattr.h> 25#include <linux/xattr.h>
25#include <linux/posix_acl_xattr.h> 26#include <linux/posix_acl_xattr.h>
26 27
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 87813e405cef..d798c54296eb 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -38,6 +38,7 @@
38#include "xfs_rw.h" 38#include "xfs_rw.h"
39#include "xfs_iomap.h" 39#include "xfs_iomap.h"
40#include "xfs_vnodeops.h" 40#include "xfs_vnodeops.h"
41#include "xfs_trace.h"
41#include <linux/mpage.h> 42#include <linux/mpage.h>
42#include <linux/pagevec.h> 43#include <linux/pagevec.h>
43#include <linux/writeback.h> 44#include <linux/writeback.h>
@@ -76,7 +77,7 @@ xfs_ioend_wake(
76 wake_up(to_ioend_wq(ip)); 77 wake_up(to_ioend_wq(ip));
77} 78}
78 79
79STATIC void 80void
80xfs_count_page_state( 81xfs_count_page_state(
81 struct page *page, 82 struct page *page,
82 int *delalloc, 83 int *delalloc,
@@ -98,48 +99,6 @@ xfs_count_page_state(
98 } while ((bh = bh->b_this_page) != head); 99 } while ((bh = bh->b_this_page) != head);
99} 100}
100 101
101#if defined(XFS_RW_TRACE)
102void
103xfs_page_trace(
104 int tag,
105 struct inode *inode,
106 struct page *page,
107 unsigned long pgoff)
108{
109 xfs_inode_t *ip;
110 loff_t isize = i_size_read(inode);
111 loff_t offset = page_offset(page);
112 int delalloc = -1, unmapped = -1, unwritten = -1;
113
114 if (page_has_buffers(page))
115 xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
116
117 ip = XFS_I(inode);
118 if (!ip->i_rwtrace)
119 return;
120
121 ktrace_enter(ip->i_rwtrace,
122 (void *)((unsigned long)tag),
123 (void *)ip,
124 (void *)inode,
125 (void *)page,
126 (void *)pgoff,
127 (void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
128 (void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
129 (void *)((unsigned long)((isize >> 32) & 0xffffffff)),
130 (void *)((unsigned long)(isize & 0xffffffff)),
131 (void *)((unsigned long)((offset >> 32) & 0xffffffff)),
132 (void *)((unsigned long)(offset & 0xffffffff)),
133 (void *)((unsigned long)delalloc),
134 (void *)((unsigned long)unmapped),
135 (void *)((unsigned long)unwritten),
136 (void *)((unsigned long)current_pid()),
137 (void *)NULL);
138}
139#else
140#define xfs_page_trace(tag, inode, page, pgoff)
141#endif
142
143STATIC struct block_device * 102STATIC struct block_device *
144xfs_find_bdev_for_inode( 103xfs_find_bdev_for_inode(
145 struct xfs_inode *ip) 104 struct xfs_inode *ip)
@@ -1202,7 +1161,7 @@ xfs_vm_writepage(
1202 int delalloc, unmapped, unwritten; 1161 int delalloc, unmapped, unwritten;
1203 struct inode *inode = page->mapping->host; 1162 struct inode *inode = page->mapping->host;
1204 1163
1205 xfs_page_trace(XFS_WRITEPAGE_ENTER, inode, page, 0); 1164 trace_xfs_writepage(inode, page, 0);
1206 1165
1207 /* 1166 /*
1208 * We need a transaction if: 1167 * We need a transaction if:
@@ -1307,7 +1266,7 @@ xfs_vm_releasepage(
1307 .nr_to_write = 1, 1266 .nr_to_write = 1,
1308 }; 1267 };
1309 1268
1310 xfs_page_trace(XFS_RELEASEPAGE_ENTER, inode, page, 0); 1269 trace_xfs_releasepage(inode, page, 0);
1311 1270
1312 if (!page_has_buffers(page)) 1271 if (!page_has_buffers(page))
1313 return 0; 1272 return 0;
@@ -1587,8 +1546,7 @@ xfs_vm_invalidatepage(
1587 struct page *page, 1546 struct page *page,
1588 unsigned long offset) 1547 unsigned long offset)
1589{ 1548{
1590 xfs_page_trace(XFS_INVALIDPAGE_ENTER, 1549 trace_xfs_invalidatepage(page->mapping->host, page, offset);
1591 page->mapping->host, page, offset);
1592 block_invalidatepage(page, offset); 1550 block_invalidatepage(page, offset);
1593} 1551}
1594 1552
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h
index 221b3e66ceef..4cfc6ea87df8 100644
--- a/fs/xfs/linux-2.6/xfs_aops.h
+++ b/fs/xfs/linux-2.6/xfs_aops.h
@@ -45,4 +45,6 @@ extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int);
45extern void xfs_ioend_init(void); 45extern void xfs_ioend_init(void);
46extern void xfs_ioend_wait(struct xfs_inode *); 46extern void xfs_ioend_wait(struct xfs_inode *);
47 47
48extern void xfs_count_page_state(struct page *, int *, int *, int *);
49
48#endif /* __XFS_AOPS_H__ */ 50#endif /* __XFS_AOPS_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 4ddc973aea7a..b4c7d4248aac 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -39,6 +39,7 @@
39#include "xfs_ag.h" 39#include "xfs_ag.h"
40#include "xfs_dmapi.h" 40#include "xfs_dmapi.h"
41#include "xfs_mount.h" 41#include "xfs_mount.h"
42#include "xfs_trace.h"
42 43
43static kmem_zone_t *xfs_buf_zone; 44static kmem_zone_t *xfs_buf_zone;
44STATIC int xfsbufd(void *); 45STATIC int xfsbufd(void *);
@@ -53,34 +54,6 @@ static struct workqueue_struct *xfslogd_workqueue;
53struct workqueue_struct *xfsdatad_workqueue; 54struct workqueue_struct *xfsdatad_workqueue;
54struct workqueue_struct *xfsconvertd_workqueue; 55struct workqueue_struct *xfsconvertd_workqueue;
55 56
56#ifdef XFS_BUF_TRACE
57void
58xfs_buf_trace(
59 xfs_buf_t *bp,
60 char *id,
61 void *data,
62 void *ra)
63{
64 ktrace_enter(xfs_buf_trace_buf,
65 bp, id,
66 (void *)(unsigned long)bp->b_flags,
67 (void *)(unsigned long)bp->b_hold.counter,
68 (void *)(unsigned long)bp->b_sema.count,
69 (void *)current,
70 data, ra,
71 (void *)(unsigned long)((bp->b_file_offset>>32) & 0xffffffff),
72 (void *)(unsigned long)(bp->b_file_offset & 0xffffffff),
73 (void *)(unsigned long)bp->b_buffer_length,
74 NULL, NULL, NULL, NULL, NULL);
75}
76ktrace_t *xfs_buf_trace_buf;
77#define XFS_BUF_TRACE_SIZE 4096
78#define XB_TRACE(bp, id, data) \
79 xfs_buf_trace(bp, id, (void *)data, (void *)__builtin_return_address(0))
80#else
81#define XB_TRACE(bp, id, data) do { } while (0)
82#endif
83
84#ifdef XFS_BUF_LOCK_TRACKING 57#ifdef XFS_BUF_LOCK_TRACKING
85# define XB_SET_OWNER(bp) ((bp)->b_last_holder = current->pid) 58# define XB_SET_OWNER(bp) ((bp)->b_last_holder = current->pid)
86# define XB_CLEAR_OWNER(bp) ((bp)->b_last_holder = -1) 59# define XB_CLEAR_OWNER(bp) ((bp)->b_last_holder = -1)
@@ -279,7 +252,8 @@ _xfs_buf_initialize(
279 init_waitqueue_head(&bp->b_waiters); 252 init_waitqueue_head(&bp->b_waiters);
280 253
281 XFS_STATS_INC(xb_create); 254 XFS_STATS_INC(xb_create);
282 XB_TRACE(bp, "initialize", target); 255
256 trace_xfs_buf_init(bp, _RET_IP_);
283} 257}
284 258
285/* 259/*
@@ -332,7 +306,7 @@ void
332xfs_buf_free( 306xfs_buf_free(
333 xfs_buf_t *bp) 307 xfs_buf_t *bp)
334{ 308{
335 XB_TRACE(bp, "free", 0); 309 trace_xfs_buf_free(bp, _RET_IP_);
336 310
337 ASSERT(list_empty(&bp->b_hash_list)); 311 ASSERT(list_empty(&bp->b_hash_list));
338 312
@@ -445,7 +419,6 @@ _xfs_buf_lookup_pages(
445 if (page_count == bp->b_page_count) 419 if (page_count == bp->b_page_count)
446 bp->b_flags |= XBF_DONE; 420 bp->b_flags |= XBF_DONE;
447 421
448 XB_TRACE(bp, "lookup_pages", (long)page_count);
449 return error; 422 return error;
450} 423}
451 424
@@ -548,7 +521,6 @@ found:
548 if (down_trylock(&bp->b_sema)) { 521 if (down_trylock(&bp->b_sema)) {
549 if (!(flags & XBF_TRYLOCK)) { 522 if (!(flags & XBF_TRYLOCK)) {
550 /* wait for buffer ownership */ 523 /* wait for buffer ownership */
551 XB_TRACE(bp, "get_lock", 0);
552 xfs_buf_lock(bp); 524 xfs_buf_lock(bp);
553 XFS_STATS_INC(xb_get_locked_waited); 525 XFS_STATS_INC(xb_get_locked_waited);
554 } else { 526 } else {
@@ -571,7 +543,8 @@ found:
571 ASSERT((bp->b_flags & _XBF_DELWRI_Q) == 0); 543 ASSERT((bp->b_flags & _XBF_DELWRI_Q) == 0);
572 bp->b_flags &= XBF_MAPPED; 544 bp->b_flags &= XBF_MAPPED;
573 } 545 }
574 XB_TRACE(bp, "got_lock", 0); 546
547 trace_xfs_buf_find(bp, flags, _RET_IP_);
575 XFS_STATS_INC(xb_get_locked); 548 XFS_STATS_INC(xb_get_locked);
576 return bp; 549 return bp;
577} 550}
@@ -627,7 +600,7 @@ xfs_buf_get(
627 bp->b_bn = ioff; 600 bp->b_bn = ioff;
628 bp->b_count_desired = bp->b_buffer_length; 601 bp->b_count_desired = bp->b_buffer_length;
629 602
630 XB_TRACE(bp, "get", (unsigned long)flags); 603 trace_xfs_buf_get(bp, flags, _RET_IP_);
631 return bp; 604 return bp;
632 605
633 no_buffer: 606 no_buffer:
@@ -644,8 +617,6 @@ _xfs_buf_read(
644{ 617{
645 int status; 618 int status;
646 619
647 XB_TRACE(bp, "_xfs_buf_read", (unsigned long)flags);
648
649 ASSERT(!(flags & (XBF_DELWRI|XBF_WRITE))); 620 ASSERT(!(flags & (XBF_DELWRI|XBF_WRITE)));
650 ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL); 621 ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL);
651 622
@@ -673,19 +644,18 @@ xfs_buf_read(
673 644
674 bp = xfs_buf_get(target, ioff, isize, flags); 645 bp = xfs_buf_get(target, ioff, isize, flags);
675 if (bp) { 646 if (bp) {
647 trace_xfs_buf_read(bp, flags, _RET_IP_);
648
676 if (!XFS_BUF_ISDONE(bp)) { 649 if (!XFS_BUF_ISDONE(bp)) {
677 XB_TRACE(bp, "read", (unsigned long)flags);
678 XFS_STATS_INC(xb_get_read); 650 XFS_STATS_INC(xb_get_read);
679 _xfs_buf_read(bp, flags); 651 _xfs_buf_read(bp, flags);
680 } else if (flags & XBF_ASYNC) { 652 } else if (flags & XBF_ASYNC) {
681 XB_TRACE(bp, "read_async", (unsigned long)flags);
682 /* 653 /*
683 * Read ahead call which is already satisfied, 654 * Read ahead call which is already satisfied,
684 * drop the buffer 655 * drop the buffer
685 */ 656 */
686 goto no_buffer; 657 goto no_buffer;
687 } else { 658 } else {
688 XB_TRACE(bp, "read_done", (unsigned long)flags);
689 /* We do not want read in the flags */ 659 /* We do not want read in the flags */
690 bp->b_flags &= ~XBF_READ; 660 bp->b_flags &= ~XBF_READ;
691 } 661 }
@@ -823,7 +793,7 @@ xfs_buf_get_noaddr(
823 793
824 xfs_buf_unlock(bp); 794 xfs_buf_unlock(bp);
825 795
826 XB_TRACE(bp, "no_daddr", len); 796 trace_xfs_buf_get_noaddr(bp, _RET_IP_);
827 return bp; 797 return bp;
828 798
829 fail_free_mem: 799 fail_free_mem:
@@ -845,8 +815,8 @@ void
845xfs_buf_hold( 815xfs_buf_hold(
846 xfs_buf_t *bp) 816 xfs_buf_t *bp)
847{ 817{
818 trace_xfs_buf_hold(bp, _RET_IP_);
848 atomic_inc(&bp->b_hold); 819 atomic_inc(&bp->b_hold);
849 XB_TRACE(bp, "hold", 0);
850} 820}
851 821
852/* 822/*
@@ -859,7 +829,7 @@ xfs_buf_rele(
859{ 829{
860 xfs_bufhash_t *hash = bp->b_hash; 830 xfs_bufhash_t *hash = bp->b_hash;
861 831
862 XB_TRACE(bp, "rele", bp->b_relse); 832 trace_xfs_buf_rele(bp, _RET_IP_);
863 833
864 if (unlikely(!hash)) { 834 if (unlikely(!hash)) {
865 ASSERT(!bp->b_relse); 835 ASSERT(!bp->b_relse);
@@ -909,21 +879,19 @@ xfs_buf_cond_lock(
909 int locked; 879 int locked;
910 880
911 locked = down_trylock(&bp->b_sema) == 0; 881 locked = down_trylock(&bp->b_sema) == 0;
912 if (locked) { 882 if (locked)
913 XB_SET_OWNER(bp); 883 XB_SET_OWNER(bp);
914 } 884
915 XB_TRACE(bp, "cond_lock", (long)locked); 885 trace_xfs_buf_cond_lock(bp, _RET_IP_);
916 return locked ? 0 : -EBUSY; 886 return locked ? 0 : -EBUSY;
917} 887}
918 888
919#if defined(DEBUG) || defined(XFS_BLI_TRACE)
920int 889int
921xfs_buf_lock_value( 890xfs_buf_lock_value(
922 xfs_buf_t *bp) 891 xfs_buf_t *bp)
923{ 892{
924 return bp->b_sema.count; 893 return bp->b_sema.count;
925} 894}
926#endif
927 895
928/* 896/*
929 * Locks a buffer object. 897 * Locks a buffer object.
@@ -935,12 +903,14 @@ void
935xfs_buf_lock( 903xfs_buf_lock(
936 xfs_buf_t *bp) 904 xfs_buf_t *bp)
937{ 905{
938 XB_TRACE(bp, "lock", 0); 906 trace_xfs_buf_lock(bp, _RET_IP_);
907
939 if (atomic_read(&bp->b_io_remaining)) 908 if (atomic_read(&bp->b_io_remaining))
940 blk_run_address_space(bp->b_target->bt_mapping); 909 blk_run_address_space(bp->b_target->bt_mapping);
941 down(&bp->b_sema); 910 down(&bp->b_sema);
942 XB_SET_OWNER(bp); 911 XB_SET_OWNER(bp);
943 XB_TRACE(bp, "locked", 0); 912
913 trace_xfs_buf_lock_done(bp, _RET_IP_);
944} 914}
945 915
946/* 916/*
@@ -962,7 +932,8 @@ xfs_buf_unlock(
962 932
963 XB_CLEAR_OWNER(bp); 933 XB_CLEAR_OWNER(bp);
964 up(&bp->b_sema); 934 up(&bp->b_sema);
965 XB_TRACE(bp, "unlock", 0); 935
936 trace_xfs_buf_unlock(bp, _RET_IP_);
966} 937}
967 938
968 939
@@ -974,17 +945,18 @@ void
974xfs_buf_pin( 945xfs_buf_pin(
975 xfs_buf_t *bp) 946 xfs_buf_t *bp)
976{ 947{
948 trace_xfs_buf_pin(bp, _RET_IP_);
977 atomic_inc(&bp->b_pin_count); 949 atomic_inc(&bp->b_pin_count);
978 XB_TRACE(bp, "pin", (long)bp->b_pin_count.counter);
979} 950}
980 951
981void 952void
982xfs_buf_unpin( 953xfs_buf_unpin(
983 xfs_buf_t *bp) 954 xfs_buf_t *bp)
984{ 955{
956 trace_xfs_buf_unpin(bp, _RET_IP_);
957
985 if (atomic_dec_and_test(&bp->b_pin_count)) 958 if (atomic_dec_and_test(&bp->b_pin_count))
986 wake_up_all(&bp->b_waiters); 959 wake_up_all(&bp->b_waiters);
987 XB_TRACE(bp, "unpin", (long)bp->b_pin_count.counter);
988} 960}
989 961
990int 962int
@@ -1035,7 +1007,7 @@ xfs_buf_iodone_work(
1035 */ 1007 */
1036 if ((bp->b_error == EOPNOTSUPP) && 1008 if ((bp->b_error == EOPNOTSUPP) &&
1037 (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) { 1009 (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
1038 XB_TRACE(bp, "ordered_retry", bp->b_iodone); 1010 trace_xfs_buf_ordered_retry(bp, _RET_IP_);
1039 bp->b_flags &= ~XBF_ORDERED; 1011 bp->b_flags &= ~XBF_ORDERED;
1040 bp->b_flags |= _XFS_BARRIER_FAILED; 1012 bp->b_flags |= _XFS_BARRIER_FAILED;
1041 xfs_buf_iorequest(bp); 1013 xfs_buf_iorequest(bp);
@@ -1050,12 +1022,12 @@ xfs_buf_ioend(
1050 xfs_buf_t *bp, 1022 xfs_buf_t *bp,
1051 int schedule) 1023 int schedule)
1052{ 1024{
1025 trace_xfs_buf_iodone(bp, _RET_IP_);
1026
1053 bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD); 1027 bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD);
1054 if (bp->b_error == 0) 1028 if (bp->b_error == 0)
1055 bp->b_flags |= XBF_DONE; 1029 bp->b_flags |= XBF_DONE;
1056 1030
1057 XB_TRACE(bp, "iodone", bp->b_iodone);
1058
1059 if ((bp->b_iodone) || (bp->b_flags & XBF_ASYNC)) { 1031 if ((bp->b_iodone) || (bp->b_flags & XBF_ASYNC)) {
1060 if (schedule) { 1032 if (schedule) {
1061 INIT_WORK(&bp->b_iodone_work, xfs_buf_iodone_work); 1033 INIT_WORK(&bp->b_iodone_work, xfs_buf_iodone_work);
@@ -1075,7 +1047,7 @@ xfs_buf_ioerror(
1075{ 1047{
1076 ASSERT(error >= 0 && error <= 0xffff); 1048 ASSERT(error >= 0 && error <= 0xffff);
1077 bp->b_error = (unsigned short)error; 1049 bp->b_error = (unsigned short)error;
1078 XB_TRACE(bp, "ioerror", (unsigned long)error); 1050 trace_xfs_buf_ioerror(bp, error, _RET_IP_);
1079} 1051}
1080 1052
1081int 1053int
@@ -1083,7 +1055,7 @@ xfs_bawrite(
1083 void *mp, 1055 void *mp,
1084 struct xfs_buf *bp) 1056 struct xfs_buf *bp)
1085{ 1057{
1086 XB_TRACE(bp, "bawrite", 0); 1058 trace_xfs_buf_bawrite(bp, _RET_IP_);
1087 1059
1088 ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL); 1060 ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL);
1089 1061
@@ -1102,7 +1074,7 @@ xfs_bdwrite(
1102 void *mp, 1074 void *mp,
1103 struct xfs_buf *bp) 1075 struct xfs_buf *bp)
1104{ 1076{
1105 XB_TRACE(bp, "bdwrite", 0); 1077 trace_xfs_buf_bdwrite(bp, _RET_IP_);
1106 1078
1107 bp->b_strat = xfs_bdstrat_cb; 1079 bp->b_strat = xfs_bdstrat_cb;
1108 bp->b_mount = mp; 1080 bp->b_mount = mp;
@@ -1253,7 +1225,7 @@ int
1253xfs_buf_iorequest( 1225xfs_buf_iorequest(
1254 xfs_buf_t *bp) 1226 xfs_buf_t *bp)
1255{ 1227{
1256 XB_TRACE(bp, "iorequest", 0); 1228 trace_xfs_buf_iorequest(bp, _RET_IP_);
1257 1229
1258 if (bp->b_flags & XBF_DELWRI) { 1230 if (bp->b_flags & XBF_DELWRI) {
1259 xfs_buf_delwri_queue(bp, 1); 1231 xfs_buf_delwri_queue(bp, 1);
@@ -1287,11 +1259,13 @@ int
1287xfs_buf_iowait( 1259xfs_buf_iowait(
1288 xfs_buf_t *bp) 1260 xfs_buf_t *bp)
1289{ 1261{
1290 XB_TRACE(bp, "iowait", 0); 1262 trace_xfs_buf_iowait(bp, _RET_IP_);
1263
1291 if (atomic_read(&bp->b_io_remaining)) 1264 if (atomic_read(&bp->b_io_remaining))
1292 blk_run_address_space(bp->b_target->bt_mapping); 1265 blk_run_address_space(bp->b_target->bt_mapping);
1293 wait_for_completion(&bp->b_iowait); 1266 wait_for_completion(&bp->b_iowait);
1294 XB_TRACE(bp, "iowaited", (long)bp->b_error); 1267
1268 trace_xfs_buf_iowait_done(bp, _RET_IP_);
1295 return bp->b_error; 1269 return bp->b_error;
1296} 1270}
1297 1271
@@ -1604,7 +1578,8 @@ xfs_buf_delwri_queue(
1604 struct list_head *dwq = &bp->b_target->bt_delwrite_queue; 1578 struct list_head *dwq = &bp->b_target->bt_delwrite_queue;
1605 spinlock_t *dwlk = &bp->b_target->bt_delwrite_lock; 1579 spinlock_t *dwlk = &bp->b_target->bt_delwrite_lock;
1606 1580
1607 XB_TRACE(bp, "delwri_q", (long)unlock); 1581 trace_xfs_buf_delwri_queue(bp, _RET_IP_);
1582
1608 ASSERT((bp->b_flags&(XBF_DELWRI|XBF_ASYNC)) == (XBF_DELWRI|XBF_ASYNC)); 1583 ASSERT((bp->b_flags&(XBF_DELWRI|XBF_ASYNC)) == (XBF_DELWRI|XBF_ASYNC));
1609 1584
1610 spin_lock(dwlk); 1585 spin_lock(dwlk);
@@ -1644,7 +1619,7 @@ xfs_buf_delwri_dequeue(
1644 if (dequeued) 1619 if (dequeued)
1645 xfs_buf_rele(bp); 1620 xfs_buf_rele(bp);
1646 1621
1647 XB_TRACE(bp, "delwri_dq", (long)dequeued); 1622 trace_xfs_buf_delwri_dequeue(bp, _RET_IP_);
1648} 1623}
1649 1624
1650STATIC void 1625STATIC void
@@ -1692,7 +1667,7 @@ xfs_buf_delwri_split(
1692 INIT_LIST_HEAD(list); 1667 INIT_LIST_HEAD(list);
1693 spin_lock(dwlk); 1668 spin_lock(dwlk);
1694 list_for_each_entry_safe(bp, n, dwq, b_list) { 1669 list_for_each_entry_safe(bp, n, dwq, b_list) {
1695 XB_TRACE(bp, "walkq1", (long)xfs_buf_ispin(bp)); 1670 trace_xfs_buf_delwri_split(bp, _RET_IP_);
1696 ASSERT(bp->b_flags & XBF_DELWRI); 1671 ASSERT(bp->b_flags & XBF_DELWRI);
1697 1672
1698 if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) { 1673 if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) {
@@ -1816,14 +1791,10 @@ xfs_flush_buftarg(
1816int __init 1791int __init
1817xfs_buf_init(void) 1792xfs_buf_init(void)
1818{ 1793{
1819#ifdef XFS_BUF_TRACE
1820 xfs_buf_trace_buf = ktrace_alloc(XFS_BUF_TRACE_SIZE, KM_NOFS);
1821#endif
1822
1823 xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf", 1794 xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf",
1824 KM_ZONE_HWALIGN, NULL); 1795 KM_ZONE_HWALIGN, NULL);
1825 if (!xfs_buf_zone) 1796 if (!xfs_buf_zone)
1826 goto out_free_trace_buf; 1797 goto out;
1827 1798
1828 xfslogd_workqueue = create_workqueue("xfslogd"); 1799 xfslogd_workqueue = create_workqueue("xfslogd");
1829 if (!xfslogd_workqueue) 1800 if (!xfslogd_workqueue)
@@ -1846,10 +1817,7 @@ xfs_buf_init(void)
1846 destroy_workqueue(xfslogd_workqueue); 1817 destroy_workqueue(xfslogd_workqueue);
1847 out_free_buf_zone: 1818 out_free_buf_zone:
1848 kmem_zone_destroy(xfs_buf_zone); 1819 kmem_zone_destroy(xfs_buf_zone);
1849 out_free_trace_buf: 1820 out:
1850#ifdef XFS_BUF_TRACE
1851 ktrace_free(xfs_buf_trace_buf);
1852#endif
1853 return -ENOMEM; 1821 return -ENOMEM;
1854} 1822}
1855 1823
@@ -1861,9 +1829,6 @@ xfs_buf_terminate(void)
1861 destroy_workqueue(xfsdatad_workqueue); 1829 destroy_workqueue(xfsdatad_workqueue);
1862 destroy_workqueue(xfslogd_workqueue); 1830 destroy_workqueue(xfslogd_workqueue);
1863 kmem_zone_destroy(xfs_buf_zone); 1831 kmem_zone_destroy(xfs_buf_zone);
1864#ifdef XFS_BUF_TRACE
1865 ktrace_free(xfs_buf_trace_buf);
1866#endif
1867} 1832}
1868 1833
1869#ifdef CONFIG_KDB_MODULES 1834#ifdef CONFIG_KDB_MODULES
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 5f07dd91c5fa..a509f4addc2a 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -95,6 +95,28 @@ typedef enum {
95 _XFS_BARRIER_FAILED = (1 << 23), 95 _XFS_BARRIER_FAILED = (1 << 23),
96} xfs_buf_flags_t; 96} xfs_buf_flags_t;
97 97
98#define XFS_BUF_FLAGS \
99 { XBF_READ, "READ" }, \
100 { XBF_WRITE, "WRITE" }, \
101 { XBF_MAPPED, "MAPPED" }, \
102 { XBF_ASYNC, "ASYNC" }, \
103 { XBF_DONE, "DONE" }, \
104 { XBF_DELWRI, "DELWRI" }, \
105 { XBF_STALE, "STALE" }, \
106 { XBF_FS_MANAGED, "FS_MANAGED" }, \
107 { XBF_ORDERED, "ORDERED" }, \
108 { XBF_READ_AHEAD, "READ_AHEAD" }, \
109 { XBF_LOCK, "LOCK" }, /* should never be set */\
110 { XBF_TRYLOCK, "TRYLOCK" }, /* ditto */\
111 { XBF_DONT_BLOCK, "DONT_BLOCK" }, /* ditto */\
112 { _XBF_PAGE_CACHE, "PAGE_CACHE" }, \
113 { _XBF_PAGES, "PAGES" }, \
114 { _XBF_RUN_QUEUES, "RUN_QUEUES" }, \
115 { _XBF_DELWRI_Q, "DELWRI_Q" }, \
116 { _XBF_PAGE_LOCKED, "PAGE_LOCKED" }, \
117 { _XFS_BARRIER_FAILED, "BARRIER_FAILED" }
118
119
98typedef enum { 120typedef enum {
99 XBT_FORCE_SLEEP = 0, 121 XBT_FORCE_SLEEP = 0,
100 XBT_FORCE_FLUSH = 1, 122 XBT_FORCE_FLUSH = 1,
@@ -243,13 +265,6 @@ extern void xfs_buf_delwri_dequeue(xfs_buf_t *);
243extern int xfs_buf_init(void); 265extern int xfs_buf_init(void);
244extern void xfs_buf_terminate(void); 266extern void xfs_buf_terminate(void);
245 267
246#ifdef XFS_BUF_TRACE
247extern ktrace_t *xfs_buf_trace_buf;
248extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *);
249#else
250#define xfs_buf_trace(bp,id,ptr,ra) do { } while (0)
251#endif
252
253#define xfs_buf_target_name(target) \ 268#define xfs_buf_target_name(target) \
254 ({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; }) 269 ({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; })
255 270
@@ -365,10 +380,6 @@ static inline void xfs_buf_relse(xfs_buf_t *bp)
365 380
366#define xfs_bpin(bp) xfs_buf_pin(bp) 381#define xfs_bpin(bp) xfs_buf_pin(bp)
367#define xfs_bunpin(bp) xfs_buf_unpin(bp) 382#define xfs_bunpin(bp) xfs_buf_unpin(bp)
368
369#define xfs_buftrace(id, bp) \
370 xfs_buf_trace(bp, id, NULL, (void *)__builtin_return_address(0))
371
372#define xfs_biodone(bp) xfs_buf_ioend(bp, 0) 383#define xfs_biodone(bp) xfs_buf_ioend(bp, 0)
373 384
374#define xfs_biomove(bp, off, len, data, rw) \ 385#define xfs_biomove(bp, off, len, data, rw) \
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c
index 08be36d7326c..7501b85fd860 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.c
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.c
@@ -19,6 +19,7 @@
19#include "xfs_vnodeops.h" 19#include "xfs_vnodeops.h"
20#include "xfs_bmap_btree.h" 20#include "xfs_bmap_btree.h"
21#include "xfs_inode.h" 21#include "xfs_inode.h"
22#include "xfs_trace.h"
22 23
23int fs_noerr(void) { return 0; } 24int fs_noerr(void) { return 0; }
24int fs_nosys(void) { return ENOSYS; } 25int fs_nosys(void) { return ENOSYS; }
@@ -51,6 +52,8 @@ xfs_flushinval_pages(
51 struct address_space *mapping = VFS_I(ip)->i_mapping; 52 struct address_space *mapping = VFS_I(ip)->i_mapping;
52 int ret = 0; 53 int ret = 0;
53 54
55 trace_xfs_pagecache_inval(ip, first, last);
56
54 if (mapping->nrpages) { 57 if (mapping->nrpages) {
55 xfs_iflags_clear(ip, XFS_ITRUNCATED); 58 xfs_iflags_clear(ip, XFS_ITRUNCATED);
56 ret = filemap_write_and_wait(mapping); 59 ret = filemap_write_and_wait(mapping);
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 5bb523d7f37e..a034cf624437 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -51,6 +51,7 @@
51#include "xfs_quota.h" 51#include "xfs_quota.h"
52#include "xfs_inode_item.h" 52#include "xfs_inode_item.h"
53#include "xfs_export.h" 53#include "xfs_export.h"
54#include "xfs_trace.h"
54 55
55#include <linux/capability.h> 56#include <linux/capability.h>
56#include <linux/dcache.h> 57#include <linux/dcache.h>
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index eafcc7c18706..be1527b1670c 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -46,6 +46,7 @@
46#include "xfs_attr.h" 46#include "xfs_attr.h"
47#include "xfs_ioctl.h" 47#include "xfs_ioctl.h"
48#include "xfs_ioctl32.h" 48#include "xfs_ioctl32.h"
49#include "xfs_trace.h"
49 50
50#define _NATIVE_IOC(cmd, type) \ 51#define _NATIVE_IOC(cmd, type) \
51 _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type)) 52 _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 1f3b4b8f7dd4..1d5b298ba8b2 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -47,6 +47,7 @@
47#include "xfs_buf_item.h" 47#include "xfs_buf_item.h"
48#include "xfs_utils.h" 48#include "xfs_utils.h"
49#include "xfs_vnodeops.h" 49#include "xfs_vnodeops.h"
50#include "xfs_trace.h"
50 51
51#include <linux/capability.h> 52#include <linux/capability.h>
52#include <linux/xattr.h> 53#include <linux/xattr.h>
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
index 6127e24062d0..5af0c81ca1ae 100644
--- a/fs/xfs/linux-2.6/xfs_linux.h
+++ b/fs/xfs/linux-2.6/xfs_linux.h
@@ -40,7 +40,6 @@
40#include <sv.h> 40#include <sv.h>
41#include <time.h> 41#include <time.h>
42 42
43#include <support/ktrace.h>
44#include <support/debug.h> 43#include <support/debug.h>
45#include <support/uuid.h> 44#include <support/uuid.h>
46 45
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 1bf47f219c97..0d32457abef1 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -48,73 +48,12 @@
48#include "xfs_utils.h" 48#include "xfs_utils.h"
49#include "xfs_iomap.h" 49#include "xfs_iomap.h"
50#include "xfs_vnodeops.h" 50#include "xfs_vnodeops.h"
51#include "xfs_trace.h"
51 52
52#include <linux/capability.h> 53#include <linux/capability.h>
53#include <linux/writeback.h> 54#include <linux/writeback.h>
54 55
55 56
56#if defined(XFS_RW_TRACE)
57void
58xfs_rw_enter_trace(
59 int tag,
60 xfs_inode_t *ip,
61 void *data,
62 size_t segs,
63 loff_t offset,
64 int ioflags)
65{
66 if (ip->i_rwtrace == NULL)
67 return;
68 ktrace_enter(ip->i_rwtrace,
69 (void *)(unsigned long)tag,
70 (void *)ip,
71 (void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
72 (void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
73 (void *)data,
74 (void *)((unsigned long)segs),
75 (void *)((unsigned long)((offset >> 32) & 0xffffffff)),
76 (void *)((unsigned long)(offset & 0xffffffff)),
77 (void *)((unsigned long)ioflags),
78 (void *)((unsigned long)((ip->i_new_size >> 32) & 0xffffffff)),
79 (void *)((unsigned long)(ip->i_new_size & 0xffffffff)),
80 (void *)((unsigned long)current_pid()),
81 (void *)NULL,
82 (void *)NULL,
83 (void *)NULL,
84 (void *)NULL);
85}
86
87void
88xfs_inval_cached_trace(
89 xfs_inode_t *ip,
90 xfs_off_t offset,
91 xfs_off_t len,
92 xfs_off_t first,
93 xfs_off_t last)
94{
95
96 if (ip->i_rwtrace == NULL)
97 return;
98 ktrace_enter(ip->i_rwtrace,
99 (void *)(__psint_t)XFS_INVAL_CACHED,
100 (void *)ip,
101 (void *)((unsigned long)((offset >> 32) & 0xffffffff)),
102 (void *)((unsigned long)(offset & 0xffffffff)),
103 (void *)((unsigned long)((len >> 32) & 0xffffffff)),
104 (void *)((unsigned long)(len & 0xffffffff)),
105 (void *)((unsigned long)((first >> 32) & 0xffffffff)),
106 (void *)((unsigned long)(first & 0xffffffff)),
107 (void *)((unsigned long)((last >> 32) & 0xffffffff)),
108 (void *)((unsigned long)(last & 0xffffffff)),
109 (void *)((unsigned long)current_pid()),
110 (void *)NULL,
111 (void *)NULL,
112 (void *)NULL,
113 (void *)NULL,
114 (void *)NULL);
115}
116#endif
117
118/* 57/*
119 * xfs_iozero 58 * xfs_iozero
120 * 59 *
@@ -250,8 +189,7 @@ xfs_read(
250 } 189 }
251 } 190 }
252 191
253 xfs_rw_enter_trace(XFS_READ_ENTER, ip, 192 trace_xfs_file_read(ip, size, *offset, ioflags);
254 (void *)iovp, segs, *offset, ioflags);
255 193
256 iocb->ki_pos = *offset; 194 iocb->ki_pos = *offset;
257 ret = generic_file_aio_read(iocb, iovp, segs, *offset); 195 ret = generic_file_aio_read(iocb, iovp, segs, *offset);
@@ -292,8 +230,9 @@ xfs_splice_read(
292 return -error; 230 return -error;
293 } 231 }
294 } 232 }
295 xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, ip, 233
296 pipe, count, *ppos, ioflags); 234 trace_xfs_file_splice_read(ip, count, *ppos, ioflags);
235
297 ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); 236 ret = generic_file_splice_read(infilp, ppos, pipe, count, flags);
298 if (ret > 0) 237 if (ret > 0)
299 XFS_STATS_ADD(xs_read_bytes, ret); 238 XFS_STATS_ADD(xs_read_bytes, ret);
@@ -342,8 +281,8 @@ xfs_splice_write(
342 ip->i_new_size = new_size; 281 ip->i_new_size = new_size;
343 xfs_iunlock(ip, XFS_ILOCK_EXCL); 282 xfs_iunlock(ip, XFS_ILOCK_EXCL);
344 283
345 xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, ip, 284 trace_xfs_file_splice_write(ip, count, *ppos, ioflags);
346 pipe, count, *ppos, ioflags); 285
347 ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags); 286 ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags);
348 if (ret > 0) 287 if (ret > 0)
349 XFS_STATS_ADD(xs_write_bytes, ret); 288 XFS_STATS_ADD(xs_write_bytes, ret);
@@ -710,8 +649,6 @@ start:
710 if ((ioflags & IO_ISDIRECT)) { 649 if ((ioflags & IO_ISDIRECT)) {
711 if (mapping->nrpages) { 650 if (mapping->nrpages) {
712 WARN_ON(need_i_mutex == 0); 651 WARN_ON(need_i_mutex == 0);
713 xfs_inval_cached_trace(xip, pos, -1,
714 (pos & PAGE_CACHE_MASK), -1);
715 error = xfs_flushinval_pages(xip, 652 error = xfs_flushinval_pages(xip,
716 (pos & PAGE_CACHE_MASK), 653 (pos & PAGE_CACHE_MASK),
717 -1, FI_REMAPF_LOCKED); 654 -1, FI_REMAPF_LOCKED);
@@ -728,8 +665,7 @@ start:
728 need_i_mutex = 0; 665 need_i_mutex = 0;
729 } 666 }
730 667
731 xfs_rw_enter_trace(XFS_DIOWR_ENTER, xip, (void *)iovp, segs, 668 trace_xfs_file_direct_write(xip, count, *offset, ioflags);
732 *offset, ioflags);
733 ret = generic_file_direct_write(iocb, iovp, 669 ret = generic_file_direct_write(iocb, iovp,
734 &segs, pos, offset, count, ocount); 670 &segs, pos, offset, count, ocount);
735 671
@@ -752,8 +688,7 @@ start:
752 ssize_t ret2 = 0; 688 ssize_t ret2 = 0;
753 689
754write_retry: 690write_retry:
755 xfs_rw_enter_trace(XFS_WRITE_ENTER, xip, (void *)iovp, segs, 691 trace_xfs_file_buffered_write(xip, count, *offset, ioflags);
756 *offset, ioflags);
757 ret2 = generic_file_buffered_write(iocb, iovp, segs, 692 ret2 = generic_file_buffered_write(iocb, iovp, segs,
758 pos, offset, count, ret); 693 pos, offset, count, ret);
759 /* 694 /*
@@ -858,7 +793,7 @@ int
858xfs_bdstrat_cb(struct xfs_buf *bp) 793xfs_bdstrat_cb(struct xfs_buf *bp)
859{ 794{
860 if (XFS_FORCED_SHUTDOWN(bp->b_mount)) { 795 if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
861 xfs_buftrace("XFS__BDSTRAT IOERROR", bp); 796 trace_xfs_bdstrat_shut(bp, _RET_IP_);
862 /* 797 /*
863 * Metadata write that didn't get logged but 798 * Metadata write that didn't get logged but
864 * written delayed anyway. These aren't associated 799 * written delayed anyway. These aren't associated
@@ -891,7 +826,7 @@ xfsbdstrat(
891 return; 826 return;
892 } 827 }
893 828
894 xfs_buftrace("XFSBDSTRAT IOERROR", bp); 829 trace_xfs_bdstrat_shut(bp, _RET_IP_);
895 xfs_bioerror_relse(bp); 830 xfs_bioerror_relse(bp);
896} 831}
897 832
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index e6be37dbd0e9..d1f7789c7ffb 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -20,52 +20,7 @@
20 20
21struct xfs_mount; 21struct xfs_mount;
22struct xfs_inode; 22struct xfs_inode;
23struct xfs_bmbt_irec;
24struct xfs_buf; 23struct xfs_buf;
25struct xfs_iomap;
26
27#if defined(XFS_RW_TRACE)
28/*
29 * Defines for the trace mechanisms in xfs_lrw.c.
30 */
31#define XFS_RW_KTRACE_SIZE 128
32
33#define XFS_READ_ENTER 1
34#define XFS_WRITE_ENTER 2
35#define XFS_IOMAP_READ_ENTER 3
36#define XFS_IOMAP_WRITE_ENTER 4
37#define XFS_IOMAP_READ_MAP 5
38#define XFS_IOMAP_WRITE_MAP 6
39#define XFS_IOMAP_WRITE_NOSPACE 7
40#define XFS_ITRUNC_START 8
41#define XFS_ITRUNC_FINISH1 9
42#define XFS_ITRUNC_FINISH2 10
43#define XFS_CTRUNC1 11
44#define XFS_CTRUNC2 12
45#define XFS_CTRUNC3 13
46#define XFS_CTRUNC4 14
47#define XFS_CTRUNC5 15
48#define XFS_CTRUNC6 16
49#define XFS_BUNMAP 17
50#define XFS_INVAL_CACHED 18
51#define XFS_DIORD_ENTER 19
52#define XFS_DIOWR_ENTER 20
53#define XFS_WRITEPAGE_ENTER 22
54#define XFS_RELEASEPAGE_ENTER 23
55#define XFS_INVALIDPAGE_ENTER 24
56#define XFS_IOMAP_ALLOC_ENTER 25
57#define XFS_IOMAP_ALLOC_MAP 26
58#define XFS_IOMAP_UNWRITTEN 27
59#define XFS_SPLICE_READ_ENTER 28
60#define XFS_SPLICE_WRITE_ENTER 29
61extern void xfs_rw_enter_trace(int, struct xfs_inode *,
62 void *, size_t, loff_t, int);
63extern void xfs_inval_cached_trace(struct xfs_inode *,
64 xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t);
65#else
66#define xfs_rw_enter_trace(tag, ip, data, size, offset, ioflags)
67#define xfs_inval_cached_trace(ip, offset, len, first, last)
68#endif
69 24
70/* errors from xfsbdstrat() must be extracted from the buffer */ 25/* errors from xfsbdstrat() must be extracted from the buffer */
71extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *); 26extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 1bfb0e980193..09783cc444ac 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -15,6 +15,7 @@
15 * along with this program; if not, write the Free Software Foundation, 15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18
18#include "xfs.h" 19#include "xfs.h"
19#include "xfs_bit.h" 20#include "xfs_bit.h"
20#include "xfs_log.h" 21#include "xfs_log.h"
@@ -52,11 +53,11 @@
52#include "xfs_trans_priv.h" 53#include "xfs_trans_priv.h"
53#include "xfs_filestream.h" 54#include "xfs_filestream.h"
54#include "xfs_da_btree.h" 55#include "xfs_da_btree.h"
55#include "xfs_dir2_trace.h"
56#include "xfs_extfree_item.h" 56#include "xfs_extfree_item.h"
57#include "xfs_mru_cache.h" 57#include "xfs_mru_cache.h"
58#include "xfs_inode_item.h" 58#include "xfs_inode_item.h"
59#include "xfs_sync.h" 59#include "xfs_sync.h"
60#include "xfs_trace.h"
60 61
61#include <linux/namei.h> 62#include <linux/namei.h>
62#include <linux/init.h> 63#include <linux/init.h>
@@ -1525,8 +1526,6 @@ xfs_fs_fill_super(
1525 goto fail_vnrele; 1526 goto fail_vnrele;
1526 1527
1527 kfree(mtpt); 1528 kfree(mtpt);
1528
1529 xfs_itrace_exit(XFS_I(sb->s_root->d_inode));
1530 return 0; 1529 return 0;
1531 1530
1532 out_filestream_unmount: 1531 out_filestream_unmount:
@@ -1602,94 +1601,6 @@ static struct file_system_type xfs_fs_type = {
1602}; 1601};
1603 1602
1604STATIC int __init 1603STATIC int __init
1605xfs_alloc_trace_bufs(void)
1606{
1607#ifdef XFS_ALLOC_TRACE
1608 xfs_alloc_trace_buf = ktrace_alloc(XFS_ALLOC_TRACE_SIZE, KM_MAYFAIL);
1609 if (!xfs_alloc_trace_buf)
1610 goto out;
1611#endif
1612#ifdef XFS_BMAP_TRACE
1613 xfs_bmap_trace_buf = ktrace_alloc(XFS_BMAP_TRACE_SIZE, KM_MAYFAIL);
1614 if (!xfs_bmap_trace_buf)
1615 goto out_free_alloc_trace;
1616#endif
1617#ifdef XFS_BTREE_TRACE
1618 xfs_allocbt_trace_buf = ktrace_alloc(XFS_ALLOCBT_TRACE_SIZE,
1619 KM_MAYFAIL);
1620 if (!xfs_allocbt_trace_buf)
1621 goto out_free_bmap_trace;
1622
1623 xfs_inobt_trace_buf = ktrace_alloc(XFS_INOBT_TRACE_SIZE, KM_MAYFAIL);
1624 if (!xfs_inobt_trace_buf)
1625 goto out_free_allocbt_trace;
1626
1627 xfs_bmbt_trace_buf = ktrace_alloc(XFS_BMBT_TRACE_SIZE, KM_MAYFAIL);
1628 if (!xfs_bmbt_trace_buf)
1629 goto out_free_inobt_trace;
1630#endif
1631#ifdef XFS_ATTR_TRACE
1632 xfs_attr_trace_buf = ktrace_alloc(XFS_ATTR_TRACE_SIZE, KM_MAYFAIL);
1633 if (!xfs_attr_trace_buf)
1634 goto out_free_bmbt_trace;
1635#endif
1636#ifdef XFS_DIR2_TRACE
1637 xfs_dir2_trace_buf = ktrace_alloc(XFS_DIR2_GTRACE_SIZE, KM_MAYFAIL);
1638 if (!xfs_dir2_trace_buf)
1639 goto out_free_attr_trace;
1640#endif
1641
1642 return 0;
1643
1644#ifdef XFS_DIR2_TRACE
1645 out_free_attr_trace:
1646#endif
1647#ifdef XFS_ATTR_TRACE
1648 ktrace_free(xfs_attr_trace_buf);
1649 out_free_bmbt_trace:
1650#endif
1651#ifdef XFS_BTREE_TRACE
1652 ktrace_free(xfs_bmbt_trace_buf);
1653 out_free_inobt_trace:
1654 ktrace_free(xfs_inobt_trace_buf);
1655 out_free_allocbt_trace:
1656 ktrace_free(xfs_allocbt_trace_buf);
1657 out_free_bmap_trace:
1658#endif
1659#ifdef XFS_BMAP_TRACE
1660 ktrace_free(xfs_bmap_trace_buf);
1661 out_free_alloc_trace:
1662#endif
1663#ifdef XFS_ALLOC_TRACE
1664 ktrace_free(xfs_alloc_trace_buf);
1665 out:
1666#endif
1667 return -ENOMEM;
1668}
1669
1670STATIC void
1671xfs_free_trace_bufs(void)
1672{
1673#ifdef XFS_DIR2_TRACE
1674 ktrace_free(xfs_dir2_trace_buf);
1675#endif
1676#ifdef XFS_ATTR_TRACE
1677 ktrace_free(xfs_attr_trace_buf);
1678#endif
1679#ifdef XFS_BTREE_TRACE
1680 ktrace_free(xfs_bmbt_trace_buf);
1681 ktrace_free(xfs_inobt_trace_buf);
1682 ktrace_free(xfs_allocbt_trace_buf);
1683#endif
1684#ifdef XFS_BMAP_TRACE
1685 ktrace_free(xfs_bmap_trace_buf);
1686#endif
1687#ifdef XFS_ALLOC_TRACE
1688 ktrace_free(xfs_alloc_trace_buf);
1689#endif
1690}
1691
1692STATIC int __init
1693xfs_init_zones(void) 1604xfs_init_zones(void)
1694{ 1605{
1695 1606
@@ -1830,7 +1741,6 @@ init_xfs_fs(void)
1830 printk(KERN_INFO XFS_VERSION_STRING " with " 1741 printk(KERN_INFO XFS_VERSION_STRING " with "
1831 XFS_BUILD_OPTIONS " enabled\n"); 1742 XFS_BUILD_OPTIONS " enabled\n");
1832 1743
1833 ktrace_init(64);
1834 xfs_ioend_init(); 1744 xfs_ioend_init();
1835 xfs_dir_startup(); 1745 xfs_dir_startup();
1836 1746
@@ -1838,13 +1748,9 @@ init_xfs_fs(void)
1838 if (error) 1748 if (error)
1839 goto out; 1749 goto out;
1840 1750
1841 error = xfs_alloc_trace_bufs();
1842 if (error)
1843 goto out_destroy_zones;
1844
1845 error = xfs_mru_cache_init(); 1751 error = xfs_mru_cache_init();
1846 if (error) 1752 if (error)
1847 goto out_free_trace_buffers; 1753 goto out_destroy_zones;
1848 1754
1849 error = xfs_filestream_init(); 1755 error = xfs_filestream_init();
1850 if (error) 1756 if (error)
@@ -1879,8 +1785,6 @@ init_xfs_fs(void)
1879 xfs_filestream_uninit(); 1785 xfs_filestream_uninit();
1880 out_mru_cache_uninit: 1786 out_mru_cache_uninit:
1881 xfs_mru_cache_uninit(); 1787 xfs_mru_cache_uninit();
1882 out_free_trace_buffers:
1883 xfs_free_trace_bufs();
1884 out_destroy_zones: 1788 out_destroy_zones:
1885 xfs_destroy_zones(); 1789 xfs_destroy_zones();
1886 out: 1790 out:
@@ -1897,9 +1801,7 @@ exit_xfs_fs(void)
1897 xfs_buf_terminate(); 1801 xfs_buf_terminate();
1898 xfs_filestream_uninit(); 1802 xfs_filestream_uninit();
1899 xfs_mru_cache_uninit(); 1803 xfs_mru_cache_uninit();
1900 xfs_free_trace_bufs();
1901 xfs_destroy_zones(); 1804 xfs_destroy_zones();
1902 ktrace_uninit();
1903} 1805}
1904 1806
1905module_init(init_xfs_fs); 1807module_init(init_xfs_fs);
diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/linux-2.6/xfs_super.h
index 18175ebd58ed..233d4b9881b1 100644
--- a/fs/xfs/linux-2.6/xfs_super.h
+++ b/fs/xfs/linux-2.6/xfs_super.h
@@ -56,12 +56,6 @@ extern void xfs_qm_exit(void);
56# define XFS_BIGFS_STRING 56# define XFS_BIGFS_STRING
57#endif 57#endif
58 58
59#ifdef CONFIG_XFS_TRACE
60# define XFS_TRACE_STRING "tracing, "
61#else
62# define XFS_TRACE_STRING
63#endif
64
65#ifdef CONFIG_XFS_DMAPI 59#ifdef CONFIG_XFS_DMAPI
66# define XFS_DMAPI_STRING "dmapi support, " 60# define XFS_DMAPI_STRING "dmapi support, "
67#else 61#else
@@ -78,7 +72,6 @@ extern void xfs_qm_exit(void);
78 XFS_SECURITY_STRING \ 72 XFS_SECURITY_STRING \
79 XFS_REALTIME_STRING \ 73 XFS_REALTIME_STRING \
80 XFS_BIGFS_STRING \ 74 XFS_BIGFS_STRING \
81 XFS_TRACE_STRING \
82 XFS_DMAPI_STRING \ 75 XFS_DMAPI_STRING \
83 XFS_DBG_STRING /* DBG must be last */ 76 XFS_DBG_STRING /* DBG must be last */
84 77
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index d895a3a960f5..6fed97a8cd3e 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -44,6 +44,7 @@
44#include "xfs_inode_item.h" 44#include "xfs_inode_item.h"
45#include "xfs_rw.h" 45#include "xfs_rw.h"
46#include "xfs_quota.h" 46#include "xfs_quota.h"
47#include "xfs_trace.h"
47 48
48#include <linux/kthread.h> 49#include <linux/kthread.h>
49#include <linux/freezer.h> 50#include <linux/freezer.h>
diff --git a/fs/xfs/linux-2.6/xfs_trace.c b/fs/xfs/linux-2.6/xfs_trace.c
new file mode 100644
index 000000000000..856eb3c8d605
--- /dev/null
+++ b/fs/xfs/linux-2.6/xfs_trace.c
@@ -0,0 +1,75 @@
1/*
2 * Copyright (c) 2009, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#include "xfs.h"
19#include "xfs_fs.h"
20#include "xfs_types.h"
21#include "xfs_bit.h"
22#include "xfs_log.h"
23#include "xfs_inum.h"
24#include "xfs_trans.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_dir2.h"
28#include "xfs_da_btree.h"
29#include "xfs_bmap_btree.h"
30#include "xfs_alloc_btree.h"
31#include "xfs_ialloc_btree.h"
32#include "xfs_dir2_sf.h"
33#include "xfs_attr_sf.h"
34#include "xfs_dinode.h"
35#include "xfs_inode.h"
36#include "xfs_btree.h"
37#include "xfs_dmapi.h"
38#include "xfs_mount.h"
39#include "xfs_ialloc.h"
40#include "xfs_itable.h"
41#include "xfs_alloc.h"
42#include "xfs_bmap.h"
43#include "xfs_attr.h"
44#include "xfs_attr_sf.h"
45#include "xfs_attr_leaf.h"
46#include "xfs_log_priv.h"
47#include "xfs_buf_item.h"
48#include "xfs_quota.h"
49#include "xfs_iomap.h"
50#include "xfs_aops.h"
51#include "quota/xfs_dquot_item.h"
52#include "quota/xfs_dquot.h"
53
54/*
55 * Format fsblock number into a static buffer & return it.
56 */
57STATIC char *xfs_fmtfsblock(xfs_fsblock_t bno)
58{
59 static char rval[50];
60
61 if (bno == NULLFSBLOCK)
62 sprintf(rval, "NULLFSBLOCK");
63 else if (isnullstartblock(bno))
64 sprintf(rval, "NULLSTARTBLOCK(%lld)", startblockval(bno));
65 else
66 sprintf(rval, "%lld", (xfs_dfsbno_t)bno);
67 return rval;
68}
69
70/*
71 * We include this last to have the helpers above available for the trace
72 * event implementations.
73 */
74#define CREATE_TRACE_POINTS
75#include "xfs_trace.h"
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h
new file mode 100644
index 000000000000..c40834bdee58
--- /dev/null
+++ b/fs/xfs/linux-2.6/xfs_trace.h
@@ -0,0 +1,1369 @@
1/*
2 * Copyright (c) 2009, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM xfs
20
21#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
22#define _TRACE_XFS_H
23
24#include <linux/tracepoint.h>
25
26struct xfs_agf;
27struct xfs_alloc_arg;
28struct xfs_attr_list_context;
29struct xfs_buf_log_item;
30struct xfs_da_args;
31struct xfs_da_node_entry;
32struct xfs_dquot;
33struct xlog_ticket;
34struct log;
35
36#define DEFINE_ATTR_LIST_EVENT(name) \
37TRACE_EVENT(name, \
38 TP_PROTO(struct xfs_attr_list_context *ctx), \
39 TP_ARGS(ctx), \
40 TP_STRUCT__entry( \
41 __field(dev_t, dev) \
42 __field(xfs_ino_t, ino) \
43 __field(u32, hashval) \
44 __field(u32, blkno) \
45 __field(u32, offset) \
46 __field(void *, alist) \
47 __field(int, bufsize) \
48 __field(int, count) \
49 __field(int, firstu) \
50 __field(int, dupcnt) \
51 __field(int, flags) \
52 ), \
53 TP_fast_assign( \
54 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; \
55 __entry->ino = ctx->dp->i_ino; \
56 __entry->hashval = ctx->cursor->hashval; \
57 __entry->blkno = ctx->cursor->blkno; \
58 __entry->offset = ctx->cursor->offset; \
59 __entry->alist = ctx->alist; \
60 __entry->bufsize = ctx->bufsize; \
61 __entry->count = ctx->count; \
62 __entry->firstu = ctx->firstu; \
63 __entry->flags = ctx->flags; \
64 ), \
65 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " \
66 "alist 0x%p size %u count %u firstu %u flags %d %s", \
67 MAJOR(__entry->dev), MINOR(__entry->dev), \
68 __entry->ino, \
69 __entry->hashval, \
70 __entry->blkno, \
71 __entry->offset, \
72 __entry->dupcnt, \
73 __entry->alist, \
74 __entry->bufsize, \
75 __entry->count, \
76 __entry->firstu, \
77 __entry->flags, \
78 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS) \
79 ) \
80)
81DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
82DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
83DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
84DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
85DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
86DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
87DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
88DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
89
90TRACE_EVENT(xfs_attr_list_node_descend,
91 TP_PROTO(struct xfs_attr_list_context *ctx,
92 struct xfs_da_node_entry *btree),
93 TP_ARGS(ctx, btree),
94 TP_STRUCT__entry(
95 __field(dev_t, dev)
96 __field(xfs_ino_t, ino)
97 __field(u32, hashval)
98 __field(u32, blkno)
99 __field(u32, offset)
100 __field(void *, alist)
101 __field(int, bufsize)
102 __field(int, count)
103 __field(int, firstu)
104 __field(int, dupcnt)
105 __field(int, flags)
106 __field(u32, bt_hashval)
107 __field(u32, bt_before)
108 ),
109 TP_fast_assign(
110 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
111 __entry->ino = ctx->dp->i_ino;
112 __entry->hashval = ctx->cursor->hashval;
113 __entry->blkno = ctx->cursor->blkno;
114 __entry->offset = ctx->cursor->offset;
115 __entry->alist = ctx->alist;
116 __entry->bufsize = ctx->bufsize;
117 __entry->count = ctx->count;
118 __entry->firstu = ctx->firstu;
119 __entry->flags = ctx->flags;
120 __entry->bt_hashval = be32_to_cpu(btree->hashval);
121 __entry->bt_before = be32_to_cpu(btree->before);
122 ),
123 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
124 "alist 0x%p size %u count %u firstu %u flags %d %s "
125 "node hashval %u, node before %u",
126 MAJOR(__entry->dev), MINOR(__entry->dev),
127 __entry->ino,
128 __entry->hashval,
129 __entry->blkno,
130 __entry->offset,
131 __entry->dupcnt,
132 __entry->alist,
133 __entry->bufsize,
134 __entry->count,
135 __entry->firstu,
136 __entry->flags,
137 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
138 __entry->bt_hashval,
139 __entry->bt_before)
140);
141
142TRACE_EVENT(xfs_iext_insert,
143 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
144 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
145 TP_ARGS(ip, idx, r, state, caller_ip),
146 TP_STRUCT__entry(
147 __field(dev_t, dev)
148 __field(xfs_ino_t, ino)
149 __field(xfs_extnum_t, idx)
150 __field(xfs_fileoff_t, startoff)
151 __field(xfs_fsblock_t, startblock)
152 __field(xfs_filblks_t, blockcount)
153 __field(xfs_exntst_t, state)
154 __field(int, bmap_state)
155 __field(unsigned long, caller_ip)
156 ),
157 TP_fast_assign(
158 __entry->dev = VFS_I(ip)->i_sb->s_dev;
159 __entry->ino = ip->i_ino;
160 __entry->idx = idx;
161 __entry->startoff = r->br_startoff;
162 __entry->startblock = r->br_startblock;
163 __entry->blockcount = r->br_blockcount;
164 __entry->state = r->br_state;
165 __entry->bmap_state = state;
166 __entry->caller_ip = caller_ip;
167 ),
168 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
169 "offset %lld block %s count %lld flag %d caller %pf",
170 MAJOR(__entry->dev), MINOR(__entry->dev),
171 __entry->ino,
172 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
173 (long)__entry->idx,
174 __entry->startoff,
175 xfs_fmtfsblock(__entry->startblock),
176 __entry->blockcount,
177 __entry->state,
178 (char *)__entry->caller_ip)
179);
180
181#define DEFINE_BMAP_EVENT(name) \
182TRACE_EVENT(name, \
183 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
184 unsigned long caller_ip), \
185 TP_ARGS(ip, idx, state, caller_ip), \
186 TP_STRUCT__entry( \
187 __field(dev_t, dev) \
188 __field(xfs_ino_t, ino) \
189 __field(xfs_extnum_t, idx) \
190 __field(xfs_fileoff_t, startoff) \
191 __field(xfs_fsblock_t, startblock) \
192 __field(xfs_filblks_t, blockcount) \
193 __field(xfs_exntst_t, state) \
194 __field(int, bmap_state) \
195 __field(unsigned long, caller_ip) \
196 ), \
197 TP_fast_assign( \
198 struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ? \
199 ip->i_afp : &ip->i_df; \
200 struct xfs_bmbt_irec r; \
201 \
202 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r); \
203 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
204 __entry->ino = ip->i_ino; \
205 __entry->idx = idx; \
206 __entry->startoff = r.br_startoff; \
207 __entry->startblock = r.br_startblock; \
208 __entry->blockcount = r.br_blockcount; \
209 __entry->state = r.br_state; \
210 __entry->bmap_state = state; \
211 __entry->caller_ip = caller_ip; \
212 ), \
213 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld " \
214 "offset %lld block %s count %lld flag %d caller %pf", \
215 MAJOR(__entry->dev), MINOR(__entry->dev), \
216 __entry->ino, \
217 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS), \
218 (long)__entry->idx, \
219 __entry->startoff, \
220 xfs_fmtfsblock(__entry->startblock), \
221 __entry->blockcount, \
222 __entry->state, \
223 (char *)__entry->caller_ip) \
224)
225
226DEFINE_BMAP_EVENT(xfs_iext_remove);
227DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
228DEFINE_BMAP_EVENT(xfs_bmap_post_update);
229DEFINE_BMAP_EVENT(xfs_extlist);
230
231#define DEFINE_BUF_EVENT(tname) \
232TRACE_EVENT(tname, \
233 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
234 TP_ARGS(bp, caller_ip), \
235 TP_STRUCT__entry( \
236 __field(dev_t, dev) \
237 __field(xfs_daddr_t, bno) \
238 __field(size_t, buffer_length) \
239 __field(int, hold) \
240 __field(int, pincount) \
241 __field(unsigned, lockval) \
242 __field(unsigned, flags) \
243 __field(unsigned long, caller_ip) \
244 ), \
245 TP_fast_assign( \
246 __entry->dev = bp->b_target->bt_dev; \
247 __entry->bno = bp->b_bn; \
248 __entry->buffer_length = bp->b_buffer_length; \
249 __entry->hold = atomic_read(&bp->b_hold); \
250 __entry->pincount = atomic_read(&bp->b_pin_count); \
251 __entry->lockval = xfs_buf_lock_value(bp); \
252 __entry->flags = bp->b_flags; \
253 __entry->caller_ip = caller_ip; \
254 ), \
255 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \
256 "lock %d flags %s caller %pf", \
257 MAJOR(__entry->dev), MINOR(__entry->dev), \
258 (unsigned long long)__entry->bno, \
259 __entry->buffer_length, \
260 __entry->hold, \
261 __entry->pincount, \
262 __entry->lockval, \
263 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \
264 (void *)__entry->caller_ip) \
265)
266DEFINE_BUF_EVENT(xfs_buf_init);
267DEFINE_BUF_EVENT(xfs_buf_free);
268DEFINE_BUF_EVENT(xfs_buf_hold);
269DEFINE_BUF_EVENT(xfs_buf_rele);
270DEFINE_BUF_EVENT(xfs_buf_pin);
271DEFINE_BUF_EVENT(xfs_buf_unpin);
272DEFINE_BUF_EVENT(xfs_buf_iodone);
273DEFINE_BUF_EVENT(xfs_buf_iorequest);
274DEFINE_BUF_EVENT(xfs_buf_bawrite);
275DEFINE_BUF_EVENT(xfs_buf_bdwrite);
276DEFINE_BUF_EVENT(xfs_buf_lock);
277DEFINE_BUF_EVENT(xfs_buf_lock_done);
278DEFINE_BUF_EVENT(xfs_buf_cond_lock);
279DEFINE_BUF_EVENT(xfs_buf_unlock);
280DEFINE_BUF_EVENT(xfs_buf_ordered_retry);
281DEFINE_BUF_EVENT(xfs_buf_iowait);
282DEFINE_BUF_EVENT(xfs_buf_iowait_done);
283DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
284DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue);
285DEFINE_BUF_EVENT(xfs_buf_delwri_split);
286DEFINE_BUF_EVENT(xfs_buf_get_noaddr);
287DEFINE_BUF_EVENT(xfs_bdstrat_shut);
288DEFINE_BUF_EVENT(xfs_buf_item_relse);
289DEFINE_BUF_EVENT(xfs_buf_item_iodone);
290DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
291DEFINE_BUF_EVENT(xfs_buf_error_relse);
292DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
293DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
294
295/* not really buffer traces, but the buf provides useful information */
296DEFINE_BUF_EVENT(xfs_btree_corrupt);
297DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
298DEFINE_BUF_EVENT(xfs_reset_dqcounts);
299DEFINE_BUF_EVENT(xfs_inode_item_push);
300
301/* pass flags explicitly */
302#define DEFINE_BUF_FLAGS_EVENT(tname) \
303TRACE_EVENT(tname, \
304 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
305 TP_ARGS(bp, flags, caller_ip), \
306 TP_STRUCT__entry( \
307 __field(dev_t, dev) \
308 __field(xfs_daddr_t, bno) \
309 __field(size_t, buffer_length) \
310 __field(int, hold) \
311 __field(int, pincount) \
312 __field(unsigned, lockval) \
313 __field(unsigned, flags) \
314 __field(unsigned long, caller_ip) \
315 ), \
316 TP_fast_assign( \
317 __entry->dev = bp->b_target->bt_dev; \
318 __entry->bno = bp->b_bn; \
319 __entry->buffer_length = bp->b_buffer_length; \
320 __entry->flags = flags; \
321 __entry->hold = atomic_read(&bp->b_hold); \
322 __entry->pincount = atomic_read(&bp->b_pin_count); \
323 __entry->lockval = xfs_buf_lock_value(bp); \
324 __entry->caller_ip = caller_ip; \
325 ), \
326 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \
327 "lock %d flags %s caller %pf", \
328 MAJOR(__entry->dev), MINOR(__entry->dev), \
329 (unsigned long long)__entry->bno, \
330 __entry->buffer_length, \
331 __entry->hold, \
332 __entry->pincount, \
333 __entry->lockval, \
334 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \
335 (void *)__entry->caller_ip) \
336)
337DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
338DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
339DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
340
341TRACE_EVENT(xfs_buf_ioerror,
342 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
343 TP_ARGS(bp, error, caller_ip),
344 TP_STRUCT__entry(
345 __field(dev_t, dev)
346 __field(xfs_daddr_t, bno)
347 __field(size_t, buffer_length)
348 __field(unsigned, flags)
349 __field(int, hold)
350 __field(int, pincount)
351 __field(unsigned, lockval)
352 __field(int, error)
353 __field(unsigned long, caller_ip)
354 ),
355 TP_fast_assign(
356 __entry->dev = bp->b_target->bt_dev;
357 __entry->bno = bp->b_bn;
358 __entry->buffer_length = bp->b_buffer_length;
359 __entry->hold = atomic_read(&bp->b_hold);
360 __entry->pincount = atomic_read(&bp->b_pin_count);
361 __entry->lockval = xfs_buf_lock_value(bp);
362 __entry->error = error;
363 __entry->flags = bp->b_flags;
364 __entry->caller_ip = caller_ip;
365 ),
366 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
367 "lock %d error %d flags %s caller %pf",
368 MAJOR(__entry->dev), MINOR(__entry->dev),
369 (unsigned long long)__entry->bno,
370 __entry->buffer_length,
371 __entry->hold,
372 __entry->pincount,
373 __entry->lockval,
374 __entry->error,
375 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
376 (void *)__entry->caller_ip)
377);
378
379#define DEFINE_BUF_ITEM_EVENT(tname) \
380TRACE_EVENT(tname, \
381 TP_PROTO(struct xfs_buf_log_item *bip), \
382 TP_ARGS(bip), \
383 TP_STRUCT__entry( \
384 __field(dev_t, dev) \
385 __field(xfs_daddr_t, buf_bno) \
386 __field(size_t, buf_len) \
387 __field(int, buf_hold) \
388 __field(int, buf_pincount) \
389 __field(int, buf_lockval) \
390 __field(unsigned, buf_flags) \
391 __field(unsigned, bli_recur) \
392 __field(int, bli_refcount) \
393 __field(unsigned, bli_flags) \
394 __field(void *, li_desc) \
395 __field(unsigned, li_flags) \
396 ), \
397 TP_fast_assign( \
398 __entry->dev = bip->bli_buf->b_target->bt_dev; \
399 __entry->bli_flags = bip->bli_flags; \
400 __entry->bli_recur = bip->bli_recur; \
401 __entry->bli_refcount = atomic_read(&bip->bli_refcount); \
402 __entry->buf_bno = bip->bli_buf->b_bn; \
403 __entry->buf_len = bip->bli_buf->b_buffer_length; \
404 __entry->buf_flags = bip->bli_buf->b_flags; \
405 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); \
406 __entry->buf_pincount = \
407 atomic_read(&bip->bli_buf->b_pin_count); \
408 __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf); \
409 __entry->li_desc = bip->bli_item.li_desc; \
410 __entry->li_flags = bip->bli_item.li_flags; \
411 ), \
412 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \
413 "lock %d flags %s recur %d refcount %d bliflags %s " \
414 "lidesc 0x%p liflags %s", \
415 MAJOR(__entry->dev), MINOR(__entry->dev), \
416 (unsigned long long)__entry->buf_bno, \
417 __entry->buf_len, \
418 __entry->buf_hold, \
419 __entry->buf_pincount, \
420 __entry->buf_lockval, \
421 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS), \
422 __entry->bli_recur, \
423 __entry->bli_refcount, \
424 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), \
425 __entry->li_desc, \
426 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) \
427)
428DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
429DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
430DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
431DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
432DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
433DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
434DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
435DEFINE_BUF_ITEM_EVENT(xfs_buf_item_trylock);
436DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
437DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
438DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
439DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
440DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
441DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
442DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
443DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
444DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
445DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
446DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
447DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
448DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
449DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
450DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
451DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
452
453#define DEFINE_LOCK_EVENT(name) \
454TRACE_EVENT(name, \
455 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
456 unsigned long caller_ip), \
457 TP_ARGS(ip, lock_flags, caller_ip), \
458 TP_STRUCT__entry( \
459 __field(dev_t, dev) \
460 __field(xfs_ino_t, ino) \
461 __field(int, lock_flags) \
462 __field(unsigned long, caller_ip) \
463 ), \
464 TP_fast_assign( \
465 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
466 __entry->ino = ip->i_ino; \
467 __entry->lock_flags = lock_flags; \
468 __entry->caller_ip = caller_ip; \
469 ), \
470 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf", \
471 MAJOR(__entry->dev), MINOR(__entry->dev), \
472 __entry->ino, \
473 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), \
474 (void *)__entry->caller_ip) \
475)
476
477DEFINE_LOCK_EVENT(xfs_ilock);
478DEFINE_LOCK_EVENT(xfs_ilock_nowait);
479DEFINE_LOCK_EVENT(xfs_ilock_demote);
480DEFINE_LOCK_EVENT(xfs_iunlock);
481
482#define DEFINE_IGET_EVENT(name) \
483TRACE_EVENT(name, \
484 TP_PROTO(struct xfs_inode *ip), \
485 TP_ARGS(ip), \
486 TP_STRUCT__entry( \
487 __field(dev_t, dev) \
488 __field(xfs_ino_t, ino) \
489 ), \
490 TP_fast_assign( \
491 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
492 __entry->ino = ip->i_ino; \
493 ), \
494 TP_printk("dev %d:%d ino 0x%llx", \
495 MAJOR(__entry->dev), MINOR(__entry->dev), \
496 __entry->ino) \
497)
498DEFINE_IGET_EVENT(xfs_iget_skip);
499DEFINE_IGET_EVENT(xfs_iget_reclaim);
500DEFINE_IGET_EVENT(xfs_iget_found);
501DEFINE_IGET_EVENT(xfs_iget_alloc);
502
503#define DEFINE_INODE_EVENT(name) \
504TRACE_EVENT(name, \
505 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
506 TP_ARGS(ip, caller_ip), \
507 TP_STRUCT__entry( \
508 __field(dev_t, dev) \
509 __field(xfs_ino_t, ino) \
510 __field(int, count) \
511 __field(unsigned long, caller_ip) \
512 ), \
513 TP_fast_assign( \
514 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
515 __entry->ino = ip->i_ino; \
516 __entry->count = atomic_read(&VFS_I(ip)->i_count); \
517 __entry->caller_ip = caller_ip; \
518 ), \
519 TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", \
520 MAJOR(__entry->dev), MINOR(__entry->dev), \
521 __entry->ino, \
522 __entry->count, \
523 (char *)__entry->caller_ip) \
524)
525DEFINE_INODE_EVENT(xfs_ihold);
526DEFINE_INODE_EVENT(xfs_irele);
527/* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */
528DEFINE_INODE_EVENT(xfs_inode);
529#define xfs_itrace_entry(ip) \
530 trace_xfs_inode(ip, _THIS_IP_)
531
532#define DEFINE_DQUOT_EVENT(tname) \
533TRACE_EVENT(tname, \
534 TP_PROTO(struct xfs_dquot *dqp), \
535 TP_ARGS(dqp), \
536 TP_STRUCT__entry( \
537 __field(dev_t, dev) \
538 __field(__be32, id) \
539 __field(unsigned, flags) \
540 __field(unsigned, nrefs) \
541 __field(unsigned long long, res_bcount) \
542 __field(unsigned long long, bcount) \
543 __field(unsigned long long, icount) \
544 __field(unsigned long long, blk_hardlimit) \
545 __field(unsigned long long, blk_softlimit) \
546 __field(unsigned long long, ino_hardlimit) \
547 __field(unsigned long long, ino_softlimit) \
548 ), \
549 TP_fast_assign( \
550 __entry->dev = dqp->q_mount->m_super->s_dev; \
551 __entry->id = dqp->q_core.d_id; \
552 __entry->flags = dqp->dq_flags; \
553 __entry->nrefs = dqp->q_nrefs; \
554 __entry->res_bcount = dqp->q_res_bcount; \
555 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); \
556 __entry->icount = be64_to_cpu(dqp->q_core.d_icount); \
557 __entry->blk_hardlimit = \
558 be64_to_cpu(dqp->q_core.d_blk_hardlimit); \
559 __entry->blk_softlimit = \
560 be64_to_cpu(dqp->q_core.d_blk_softlimit); \
561 __entry->ino_hardlimit = \
562 be64_to_cpu(dqp->q_core.d_ino_hardlimit); \
563 __entry->ino_softlimit = \
564 be64_to_cpu(dqp->q_core.d_ino_softlimit); \
565 ), \
566 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " \
567 "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] " \
568 "icnt 0x%llx [hard 0x%llx | soft 0x%llx]", \
569 MAJOR(__entry->dev), MINOR(__entry->dev), \
570 be32_to_cpu(__entry->id), \
571 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS), \
572 __entry->nrefs, \
573 __entry->res_bcount, \
574 __entry->bcount, \
575 __entry->blk_hardlimit, \
576 __entry->blk_softlimit, \
577 __entry->icount, \
578 __entry->ino_hardlimit, \
579 __entry->ino_softlimit) \
580)
581DEFINE_DQUOT_EVENT(xfs_dqadjust);
582DEFINE_DQUOT_EVENT(xfs_dqshake_dirty);
583DEFINE_DQUOT_EVENT(xfs_dqshake_unlink);
584DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
585DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
586DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink);
587DEFINE_DQUOT_EVENT(xfs_dqattach_found);
588DEFINE_DQUOT_EVENT(xfs_dqattach_get);
589DEFINE_DQUOT_EVENT(xfs_dqinit);
590DEFINE_DQUOT_EVENT(xfs_dqreuse);
591DEFINE_DQUOT_EVENT(xfs_dqalloc);
592DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
593DEFINE_DQUOT_EVENT(xfs_dqread);
594DEFINE_DQUOT_EVENT(xfs_dqread_fail);
595DEFINE_DQUOT_EVENT(xfs_dqlookup_found);
596DEFINE_DQUOT_EVENT(xfs_dqlookup_want);
597DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist);
598DEFINE_DQUOT_EVENT(xfs_dqlookup_move);
599DEFINE_DQUOT_EVENT(xfs_dqlookup_done);
600DEFINE_DQUOT_EVENT(xfs_dqget_hit);
601DEFINE_DQUOT_EVENT(xfs_dqget_miss);
602DEFINE_DQUOT_EVENT(xfs_dqput);
603DEFINE_DQUOT_EVENT(xfs_dqput_wait);
604DEFINE_DQUOT_EVENT(xfs_dqput_free);
605DEFINE_DQUOT_EVENT(xfs_dqrele);
606DEFINE_DQUOT_EVENT(xfs_dqflush);
607DEFINE_DQUOT_EVENT(xfs_dqflush_force);
608DEFINE_DQUOT_EVENT(xfs_dqflush_done);
609/* not really iget events, but we re-use the format */
610DEFINE_IGET_EVENT(xfs_dquot_dqalloc);
611DEFINE_IGET_EVENT(xfs_dquot_dqdetach);
612
613
614#define DEFINE_LOGGRANT_EVENT(tname) \
615TRACE_EVENT(tname, \
616 TP_PROTO(struct log *log, struct xlog_ticket *tic), \
617 TP_ARGS(log, tic), \
618 TP_STRUCT__entry( \
619 __field(dev_t, dev) \
620 __field(unsigned, trans_type) \
621 __field(char, ocnt) \
622 __field(char, cnt) \
623 __field(int, curr_res) \
624 __field(int, unit_res) \
625 __field(unsigned int, flags) \
626 __field(void *, reserve_headq) \
627 __field(void *, write_headq) \
628 __field(int, grant_reserve_cycle) \
629 __field(int, grant_reserve_bytes) \
630 __field(int, grant_write_cycle) \
631 __field(int, grant_write_bytes) \
632 __field(int, curr_cycle) \
633 __field(int, curr_block) \
634 __field(xfs_lsn_t, tail_lsn) \
635 ), \
636 TP_fast_assign( \
637 __entry->dev = log->l_mp->m_super->s_dev; \
638 __entry->trans_type = tic->t_trans_type; \
639 __entry->ocnt = tic->t_ocnt; \
640 __entry->cnt = tic->t_cnt; \
641 __entry->curr_res = tic->t_curr_res; \
642 __entry->unit_res = tic->t_unit_res; \
643 __entry->flags = tic->t_flags; \
644 __entry->reserve_headq = log->l_reserve_headq; \
645 __entry->write_headq = log->l_write_headq; \
646 __entry->grant_reserve_cycle = log->l_grant_reserve_cycle; \
647 __entry->grant_reserve_bytes = log->l_grant_reserve_bytes; \
648 __entry->grant_write_cycle = log->l_grant_write_cycle; \
649 __entry->grant_write_bytes = log->l_grant_write_bytes; \
650 __entry->curr_cycle = log->l_curr_cycle; \
651 __entry->curr_block = log->l_curr_block; \
652 __entry->tail_lsn = log->l_tail_lsn; \
653 ), \
654 TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u " \
655 "t_unit_res %u t_flags %s reserve_headq 0x%p " \
656 "write_headq 0x%p grant_reserve_cycle %d " \
657 "grant_reserve_bytes %d grant_write_cycle %d " \
658 "grant_write_bytes %d curr_cycle %d curr_block %d " \
659 "tail_cycle %d tail_block %d", \
660 MAJOR(__entry->dev), MINOR(__entry->dev), \
661 __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES), \
662 __entry->ocnt, \
663 __entry->cnt, \
664 __entry->curr_res, \
665 __entry->unit_res, \
666 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS), \
667 __entry->reserve_headq, \
668 __entry->write_headq, \
669 __entry->grant_reserve_cycle, \
670 __entry->grant_reserve_bytes, \
671 __entry->grant_write_cycle, \
672 __entry->grant_write_bytes, \
673 __entry->curr_cycle, \
674 __entry->curr_block, \
675 CYCLE_LSN(__entry->tail_lsn), \
676 BLOCK_LSN(__entry->tail_lsn) \
677 ) \
678)
679DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
680DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
681DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
682DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
683DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter);
684DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit);
685DEFINE_LOGGRANT_EVENT(xfs_log_grant_error);
686DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1);
687DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1);
688DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2);
689DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2);
690DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter);
691DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit);
692DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error);
693DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1);
694DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1);
695DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2);
696DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2);
697DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
698DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
699DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
700DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
701DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
702DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
703
704#define DEFINE_RW_EVENT(name) \
705TRACE_EVENT(name, \
706 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
707 TP_ARGS(ip, count, offset, flags), \
708 TP_STRUCT__entry( \
709 __field(dev_t, dev) \
710 __field(xfs_ino_t, ino) \
711 __field(xfs_fsize_t, size) \
712 __field(xfs_fsize_t, new_size) \
713 __field(loff_t, offset) \
714 __field(size_t, count) \
715 __field(int, flags) \
716 ), \
717 TP_fast_assign( \
718 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
719 __entry->ino = ip->i_ino; \
720 __entry->size = ip->i_d.di_size; \
721 __entry->new_size = ip->i_new_size; \
722 __entry->offset = offset; \
723 __entry->count = count; \
724 __entry->flags = flags; \
725 ), \
726 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
727 "offset 0x%llx count 0x%zx ioflags %s", \
728 MAJOR(__entry->dev), MINOR(__entry->dev), \
729 __entry->ino, \
730 __entry->size, \
731 __entry->new_size, \
732 __entry->offset, \
733 __entry->count, \
734 __print_flags(__entry->flags, "|", XFS_IO_FLAGS)) \
735)
736DEFINE_RW_EVENT(xfs_file_read);
737DEFINE_RW_EVENT(xfs_file_buffered_write);
738DEFINE_RW_EVENT(xfs_file_direct_write);
739DEFINE_RW_EVENT(xfs_file_splice_read);
740DEFINE_RW_EVENT(xfs_file_splice_write);
741
742
743#define DEFINE_PAGE_EVENT(name) \
744TRACE_EVENT(name, \
745 TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \
746 TP_ARGS(inode, page, off), \
747 TP_STRUCT__entry( \
748 __field(dev_t, dev) \
749 __field(xfs_ino_t, ino) \
750 __field(pgoff_t, pgoff) \
751 __field(loff_t, size) \
752 __field(unsigned long, offset) \
753 __field(int, delalloc) \
754 __field(int, unmapped) \
755 __field(int, unwritten) \
756 ), \
757 TP_fast_assign( \
758 int delalloc = -1, unmapped = -1, unwritten = -1; \
759 \
760 if (page_has_buffers(page)) \
761 xfs_count_page_state(page, &delalloc, \
762 &unmapped, &unwritten); \
763 __entry->dev = inode->i_sb->s_dev; \
764 __entry->ino = XFS_I(inode)->i_ino; \
765 __entry->pgoff = page_offset(page); \
766 __entry->size = i_size_read(inode); \
767 __entry->offset = off; \
768 __entry->delalloc = delalloc; \
769 __entry->unmapped = unmapped; \
770 __entry->unwritten = unwritten; \
771 ), \
772 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx " \
773 "delalloc %d unmapped %d unwritten %d", \
774 MAJOR(__entry->dev), MINOR(__entry->dev), \
775 __entry->ino, \
776 __entry->pgoff, \
777 __entry->size, \
778 __entry->offset, \
779 __entry->delalloc, \
780 __entry->unmapped, \
781 __entry->unwritten) \
782)
783DEFINE_PAGE_EVENT(xfs_writepage);
784DEFINE_PAGE_EVENT(xfs_releasepage);
785DEFINE_PAGE_EVENT(xfs_invalidatepage);
786
787#define DEFINE_IOMAP_EVENT(name) \
788TRACE_EVENT(name, \
789 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
790 int flags, struct xfs_bmbt_irec *irec), \
791 TP_ARGS(ip, offset, count, flags, irec), \
792 TP_STRUCT__entry( \
793 __field(dev_t, dev) \
794 __field(xfs_ino_t, ino) \
795 __field(loff_t, size) \
796 __field(loff_t, new_size) \
797 __field(loff_t, offset) \
798 __field(size_t, count) \
799 __field(int, flags) \
800 __field(xfs_fileoff_t, startoff) \
801 __field(xfs_fsblock_t, startblock) \
802 __field(xfs_filblks_t, blockcount) \
803 ), \
804 TP_fast_assign( \
805 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
806 __entry->ino = ip->i_ino; \
807 __entry->size = ip->i_d.di_size; \
808 __entry->new_size = ip->i_new_size; \
809 __entry->offset = offset; \
810 __entry->count = count; \
811 __entry->flags = flags; \
812 __entry->startoff = irec ? irec->br_startoff : 0; \
813 __entry->startblock = irec ? irec->br_startblock : 0; \
814 __entry->blockcount = irec ? irec->br_blockcount : 0; \
815 ), \
816 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
817 "offset 0x%llx count %zd flags %s " \
818 "startoff 0x%llx startblock 0x%llx blockcount 0x%llx", \
819 MAJOR(__entry->dev), MINOR(__entry->dev), \
820 __entry->ino, \
821 __entry->size, \
822 __entry->new_size, \
823 __entry->offset, \
824 __entry->count, \
825 __print_flags(__entry->flags, "|", BMAPI_FLAGS), \
826 __entry->startoff, \
827 __entry->startblock, \
828 __entry->blockcount) \
829)
830DEFINE_IOMAP_EVENT(xfs_iomap_enter);
831DEFINE_IOMAP_EVENT(xfs_iomap_found);
832DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
833
834#define DEFINE_SIMPLE_IO_EVENT(name) \
835TRACE_EVENT(name, \
836 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
837 TP_ARGS(ip, offset, count), \
838 TP_STRUCT__entry( \
839 __field(dev_t, dev) \
840 __field(xfs_ino_t, ino) \
841 __field(loff_t, size) \
842 __field(loff_t, new_size) \
843 __field(loff_t, offset) \
844 __field(size_t, count) \
845 ), \
846 TP_fast_assign( \
847 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
848 __entry->ino = ip->i_ino; \
849 __entry->size = ip->i_d.di_size; \
850 __entry->new_size = ip->i_new_size; \
851 __entry->offset = offset; \
852 __entry->count = count; \
853 ), \
854 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
855 "offset 0x%llx count %zd", \
856 MAJOR(__entry->dev), MINOR(__entry->dev), \
857 __entry->ino, \
858 __entry->size, \
859 __entry->new_size, \
860 __entry->offset, \
861 __entry->count) \
862);
863DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
864DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
865
866
867TRACE_EVENT(xfs_itruncate_start,
868 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size, int flag,
869 xfs_off_t toss_start, xfs_off_t toss_finish),
870 TP_ARGS(ip, new_size, flag, toss_start, toss_finish),
871 TP_STRUCT__entry(
872 __field(dev_t, dev)
873 __field(xfs_ino_t, ino)
874 __field(xfs_fsize_t, size)
875 __field(xfs_fsize_t, new_size)
876 __field(xfs_off_t, toss_start)
877 __field(xfs_off_t, toss_finish)
878 __field(int, flag)
879 ),
880 TP_fast_assign(
881 __entry->dev = VFS_I(ip)->i_sb->s_dev;
882 __entry->ino = ip->i_ino;
883 __entry->size = ip->i_d.di_size;
884 __entry->new_size = new_size;
885 __entry->toss_start = toss_start;
886 __entry->toss_finish = toss_finish;
887 __entry->flag = flag;
888 ),
889 TP_printk("dev %d:%d ino 0x%llx %s size 0x%llx new_size 0x%llx "
890 "toss start 0x%llx toss finish 0x%llx",
891 MAJOR(__entry->dev), MINOR(__entry->dev),
892 __entry->ino,
893 __print_flags(__entry->flag, "|", XFS_ITRUNC_FLAGS),
894 __entry->size,
895 __entry->new_size,
896 __entry->toss_start,
897 __entry->toss_finish)
898);
899
900#define DEFINE_ITRUNC_EVENT(name) \
901TRACE_EVENT(name, \
902 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
903 TP_ARGS(ip, new_size), \
904 TP_STRUCT__entry( \
905 __field(dev_t, dev) \
906 __field(xfs_ino_t, ino) \
907 __field(xfs_fsize_t, size) \
908 __field(xfs_fsize_t, new_size) \
909 ), \
910 TP_fast_assign( \
911 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
912 __entry->ino = ip->i_ino; \
913 __entry->size = ip->i_d.di_size; \
914 __entry->new_size = new_size; \
915 ), \
916 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx", \
917 MAJOR(__entry->dev), MINOR(__entry->dev), \
918 __entry->ino, \
919 __entry->size, \
920 __entry->new_size) \
921)
922DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start);
923DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end);
924
925TRACE_EVENT(xfs_pagecache_inval,
926 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
927 TP_ARGS(ip, start, finish),
928 TP_STRUCT__entry(
929 __field(dev_t, dev)
930 __field(xfs_ino_t, ino)
931 __field(xfs_fsize_t, size)
932 __field(xfs_off_t, start)
933 __field(xfs_off_t, finish)
934 ),
935 TP_fast_assign(
936 __entry->dev = VFS_I(ip)->i_sb->s_dev;
937 __entry->ino = ip->i_ino;
938 __entry->size = ip->i_d.di_size;
939 __entry->start = start;
940 __entry->finish = finish;
941 ),
942 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
943 MAJOR(__entry->dev), MINOR(__entry->dev),
944 __entry->ino,
945 __entry->size,
946 __entry->start,
947 __entry->finish)
948);
949
950TRACE_EVENT(xfs_bunmap,
951 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
952 int flags, unsigned long caller_ip),
953 TP_ARGS(ip, bno, len, flags, caller_ip),
954 TP_STRUCT__entry(
955 __field(dev_t, dev)
956 __field(xfs_ino_t, ino)
957 __field(xfs_fsize_t, size)
958 __field(xfs_fileoff_t, bno)
959 __field(xfs_filblks_t, len)
960 __field(unsigned long, caller_ip)
961 __field(int, flags)
962 ),
963 TP_fast_assign(
964 __entry->dev = VFS_I(ip)->i_sb->s_dev;
965 __entry->ino = ip->i_ino;
966 __entry->size = ip->i_d.di_size;
967 __entry->bno = bno;
968 __entry->len = len;
969 __entry->caller_ip = caller_ip;
970 __entry->flags = flags;
971 ),
972 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
973 "flags %s caller %pf",
974 MAJOR(__entry->dev), MINOR(__entry->dev),
975 __entry->ino,
976 __entry->size,
977 __entry->bno,
978 __entry->len,
979 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
980 (void *)__entry->caller_ip)
981
982);
983
984TRACE_EVENT(xfs_alloc_busy,
985 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
986 xfs_extlen_t len, int slot),
987 TP_ARGS(mp, agno, agbno, len, slot),
988 TP_STRUCT__entry(
989 __field(dev_t, dev)
990 __field(xfs_agnumber_t, agno)
991 __field(xfs_agblock_t, agbno)
992 __field(xfs_extlen_t, len)
993 __field(int, slot)
994 ),
995 TP_fast_assign(
996 __entry->dev = mp->m_super->s_dev;
997 __entry->agno = agno;
998 __entry->agbno = agbno;
999 __entry->len = len;
1000 __entry->slot = slot;
1001 ),
1002 TP_printk("dev %d:%d agno %u agbno %u len %u slot %d",
1003 MAJOR(__entry->dev), MINOR(__entry->dev),
1004 __entry->agno,
1005 __entry->agbno,
1006 __entry->len,
1007 __entry->slot)
1008
1009);
1010
1011#define XFS_BUSY_STATES \
1012 { 0, "found" }, \
1013 { 1, "missing" }
1014
1015TRACE_EVENT(xfs_alloc_unbusy,
1016 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1017 int slot, int found),
1018 TP_ARGS(mp, agno, slot, found),
1019 TP_STRUCT__entry(
1020 __field(dev_t, dev)
1021 __field(xfs_agnumber_t, agno)
1022 __field(int, slot)
1023 __field(int, found)
1024 ),
1025 TP_fast_assign(
1026 __entry->dev = mp->m_super->s_dev;
1027 __entry->agno = agno;
1028 __entry->slot = slot;
1029 __entry->found = found;
1030 ),
1031 TP_printk("dev %d:%d agno %u slot %d %s",
1032 MAJOR(__entry->dev), MINOR(__entry->dev),
1033 __entry->agno,
1034 __entry->slot,
1035 __print_symbolic(__entry->found, XFS_BUSY_STATES))
1036);
1037
1038TRACE_EVENT(xfs_alloc_busysearch,
1039 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1040 xfs_extlen_t len, int found),
1041 TP_ARGS(mp, agno, agbno, len, found),
1042 TP_STRUCT__entry(
1043 __field(dev_t, dev)
1044 __field(xfs_agnumber_t, agno)
1045 __field(xfs_agblock_t, agbno)
1046 __field(xfs_extlen_t, len)
1047 __field(int, found)
1048 ),
1049 TP_fast_assign(
1050 __entry->dev = mp->m_super->s_dev;
1051 __entry->agno = agno;
1052 __entry->agbno = agbno;
1053 __entry->len = len;
1054 __entry->found = found;
1055 ),
1056 TP_printk("dev %d:%d agno %u agbno %u len %u %s",
1057 MAJOR(__entry->dev), MINOR(__entry->dev),
1058 __entry->agno,
1059 __entry->agbno,
1060 __entry->len,
1061 __print_symbolic(__entry->found, XFS_BUSY_STATES))
1062);
1063
1064TRACE_EVENT(xfs_agf,
1065 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1066 unsigned long caller_ip),
1067 TP_ARGS(mp, agf, flags, caller_ip),
1068 TP_STRUCT__entry(
1069 __field(dev_t, dev)
1070 __field(xfs_agnumber_t, agno)
1071 __field(int, flags)
1072 __field(__u32, length)
1073 __field(__u32, bno_root)
1074 __field(__u32, cnt_root)
1075 __field(__u32, bno_level)
1076 __field(__u32, cnt_level)
1077 __field(__u32, flfirst)
1078 __field(__u32, fllast)
1079 __field(__u32, flcount)
1080 __field(__u32, freeblks)
1081 __field(__u32, longest)
1082 __field(unsigned long, caller_ip)
1083 ),
1084 TP_fast_assign(
1085 __entry->dev = mp->m_super->s_dev;
1086 __entry->agno = be32_to_cpu(agf->agf_seqno),
1087 __entry->flags = flags;
1088 __entry->length = be32_to_cpu(agf->agf_length),
1089 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1090 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1091 __entry->bno_level =
1092 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1093 __entry->cnt_level =
1094 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1095 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1096 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1097 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1098 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1099 __entry->longest = be32_to_cpu(agf->agf_longest);
1100 __entry->caller_ip = caller_ip;
1101 ),
1102 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1103 "levels b %u c %u flfirst %u fllast %u flcount %u "
1104 "freeblks %u longest %u caller %pf",
1105 MAJOR(__entry->dev), MINOR(__entry->dev),
1106 __entry->agno,
1107 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1108 __entry->length,
1109 __entry->bno_root,
1110 __entry->cnt_root,
1111 __entry->bno_level,
1112 __entry->cnt_level,
1113 __entry->flfirst,
1114 __entry->fllast,
1115 __entry->flcount,
1116 __entry->freeblks,
1117 __entry->longest,
1118 (void *)__entry->caller_ip)
1119);
1120
1121TRACE_EVENT(xfs_free_extent,
1122 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1123 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1124 TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1125 TP_STRUCT__entry(
1126 __field(dev_t, dev)
1127 __field(xfs_agnumber_t, agno)
1128 __field(xfs_agblock_t, agbno)
1129 __field(xfs_extlen_t, len)
1130 __field(int, isfl)
1131 __field(int, haveleft)
1132 __field(int, haveright)
1133 ),
1134 TP_fast_assign(
1135 __entry->dev = mp->m_super->s_dev;
1136 __entry->agno = agno;
1137 __entry->agbno = agbno;
1138 __entry->len = len;
1139 __entry->isfl = isfl;
1140 __entry->haveleft = haveleft;
1141 __entry->haveright = haveright;
1142 ),
1143 TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1144 MAJOR(__entry->dev), MINOR(__entry->dev),
1145 __entry->agno,
1146 __entry->agbno,
1147 __entry->len,
1148 __entry->isfl,
1149 __entry->haveleft ?
1150 (__entry->haveright ? "both" : "left") :
1151 (__entry->haveright ? "right" : "none"))
1152
1153);
1154
1155#define DEFINE_ALLOC_EVENT(name) \
1156TRACE_EVENT(name, \
1157 TP_PROTO(struct xfs_alloc_arg *args), \
1158 TP_ARGS(args), \
1159 TP_STRUCT__entry( \
1160 __field(dev_t, dev) \
1161 __field(xfs_agnumber_t, agno) \
1162 __field(xfs_agblock_t, agbno) \
1163 __field(xfs_extlen_t, minlen) \
1164 __field(xfs_extlen_t, maxlen) \
1165 __field(xfs_extlen_t, mod) \
1166 __field(xfs_extlen_t, prod) \
1167 __field(xfs_extlen_t, minleft) \
1168 __field(xfs_extlen_t, total) \
1169 __field(xfs_extlen_t, alignment) \
1170 __field(xfs_extlen_t, minalignslop) \
1171 __field(xfs_extlen_t, len) \
1172 __field(short, type) \
1173 __field(short, otype) \
1174 __field(char, wasdel) \
1175 __field(char, wasfromfl) \
1176 __field(char, isfl) \
1177 __field(char, userdata) \
1178 __field(xfs_fsblock_t, firstblock) \
1179 ), \
1180 TP_fast_assign( \
1181 __entry->dev = args->mp->m_super->s_dev; \
1182 __entry->agno = args->agno; \
1183 __entry->agbno = args->agbno; \
1184 __entry->minlen = args->minlen; \
1185 __entry->maxlen = args->maxlen; \
1186 __entry->mod = args->mod; \
1187 __entry->prod = args->prod; \
1188 __entry->minleft = args->minleft; \
1189 __entry->total = args->total; \
1190 __entry->alignment = args->alignment; \
1191 __entry->minalignslop = args->minalignslop; \
1192 __entry->len = args->len; \
1193 __entry->type = args->type; \
1194 __entry->otype = args->otype; \
1195 __entry->wasdel = args->wasdel; \
1196 __entry->wasfromfl = args->wasfromfl; \
1197 __entry->isfl = args->isfl; \
1198 __entry->userdata = args->userdata; \
1199 __entry->firstblock = args->firstblock; \
1200 ), \
1201 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u " \
1202 "prod %u minleft %u total %u alignment %u minalignslop %u " \
1203 "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d " \
1204 "userdata %d firstblock 0x%llx", \
1205 MAJOR(__entry->dev), MINOR(__entry->dev), \
1206 __entry->agno, \
1207 __entry->agbno, \
1208 __entry->minlen, \
1209 __entry->maxlen, \
1210 __entry->mod, \
1211 __entry->prod, \
1212 __entry->minleft, \
1213 __entry->total, \
1214 __entry->alignment, \
1215 __entry->minalignslop, \
1216 __entry->len, \
1217 __print_symbolic(__entry->type, XFS_ALLOC_TYPES), \
1218 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES), \
1219 __entry->wasdel, \
1220 __entry->wasfromfl, \
1221 __entry->isfl, \
1222 __entry->userdata, \
1223 __entry->firstblock) \
1224)
1225
1226DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1227DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1228DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1229DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1230DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1231DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1232DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1233DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1234DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1235DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1236DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1237DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1238DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1239DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1240DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1241DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1242DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1243DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1244DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1245DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1246DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1247
1248#define DEFINE_DIR2_TRACE(tname) \
1249TRACE_EVENT(tname, \
1250 TP_PROTO(struct xfs_da_args *args), \
1251 TP_ARGS(args), \
1252 TP_STRUCT__entry( \
1253 __field(dev_t, dev) \
1254 __field(xfs_ino_t, ino) \
1255 __dynamic_array(char, name, args->namelen) \
1256 __field(int, namelen) \
1257 __field(xfs_dahash_t, hashval) \
1258 __field(xfs_ino_t, inumber) \
1259 __field(int, op_flags) \
1260 ), \
1261 TP_fast_assign( \
1262 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \
1263 __entry->ino = args->dp->i_ino; \
1264 if (args->namelen) \
1265 memcpy(__get_str(name), args->name, args->namelen); \
1266 __entry->namelen = args->namelen; \
1267 __entry->hashval = args->hashval; \
1268 __entry->inumber = args->inumber; \
1269 __entry->op_flags = args->op_flags; \
1270 ), \
1271 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x " \
1272 "inumber 0x%llx op_flags %s", \
1273 MAJOR(__entry->dev), MINOR(__entry->dev), \
1274 __entry->ino, \
1275 __entry->namelen, \
1276 __entry->namelen ? __get_str(name) : NULL, \
1277 __entry->namelen, \
1278 __entry->hashval, \
1279 __entry->inumber, \
1280 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) \
1281)
1282DEFINE_DIR2_TRACE(xfs_dir2_sf_addname);
1283DEFINE_DIR2_TRACE(xfs_dir2_sf_create);
1284DEFINE_DIR2_TRACE(xfs_dir2_sf_lookup);
1285DEFINE_DIR2_TRACE(xfs_dir2_sf_replace);
1286DEFINE_DIR2_TRACE(xfs_dir2_sf_removename);
1287DEFINE_DIR2_TRACE(xfs_dir2_sf_toino4);
1288DEFINE_DIR2_TRACE(xfs_dir2_sf_toino8);
1289DEFINE_DIR2_TRACE(xfs_dir2_sf_to_block);
1290DEFINE_DIR2_TRACE(xfs_dir2_block_addname);
1291DEFINE_DIR2_TRACE(xfs_dir2_block_lookup);
1292DEFINE_DIR2_TRACE(xfs_dir2_block_replace);
1293DEFINE_DIR2_TRACE(xfs_dir2_block_removename);
1294DEFINE_DIR2_TRACE(xfs_dir2_block_to_sf);
1295DEFINE_DIR2_TRACE(xfs_dir2_block_to_leaf);
1296DEFINE_DIR2_TRACE(xfs_dir2_leaf_addname);
1297DEFINE_DIR2_TRACE(xfs_dir2_leaf_lookup);
1298DEFINE_DIR2_TRACE(xfs_dir2_leaf_replace);
1299DEFINE_DIR2_TRACE(xfs_dir2_leaf_removename);
1300DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_block);
1301DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_node);
1302DEFINE_DIR2_TRACE(xfs_dir2_node_addname);
1303DEFINE_DIR2_TRACE(xfs_dir2_node_lookup);
1304DEFINE_DIR2_TRACE(xfs_dir2_node_replace);
1305DEFINE_DIR2_TRACE(xfs_dir2_node_removename);
1306DEFINE_DIR2_TRACE(xfs_dir2_node_to_leaf);
1307
1308#define DEFINE_DIR2_SPACE_TRACE(tname) \
1309TRACE_EVENT(tname, \
1310 TP_PROTO(struct xfs_da_args *args, int idx), \
1311 TP_ARGS(args, idx), \
1312 TP_STRUCT__entry( \
1313 __field(dev_t, dev) \
1314 __field(xfs_ino_t, ino) \
1315 __field(int, op_flags) \
1316 __field(int, idx) \
1317 ), \
1318 TP_fast_assign( \
1319 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \
1320 __entry->ino = args->dp->i_ino; \
1321 __entry->op_flags = args->op_flags; \
1322 __entry->idx = idx; \
1323 ), \
1324 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d", \
1325 MAJOR(__entry->dev), MINOR(__entry->dev), \
1326 __entry->ino, \
1327 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), \
1328 __entry->idx) \
1329)
1330DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_add);
1331DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_remove);
1332DEFINE_DIR2_SPACE_TRACE(xfs_dir2_grow_inode);
1333DEFINE_DIR2_SPACE_TRACE(xfs_dir2_shrink_inode);
1334
1335TRACE_EVENT(xfs_dir2_leafn_moveents,
1336 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1337 TP_ARGS(args, src_idx, dst_idx, count),
1338 TP_STRUCT__entry(
1339 __field(dev_t, dev)
1340 __field(xfs_ino_t, ino)
1341 __field(int, op_flags)
1342 __field(int, src_idx)
1343 __field(int, dst_idx)
1344 __field(int, count)
1345 ),
1346 TP_fast_assign(
1347 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1348 __entry->ino = args->dp->i_ino;
1349 __entry->op_flags = args->op_flags;
1350 __entry->src_idx = src_idx;
1351 __entry->dst_idx = dst_idx;
1352 __entry->count = count;
1353 ),
1354 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1355 "src_idx %d dst_idx %d count %d",
1356 MAJOR(__entry->dev), MINOR(__entry->dev),
1357 __entry->ino,
1358 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1359 __entry->src_idx,
1360 __entry->dst_idx,
1361 __entry->count)
1362);
1363
1364#endif /* _TRACE_XFS_H */
1365
1366#undef TRACE_INCLUDE_PATH
1367#define TRACE_INCLUDE_PATH .
1368#define TRACE_INCLUDE_FILE xfs_trace
1369#include <trace/define_trace.h>
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 00cabf5354d2..7c220b4227bc 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -39,6 +39,10 @@ struct attrlist_cursor_kern;
39#define IO_ISDIRECT 0x00004 /* bypass page cache */ 39#define IO_ISDIRECT 0x00004 /* bypass page cache */
40#define IO_INVIS 0x00020 /* don't update inode timestamps */ 40#define IO_INVIS 0x00020 /* don't update inode timestamps */
41 41
42#define XFS_IO_FLAGS \
43 { IO_ISDIRECT, "DIRECT" }, \
44 { IO_INVIS, "INVIS"}
45
42/* 46/*
43 * Flush/Invalidate options for vop_toss/flush/flushinval_pages. 47 * Flush/Invalidate options for vop_toss/flush/flushinval_pages.
44 */ 48 */