]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFSv4: Improve read/write/commit tracing
authorTrond Myklebust <trondmy@gmail.com>
Mon, 6 Jan 2020 20:25:05 +0000 (15:25 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 15 Jan 2020 15:54:32 +0000 (10:54 -0500)
Ensure we always return the number of bytes read/written. Also display
the pnfs filehandle if it is in use.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4trace.h

index e3586c16ef5924c189b40b12ec73b54618fae3ee..497740f89f00373ec7c7991448319e5503d0e0c4 100644 (file)
@@ -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),