Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/os/freebsd/zfs/zfs_racct.c
Show All 23 Lines | |||||
*/ | */ | ||||
#include <sys/zfs_racct.h> | #include <sys/zfs_racct.h> | ||||
#include <sys/racct.h> | #include <sys/racct.h> | ||||
void | void | ||||
zfs_racct_read(uint64_t size, uint64_t iops) | zfs_racct_read(uint64_t size, uint64_t iops) | ||||
{ | { | ||||
curthread->td_ru.ru_inblock += iops; | RU_ATOMIC_ADD(curthread->td_ru.ru_inblock, iops); | ||||
#ifdef RACCT | #ifdef RACCT | ||||
if (racct_enable) { | if (racct_enable) { | ||||
PROC_LOCK(curproc); | PROC_LOCK(curproc); | ||||
racct_add_force(curproc, RACCT_READBPS, size); | racct_add_force(curproc, RACCT_READBPS, size); | ||||
racct_add_force(curproc, RACCT_READIOPS, iops); | racct_add_force(curproc, RACCT_READIOPS, iops); | ||||
PROC_UNLOCK(curproc); | PROC_UNLOCK(curproc); | ||||
} | } | ||||
#endif /* RACCT */ | #endif /* RACCT */ | ||||
} | } | ||||
void | void | ||||
zfs_racct_write(uint64_t size, uint64_t iops) | zfs_racct_write(uint64_t size, uint64_t iops) | ||||
{ | { | ||||
curthread->td_ru.ru_oublock += iops; | RU_ATOMIC_ADD(curthread->td_ru.ru_oublock, iops); | ||||
#ifdef RACCT | #ifdef RACCT | ||||
if (racct_enable) { | if (racct_enable) { | ||||
PROC_LOCK(curproc); | PROC_LOCK(curproc); | ||||
racct_add_force(curproc, RACCT_WRITEBPS, size); | racct_add_force(curproc, RACCT_WRITEBPS, size); | ||||
racct_add_force(curproc, RACCT_WRITEIOPS, iops); | racct_add_force(curproc, RACCT_WRITEIOPS, iops); | ||||
PROC_UNLOCK(curproc); | PROC_UNLOCK(curproc); | ||||
} | } | ||||
#endif /* RACCT */ | #endif /* RACCT */ | ||||
} | } |