From 92cfd8fca32e155374fa217b62016d49f17b56a1 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Wed, 22 Jul 2020 12:10:17 -0400 Subject: [PATCH] Base dbuf cache size limit on arc_c_max Fixes #10563 Signed-off-by: Ryan Moeller --- include/sys/arc_impl.h | 1 + module/zfs/dbuf.c | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h index e43cf57d853b..3f6b0663b688 100644 --- a/include/sys/arc_impl.h +++ b/include/sys/arc_impl.h @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 207d59439691..3d6868accf37 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -613,8 +614,7 @@ dbuf_cache_multilist_index_func(multilist_t *ml, void *obj) static inline unsigned long dbuf_cache_target_bytes(void) { - return MIN(dbuf_cache_max_bytes, - arc_target_bytes() >> dbuf_cache_shift); + return MIN(dbuf_cache_max_bytes, arc_c_max >> dbuf_cache_shift); } static inline uint64_t @@ -808,19 +808,16 @@ dbuf_init(void) /* * Setup the parameters for the dbuf caches. We set the sizes of the * dbuf cache and the metadata cache to 1/32nd and 1/16th (default) - * of the target size of the ARC. If the values has been specified as - * a module option and they're not greater than the target size of the + * of the max size of the ARC. If the values has been specified as + * a module option and they're not greater than the max size of the * ARC, then we honor that value. */ - if (dbuf_cache_max_bytes == 0 || - dbuf_cache_max_bytes >= arc_target_bytes()) { - dbuf_cache_max_bytes = arc_target_bytes() >> dbuf_cache_shift; - } + if (dbuf_cache_max_bytes == 0 || dbuf_cache_max_bytes >= arc_c_max) + dbuf_cache_max_bytes = arc_c_max >> dbuf_cache_shift; if (dbuf_metadata_cache_max_bytes == 0 || - dbuf_metadata_cache_max_bytes >= arc_target_bytes()) { + dbuf_metadata_cache_max_bytes >= arc_c_max) dbuf_metadata_cache_max_bytes = - arc_target_bytes() >> dbuf_metadata_cache_shift; - } + arc_c_max >> dbuf_metadata_cache_shift; /* * All entries are queued via taskq_dispatch_ent(), so min/maxalloc