Skip to content

Commit 40a8241

Browse files
olgakorn1Trond Myklebust
authored andcommitted
NFSv4.2 add tracepoints to FALLOCATE and DEALLOCATE
Add a tracepoint to the FALLOCATE/DEALLOCATE operations. Signed-off-by: Olga Kornievskaia <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent f628d46 commit 40a8241

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

fs/nfs/nfs42proc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
8383
status = nfs_post_op_update_inode_force_wcc(inode,
8484
res.falloc_fattr);
8585

86+
if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_ALLOCATE])
87+
trace_nfs4_fallocate(inode, &args, status);
88+
else
89+
trace_nfs4_deallocate(inode, &args, status);
8690
kfree(res.falloc_fattr);
8791
return status;
8892
}

fs/nfs/nfs4trace.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,6 +2127,62 @@ TRACE_EVENT(nfs4_llseek,
21272127
)
21282128
);
21292129

2130+
DECLARE_EVENT_CLASS(nfs4_sparse_event,
2131+
TP_PROTO(
2132+
const struct inode *inode,
2133+
const struct nfs42_falloc_args *args,
2134+
int error
2135+
),
2136+
2137+
TP_ARGS(inode, args, error),
2138+
2139+
TP_STRUCT__entry(
2140+
__field(unsigned long, error)
2141+
__field(loff_t, offset)
2142+
__field(loff_t, len)
2143+
__field(dev_t, dev)
2144+
__field(u32, fhandle)
2145+
__field(u64, fileid)
2146+
__field(int, stateid_seq)
2147+
__field(u32, stateid_hash)
2148+
),
2149+
2150+
TP_fast_assign(
2151+
__entry->error = error < 0 ? -error : 0;
2152+
__entry->offset = args->falloc_offset;
2153+
__entry->len = args->falloc_length;
2154+
__entry->dev = inode->i_sb->s_dev;
2155+
__entry->fileid = NFS_FILEID(inode);
2156+
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2157+
__entry->stateid_seq =
2158+
be32_to_cpu(args->falloc_stateid.seqid);
2159+
__entry->stateid_hash =
2160+
nfs_stateid_hash(&args->falloc_stateid);
2161+
),
2162+
2163+
TP_printk(
2164+
"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2165+
"stateid=%d:0x%08x offset=%llu len=%llu",
2166+
-__entry->error,
2167+
show_nfs4_status(__entry->error),
2168+
MAJOR(__entry->dev), MINOR(__entry->dev),
2169+
(unsigned long long)__entry->fileid,
2170+
__entry->fhandle,
2171+
__entry->stateid_seq, __entry->stateid_hash,
2172+
(long long)__entry->offset,
2173+
(long long)__entry->len
2174+
)
2175+
);
2176+
#define DEFINE_NFS4_SPARSE_EVENT(name) \
2177+
DEFINE_EVENT(nfs4_sparse_event, name, \
2178+
TP_PROTO( \
2179+
const struct inode *inode, \
2180+
const struct nfs42_falloc_args *args, \
2181+
int error \
2182+
), \
2183+
TP_ARGS(inode, args, error))
2184+
DEFINE_NFS4_SPARSE_EVENT(nfs4_fallocate);
2185+
DEFINE_NFS4_SPARSE_EVENT(nfs4_deallocate);
21302186
#endif /* CONFIG_NFS_V4_2 */
21312187

21322188
#endif /* CONFIG_NFS_V4_1 */

0 commit comments

Comments
 (0)