afs: Trace the sending of pages
authorDavid Howells <dhowells@redhat.com>
Thu, 2 Nov 2017 15:27:51 +0000 (15:27 +0000)
committerDavid Howells <dhowells@redhat.com>
Mon, 13 Nov 2017 15:38:19 +0000 (15:38 +0000)
Add a pair of tracepoints to log the sending of pages for an FS.StoreData
or FS.StoreData64 operation.

Tracepoint afs_send_pages notes each set of pages added to the operation.
There may be several of these per operation as we get up at most 8
contiguous pages in one go because the bvec we're using is on the stack.

Tracepoint afs_sent_pages notes the end of adding data from a whole run of
pages to the operation and the completion of the request phase.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/rxrpc.c
include/trace/events/afs.h

index 59cc580..06a51d7 100644 (file)
@@ -303,6 +303,8 @@ static int afs_send_pages(struct afs_call *call, struct msghdr *msg)
 
        do {
                afs_load_bvec(call, msg, bv, first, last, offset);
+               trace_afs_send_pages(call, msg, first, last, offset);
+
                offset = 0;
                bytes = msg->msg_iter.count;
                nr = msg->msg_iter.nr_segs;
@@ -317,6 +319,7 @@ static int afs_send_pages(struct afs_call *call, struct msghdr *msg)
                first += nr;
        } while (first <= last);
 
+       trace_afs_sent_pages(call, call->first, last, first, ret);
        return ret;
 }
 
index dd9d260..c780f4c 100644 (file)
@@ -320,6 +320,67 @@ TRACE_EVENT(afs_call_done,
                      __entry->rx_call)
            );
 
+TRACE_EVENT(afs_send_pages,
+           TP_PROTO(struct afs_call *call, struct msghdr *msg,
+                    pgoff_t first, pgoff_t last, unsigned int offset),
+
+           TP_ARGS(call, msg, first, last, offset),
+
+           TP_STRUCT__entry(
+                   __field(struct afs_call *,          call            )
+                   __field(pgoff_t,                    first           )
+                   __field(pgoff_t,                    last            )
+                   __field(unsigned int,               nr              )
+                   __field(unsigned int,               bytes           )
+                   __field(unsigned int,               offset          )
+                   __field(unsigned int,               flags           )
+                            ),
+
+           TP_fast_assign(
+                   __entry->call = call;
+                   __entry->first = first;
+                   __entry->last = last;
+                   __entry->nr = msg->msg_iter.nr_segs;
+                   __entry->bytes = msg->msg_iter.count;
+                   __entry->offset = offset;
+                   __entry->flags = msg->msg_flags;
+                          ),
+
+           TP_printk(" c=%p %lx-%lx-%lx b=%x o=%x f=%x",
+                     __entry->call,
+                     __entry->first, __entry->first + __entry->nr - 1, __entry->last,
+                     __entry->bytes, __entry->offset,
+                     __entry->flags)
+           );
+
+TRACE_EVENT(afs_sent_pages,
+           TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
+                    pgoff_t cursor, int ret),
+
+           TP_ARGS(call, first, last, cursor, ret),
+
+           TP_STRUCT__entry(
+                   __field(struct afs_call *,          call            )
+                   __field(pgoff_t,                    first           )
+                   __field(pgoff_t,                    last            )
+                   __field(pgoff_t,                    cursor          )
+                   __field(int,                        ret             )
+                            ),
+
+           TP_fast_assign(
+                   __entry->call = call;
+                   __entry->first = first;
+                   __entry->last = last;
+                   __entry->cursor = cursor;
+                   __entry->ret = ret;
+                          ),
+
+           TP_printk(" c=%p %lx-%lx c=%lx r=%d",
+                     __entry->call,
+                     __entry->first, __entry->last,
+                     __entry->cursor, __entry->ret)
+           );
+
 #endif /* _TRACE_AFS_H */
 
 /* This part must be outside protection */