[PATCH v1 2/2] NFS: use unsigned long for req field in nfs_page_class
From: Sean Chang
Date: Wed Apr 08 2026 - 12:15:08 EST
The nfs_page_class tracepoint used a pointer for the req field. This
caused Sparse to complain about dereferencing a pointer marked as
__private within the trace ring buffer context.
Change the field type to unsigned long to store the address of the
request without dereferencing it. Update TP_printk to use 0x%lx for
consistent hexadecimal output, allowing for unique identification of
requests across the trace log.
Signed-off-by: Sean Chang <seanwascoding@xxxxxxxxx>
---
fs/nfs/nfstrace.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 9f9ce4a565ea..4150bbd99cfa 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1496,7 +1496,7 @@ DECLARE_EVENT_CLASS(nfs_page_class,
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
- __field(const struct nfs_page *__private, req)
+ __field(unsigned long, req)
__field(loff_t, offset)
__field(unsigned int, count)
__field(unsigned long, flags)
@@ -1509,14 +1509,14 @@ DECLARE_EVENT_CLASS(nfs_page_class,
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = nfsi->fileid;
__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
- __entry->req = req;
+ __entry->req = (unsigned long)req;
__entry->offset = req_offset(req);
__entry->count = req->wb_bytes;
__entry->flags = req->wb_flags;
),
TP_printk(
- "fileid=%02x:%02x:%llu fhandle=0x%08x req=%p offset=%lld count=%u flags=%s",
+ "fileid=%02x:%02x:%llu fhandle=0x%08x req=0x%lx offset=%lld count=%u flags=%s",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid, __entry->fhandle,
__entry->req, __entry->offset, __entry->count,
--
2.34.1