From 5c0b9cf5628e50ec0e3c7d9a8297e81465530893 Mon Sep 17 00:00:00 2001 From: Matthias Blankertz Date: Sun, 30 Jan 2022 13:44:34 +0100 Subject: [PATCH] Add dataset_kstats_update.. to mmap read/write path on Linux This allows reads/writes caused by accesses to mmap files to be accounted correctly in the per-dataset kstats. Signed-off-by: Matthias Blankertz Issue openzfs#12994 --- module/os/linux/zfs/zfs_vnops_os.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/os/linux/zfs/zfs_vnops_os.c b/module/os/linux/zfs/zfs_vnops_os.c index c6115b530ff5..3cc0e69cc4b5 100644 --- a/module/os/linux/zfs/zfs_vnops_os.c +++ b/module/os/linux/zfs/zfs_vnops_os.c @@ -3610,6 +3610,8 @@ zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc) zil_commit(zfsvfs->z_log, zp->z_id); } + dataset_kstats_update_write_kstats(&zfsvfs->z_kstat, pglen); + ZFS_EXIT(zfsvfs); return (err); } @@ -3805,6 +3807,8 @@ zfs_getpage(struct inode *ip, struct page *pl[], int nr_pages) err = zfs_fillpage(ip, pl, nr_pages); + dataset_kstats_update_read_kstats(&zfsvfs->z_kstat, nr_pages*PAGESIZE); + ZFS_EXIT(zfsvfs); return (err); }