mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Introduce a tunable to exclude special class buffers from L2ARC
Special allocation class or dedup vdevs may have roughly the same performance as L2ARC vdevs. Introduce a new tunable to exclude those buffers from being cacheable on L2ARC. Reviewed-by: Don Brady <don.brady@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #11761 Closes #12285
This commit is contained in:
+32
-2
@@ -63,6 +63,8 @@
|
||||
#include <sys/dmu_recv.h>
|
||||
#include <sys/zfs_project.h>
|
||||
#include "zfs_namecheck.h"
|
||||
#include <sys/vdev_impl.h>
|
||||
#include <sys/arc.h>
|
||||
|
||||
/*
|
||||
* Needed to close a window in dnode_move() that allows the objset to be freed
|
||||
@@ -411,6 +413,34 @@ dnode_multilist_index_func(multilist_t *ml, void *obj)
|
||||
multilist_get_num_sublists(ml));
|
||||
}
|
||||
|
||||
static inline boolean_t
|
||||
dmu_os_is_l2cacheable(objset_t *os)
|
||||
{
|
||||
vdev_t *vd = NULL;
|
||||
zfs_cache_type_t cache = os->os_secondary_cache;
|
||||
blkptr_t *bp = os->os_rootbp;
|
||||
|
||||
if (bp != NULL && !BP_IS_HOLE(bp)) {
|
||||
uint64_t vdev = DVA_GET_VDEV(bp->blk_dva);
|
||||
vdev_t *rvd = os->os_spa->spa_root_vdev;
|
||||
|
||||
if (vdev < rvd->vdev_children)
|
||||
vd = rvd->vdev_child[vdev];
|
||||
|
||||
if (cache == ZFS_CACHE_ALL || cache == ZFS_CACHE_METADATA) {
|
||||
if (vd == NULL)
|
||||
return (B_TRUE);
|
||||
|
||||
if ((vd->vdev_alloc_bias != VDEV_BIAS_SPECIAL &&
|
||||
vd->vdev_alloc_bias != VDEV_BIAS_DEDUP) ||
|
||||
l2arc_exclude_special == 0)
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Instantiates the objset_t in-memory structure corresponding to the
|
||||
* objset_phys_t that's pointed to by the specified blkptr_t.
|
||||
@@ -453,7 +483,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
|
||||
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
|
||||
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID);
|
||||
|
||||
if (DMU_OS_IS_L2CACHEABLE(os))
|
||||
if (dmu_os_is_l2cacheable(os))
|
||||
aflags |= ARC_FLAG_L2CACHE;
|
||||
|
||||
if (ds != NULL && ds->ds_dir->dd_crypto_obj != 0) {
|
||||
@@ -1663,7 +1693,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
zio = arc_write(pio, os->os_spa, tx->tx_txg,
|
||||
blkptr_copy, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os),
|
||||
blkptr_copy, os->os_phys_buf, dmu_os_is_l2cacheable(os),
|
||||
&zp, dmu_objset_write_ready, NULL, NULL, dmu_objset_write_done,
|
||||
os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user