Skip to content

Commit 488b170

Browse files
olgakorn1Trond Myklebust
authored andcommitted
NFSv4.2 add tracepoint to COPY_NOTIFY
Add a tracepoint to COPY_NOTIFY operation. Signed-off-by: Olga Kornievskaia <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 8db744c commit 488b170

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

fs/nfs/nfs42proc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ static int _nfs42_proc_copy_notify(struct file *src, struct file *dst,
603603

604604
status = nfs4_call_sync(src_server->client, src_server, &msg,
605605
&args->cna_seq_args, &res->cnr_seq_res, 0);
606+
trace_nfs4_copy_notify(file_inode(src), args, res, status);
606607
if (status == -ENOTSUPP)
607608
src_server->caps &= ~NFS_CAP_COPY_NOTIFY;
608609

fs/nfs/nfs4trace.h

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ TRACE_EVENT(nfs4_cb_offload,
243243
show_nfs_stable_how(__entry->cb_how)
244244
)
245245
);
246-
247246
#endif /* CONFIG_NFS_V4_1 */
248247

249248
TRACE_EVENT(nfs4_setup_sequence,
@@ -2407,6 +2406,63 @@ TRACE_EVENT(nfs4_clone,
24072406
__entry->len
24082407
)
24092408
);
2409+
2410+
TRACE_EVENT(nfs4_copy_notify,
2411+
TP_PROTO(
2412+
const struct inode *inode,
2413+
const struct nfs42_copy_notify_args *args,
2414+
const struct nfs42_copy_notify_res *res,
2415+
int error
2416+
),
2417+
2418+
TP_ARGS(inode, args, res, error),
2419+
2420+
TP_STRUCT__entry(
2421+
__field(unsigned long, error)
2422+
__field(u32, fhandle)
2423+
__field(u32, fileid)
2424+
__field(dev_t, dev)
2425+
__field(int, stateid_seq)
2426+
__field(u32, stateid_hash)
2427+
__field(int, res_stateid_seq)
2428+
__field(u32, res_stateid_hash)
2429+
),
2430+
2431+
TP_fast_assign(
2432+
const struct nfs_inode *nfsi = NFS_I(inode);
2433+
2434+
__entry->fileid = nfsi->fileid;
2435+
__entry->dev = inode->i_sb->s_dev;
2436+
__entry->fhandle = nfs_fhandle_hash(args->cna_src_fh);
2437+
__entry->stateid_seq =
2438+
be32_to_cpu(args->cna_src_stateid.seqid);
2439+
__entry->stateid_hash =
2440+
nfs_stateid_hash(&args->cna_src_stateid);
2441+
if (error) {
2442+
__entry->error = -error;
2443+
__entry->res_stateid_seq = 0;
2444+
__entry->res_stateid_hash = 0;
2445+
} else {
2446+
__entry->error = 0;
2447+
__entry->res_stateid_seq =
2448+
be32_to_cpu(res->cnr_stateid.seqid);
2449+
__entry->res_stateid_hash =
2450+
nfs_stateid_hash(&res->cnr_stateid);
2451+
}
2452+
),
2453+
2454+
TP_printk(
2455+
"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2456+
"stateid=%d:0x%08x res_stateid=%d:0x%08x",
2457+
-__entry->error,
2458+
show_nfs4_status(__entry->error),
2459+
MAJOR(__entry->dev), MINOR(__entry->dev),
2460+
(unsigned long long)__entry->fileid,
2461+
__entry->fhandle,
2462+
__entry->stateid_seq, __entry->stateid_hash,
2463+
__entry->res_stateid_seq, __entry->res_stateid_hash
2464+
)
2465+
);
24102466
#endif /* CONFIG_NFS_V4_2 */
24112467

24122468
#endif /* CONFIG_NFS_V4_1 */

0 commit comments

Comments
 (0)