Re: [RFC PATCH] mm: trace filemap add and del

Dave Chinner
2012-11-21T04:15:51Z

On Tue, Nov 20, 2012 at 03:57:35PM -0800, Andrew Morton wrote:
> On Thu, 8 Nov 2012 20:54:10 +0100
> Robert Jarzmik <robert.jarzmik@free.fr> wrote:
.....
> > + __field(dev_t, s_dev)
>
> Perhaps use super_block.s_id here
>
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->page = page;
> > + __entry->i_no = page->mapping->host->i_ino;
> > + __entry->pageofs = page->index;
> > + if (page->mapping->host->i_sb)
> > + __entry->s_dev = page->mapping->host->i_sb->s_dev;
> > + else
> > + __entry->s_dev = page->mapping->host->i_rdev;
>
> and hence avoid all this stuff.

We actually have an informal convention for formating filesystem
trace events, and that is to use the device number....

>
> > + ),
> > +
> > + TP_printk("page=%p pfn=%lu blk=%d:%d inode+ofs=%lu+%lu",

... and to prefix messages like:

TP_printk("dev %d:%d ino 0x%llx ....
MAJOR(__entry->dev), MINOR(__entry->dev),

i.e. the start of the event message has all the identifying
information where it is easy to grep for and get all the events for
a specific dev/inode combination without even having to think about
it.

XFS, ext3/4, jbd/jdb2 and gfs2 follow this convention, so we should
keep propagating that pattern in the name of consistency, rather
than having different trace formats for different parts of the
VFS/FS layers...

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com