Message ID | 20191006154608.24738-2-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/11] iomap: add tracing for the readpage / readpages | expand |
On Sun, Oct 06, 2019 at 05:45:58PM +0200, Christoph Hellwig wrote: > Lift the xfs code for tracing address space operations to the iomap > layer. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/iomap/Makefile | 16 ++++++++------ > fs/iomap/buffered-io.c | 5 +++++ > fs/iomap/trace.h | 49 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 63 insertions(+), 7 deletions(-) > create mode 100644 fs/iomap/trace.h > > diff --git a/fs/iomap/Makefile b/fs/iomap/Makefile > index 93cd11938bf5..eef2722d93a1 100644 > --- a/fs/iomap/Makefile > +++ b/fs/iomap/Makefile > @@ -3,13 +3,15 @@ > # Copyright (c) 2019 Oracle. > # All Rights Reserved. > # > -obj-$(CONFIG_FS_IOMAP) += iomap.o > > -iomap-y += \ > - apply.o \ > - buffered-io.o \ > - direct-io.o \ > - fiemap.o \ > - seek.o > +ccflags-y += -I $(srctree)/$(src) # needed for trace events > + > +obj-$(CONFIG_FS_IOMAP) += iomap.o > > +iomap-y += trace.o \ I think this patch is missing fs/iomap/trace.c ? --D > + apply.o \ > + buffered-io.o \ > + direct-io.o \ > + fiemap.o \ > + seek.o > iomap-$(CONFIG_SWAP) += swapfile.o > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index e25901ae3ff4..fb209272765c 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -16,6 +16,7 @@ > #include <linux/bio.h> > #include <linux/sched/signal.h> > #include <linux/migrate.h> > +#include "trace.h" > > #include "../internal.h" > > @@ -293,6 +294,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, > @@ -389,6 +392,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); > diff --git a/fs/iomap/trace.h b/fs/iomap/trace.h > new file mode 100644 > index 000000000000..7798aeda7fb9 > --- /dev/null > +++ b/fs/iomap/trace.h > @@ -0,0 +1,49 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2009-2019, Christoph Hellwig > + * > + * 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(_IOMAP_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _IOMAP_TRACE_H > + > +#include <linux/tracepoint.h> > + > +struct inode; > + > +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 /* _IOMAP_TRACE_H */ > + > +#undef TRACE_INCLUDE_PATH > +#define TRACE_INCLUDE_PATH . > +#define TRACE_INCLUDE_FILE trace > +#include <trace/define_trace.h> > -- > 2.20.1 >
On Sun, Oct 06, 2019 at 03:43:24PM -0700, Darrick J. Wong wrote: > > +iomap-y += trace.o \ > > I think this patch is missing fs/iomap/trace.c ? It does. The file is in my tree, but I never did a git-add for it..
On Mon, Oct 07, 2019 at 07:48:38AM +0200, Christoph Hellwig wrote: > On Sun, Oct 06, 2019 at 03:43:24PM -0700, Darrick J. Wong wrote: > > > +iomap-y += trace.o \ > > > > I think this patch is missing fs/iomap/trace.c ? > > It does. The file is in my tree, but I never did a git-add for it.. A branch with the file is here: git://git.infradead.org/users/hch/xfs.git iomap-writepage.7 Gitweb: http://git.infradead.org/users/hch/xfs.git/shortlog/refs/heads/iomap-writepage.7 I'll wait a bit until I resend to see if people find other issues.
On Sun, Oct 06, 2019 at 05:45:58PM +0200, Christoph Hellwig wrote: > Lift the xfs code for tracing address space operations to the iomap > layer. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- For the v7 version: Reviewed-by: Brian Foster <bfoster@redhat.com> > fs/iomap/Makefile | 16 ++++++++------ > fs/iomap/buffered-io.c | 5 +++++ > fs/iomap/trace.h | 49 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 63 insertions(+), 7 deletions(-) > create mode 100644 fs/iomap/trace.h > > diff --git a/fs/iomap/Makefile b/fs/iomap/Makefile > index 93cd11938bf5..eef2722d93a1 100644 > --- a/fs/iomap/Makefile > +++ b/fs/iomap/Makefile > @@ -3,13 +3,15 @@ > # Copyright (c) 2019 Oracle. > # All Rights Reserved. > # > -obj-$(CONFIG_FS_IOMAP) += iomap.o > > -iomap-y += \ > - apply.o \ > - buffered-io.o \ > - direct-io.o \ > - fiemap.o \ > - seek.o > +ccflags-y += -I $(srctree)/$(src) # needed for trace events > + > +obj-$(CONFIG_FS_IOMAP) += iomap.o > > +iomap-y += trace.o \ > + apply.o \ > + buffered-io.o \ > + direct-io.o \ > + fiemap.o \ > + seek.o > iomap-$(CONFIG_SWAP) += swapfile.o > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index e25901ae3ff4..fb209272765c 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -16,6 +16,7 @@ > #include <linux/bio.h> > #include <linux/sched/signal.h> > #include <linux/migrate.h> > +#include "trace.h" > > #include "../internal.h" > > @@ -293,6 +294,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, > @@ -389,6 +392,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); > diff --git a/fs/iomap/trace.h b/fs/iomap/trace.h > new file mode 100644 > index 000000000000..7798aeda7fb9 > --- /dev/null > +++ b/fs/iomap/trace.h > @@ -0,0 +1,49 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2009-2019, Christoph Hellwig > + * > + * 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(_IOMAP_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _IOMAP_TRACE_H > + > +#include <linux/tracepoint.h> > + > +struct inode; > + > +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 /* _IOMAP_TRACE_H */ > + > +#undef TRACE_INCLUDE_PATH > +#define TRACE_INCLUDE_PATH . > +#define TRACE_INCLUDE_FILE trace > +#include <trace/define_trace.h> > -- > 2.20.1 >
On Mon, Oct 07, 2019 at 08:17:05AM +0200, Christoph Hellwig wrote: > On Mon, Oct 07, 2019 at 07:48:38AM +0200, Christoph Hellwig wrote: > > On Sun, Oct 06, 2019 at 03:43:24PM -0700, Darrick J. Wong wrote: > > > > +iomap-y += trace.o \ > > > > > > I think this patch is missing fs/iomap/trace.c ? > > > > It does. The file is in my tree, but I never did a git-add for it.. > > A branch with the file is here: > > git://git.infradead.org/users/hch/xfs.git iomap-writepage.7 > > Gitweb: > > http://git.infradead.org/users/hch/xfs.git/shortlog/refs/heads/iomap-writepage.7 > > I'll wait a bit until I resend to see if people find other issues. I didn't see any, at least not in a quick overnight fstests run. Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> --D
diff --git a/fs/iomap/Makefile b/fs/iomap/Makefile index 93cd11938bf5..eef2722d93a1 100644 --- a/fs/iomap/Makefile +++ b/fs/iomap/Makefile @@ -3,13 +3,15 @@ # Copyright (c) 2019 Oracle. # All Rights Reserved. # -obj-$(CONFIG_FS_IOMAP) += iomap.o -iomap-y += \ - apply.o \ - buffered-io.o \ - direct-io.o \ - fiemap.o \ - seek.o +ccflags-y += -I $(srctree)/$(src) # needed for trace events + +obj-$(CONFIG_FS_IOMAP) += iomap.o +iomap-y += trace.o \ + apply.o \ + buffered-io.o \ + direct-io.o \ + fiemap.o \ + seek.o iomap-$(CONFIG_SWAP) += swapfile.o diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index e25901ae3ff4..fb209272765c 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -16,6 +16,7 @@ #include <linux/bio.h> #include <linux/sched/signal.h> #include <linux/migrate.h> +#include "trace.h" #include "../internal.h" @@ -293,6 +294,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, @@ -389,6 +392,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); diff --git a/fs/iomap/trace.h b/fs/iomap/trace.h new file mode 100644 index 000000000000..7798aeda7fb9 --- /dev/null +++ b/fs/iomap/trace.h @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2009-2019, Christoph Hellwig + * + * 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(_IOMAP_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _IOMAP_TRACE_H + +#include <linux/tracepoint.h> + +struct inode; + +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 /* _IOMAP_TRACE_H */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE trace +#include <trace/define_trace.h>
Lift the xfs code for tracing address space operations to the iomap layer. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/iomap/Makefile | 16 ++++++++------ fs/iomap/buffered-io.c | 5 +++++ fs/iomap/trace.h | 49 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 fs/iomap/trace.h