Skip to content

Commit 1171de3

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
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 <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent 59e43f5 commit 1171de3

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

fs/xfs/xfs_file.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,8 @@ xfs_dax_read_fault(
14251425
struct xfs_inode *ip = XFS_I(file_inode(vmf->vma->vm_file));
14261426
vm_fault_t ret;
14271427

1428+
trace_xfs_read_fault(ip, order);
1429+
14281430
xfs_ilock(ip, XFS_MMAPLOCK_SHARED);
14291431
ret = xfs_dax_fault_locked(vmf, order, false);
14301432
xfs_iunlock(ip, XFS_MMAPLOCK_SHARED);
@@ -1442,6 +1444,8 @@ xfs_write_fault(
14421444
unsigned int lock_mode = XFS_MMAPLOCK_SHARED;
14431445
vm_fault_t ret;
14441446

1447+
trace_xfs_write_fault(ip, order);
1448+
14451449
sb_start_pagefault(inode->i_sb);
14461450
file_update_time(vmf->vma->vm_file);
14471451

@@ -1485,12 +1489,12 @@ __xfs_filemap_fault(
14851489
{
14861490
struct inode *inode = file_inode(vmf->vma->vm_file);
14871491

1488-
trace_xfs_filemap_fault(XFS_I(inode), order, write_fault);
1489-
14901492
if (write_fault)
14911493
return xfs_write_fault(vmf, order);
14921494
if (IS_DAX(inode))
14931495
return xfs_dax_read_fault(vmf, order);
1496+
1497+
trace_xfs_read_fault(XFS_I(inode), order);
14941498
return filemap_fault(vmf);
14951499
}
14961500

fs/xfs/xfs_trace.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -822,28 +822,32 @@ DEFINE_INODE_EVENT(xfs_inode_inactivating);
822822
TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
823823
TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
824824

825-
TRACE_EVENT(xfs_filemap_fault,
826-
TP_PROTO(struct xfs_inode *ip, unsigned int order, bool write_fault),
827-
TP_ARGS(ip, order, write_fault),
825+
DECLARE_EVENT_CLASS(xfs_fault_class,
826+
TP_PROTO(struct xfs_inode *ip, unsigned int order),
827+
TP_ARGS(ip, order),
828828
TP_STRUCT__entry(
829829
__field(dev_t, dev)
830830
__field(xfs_ino_t, ino)
831831
__field(unsigned int, order)
832-
__field(bool, write_fault)
833832
),
834833
TP_fast_assign(
835834
__entry->dev = VFS_I(ip)->i_sb->s_dev;
836835
__entry->ino = ip->i_ino;
837836
__entry->order = order;
838-
__entry->write_fault = write_fault;
839837
),
840-
TP_printk("dev %d:%d ino 0x%llx order %u write_fault %d",
838+
TP_printk("dev %d:%d ino 0x%llx order %u",
841839
MAJOR(__entry->dev), MINOR(__entry->dev),
842840
__entry->ino,
843-
__entry->order,
844-
__entry->write_fault)
841+
__entry->order)
845842
)
846843

844+
#define DEFINE_FAULT_EVENT(name) \
845+
DEFINE_EVENT(xfs_fault_class, name, \
846+
TP_PROTO(struct xfs_inode *ip, unsigned int order), \
847+
TP_ARGS(ip, order))
848+
DEFINE_FAULT_EVENT(xfs_read_fault);
849+
DEFINE_FAULT_EVENT(xfs_write_fault);
850+
847851
DECLARE_EVENT_CLASS(xfs_iref_class,
848852
TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
849853
TP_ARGS(ip, caller_ip),

0 commit comments

Comments
 (0)