diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/spl/spl-kmem-cache.c | 14 | ||||
-rw-r--r-- | module/zfs/metaslab.c | 9 |
2 files changed, 19 insertions, 4 deletions
diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c index b39867b03..853cf33f0 100644 --- a/module/os/linux/spl/spl-kmem-cache.c +++ b/module/os/linux/spl/spl-kmem-cache.c @@ -257,6 +257,20 @@ spl_obj_size(spl_kmem_cache_t *skc) P2ROUNDUP_TYPED(sizeof (spl_kmem_obj_t), align, uint32_t)); } +uint64_t +spl_kmem_cache_inuse(kmem_cache_t *cache) +{ + return (cache->skc_obj_total); +} +EXPORT_SYMBOL(spl_kmem_cache_inuse); + +uint64_t +spl_kmem_cache_entry_size(kmem_cache_t *cache) +{ + return (cache->skc_obj_size); +} +EXPORT_SYMBOL(spl_kmem_cache_entry_size); + /* * Lookup the spl_kmem_object_t for an object given that object. */ diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 7b8ac91b1..459f4dbbc 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -2142,8 +2142,8 @@ metaslab_potentially_evict(metaslab_class_t *mc) { #ifdef _KERNEL uint64_t allmem = arc_all_memory(); - uint64_t inuse = zfs_btree_leaf_cache->skc_obj_total; - uint64_t size = zfs_btree_leaf_cache->skc_obj_size; + uint64_t inuse = spl_kmem_cache_inuse(zfs_btree_leaf_cache); + uint64_t size = spl_kmem_cache_entry_size(zfs_btree_leaf_cache); int tries = 0; for (; allmem * zfs_metaslab_mem_limit / 100 < inuse * size && tries < multilist_get_num_sublists(mc->mc_metaslab_txg_list) * 2; @@ -2180,7 +2180,8 @@ metaslab_potentially_evict(metaslab_class_t *mc) */ if (msp->ms_loading) { msp = next_msp; - inuse = zfs_btree_leaf_cache->skc_obj_total; + inuse = + spl_kmem_cache_inuse(zfs_btree_leaf_cache); continue; } /* @@ -2202,7 +2203,7 @@ metaslab_potentially_evict(metaslab_class_t *mc) } mutex_exit(&msp->ms_lock); msp = next_msp; - inuse = zfs_btree_leaf_cache->skc_obj_total; + inuse = spl_kmem_cache_inuse(zfs_btree_leaf_cache); } } #endif |