Skip to content

Commit 215b2bf

Browse files
Darrick J. WongChandan Babu R
authored andcommitted
xfs: fix dev_t usage in xmbuf tracepoints
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: 5076a60 ("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>
1 parent 75bcffb commit 215b2bf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

fs/xfs/xfs_buf_mem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ xmbuf_alloc(
8181
/* ensure all writes are below EOF to avoid pagecache zeroing */
8282
i_size_write(inode, inode->i_sb->s_maxbytes);
8383

84-
trace_xmbuf_create(btp);
85-
8684
error = xfs_buf_cache_init(btp->bt_cache);
8785
if (error)
8886
goto out_file;
@@ -99,6 +97,8 @@ xmbuf_alloc(
9997
if (error)
10098
goto out_bcache;
10199

100+
trace_xmbuf_create(btp);
101+
102102
*btpp = btp;
103103
return 0;
104104

fs/xfs/xfs_trace.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4626,14 +4626,16 @@ TRACE_EVENT(xmbuf_create,
46264626
char *path;
46274627
struct file *file = btp->bt_file;
46284628

4629+
__entry->dev = btp->bt_mount->m_super->s_dev;
46294630
__entry->ino = file_inode(file)->i_ino;
46304631
memset(pathname, 0, sizeof(pathname));
46314632
path = file_path(file, pathname, sizeof(pathname) - 1);
46324633
if (IS_ERR(path))
46334634
path = "(unknown)";
46344635
strncpy(__entry->pathname, path, sizeof(__entry->pathname));
46354636
),
4636-
TP_printk("xmino 0x%lx path '%s'",
4637+
TP_printk("dev %d:%d xmino 0x%lx path '%s'",
4638+
MAJOR(__entry->dev), MINOR(__entry->dev),
46374639
__entry->ino,
46384640
__entry->pathname)
46394641
);
@@ -4642,6 +4644,7 @@ TRACE_EVENT(xmbuf_free,
46424644
TP_PROTO(struct xfs_buftarg *btp),
46434645
TP_ARGS(btp),
46444646
TP_STRUCT__entry(
4647+
__field(dev_t, dev)
46454648
__field(unsigned long, ino)
46464649
__field(unsigned long long, bytes)
46474650
__field(loff_t, size)
@@ -4650,11 +4653,13 @@ TRACE_EVENT(xmbuf_free,
46504653
struct file *file = btp->bt_file;
46514654
struct inode *inode = file_inode(file);
46524655

4656+
__entry->dev = btp->bt_mount->m_super->s_dev;
46534657
__entry->size = i_size_read(inode);
46544658
__entry->bytes = (inode->i_blocks << SECTOR_SHIFT) + inode->i_bytes;
46554659
__entry->ino = inode->i_ino;
46564660
),
4657-
TP_printk("xmino 0x%lx mem_bytes 0x%llx isize 0x%llx",
4661+
TP_printk("dev %d:%d xmino 0x%lx mem_bytes 0x%llx isize 0x%llx",
4662+
MAJOR(__entry->dev), MINOR(__entry->dev),
46584663
__entry->ino,
46594664
__entry->bytes,
46604665
__entry->size)

0 commit comments

Comments
 (0)