From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: hch@infradead.org, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Damien.LeMoal@wdc.com, Christoph Hellwig <hch@lst.de>,
agruenba@redhat.com
Subject: [PATCH 3/6] iomap: add tracing for the address space operations
Date: Mon, 29 Jul 2019 18:17:59 -0700 [thread overview]
Message-ID: <156444947938.2682261.6673442000849449944.stgit@magnolia> (raw)
In-Reply-To: <156444945993.2682261.3926017251626679029.stgit@magnolia>
From: Christoph Hellwig <hch@lst.de>
Lift the xfs code for tracing address space operations to the iomap
layer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
[darrick: remove deletion of xfs writeback tracepoints]
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/iomap/buffered-io.c | 13 ++++++
include/trace/events/iomap.h | 85 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+)
create mode 100644 include/trace/events/iomap.h
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index ff1f7d2b4d7a..21b50e8cb9f2 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -20,6 +20,9 @@
#include "../internal.h"
+#define CREATE_TRACE_POINTS
+#include <trace/events/iomap.h>
+
static struct bio_set iomap_ioend_bioset;
static struct iomap_page *
@@ -296,6 +299,8 @@ iomap_readpage(struct page *page, const struct iomap_ops *ops)
unsigned poff;
loff_t ret;
+ trace_iomap_readpage(page->mapping->host, 1);
+
for (poff = 0; poff < PAGE_SIZE; poff += ret) {
ret = iomap_apply(inode, page_offset(page) + poff,
PAGE_SIZE - poff, 0, ops, &ctx,
@@ -392,6 +397,8 @@ iomap_readpages(struct address_space *mapping, struct list_head *pages,
loff_t last = page_offset(list_entry(pages->next, struct page, lru));
loff_t length = last - pos + PAGE_SIZE, ret = 0;
+ trace_iomap_readpages(mapping->host, nr_pages);
+
while (length > 0) {
ret = iomap_apply(mapping->host, pos, length, 0, ops,
&ctx, iomap_readpages_actor);
@@ -458,6 +465,8 @@ EXPORT_SYMBOL_GPL(iomap_is_partially_uptodate);
int
iomap_releasepage(struct page *page, gfp_t gfp_mask)
{
+ trace_iomap_releasepage(page->mapping->host, page, 0, 0);
+
/*
* mm accommodates an old ext3 case where clean pages might not have had
* the dirty bit cleared. Thus, it can send actual dirty pages to
@@ -473,6 +482,8 @@ EXPORT_SYMBOL_GPL(iomap_releasepage);
void
iomap_invalidatepage(struct page *page, unsigned int offset, unsigned int len)
{
+ trace_iomap_invalidatepage(page->mapping->host, page, offset, len);
+
/*
* If we are invalidating the entire page, clear the dirty state from it
* and release it to avoid unnecessary buildup of the LRU.
@@ -1485,6 +1496,8 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data)
u64 end_offset;
loff_t offset;
+ trace_iomap_writepage(inode, page, 0, 0);
+
/*
* Refuse to write the page out if we are called from reclaim context.
*
diff --git a/include/trace/events/iomap.h b/include/trace/events/iomap.h
new file mode 100644
index 000000000000..1da90e743e6e
--- /dev/null
+++ b/include/trace/events/iomap.h
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2009-2019, Christoph Hellwig
+ * All Rights Reserved.
+ *
+ * NOTE: none of these tracepoints shall be consider a stable kernel ABI
+ * as they can change at any time.
+ */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM iomap
+
+#if !defined(_TRACE_IOMAP_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_IOMAP_H
+
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(iomap_page_class,
+ TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
+ unsigned int len),
+ TP_ARGS(inode, page, off, len),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u64, ino)
+ __field(pgoff_t, pgoff)
+ __field(loff_t, size)
+ __field(unsigned long, offset)
+ __field(unsigned int, length)
+ ),
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->pgoff = page_offset(page);
+ __entry->size = i_size_read(inode);
+ __entry->offset = off;
+ __entry->length = len;
+ ),
+ TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
+ "length %x",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __entry->ino,
+ __entry->pgoff,
+ __entry->size,
+ __entry->offset,
+ __entry->length)
+)
+
+#define DEFINE_PAGE_EVENT(name) \
+DEFINE_EVENT(iomap_page_class, name, \
+ TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
+ unsigned int len), \
+ TP_ARGS(inode, page, off, len))
+DEFINE_PAGE_EVENT(iomap_writepage);
+DEFINE_PAGE_EVENT(iomap_releasepage);
+DEFINE_PAGE_EVENT(iomap_invalidatepage);
+
+DECLARE_EVENT_CLASS(iomap_readpage_class,
+ TP_PROTO(struct inode *inode, int nr_pages),
+ TP_ARGS(inode, nr_pages),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u64, 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(iomap_readpage_class, name, \
+ TP_PROTO(struct inode *inode, int nr_pages), \
+ TP_ARGS(inode, nr_pages))
+DEFINE_READPAGE_EVENT(iomap_readpage);
+DEFINE_READPAGE_EVENT(iomap_readpages);
+
+#endif /* _TRACE_IOMAP_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
next prev parent reply other threads:[~2019-07-30 1:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 1:17 [PATCH v4 0/6] iomap: lift the xfs writepage code into iomap Darrick J. Wong
2019-07-30 1:17 ` [PATCH 1/6] list.h: add list_pop and list_pop_entry helpers Darrick J. Wong
2019-07-30 1:17 ` [PATCH 2/6] iomap: copy the xfs writeback code to iomap.c Darrick J. Wong
2019-08-04 14:59 ` Andreas Gruenbacher
2019-08-06 5:33 ` Christoph Hellwig
2019-08-05 12:31 ` Andreas Gruenbacher
2019-08-06 5:32 ` Christoph Hellwig
2019-07-30 1:17 ` Darrick J. Wong [this message]
2019-07-30 1:18 ` [PATCH 4/6] iomap: warn on inline maps in iomap_writepage_map Darrick J. Wong
2019-07-30 1:18 ` [PATCH 5/6] xfs: set IOMAP_F_NEW more carefully Darrick J. Wong
2019-07-30 1:18 ` [PATCH 6/6] iomap: zero newly allocated mapped blocks Darrick J. Wong
2019-07-30 14:48 ` [PATCH v4 0/6] iomap: lift the xfs writepage code into iomap Christoph Hellwig
2019-08-05 12:34 ` Andreas Gruenbacher
2019-08-16 6:52 ` Christoph Hellwig
2019-08-17 1:46 ` Darrick J. Wong
2019-08-17 8:25 ` Andreas Gruenbacher
2019-08-17 13:15 ` Damien Le Moal
2019-08-20 7:30 ` Christoph Hellwig
2019-09-01 7:34 ` Christoph Hellwig
2019-09-01 20:44 ` Darrick J. Wong
2019-09-02 17:16 ` Christoph Hellwig
2019-09-10 7:01 ` Christoph Hellwig
2019-09-10 21:30 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=156444947938.2682261.6673442000849449944.stgit@magnolia \
--to=darrick.wong@oracle.com \
--cc=Damien.LeMoal@wdc.com \
--cc=agruenba@redhat.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).