Skip to content

Commit 2c09901

Browse files
committed
afs: Trace the sending of pages
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 <[email protected]>
1 parent 025db80 commit 2c09901

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

fs/afs/rxrpc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ static int afs_send_pages(struct afs_call *call, struct msghdr *msg)
303303

304304
do {
305305
afs_load_bvec(call, msg, bv, first, last, offset);
306+
trace_afs_send_pages(call, msg, first, last, offset);
307+
306308
offset = 0;
307309
bytes = msg->msg_iter.count;
308310
nr = msg->msg_iter.nr_segs;
@@ -317,6 +319,7 @@ static int afs_send_pages(struct afs_call *call, struct msghdr *msg)
317319
first += nr;
318320
} while (first <= last);
319321

322+
trace_afs_sent_pages(call, call->first, last, first, ret);
320323
return ret;
321324
}
322325

include/trace/events/afs.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,67 @@ TRACE_EVENT(afs_call_done,
320320
__entry->rx_call)
321321
);
322322

323+
TRACE_EVENT(afs_send_pages,
324+
TP_PROTO(struct afs_call *call, struct msghdr *msg,
325+
pgoff_t first, pgoff_t last, unsigned int offset),
326+
327+
TP_ARGS(call, msg, first, last, offset),
328+
329+
TP_STRUCT__entry(
330+
__field(struct afs_call *, call )
331+
__field(pgoff_t, first )
332+
__field(pgoff_t, last )
333+
__field(unsigned int, nr )
334+
__field(unsigned int, bytes )
335+
__field(unsigned int, offset )
336+
__field(unsigned int, flags )
337+
),
338+
339+
TP_fast_assign(
340+
__entry->call = call;
341+
__entry->first = first;
342+
__entry->last = last;
343+
__entry->nr = msg->msg_iter.nr_segs;
344+
__entry->bytes = msg->msg_iter.count;
345+
__entry->offset = offset;
346+
__entry->flags = msg->msg_flags;
347+
),
348+
349+
TP_printk(" c=%p %lx-%lx-%lx b=%x o=%x f=%x",
350+
__entry->call,
351+
__entry->first, __entry->first + __entry->nr - 1, __entry->last,
352+
__entry->bytes, __entry->offset,
353+
__entry->flags)
354+
);
355+
356+
TRACE_EVENT(afs_sent_pages,
357+
TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
358+
pgoff_t cursor, int ret),
359+
360+
TP_ARGS(call, first, last, cursor, ret),
361+
362+
TP_STRUCT__entry(
363+
__field(struct afs_call *, call )
364+
__field(pgoff_t, first )
365+
__field(pgoff_t, last )
366+
__field(pgoff_t, cursor )
367+
__field(int, ret )
368+
),
369+
370+
TP_fast_assign(
371+
__entry->call = call;
372+
__entry->first = first;
373+
__entry->last = last;
374+
__entry->cursor = cursor;
375+
__entry->ret = ret;
376+
),
377+
378+
TP_printk(" c=%p %lx-%lx c=%lx r=%d",
379+
__entry->call,
380+
__entry->first, __entry->last,
381+
__entry->cursor, __entry->ret)
382+
);
383+
323384
#endif /* _TRACE_AFS_H */
324385

325386
/* This part must be outside protection */

0 commit comments

Comments
 (0)