]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS: Clean up generic writeback tracepoints
authorTrond Myklebust <trondmy@gmail.com>
Mon, 6 Jan 2020 20:25:09 +0000 (15:25 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 15 Jan 2020 15:54:32 +0000 (10:54 -0500)
Clean up the generic writeback tracepoints so they do pass the
full structures as arguments. Also ensure we report the number
of bytes actually written.

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

index 0710b91f82d35e4dd57c947cc122a994ca78caf3..7ed75b3b7aac4826ef064f191fc14f7c85240b6f 100644 (file)
@@ -915,87 +915,96 @@ TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
 
 TRACE_EVENT(nfs_initiate_write,
                TP_PROTO(
-                       const struct inode *inode,
-                       loff_t offset, unsigned long count,
-                       enum nfs3_stable_how stable
+                       const struct nfs_pgio_header *hdr
                ),
 
-               TP_ARGS(inode, offset, count, stable),
+               TP_ARGS(hdr),
 
                TP_STRUCT__entry(
-                       __field(loff_t, offset)
-                       __field(unsigned long, count)
-                       __field(enum nfs3_stable_how, stable)
                        __field(dev_t, dev)
                        __field(u32, fhandle)
                        __field(u64, fileid)
+                       __field(loff_t, offset)
+                       __field(u32, count)
+                       __field(enum nfs3_stable_how, stable)
                ),
 
                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->offset = offset;
-                       __entry->count = count;
-                       __entry->stable = stable;
+                       __entry->offset = hdr->args.offset;
+                       __entry->count = hdr->args.count;
+                       __entry->stable = hdr->args.stable;
                        __entry->dev = inode->i_sb->s_dev;
                        __entry->fileid = nfsi->fileid;
-                       __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
+                       __entry->fhandle = nfs_fhandle_hash(fh);
                ),
 
                TP_printk(
                        "fileid=%02x:%02x:%llu fhandle=0x%08x "
-                       "offset=%lld count=%lu stable=%s",
+                       "offset=%lld count=%u stable=%s",
                        MAJOR(__entry->dev), MINOR(__entry->dev),
                        (unsigned long long)__entry->fileid,
                        __entry->fhandle,
-                       __entry->offset, __entry->count,
+                       (long long)__entry->offset, __entry->count,
                        nfs_show_stable(__entry->stable)
                )
 );
 
 TRACE_EVENT(nfs_writeback_done,
                TP_PROTO(
-                       const struct inode *inode,
-                       int status,
-                       loff_t offset,
-                       struct nfs_writeverf *writeverf
+                       const struct rpc_task *task,
+                       const struct nfs_pgio_header *hdr
                ),
 
-               TP_ARGS(inode, status, offset, writeverf),
+               TP_ARGS(task, hdr),
 
                TP_STRUCT__entry(
-                       __field(int, status)
-                       __field(loff_t, offset)
-                       __field(enum nfs3_stable_how, stable)
-                       __field(unsigned long long, verifier)
                        __field(dev_t, dev)
                        __field(u32, fhandle)
                        __field(u64, fileid)
+                       __field(loff_t, offset)
+                       __field(u32, arg_count)
+                       __field(u32, res_count)
+                       __field(int, status)
+                       __field(enum nfs3_stable_how, stable)
+                       __array(char, verifier, NFS4_VERIFIER_SIZE)
                ),
 
                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 nfs_writeverf *verf = hdr->res.verf;
 
-                       __entry->status = status;
-                       __entry->offset = offset;
-                       __entry->stable = writeverf->committed;
-                       memcpy(&__entry->verifier, &writeverf->verifier,
-                              sizeof(__entry->verifier));
+                       __entry->status = task->tk_status;
+                       __entry->offset = hdr->args.offset;
+                       __entry->arg_count = hdr->args.count;
+                       __entry->res_count = hdr->res.count;
+                       __entry->stable = verf->committed;
+                       memcpy(__entry->verifier,
+                               &verf->verifier,
+                               NFS4_VERIFIER_SIZE);
                        __entry->dev = inode->i_sb->s_dev;
                        __entry->fileid = nfsi->fileid;
-                       __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
+                       __entry->fhandle = nfs_fhandle_hash(fh);
                ),
 
                TP_printk(
                        "fileid=%02x:%02x:%llu fhandle=0x%08x "
-                       "offset=%lld status=%d stable=%s "
-                       "verifier 0x%016llx",
+                       "offset=%lld count=%u res=%u status=%d stable=%s "
+                       "verifier=%s",
                        MAJOR(__entry->dev), MINOR(__entry->dev),
                        (unsigned long long)__entry->fileid,
                        __entry->fhandle,
-                       __entry->offset, __entry->status,
+                       (long long)__entry->offset, __entry->arg_count,
+                       __entry->res_count, __entry->status,
                        nfs_show_stable(__entry->stable),
-                       __entry->verifier
+                       __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
                )
 );
 
index c86fc9efd99bc9736eb74e45bb33a99a122d812a..cd837744a7320eddb98c7e1dc75babef5b50ef8b 100644 (file)
@@ -1414,8 +1414,7 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr,
 
        task_setup_data->priority = priority;
        rpc_ops->write_setup(hdr, msg, &task_setup_data->rpc_client);
-       trace_nfs_initiate_write(hdr->inode, hdr->io_start, hdr->good_bytes,
-                                hdr->args.stable);
+       trace_nfs_initiate_write(hdr);
 }
 
 /* If a nfs_flush_* function fails, it should remove reqs from @head and
@@ -1579,8 +1578,7 @@ static int nfs_writeback_done(struct rpc_task *task,
                return status;
 
        nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, hdr->res.count);
-       trace_nfs_writeback_done(inode, task->tk_status,
-                                hdr->args.offset, hdr->res.verf);
+       trace_nfs_writeback_done(task, hdr);
 
        if (hdr->res.verf->committed < hdr->args.stable &&
            task->tk_status >= 0) {