]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
xfs: fix dev_t usage in xmbuf tracepoints
authorDarrick J. Wong <djwong@kernel.org>
Thu, 7 Mar 2024 23:13:52 +0000 (15:13 -0800)
committerChandan Babu R <chandanbabu@kernel.org>
Fri, 15 Mar 2024 05:00:23 +0000 (10:30 +0530)
Fix some inconsistencies in the xmbuf tracepoints -- they should be
reporting the major/minor of the filesystem that they're associated
with, so that we have some clue on whose behalf the xmbuf was created.
Fix the xmbuf_free tracepoint to report the same.

Don't call the trace function until the xmbuf is fully initialized.

Fixes: 5076a6040ca1 ("xfs: support in-memory buffer cache target")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/xfs_buf_mem.c
fs/xfs/xfs_trace.h

index 8ad38c64708ec5c2f1103ebdb5fa683cc7afc28d..9bb2d24de7094114a6f8c303647fe1b857805fb4 100644 (file)
@@ -81,8 +81,6 @@ xmbuf_alloc(
        /* ensure all writes are below EOF to avoid pagecache zeroing */
        i_size_write(inode, inode->i_sb->s_maxbytes);
 
-       trace_xmbuf_create(btp);
-
        error = xfs_buf_cache_init(btp->bt_cache);
        if (error)
                goto out_file;
@@ -99,6 +97,8 @@ xmbuf_alloc(
        if (error)
                goto out_bcache;
 
+       trace_xmbuf_create(btp);
+
        *btpp = btp;
        return 0;
 
index 56b07d8ed431f214325fd810b93d6469294bd6cd..aea97fc074f8de2d786d393e85075f1aad46e155 100644 (file)
@@ -4626,6 +4626,7 @@ TRACE_EVENT(xmbuf_create,
                char            *path;
                struct file     *file = btp->bt_file;
 
+               __entry->dev = btp->bt_mount->m_super->s_dev;
                __entry->ino = file_inode(file)->i_ino;
                memset(pathname, 0, sizeof(pathname));
                path = file_path(file, pathname, sizeof(pathname) - 1);
@@ -4633,7 +4634,8 @@ TRACE_EVENT(xmbuf_create,
                        path = "(unknown)";
                strncpy(__entry->pathname, path, sizeof(__entry->pathname));
        ),
-       TP_printk("xmino 0x%lx path '%s'",
+       TP_printk("dev %d:%d xmino 0x%lx path '%s'",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
                  __entry->pathname)
 );
@@ -4642,6 +4644,7 @@ TRACE_EVENT(xmbuf_free,
        TP_PROTO(struct xfs_buftarg *btp),
        TP_ARGS(btp),
        TP_STRUCT__entry(
+               __field(dev_t, dev)
                __field(unsigned long, ino)
                __field(unsigned long long, bytes)
                __field(loff_t, size)
@@ -4650,11 +4653,13 @@ TRACE_EVENT(xmbuf_free,
                struct file     *file = btp->bt_file;
                struct inode    *inode = file_inode(file);
 
+               __entry->dev = btp->bt_mount->m_super->s_dev;
                __entry->size = i_size_read(inode);
                __entry->bytes = (inode->i_blocks << SECTOR_SHIFT) + inode->i_bytes;
                __entry->ino = inode->i_ino;
        ),
-       TP_printk("xmino 0x%lx mem_bytes 0x%llx isize 0x%llx",
+       TP_printk("dev %d:%d xmino 0x%lx mem_bytes 0x%llx isize 0x%llx",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
                  __entry->bytes,
                  __entry->size)