xfs: add tracepoints to readpage calls
authorDave Chinner <dchinner@redhat.com>
Fri, 8 Jan 2016 00:28:35 +0000 (11:28 +1100)
committerDave Chinner <david@fromorbit.com>
Fri, 8 Jan 2016 00:28:35 +0000 (11:28 +1100)
This allows us to see page cache driven readahead in action as it
passes through XFS. This helps to understand buffered read
throughput problems such as readahead IO IO sizes being too small
for the underlying device to reach max throughput.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_aops.c
fs/xfs/xfs_trace.h

index 29e7e5dd5178ef84638752f31ce6149c64398061..379c089fb0514a5a34934b51b790181567a3384f 100644 (file)
@@ -1917,6 +1917,7 @@ xfs_vm_readpage(
        struct file             *unused,
        struct page             *page)
 {
+       trace_xfs_vm_readpage(page->mapping->host, 1);
        return mpage_readpage(page, xfs_get_blocks);
 }
 
@@ -1927,6 +1928,7 @@ xfs_vm_readpages(
        struct list_head        *pages,
        unsigned                nr_pages)
 {
+       trace_xfs_vm_readpages(mapping->host, nr_pages);
        return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks);
 }
 
index 877079eb0f8f0e5d286e4c797761df6bf2f55228..391d797cb53fee0a9196d3e392dfd8fa95d5d33a 100644 (file)
@@ -1222,6 +1222,32 @@ DEFINE_PAGE_EVENT(xfs_writepage);
 DEFINE_PAGE_EVENT(xfs_releasepage);
 DEFINE_PAGE_EVENT(xfs_invalidatepage);
 
+DECLARE_EVENT_CLASS(xfs_readpage_class,
+       TP_PROTO(struct inode *inode, int nr_pages),
+       TP_ARGS(inode, nr_pages),
+       TP_STRUCT__entry(
+               __field(dev_t, dev)
+               __field(xfs_ino_t, ino)
+               __field(int, nr_pages)
+       ),
+       TP_fast_assign(
+               __entry->dev = inode->i_sb->s_dev;
+               __entry->ino = inode->i_ino;
+               __entry->nr_pages = nr_pages;
+       ),
+       TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 __entry->ino,
+                 __entry->nr_pages)
+)
+
+#define DEFINE_READPAGE_EVENT(name)            \
+DEFINE_EVENT(xfs_readpage_class, name, \
+       TP_PROTO(struct inode *inode, int nr_pages), \
+       TP_ARGS(inode, nr_pages))
+DEFINE_READPAGE_EVENT(xfs_vm_readpage);
+DEFINE_READPAGE_EVENT(xfs_vm_readpages);
+
 DECLARE_EVENT_CLASS(xfs_imap_class,
        TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
                 int type, struct xfs_bmbt_irec *irec),