Commit 25925b00 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker
Browse files

NFSv4: Improve read/write/commit tracing



Ensure we always return the number of bytes read/written. Also display
the pnfs filehandle if it is in use.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 221203ce
Loading
Loading
Loading
Loading
+34 −18
Original line number Diff line number Diff line
@@ -1729,7 +1729,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
			__field(u32, fhandle)
			__field(u64, fileid)
			__field(loff_t, offset)
			__field(size_t, count)
			__field(u32, arg_count)
			__field(u32, res_count)
			__field(unsigned long, error)
			__field(int, stateid_seq)
			__field(u32, stateid_hash)
@@ -1737,13 +1738,18 @@ DECLARE_EVENT_CLASS(nfs4_read_event,

		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;
			const struct nfs4_state *state =
				hdr->args.context->state;

			__entry->dev = inode->i_sb->s_dev;
			__entry->fileid = NFS_FILEID(inode);
			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
			__entry->fileid = nfsi->fileid;
			__entry->fhandle = nfs_fhandle_hash(fh);
			__entry->offset = hdr->args.offset;
			__entry->count = hdr->args.count;
			__entry->arg_count = hdr->args.count;
			__entry->res_count = hdr->res.count;
			__entry->error = error < 0 ? -error : 0;
			__entry->stateid_seq =
				be32_to_cpu(state->stateid.seqid);
@@ -1753,14 +1759,14 @@ DECLARE_EVENT_CLASS(nfs4_read_event,

		TP_printk(
			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
			"offset=%lld count=%zu stateid=%d:0x%08x",
			"offset=%lld count=%u res=%u stateid=%d:0x%08x",
			-__entry->error,
			show_nfsv4_errors(__entry->error),
			MAJOR(__entry->dev), MINOR(__entry->dev),
			(unsigned long long)__entry->fileid,
			__entry->fhandle,
			(long long)__entry->offset,
			__entry->count,
			__entry->arg_count, __entry->res_count,
			__entry->stateid_seq, __entry->stateid_hash
		)
);
@@ -1789,7 +1795,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
			__field(u32, fhandle)
			__field(u64, fileid)
			__field(loff_t, offset)
			__field(size_t, count)
			__field(u32, arg_count)
			__field(u32, res_count)
			__field(unsigned long, error)
			__field(int, stateid_seq)
			__field(u32, stateid_hash)
@@ -1797,13 +1804,18 @@ DECLARE_EVENT_CLASS(nfs4_write_event,

		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;
			const struct nfs4_state *state =
				hdr->args.context->state;

			__entry->dev = inode->i_sb->s_dev;
			__entry->fileid = NFS_FILEID(inode);
			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
			__entry->fileid = nfsi->fileid;
			__entry->fhandle = nfs_fhandle_hash(fh);
			__entry->offset = hdr->args.offset;
			__entry->count = hdr->args.count;
			__entry->arg_count = hdr->args.count;
			__entry->res_count = hdr->res.count;
			__entry->error = error < 0 ? -error : 0;
			__entry->stateid_seq =
				be32_to_cpu(state->stateid.seqid);
@@ -1813,14 +1825,14 @@ DECLARE_EVENT_CLASS(nfs4_write_event,

		TP_printk(
			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
			"offset=%lld count=%zu stateid=%d:0x%08x",
			"offset=%lld count=%u res=%u stateid=%d:0x%08x",
			-__entry->error,
			show_nfsv4_errors(__entry->error),
			MAJOR(__entry->dev), MINOR(__entry->dev),
			(unsigned long long)__entry->fileid,
			__entry->fhandle,
			(long long)__entry->offset,
			__entry->count,
			__entry->arg_count, __entry->res_count,
			__entry->stateid_seq, __entry->stateid_hash
		)
);
@@ -1849,24 +1861,28 @@ DECLARE_EVENT_CLASS(nfs4_commit_event,
			__field(dev_t, dev)
			__field(u32, fhandle)
			__field(u64, fileid)
			__field(loff_t, offset)
			__field(size_t, count)
			__field(unsigned long, error)
			__field(loff_t, offset)
			__field(u32, count)
		),

		TP_fast_assign(
			const struct inode *inode = data->inode;
			const struct nfs_inode *nfsi = NFS_I(inode);
			const struct nfs_fh *fh = data->args.fh ?
						  data->args.fh : &nfsi->fh;

			__entry->dev = inode->i_sb->s_dev;
			__entry->fileid = NFS_FILEID(inode);
			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
			__entry->fileid = nfsi->fileid;
			__entry->fhandle = nfs_fhandle_hash(fh);
			__entry->offset = data->args.offset;
			__entry->count = data->args.count;
			__entry->error = error;
			__entry->error = error < 0 ? -error : 0;
		),

		TP_printk(
			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
			"offset=%lld count=%zu",
			"offset=%lld count=%u",
			-__entry->error,
			show_nfsv4_errors(__entry->error),
			MAJOR(__entry->dev), MINOR(__entry->dev),