2020-09-18 16:25:13 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/* Network filesystem support module tracepoints
|
|
|
|
*
|
|
|
|
* Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
|
|
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
|
|
*/
|
|
|
|
#undef TRACE_SYSTEM
|
|
|
|
#define TRACE_SYSTEM netfs
|
|
|
|
|
|
|
|
#if !defined(_TRACE_NETFS_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
|
|
#define _TRACE_NETFS_H
|
|
|
|
|
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define enums for tracing information.
|
|
|
|
*/
|
|
|
|
#define netfs_read_traces \
|
|
|
|
EM(netfs_read_trace_expanded, "EXPANDED ") \
|
|
|
|
EM(netfs_read_trace_readahead, "READAHEAD") \
|
2020-09-22 18:06:07 +08:00
|
|
|
EM(netfs_read_trace_readpage, "READPAGE ") \
|
|
|
|
E_(netfs_read_trace_write_begin, "WRITEBEGN")
|
2020-09-18 16:25:13 +08:00
|
|
|
|
2021-08-26 21:24:42 +08:00
|
|
|
#define netfs_rreq_origins \
|
|
|
|
EM(NETFS_READAHEAD, "RA") \
|
|
|
|
EM(NETFS_READPAGE, "RP") \
|
|
|
|
E_(NETFS_READ_FOR_WRITE, "RW")
|
|
|
|
|
2020-09-18 16:25:13 +08:00
|
|
|
#define netfs_rreq_traces \
|
2022-02-20 07:05:40 +08:00
|
|
|
EM(netfs_rreq_trace_assess, "ASSESS ") \
|
|
|
|
EM(netfs_rreq_trace_copy, "COPY ") \
|
|
|
|
EM(netfs_rreq_trace_done, "DONE ") \
|
|
|
|
EM(netfs_rreq_trace_free, "FREE ") \
|
|
|
|
EM(netfs_rreq_trace_resubmit, "RESUBMT") \
|
|
|
|
EM(netfs_rreq_trace_unlock, "UNLOCK ") \
|
|
|
|
E_(netfs_rreq_trace_unmark, "UNMARK ")
|
2020-09-18 16:25:13 +08:00
|
|
|
|
|
|
|
#define netfs_sreq_sources \
|
|
|
|
EM(NETFS_FILL_WITH_ZEROES, "ZERO") \
|
|
|
|
EM(NETFS_DOWNLOAD_FROM_SERVER, "DOWN") \
|
|
|
|
EM(NETFS_READ_FROM_CACHE, "READ") \
|
|
|
|
E_(NETFS_INVALID_READ, "INVL") \
|
|
|
|
|
|
|
|
#define netfs_sreq_traces \
|
|
|
|
EM(netfs_sreq_trace_download_instead, "RDOWN") \
|
|
|
|
EM(netfs_sreq_trace_free, "FREE ") \
|
|
|
|
EM(netfs_sreq_trace_prepare, "PREP ") \
|
|
|
|
EM(netfs_sreq_trace_resubmit_short, "SHORT") \
|
|
|
|
EM(netfs_sreq_trace_submit, "SUBMT") \
|
|
|
|
EM(netfs_sreq_trace_terminated, "TERM ") \
|
|
|
|
EM(netfs_sreq_trace_write, "WRITE") \
|
2020-02-06 22:22:24 +08:00
|
|
|
EM(netfs_sreq_trace_write_skip, "SKIP ") \
|
2020-09-18 16:25:13 +08:00
|
|
|
E_(netfs_sreq_trace_write_term, "WTERM")
|
|
|
|
|
2021-04-07 00:31:54 +08:00
|
|
|
#define netfs_failures \
|
|
|
|
EM(netfs_fail_check_write_begin, "check-write-begin") \
|
|
|
|
EM(netfs_fail_copy_to_cache, "copy-to-cache") \
|
|
|
|
EM(netfs_fail_read, "read") \
|
|
|
|
EM(netfs_fail_short_readpage, "short-readpage") \
|
|
|
|
EM(netfs_fail_short_write_begin, "short-write-begin") \
|
|
|
|
E_(netfs_fail_prepare_write, "prep-write")
|
|
|
|
|
2022-02-18 05:13:05 +08:00
|
|
|
#define netfs_rreq_ref_traces \
|
|
|
|
EM(netfs_rreq_trace_get_hold, "GET HOLD ") \
|
|
|
|
EM(netfs_rreq_trace_get_subreq, "GET SUBREQ ") \
|
|
|
|
EM(netfs_rreq_trace_put_complete, "PUT COMPLT ") \
|
|
|
|
EM(netfs_rreq_trace_put_failed, "PUT FAILED ") \
|
|
|
|
EM(netfs_rreq_trace_put_hold, "PUT HOLD ") \
|
|
|
|
EM(netfs_rreq_trace_put_subreq, "PUT SUBREQ ") \
|
|
|
|
E_(netfs_rreq_trace_new, "NEW ")
|
|
|
|
|
2022-02-17 23:01:24 +08:00
|
|
|
#define netfs_sreq_ref_traces \
|
|
|
|
EM(netfs_sreq_trace_get_copy_to_cache, "GET COPY2C ") \
|
|
|
|
EM(netfs_sreq_trace_get_resubmit, "GET RESUBMIT") \
|
|
|
|
EM(netfs_sreq_trace_get_short_read, "GET SHORTRD") \
|
|
|
|
EM(netfs_sreq_trace_new, "NEW ") \
|
|
|
|
EM(netfs_sreq_trace_put_clear, "PUT CLEAR ") \
|
|
|
|
EM(netfs_sreq_trace_put_failed, "PUT FAILED ") \
|
|
|
|
EM(netfs_sreq_trace_put_merged, "PUT MERGED ") \
|
|
|
|
EM(netfs_sreq_trace_put_no_copy, "PUT NO COPY") \
|
|
|
|
E_(netfs_sreq_trace_put_terminated, "PUT TERM ")
|
|
|
|
|
2022-02-02 23:12:44 +08:00
|
|
|
#ifndef __NETFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
|
|
|
|
#define __NETFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
|
|
|
|
|
|
|
|
#undef EM
|
|
|
|
#undef E_
|
|
|
|
#define EM(a, b) a,
|
|
|
|
#define E_(a, b) a
|
|
|
|
|
|
|
|
enum netfs_read_trace { netfs_read_traces } __mode(byte);
|
|
|
|
enum netfs_rreq_trace { netfs_rreq_traces } __mode(byte);
|
|
|
|
enum netfs_sreq_trace { netfs_sreq_traces } __mode(byte);
|
|
|
|
enum netfs_failure { netfs_failures } __mode(byte);
|
2022-02-18 05:13:05 +08:00
|
|
|
enum netfs_rreq_ref_trace { netfs_rreq_ref_traces } __mode(byte);
|
2022-02-17 23:01:24 +08:00
|
|
|
enum netfs_sreq_ref_trace { netfs_sreq_ref_traces } __mode(byte);
|
2022-02-02 23:12:44 +08:00
|
|
|
|
|
|
|
#endif
|
2020-09-18 16:25:13 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Export enum symbols via userspace.
|
|
|
|
*/
|
|
|
|
#undef EM
|
|
|
|
#undef E_
|
|
|
|
#define EM(a, b) TRACE_DEFINE_ENUM(a);
|
|
|
|
#define E_(a, b) TRACE_DEFINE_ENUM(a);
|
|
|
|
|
|
|
|
netfs_read_traces;
|
2021-08-26 21:24:42 +08:00
|
|
|
netfs_rreq_origins;
|
2020-09-18 16:25:13 +08:00
|
|
|
netfs_rreq_traces;
|
|
|
|
netfs_sreq_sources;
|
|
|
|
netfs_sreq_traces;
|
2021-04-07 00:31:54 +08:00
|
|
|
netfs_failures;
|
2022-02-18 05:13:05 +08:00
|
|
|
netfs_rreq_ref_traces;
|
2022-02-17 23:01:24 +08:00
|
|
|
netfs_sreq_ref_traces;
|
2020-09-18 16:25:13 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Now redefine the EM() and E_() macros to map the enums to the strings that
|
|
|
|
* will be printed in the output.
|
|
|
|
*/
|
|
|
|
#undef EM
|
|
|
|
#undef E_
|
|
|
|
#define EM(a, b) { a, b },
|
|
|
|
#define E_(a, b) { a, b }
|
|
|
|
|
|
|
|
TRACE_EVENT(netfs_read,
|
2022-02-17 18:01:23 +08:00
|
|
|
TP_PROTO(struct netfs_io_request *rreq,
|
2020-09-18 16:25:13 +08:00
|
|
|
loff_t start, size_t len,
|
|
|
|
enum netfs_read_trace what),
|
|
|
|
|
|
|
|
TP_ARGS(rreq, start, len, what),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned int, rreq )
|
|
|
|
__field(unsigned int, cookie )
|
|
|
|
__field(loff_t, start )
|
|
|
|
__field(size_t, len )
|
|
|
|
__field(enum netfs_read_trace, what )
|
2021-10-12 19:05:27 +08:00
|
|
|
__field(unsigned int, netfs_inode )
|
2020-09-18 16:25:13 +08:00
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->rreq = rreq->debug_id;
|
2021-05-12 21:10:09 +08:00
|
|
|
__entry->cookie = rreq->cache_resources.debug_id;
|
2020-09-18 16:25:13 +08:00
|
|
|
__entry->start = start;
|
|
|
|
__entry->len = len;
|
|
|
|
__entry->what = what;
|
2021-10-12 19:05:27 +08:00
|
|
|
__entry->netfs_inode = rreq->inode->i_ino;
|
2020-09-18 16:25:13 +08:00
|
|
|
),
|
|
|
|
|
2021-10-12 19:05:27 +08:00
|
|
|
TP_printk("R=%08x %s c=%08x ni=%x s=%llx %zx",
|
2020-09-18 16:25:13 +08:00
|
|
|
__entry->rreq,
|
|
|
|
__print_symbolic(__entry->what, netfs_read_traces),
|
|
|
|
__entry->cookie,
|
2021-10-12 19:05:27 +08:00
|
|
|
__entry->netfs_inode,
|
2020-09-18 16:25:13 +08:00
|
|
|
__entry->start, __entry->len)
|
|
|
|
);
|
|
|
|
|
|
|
|
TRACE_EVENT(netfs_rreq,
|
2022-02-17 18:01:23 +08:00
|
|
|
TP_PROTO(struct netfs_io_request *rreq,
|
2020-09-18 16:25:13 +08:00
|
|
|
enum netfs_rreq_trace what),
|
|
|
|
|
|
|
|
TP_ARGS(rreq, what),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned int, rreq )
|
2022-02-20 07:05:40 +08:00
|
|
|
__field(unsigned int, flags )
|
2021-08-26 21:24:42 +08:00
|
|
|
__field(enum netfs_io_origin, origin )
|
2020-09-18 16:25:13 +08:00
|
|
|
__field(enum netfs_rreq_trace, what )
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->rreq = rreq->debug_id;
|
|
|
|
__entry->flags = rreq->flags;
|
2021-08-26 21:24:42 +08:00
|
|
|
__entry->origin = rreq->origin;
|
2020-09-18 16:25:13 +08:00
|
|
|
__entry->what = what;
|
|
|
|
),
|
|
|
|
|
2021-08-26 21:24:42 +08:00
|
|
|
TP_printk("R=%08x %s %s f=%02x",
|
2020-09-18 16:25:13 +08:00
|
|
|
__entry->rreq,
|
2021-08-26 21:24:42 +08:00
|
|
|
__print_symbolic(__entry->origin, netfs_rreq_origins),
|
2020-09-18 16:25:13 +08:00
|
|
|
__print_symbolic(__entry->what, netfs_rreq_traces),
|
|
|
|
__entry->flags)
|
|
|
|
);
|
|
|
|
|
|
|
|
TRACE_EVENT(netfs_sreq,
|
2022-02-17 18:01:23 +08:00
|
|
|
TP_PROTO(struct netfs_io_subrequest *sreq,
|
2020-09-18 16:25:13 +08:00
|
|
|
enum netfs_sreq_trace what),
|
|
|
|
|
|
|
|
TP_ARGS(sreq, what),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned int, rreq )
|
|
|
|
__field(unsigned short, index )
|
|
|
|
__field(short, error )
|
|
|
|
__field(unsigned short, flags )
|
2022-02-17 18:01:23 +08:00
|
|
|
__field(enum netfs_io_source, source )
|
2020-09-18 16:25:13 +08:00
|
|
|
__field(enum netfs_sreq_trace, what )
|
|
|
|
__field(size_t, len )
|
|
|
|
__field(size_t, transferred )
|
|
|
|
__field(loff_t, start )
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->rreq = sreq->rreq->debug_id;
|
|
|
|
__entry->index = sreq->debug_index;
|
|
|
|
__entry->error = sreq->error;
|
|
|
|
__entry->flags = sreq->flags;
|
|
|
|
__entry->source = sreq->source;
|
|
|
|
__entry->what = what;
|
|
|
|
__entry->len = sreq->len;
|
|
|
|
__entry->transferred = sreq->transferred;
|
|
|
|
__entry->start = sreq->start;
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_printk("R=%08x[%u] %s %s f=%02x s=%llx %zx/%zx e=%d",
|
|
|
|
__entry->rreq, __entry->index,
|
|
|
|
__print_symbolic(__entry->source, netfs_sreq_sources),
|
2022-02-20 07:05:40 +08:00
|
|
|
__print_symbolic(__entry->what, netfs_sreq_traces),
|
2020-09-18 16:25:13 +08:00
|
|
|
__entry->flags,
|
|
|
|
__entry->start, __entry->transferred, __entry->len,
|
|
|
|
__entry->error)
|
|
|
|
);
|
|
|
|
|
2021-04-07 00:31:54 +08:00
|
|
|
TRACE_EVENT(netfs_failure,
|
2022-02-17 18:01:23 +08:00
|
|
|
TP_PROTO(struct netfs_io_request *rreq,
|
|
|
|
struct netfs_io_subrequest *sreq,
|
2021-04-07 00:31:54 +08:00
|
|
|
int error, enum netfs_failure what),
|
|
|
|
|
|
|
|
TP_ARGS(rreq, sreq, error, what),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned int, rreq )
|
2022-02-26 00:24:03 +08:00
|
|
|
__field(short, index )
|
2021-04-07 00:31:54 +08:00
|
|
|
__field(short, error )
|
|
|
|
__field(unsigned short, flags )
|
2022-02-17 18:01:23 +08:00
|
|
|
__field(enum netfs_io_source, source )
|
2021-04-07 00:31:54 +08:00
|
|
|
__field(enum netfs_failure, what )
|
|
|
|
__field(size_t, len )
|
|
|
|
__field(size_t, transferred )
|
|
|
|
__field(loff_t, start )
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->rreq = rreq->debug_id;
|
2022-02-26 00:24:03 +08:00
|
|
|
__entry->index = sreq ? sreq->debug_index : -1;
|
2021-04-07 00:31:54 +08:00
|
|
|
__entry->error = error;
|
|
|
|
__entry->flags = sreq ? sreq->flags : 0;
|
|
|
|
__entry->source = sreq ? sreq->source : NETFS_INVALID_READ;
|
|
|
|
__entry->what = what;
|
2022-02-26 00:24:03 +08:00
|
|
|
__entry->len = sreq ? sreq->len : rreq->len;
|
2021-04-07 00:31:54 +08:00
|
|
|
__entry->transferred = sreq ? sreq->transferred : 0;
|
|
|
|
__entry->start = sreq ? sreq->start : 0;
|
|
|
|
),
|
|
|
|
|
2022-02-26 00:24:03 +08:00
|
|
|
TP_printk("R=%08x[%d] %s f=%02x s=%llx %zx/%zx %s e=%d",
|
2021-04-07 00:31:54 +08:00
|
|
|
__entry->rreq, __entry->index,
|
|
|
|
__print_symbolic(__entry->source, netfs_sreq_sources),
|
|
|
|
__entry->flags,
|
|
|
|
__entry->start, __entry->transferred, __entry->len,
|
|
|
|
__print_symbolic(__entry->what, netfs_failures),
|
|
|
|
__entry->error)
|
|
|
|
);
|
|
|
|
|
2022-02-18 05:13:05 +08:00
|
|
|
TRACE_EVENT(netfs_rreq_ref,
|
|
|
|
TP_PROTO(unsigned int rreq_debug_id, int ref,
|
|
|
|
enum netfs_rreq_ref_trace what),
|
|
|
|
|
|
|
|
TP_ARGS(rreq_debug_id, ref, what),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned int, rreq )
|
|
|
|
__field(int, ref )
|
|
|
|
__field(enum netfs_rreq_ref_trace, what )
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->rreq = rreq_debug_id;
|
|
|
|
__entry->ref = ref;
|
|
|
|
__entry->what = what;
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_printk("R=%08x %s r=%u",
|
|
|
|
__entry->rreq,
|
|
|
|
__print_symbolic(__entry->what, netfs_rreq_ref_traces),
|
|
|
|
__entry->ref)
|
|
|
|
);
|
|
|
|
|
2022-02-17 23:01:24 +08:00
|
|
|
TRACE_EVENT(netfs_sreq_ref,
|
|
|
|
TP_PROTO(unsigned int rreq_debug_id, unsigned int subreq_debug_index,
|
|
|
|
int ref, enum netfs_sreq_ref_trace what),
|
|
|
|
|
|
|
|
TP_ARGS(rreq_debug_id, subreq_debug_index, ref, what),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned int, rreq )
|
|
|
|
__field(unsigned int, subreq )
|
|
|
|
__field(int, ref )
|
|
|
|
__field(enum netfs_sreq_ref_trace, what )
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->rreq = rreq_debug_id;
|
|
|
|
__entry->subreq = subreq_debug_index;
|
|
|
|
__entry->ref = ref;
|
|
|
|
__entry->what = what;
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_printk("R=%08x[%x] %s r=%u",
|
|
|
|
__entry->rreq,
|
|
|
|
__entry->subreq,
|
|
|
|
__print_symbolic(__entry->what, netfs_sreq_ref_traces),
|
|
|
|
__entry->ref)
|
|
|
|
);
|
|
|
|
|
2022-02-02 23:12:44 +08:00
|
|
|
#undef EM
|
|
|
|
#undef E_
|
2020-09-18 16:25:13 +08:00
|
|
|
#endif /* _TRACE_NETFS_H */
|
|
|
|
|
|
|
|
/* This part must be outside protection */
|
|
|
|
#include <trace/define_trace.h>
|