diff options
author | Ryan Moeller <[email protected]> | 2021-02-20 01:34:33 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-19 22:34:33 -0800 |
commit | 64e0fe14fff465604952d576051ca80c2f1be898 (patch) | |
tree | 61cb2bbb0c8f011b60534d21a583fba38af30a17 /module/zfs | |
parent | 03e02e5b561f7f60597dd905414eb476610740cc (diff) |
Restore FreeBSD resource usage accounting
Add zfs_racct_* interfaces for platform-dependent read/write accounting.
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #11613
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/arc.c | 2 | ||||
-rw-r--r-- | module/zfs/dmu.c | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index b4f0c8a85..9be0a4e8a 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -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 @@ -6302,6 +6303,7 @@ top: ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr), demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data, metadata, misses); + zfs_racct_read(size, 1); } /* Check if the spa even has l2 configured */ diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index ed345f0b6..b46bf60d1 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -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> @@ -551,6 +552,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, @@ -1440,6 +1444,7 @@ dmu_assign_arcbuf_by_dnode(dnode_t *dn, uint64_t offset, arc_buf_t *buf, * same size as the dbuf. */ 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 { |