]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: io provider probes for nfs
authorNicolas Droux <nicolas.droux@oracle.com>
Fri, 26 May 2017 15:50:17 +0000 (09:50 -0600)
committerNicolas Droux <nicolas.droux@oracle.com>
Mon, 12 Jun 2017 18:07:12 +0000 (12:07 -0600)
DTrace io provider probes are added for NFS read and write requests.

Orabug: 26242655

Signed-off-by: Nicolas Droux <nicolas.droux@oracle.com>
Acked-by: Saar Maoz <Saar.Maoz@oracle.com>
Acked-by: Rajan Shanmugavelu <rajan.shanmugavelu@oracle.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfs/internal.h
fs/nfs/read.c
fs/nfs/write.c

index 9e6475bc5ba22be7293c687d78dda1a626d3024b..12efee9cdeded52892b85a159ef001c12eecefde 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/security.h>
 #include <linux/crc32.h>
 #include <linux/nfs_page.h>
+#include <linux/sdt.h>
 
 #define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS)
 
@@ -681,3 +682,16 @@ static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh)
        return 0;
 }
 #endif
+
+#define        DTRACE_IO_NFS(name, rw, size, inode)                    \
+       if (DTRACE_IO_ENABLED(name)) {                          \
+               struct bio bio = {                              \
+                       .bi_rw = rw,                            \
+                       .bi_flags = (1 << BIO_USER_MAPPED),     \
+                       .bi_iter.bi_size = size,                \
+                       .bi_iter.bi_sector = NFS_FILEID(inode), \
+               };                                              \
+               DTRACE_IO(name, struct bio * : (bufinfo_t *,    \
+                         devinfo_t *), &bio,                   \
+                         struct file * : fileinfo_t *, NULL);  \
+}
index 01b8cc8e8cfc436784052bf5e92a7c21a1230012..910638fd7d19583f605b3e39b83d5c846b3eea14 100644 (file)
@@ -191,6 +191,8 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr,
        struct inode *inode = hdr->inode;
        int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0;
 
+       DTRACE_IO_NFS(start, 0, hdr->args.count, hdr->inode);
+
        task_setup_data->flags |= swap_flags;
        rpc_ops->read_setup(hdr, msg);
 }
@@ -221,6 +223,7 @@ static int nfs_readpage_done(struct rpc_task *task,
                             struct inode *inode)
 {
        int status = NFS_PROTO(inode)->read_done(task, hdr);
+       DTRACE_IO_NFS(done, 0, hdr->res.count, hdr->inode);
        if (status != 0)
                return status;
 
index d9851a6a28138695fa19ced00ba31c95d79d4bb5..c7ffcb16d4321d772d9656195df0781d97ceb4c2 100644 (file)
@@ -1278,6 +1278,8 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr,
        task_setup_data->priority = priority;
        rpc_ops->write_setup(hdr, msg);
 
+       DTRACE_IO_NFS(start, REQ_WRITE, hdr->args.count, hdr->inode);
+
        nfs4_state_protect_write(NFS_SERVER(hdr->inode)->nfs_client,
                                 &task_setup_data->rpc_client, msg, hdr);
 }
@@ -1431,6 +1433,7 @@ static int nfs_writeback_done(struct rpc_task *task,
         * depend on tighter cache coherency when writing.
         */
        status = NFS_PROTO(inode)->write_done(task, hdr);
+       DTRACE_IO_NFS(done, REQ_WRITE, hdr->res.count, hdr->inode);
        if (status != 0)
                return status;
        nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, hdr->res.count);