Skip to content

Commit 2a65ca8

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

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

fs/nfs/nfs42proc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ static int _nfs42_proc_clone(struct rpc_message *msg, struct file *src_f,
10771077

10781078
status = nfs4_call_sync(server->client, server, msg,
10791079
&args.seq_args, &res.seq_res, 0);
1080+
trace_nfs4_clone(src_inode, dst_inode, &args, status);
10801081
if (status == 0) {
10811082
nfs42_copy_dest_done(dst_inode, dst_offset, count);
10821083
status = nfs_post_op_update_inode(dst_inode, res.dst_fattr);

fs/nfs/nfs4trace.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,79 @@ TRACE_EVENT(nfs4_copy,
22902290
__entry->res_count
22912291
)
22922292
);
2293+
2294+
TRACE_EVENT(nfs4_clone,
2295+
TP_PROTO(
2296+
const struct inode *src_inode,
2297+
const struct inode *dst_inode,
2298+
const struct nfs42_clone_args *args,
2299+
int error
2300+
),
2301+
2302+
TP_ARGS(src_inode, dst_inode, args, error),
2303+
2304+
TP_STRUCT__entry(
2305+
__field(unsigned long, error)
2306+
__field(u32, src_fhandle)
2307+
__field(u32, src_fileid)
2308+
__field(u32, dst_fhandle)
2309+
__field(u32, dst_fileid)
2310+
__field(dev_t, src_dev)
2311+
__field(dev_t, dst_dev)
2312+
__field(loff_t, src_offset)
2313+
__field(loff_t, dst_offset)
2314+
__field(int, src_stateid_seq)
2315+
__field(u32, src_stateid_hash)
2316+
__field(int, dst_stateid_seq)
2317+
__field(u32, dst_stateid_hash)
2318+
__field(loff_t, len)
2319+
),
2320+
2321+
TP_fast_assign(
2322+
const struct nfs_inode *src_nfsi = NFS_I(src_inode);
2323+
const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
2324+
2325+
__entry->src_fileid = src_nfsi->fileid;
2326+
__entry->src_dev = src_inode->i_sb->s_dev;
2327+
__entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
2328+
__entry->src_offset = args->src_offset;
2329+
__entry->dst_fileid = dst_nfsi->fileid;
2330+
__entry->dst_dev = dst_inode->i_sb->s_dev;
2331+
__entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
2332+
__entry->dst_offset = args->dst_offset;
2333+
__entry->len = args->count;
2334+
__entry->error = error < 0 ? -error : 0;
2335+
__entry->src_stateid_seq =
2336+
be32_to_cpu(args->src_stateid.seqid);
2337+
__entry->src_stateid_hash =
2338+
nfs_stateid_hash(&args->src_stateid);
2339+
__entry->dst_stateid_seq =
2340+
be32_to_cpu(args->dst_stateid.seqid);
2341+
__entry->dst_stateid_hash =
2342+
nfs_stateid_hash(&args->dst_stateid);
2343+
),
2344+
2345+
TP_printk(
2346+
"error=%ld (%s) src_fileid=%02x:%02x:%llu "
2347+
"src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
2348+
"dst_fhandle=0x%08x src_stateid=%d:0x%08x "
2349+
"dst_stateid=%d:0x%08x src_offset=%llu "
2350+
"dst_offset=%llu len=%llu",
2351+
-__entry->error,
2352+
show_nfs4_status(__entry->error),
2353+
MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
2354+
(unsigned long long)__entry->src_fileid,
2355+
__entry->src_fhandle,
2356+
MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
2357+
(unsigned long long)__entry->dst_fileid,
2358+
__entry->dst_fhandle,
2359+
__entry->src_stateid_seq, __entry->src_stateid_hash,
2360+
__entry->dst_stateid_seq, __entry->dst_stateid_hash,
2361+
__entry->src_offset,
2362+
__entry->dst_offset,
2363+
__entry->len
2364+
)
2365+
);
22932366
#endif /* CONFIG_NFS_V4_2 */
22942367

22952368
#endif /* CONFIG_NFS_V4_1 */

0 commit comments

Comments
 (0)