Skip to content

Commit

Permalink
Base dbuf cache size limit on arc_c_max
Browse files Browse the repository at this point in the history
Fixes openzfs#10563

Signed-off-by: Ryan Moeller <[email protected]>
  • Loading branch information
Ryan Moeller authored and Ryan Moeller committed Jul 22, 2020
1 parent 317dbea commit 92cfd8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions include/sys/arc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <sys/zio_crypt.h>
#include <sys/zthr.h>
#include <sys/aggsum.h>
#include <sys/multilist.h>

#ifdef __cplusplus
extern "C" {
Expand Down
19 changes: 8 additions & 11 deletions module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <sys/zfs_context.h>
#include <sys/arc.h>
#include <sys/arc_impl.h>
#include <sys/dmu.h>
#include <sys/dmu_send.h>
#include <sys/dmu_impl.h>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 92cfd8f

Please sign in to comment.