diff options
author | Alexander Motin <[email protected]> | 2021-05-26 14:14:26 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-26 12:14:26 -0600 |
commit | c71a2bb52fd3ec4db44890e05c071b137ec420b3 (patch) | |
tree | 6843542682b65eab9889107ccc7c742e774fe354 /module | |
parent | 671ea40f626ff98064442834e386a49b009b144d (diff) |
FreeBSD: Update dataset_kstats for zvols in dev mode
Previous commit added accounting for geom mode, but not for dev.
In geom mode we actually have GEOM statistics, while in dev mode
additional accounting actually makes more sense.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Closes #12097
Diffstat (limited to 'module')
-rw-r--r-- | module/os/freebsd/zfs/zvol_os.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/module/os/freebsd/zfs/zvol_os.c b/module/os/freebsd/zfs/zvol_os.c index 1993ca563..34aad72fb 100644 --- a/module/os/freebsd/zfs/zvol_os.c +++ b/module/os/freebsd/zfs/zvol_os.c @@ -767,6 +767,7 @@ zvol_cdev_read(struct cdev *dev, struct uio *uio_s, int ioflag) (zfs_uio_offset(&uio) < 0 || zfs_uio_offset(&uio) > volsize)) return (SET_ERROR(EIO)); + ssize_t start_resid = zfs_uio_resid(&uio); lr = zfs_rangelock_enter(&zv->zv_rangelock, zfs_uio_offset(&uio), zfs_uio_resid(&uio), RL_READER); while (zfs_uio_resid(&uio) > 0 && zfs_uio_offset(&uio) < volsize) { @@ -785,6 +786,8 @@ zvol_cdev_read(struct cdev *dev, struct uio *uio_s, int ioflag) } } zfs_rangelock_exit(lr); + int64_t nread = start_resid - zfs_uio_resid(&uio); + dataset_kstats_update_read_kstats(&zv->zv_kstat, nread); return (error); } @@ -809,6 +812,7 @@ zvol_cdev_write(struct cdev *dev, struct uio *uio_s, int ioflag) (zfs_uio_offset(&uio) < 0 || zfs_uio_offset(&uio) > volsize)) return (SET_ERROR(EIO)); + ssize_t start_resid = zfs_uio_resid(&uio); sync = (ioflag & IO_SYNC) || (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS); @@ -840,6 +844,8 @@ zvol_cdev_write(struct cdev *dev, struct uio *uio_s, int ioflag) break; } zfs_rangelock_exit(lr); + int64_t nwritten = start_resid - zfs_uio_resid(&uio); + dataset_kstats_update_write_kstats(&zv->zv_kstat, nwritten); if (sync) zil_commit(zv->zv_zilog, ZVOL_OBJ); rw_exit(&zv->zv_suspend_lock); |