All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: anna.schumaker@netapp.com, trondmy@hammerspace.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v1 14/15] NFS: Trace short NFS READs
Date: Tue, 12 May 2020 17:14:05 -0400	[thread overview]
Message-ID: <20200512211405.3288.44179.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20200512210724.3288.15187.stgit@manet.1015granger.net>

A short read can generate an -EIO error without there being an error
on the wire. This tracepoint acts as an eyecatcher when there is no
obvious I/O error.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfs/nfstrace.h |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/read.c     |    2 ++
 2 files changed, 49 insertions(+)

diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index e90651431804..b35998c5c9ca 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -961,6 +961,53 @@
 		)
 );
 
+TRACE_EVENT(nfs_readpage_short,
+		TP_PROTO(
+			const struct rpc_task *task,
+			const struct nfs_pgio_header *hdr
+		),
+
+		TP_ARGS(task, hdr),
+
+		TP_STRUCT__entry(
+			__field(dev_t, dev)
+			__field(u32, fhandle)
+			__field(u64, fileid)
+			__field(loff_t, offset)
+			__field(u32, arg_count)
+			__field(u32, res_count)
+			__field(bool, eof)
+			__field(int, status)
+		),
+
+		TP_fast_assign(
+			const struct inode *inode = hdr->inode;
+			const struct nfs_inode *nfsi = NFS_I(inode);
+			const struct nfs_fh *fh = hdr->args.fh ?
+						  hdr->args.fh : &nfsi->fh;
+
+			__entry->status = task->tk_status;
+			__entry->offset = hdr->args.offset;
+			__entry->arg_count = hdr->args.count;
+			__entry->res_count = hdr->res.count;
+			__entry->eof = hdr->res.eof;
+			__entry->dev = inode->i_sb->s_dev;
+			__entry->fileid = nfsi->fileid;
+			__entry->fhandle = nfs_fhandle_hash(fh);
+		),
+
+		TP_printk(
+			"fileid=%02x:%02x:%llu fhandle=0x%08x "
+			"offset=%lld count=%u res=%u status=%d%s",
+			MAJOR(__entry->dev), MINOR(__entry->dev),
+			(unsigned long long)__entry->fileid,
+			__entry->fhandle,
+			(long long)__entry->offset, __entry->arg_count,
+			__entry->res_count, __entry->status,
+			__entry->eof ? " eof" : ""
+		)
+);
+
 TRACE_DEFINE_ENUM(NFS_UNSTABLE);
 TRACE_DEFINE_ENUM(NFS_DATA_SYNC);
 TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 13b22e898116..eb854f1f86e2 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -264,6 +264,8 @@ static void nfs_readpage_retry(struct rpc_task *task,
 
 	/* This is a short read! */
 	nfs_inc_stats(hdr->inode, NFSIOS_SHORTREAD);
+	trace_nfs_readpage_short(task, hdr);
+
 	/* Has the server at least made some progress? */
 	if (resp->count == 0) {
 		nfs_set_pgio_error(hdr, -EIO, argp->offset);


  parent reply	other threads:[~2020-05-12 21:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 21:12 [PATCH v1 00/15] Possible patches for v5.8 Chuck Lever
2020-05-12 21:12 ` [PATCH v1 01/15] SUNRPC: Signalled ASYNC tasks need to exit Chuck Lever
2020-05-12 21:13 ` [PATCH v1 02/15] SUNRPC: receive buffer size estimation values almost never change Chuck Lever
2020-05-12 21:13 ` [PATCH v1 03/15] SUNRPC: Trace GSS context lifetimes Chuck Lever
2020-05-12 21:13 ` [PATCH v1 04/15] SUNRPC: Update the rpc_show_task_flags() macro Chuck Lever
2020-05-12 21:13 ` [PATCH v1 05/15] SUNRPC: Update the RPC_SHOW_SOCKET() macro Chuck Lever
2020-05-12 21:13 ` [PATCH v1 06/15] SUNRPC: Add tracepoint to rpc_call_rpcerror() Chuck Lever
2020-05-12 21:13 ` [PATCH v1 07/15] SUNRPC: Split the xdr_buf event class Chuck Lever
2020-05-12 21:13 ` [PATCH v1 08/15] SUNRPC: Trace transport lifetime events Chuck Lever
2020-05-12 21:13 ` [PATCH v1 09/15] SUNRPC: trace RPC client " Chuck Lever
2020-05-12 21:13 ` [PATCH v1 10/15] SUNRPC: rpc_call_null_helper() already sets RPC_TASK_NULLCREDS Chuck Lever
2020-05-12 21:13 ` [PATCH v1 11/15] SUNRPC: rpc_call_null_helper() should set RPC_TASK_SOFT Chuck Lever
2020-05-12 21:13 ` [PATCH v1 12/15] SUNRPC: Set SOFTCONN when destroying GSS contexts Chuck Lever
2020-05-12 21:14 ` [PATCH v1 13/15] NFS: nfs_xdr_status should record the procedure name Chuck Lever
2020-05-12 21:14 ` Chuck Lever [this message]
2020-05-12 21:14 ` [PATCH v1 15/15] NFS: Add a tracepoint in nfs_set_pgio_error() Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512211405.3288.44179.stgit@manet.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=anna.schumaker@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.