Skip to content

Commit f628d46

Browse files
olgakorn1Trond Myklebust
authored andcommitted
NFSv4.2 add tracepoint to SEEK
Add a tracepoint to the SEEK operation. Signed-off-by: Olga Kornievskaia <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 17f09d3 commit f628d46

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

fs/nfs/nfs42proc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ static loff_t _nfs42_proc_llseek(struct file *filep,
678678

679679
status = nfs4_call_sync(server->client, server, &msg,
680680
&args.seq_args, &res.seq_res, 0);
681+
trace_nfs4_llseek(inode, &args, &res, status);
681682
if (status == -ENOTSUPP)
682683
server->caps &= ~NFS_CAP_SEEK;
683684
if (status)

fs/nfs/nfs4trace.h

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,6 +2054,80 @@ TRACE_EVENT(ff_layout_commit_error,
20542054
)
20552055
);
20562056

2057+
TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA);
2058+
TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE);
2059+
2060+
#define show_llseek_mode(what) \
2061+
__print_symbolic(what, \
2062+
{ NFS4_CONTENT_DATA, "DATA" }, \
2063+
{ NFS4_CONTENT_HOLE, "HOLE" })
2064+
2065+
#ifdef CONFIG_NFS_V4_2
2066+
TRACE_EVENT(nfs4_llseek,
2067+
TP_PROTO(
2068+
const struct inode *inode,
2069+
const struct nfs42_seek_args *args,
2070+
const struct nfs42_seek_res *res,
2071+
int error
2072+
),
2073+
2074+
TP_ARGS(inode, args, res, error),
2075+
2076+
TP_STRUCT__entry(
2077+
__field(unsigned long, error)
2078+
__field(u32, fhandle)
2079+
__field(u32, fileid)
2080+
__field(dev_t, dev)
2081+
__field(int, stateid_seq)
2082+
__field(u32, stateid_hash)
2083+
__field(loff_t, offset_s)
2084+
__field(u32, what)
2085+
__field(loff_t, offset_r)
2086+
__field(u32, eof)
2087+
),
2088+
2089+
TP_fast_assign(
2090+
const struct nfs_inode *nfsi = NFS_I(inode);
2091+
const struct nfs_fh *fh = args->sa_fh;
2092+
2093+
__entry->fileid = nfsi->fileid;
2094+
__entry->dev = inode->i_sb->s_dev;
2095+
__entry->fhandle = nfs_fhandle_hash(fh);
2096+
__entry->offset_s = args->sa_offset;
2097+
__entry->stateid_seq =
2098+
be32_to_cpu(args->sa_stateid.seqid);
2099+
__entry->stateid_hash =
2100+
nfs_stateid_hash(&args->sa_stateid);
2101+
__entry->what = args->sa_what;
2102+
if (error) {
2103+
__entry->error = -error;
2104+
__entry->offset_r = 0;
2105+
__entry->eof = 0;
2106+
} else {
2107+
__entry->error = 0;
2108+
__entry->offset_r = res->sr_offset;
2109+
__entry->eof = res->sr_eof;
2110+
}
2111+
),
2112+
2113+
TP_printk(
2114+
"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2115+
"stateid=%d:0x%08x offset_s=%llu what=%s "
2116+
"offset_r=%llu eof=%u",
2117+
-__entry->error,
2118+
show_nfs4_status(__entry->error),
2119+
MAJOR(__entry->dev), MINOR(__entry->dev),
2120+
(unsigned long long)__entry->fileid,
2121+
__entry->fhandle,
2122+
__entry->stateid_seq, __entry->stateid_hash,
2123+
__entry->offset_s,
2124+
show_llseek_mode(__entry->what),
2125+
__entry->offset_r,
2126+
__entry->eof
2127+
)
2128+
);
2129+
2130+
#endif /* CONFIG_NFS_V4_2 */
20572131

20582132
#endif /* CONFIG_NFS_V4_1 */
20592133

0 commit comments

Comments
 (0)