xfs: split the page fault trace event

Split the xfs_filemap_fault trace event into separate ones for read and
write faults and move them into the applicable locations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Christoph Hellwig 2024-10-29 16:11:57 +01:00 committed by Carlos Maiolino
parent 59e43f5479
commit 1171de3296
2 changed files with 18 additions and 10 deletions

View File

@ -1425,6 +1425,8 @@ xfs_dax_read_fault(
struct xfs_inode *ip = XFS_I(file_inode(vmf->vma->vm_file));
vm_fault_t ret;
trace_xfs_read_fault(ip, order);
xfs_ilock(ip, XFS_MMAPLOCK_SHARED);
ret = xfs_dax_fault_locked(vmf, order, false);
xfs_iunlock(ip, XFS_MMAPLOCK_SHARED);
@ -1442,6 +1444,8 @@ xfs_write_fault(
unsigned int lock_mode = XFS_MMAPLOCK_SHARED;
vm_fault_t ret;
trace_xfs_write_fault(ip, order);
sb_start_pagefault(inode->i_sb);
file_update_time(vmf->vma->vm_file);
@ -1485,12 +1489,12 @@ __xfs_filemap_fault(
{
struct inode *inode = file_inode(vmf->vma->vm_file);
trace_xfs_filemap_fault(XFS_I(inode), order, write_fault);
if (write_fault)
return xfs_write_fault(vmf, order);
if (IS_DAX(inode))
return xfs_dax_read_fault(vmf, order);
trace_xfs_read_fault(XFS_I(inode), order);
return filemap_fault(vmf);
}

View File

@ -822,28 +822,32 @@ DEFINE_INODE_EVENT(xfs_inode_inactivating);
TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
TRACE_EVENT(xfs_filemap_fault,
TP_PROTO(struct xfs_inode *ip, unsigned int order, bool write_fault),
TP_ARGS(ip, order, write_fault),
DECLARE_EVENT_CLASS(xfs_fault_class,
TP_PROTO(struct xfs_inode *ip, unsigned int order),
TP_ARGS(ip, order),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(xfs_ino_t, ino)
__field(unsigned int, order)
__field(bool, write_fault)
),
TP_fast_assign(
__entry->dev = VFS_I(ip)->i_sb->s_dev;
__entry->ino = ip->i_ino;
__entry->order = order;
__entry->write_fault = write_fault;
),
TP_printk("dev %d:%d ino 0x%llx order %u write_fault %d",
TP_printk("dev %d:%d ino 0x%llx order %u",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->ino,
__entry->order,
__entry->write_fault)
__entry->order)
)
#define DEFINE_FAULT_EVENT(name) \
DEFINE_EVENT(xfs_fault_class, name, \
TP_PROTO(struct xfs_inode *ip, unsigned int order), \
TP_ARGS(ip, order))
DEFINE_FAULT_EVENT(xfs_read_fault);
DEFINE_FAULT_EVENT(xfs_write_fault);
DECLARE_EVENT_CLASS(xfs_iref_class,
TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
TP_ARGS(ip, caller_ip),