mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Restore FreeBSD resource usage accounting
Add zfs_racct_* interfaces for platform-dependent read/write accounting. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11613
This commit is contained in:
committed by
Brian Behlendorf
parent
f17c843eff
commit
403703d57a
@@ -308,6 +308,7 @@
|
||||
#include <sys/aggsum.h>
|
||||
#include <cityhash.h>
|
||||
#include <sys/vdev_trim.h>
|
||||
#include <sys/zfs_racct.h>
|
||||
#include <sys/zstd/zstd.h>
|
||||
|
||||
#ifndef _KERNEL
|
||||
@@ -6180,6 +6181,7 @@ top:
|
||||
ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr),
|
||||
demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data,
|
||||
metadata, misses);
|
||||
zfs_racct_read(size, 1);
|
||||
}
|
||||
|
||||
if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) {
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <sys/zfeature.h>
|
||||
#include <sys/abd.h>
|
||||
#include <sys/trace_zfs.h>
|
||||
#include <sys/zfs_racct.h>
|
||||
#include <sys/zfs_rlock.h>
|
||||
#ifdef _KERNEL
|
||||
#include <sys/vmsystm.h>
|
||||
@@ -548,6 +549,9 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
|
||||
dbp[i] = &db->db;
|
||||
}
|
||||
|
||||
if (!read)
|
||||
zfs_racct_write(length, nblks);
|
||||
|
||||
if ((flags & DMU_READ_NO_PREFETCH) == 0 &&
|
||||
DNODE_META_IS_CACHEABLE(dn) && length <= zfetch_array_rd_sz) {
|
||||
dmu_zfetch(&dn->dn_zfetch, blkid, nblks,
|
||||
@@ -1587,6 +1591,7 @@ dmu_assign_arcbuf_by_dnode(dnode_t *dn, uint64_t offset, arc_buf_t *buf,
|
||||
* same size as the dbuf, and the dbuf is not metadata.
|
||||
*/
|
||||
if (offset == db->db.db_offset && blksz == db->db.db_size) {
|
||||
zfs_racct_write(blksz, 1);
|
||||
dbuf_assign_arcbuf(db, buf, tx);
|
||||
dbuf_rele(db, FTAG);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user