2020-11-02 13:51:53

by David Wysochanski

[permalink] [raw]
Subject: [PATCH 10/11] NFS: Add page_index to nfs_readdir enter and exit tracepoints

Add nfs_open_dir_context.page_index to enter and exit tracepoints
since this affects searching the cache.

Signed-off-by: Dave Wysochanski <[email protected]>
---
fs/nfs/dir.c | 2 ++
fs/nfs/nfstrace.h | 22 ++++++++++++++--------
2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index b266f505b521..cbd74cbdbb9f 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -894,6 +894,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)

nfs_inc_stats(inode, NFSIOS_VFSGETDENTS);
trace_nfs_readdir_enter(inode, ctx->pos, dir_ctx->dir_cookie,
+ dir_ctx->page_index,
NFS_SERVER(inode)->dtsize, my_desc.plus);

/*
@@ -943,6 +944,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
res = 0;
dir_ctx->page_index = desc->page_index;
trace_nfs_readdir_exit(inode, ctx->pos, dir_ctx->dir_cookie,
+ dir_ctx->page_index,
NFS_SERVER(inode)->dtsize, my_desc.plus, res);
return res;
}
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 06b301da85a2..12869b0c3f70 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -754,11 +754,12 @@
const struct inode *inode,
u64 cookie,
u64 dir_cookie,
+ unsigned long page_index,
unsigned int count,
bool plus
),

- TP_ARGS(inode, cookie, dir_cookie, count, plus),
+ TP_ARGS(inode, cookie, dir_cookie, page_index, count, plus),

TP_STRUCT__entry(
__field(dev_t, dev)
@@ -766,6 +767,7 @@
__field(u64, fileid)
__field(u64, cookie)
__field(u64, dir_cookie)
+ __field(unsigned long, page_index)
__field(u64, count)
__field(bool, plus)
),
@@ -776,15 +778,16 @@
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->cookie = cookie;
__entry->dir_cookie = dir_cookie;
+ __entry->page_index = page_index;
__entry->count = count;
__entry->plus = plus;
),

TP_printk(
- "fileid=%02x:%02x:%llu fhandle=0x%08x cookie=0x%08llx dir_cookie=0x%08llx count=%llu plus=%s",
+ "fileid=%02x:%02x:%llu fhandle=0x%08x cookie=0x%08llx dir_cookie=0x%08llx page_index=0x%08lx count=%llu plus=%s",
MAJOR(__entry->dev), MINOR(__entry->dev),
- (unsigned long long)__entry->fileid,
- __entry->fhandle, __entry->cookie, __entry->dir_cookie,
+ (unsigned long long)__entry->fileid, __entry->fhandle,
+ __entry->cookie, __entry->dir_cookie, __entry->page_index,
__entry->count, __entry->plus ? "true" : "false"
)
);
@@ -794,12 +797,13 @@
const struct inode *inode,
u64 cookie,
u64 dir_cookie,
+ unsigned long page_index,
unsigned int count,
bool plus,
int error
),

- TP_ARGS(inode, cookie, dir_cookie, count, plus, error),
+ TP_ARGS(inode, cookie, dir_cookie, page_index, count, plus, error),

TP_STRUCT__entry(
__field(dev_t, dev)
@@ -808,6 +812,7 @@
__field(unsigned long, error)
__field(u64, cookie)
__field(u64, dir_cookie)
+ __field(unsigned long, page_index)
__field(u64, count)
__field(bool, plus)
),
@@ -819,16 +824,17 @@
__entry->error = error;
__entry->cookie = cookie;
__entry->dir_cookie = dir_cookie;
+ __entry->page_index = page_index;
__entry->count = count;
__entry->plus = plus;
),

TP_printk(
- "error=%ld fileid=%02x:%02x:%llu fhandle=0x%08x cookie=0x%08llx dir_cookie=0x%08llx count=%llu plus=%s",
+ "error=%ld fileid=%02x:%02x:%llu fhandle=0x%08x cookie=0x%08llx dir_cookie=0x%08llx page_index=0x%08lx count=%llu plus=%s",
__entry->error,
MAJOR(__entry->dev), MINOR(__entry->dev),
- (unsigned long long)__entry->fileid,
- __entry->fhandle, __entry->cookie, __entry->dir_cookie,
+ (unsigned long long)__entry->fileid, __entry->fhandle,
+ __entry->cookie, __entry->dir_cookie, __entry->page_index,
__entry->count, __entry->plus ? "true" : "false"
)
);
--
1.8.3.1