BRT: Make BRT block sizes configurable

Similar to DDT make BRT data and indirect block sizes configurable
via module parameters.  I am not sure what would be the best yet,
but similar to DDT 4KB blocks kill all chances of compression on
vdev with ashift=12 or more, that on my tests reaches 3x.

While here, fix documentation for respective DDT parameters.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15967
This commit is contained in:
Alexander Motin 2024-03-25 18:02:38 -04:00 committed by Brian Behlendorf
parent 457e62d7ca
commit c94f730078
2 changed files with 26 additions and 13 deletions

View File

@ -245,12 +245,25 @@ For blocks that could be forced to be a gang block (due to
.Sy metaslab_force_ganging ) , .Sy metaslab_force_ganging ) ,
force this many of them to be gang blocks. force this many of them to be gang blocks.
. .
.It Sy zfs_ddt_zap_default_bs Ns = Ns Sy 15 Po 32 KiB Pc Pq int .It Sy brt_zap_prefetch Ns = Ns Sy 1 Ns | Ns 0 Pq int
Controls prefetching BRT records for blocks which are going to be cloned.
.
.It Sy brt_zap_default_bs Ns = Ns Sy 12 Po 4 KiB Pc Pq int
Default BRT ZAP data block size as a power of 2. Note that changing this after
creating a BRT on the pool will not affect existing BRTs, only newly created
ones.
.
.It Sy brt_zap_default_ibs Ns = Ns Sy 12 Po 4 KiB Pc Pq int
Default BRT ZAP indirect block size as a power of 2. Note that changing this
after creating a BRT on the pool will not affect existing BRTs, only newly
created ones.
.
.It Sy ddt_zap_default_bs Ns = Ns Sy 15 Po 32 KiB Pc Pq int
Default DDT ZAP data block size as a power of 2. Note that changing this after Default DDT ZAP data block size as a power of 2. Note that changing this after
creating a DDT on the pool will not affect existing DDTs, only newly created creating a DDT on the pool will not affect existing DDTs, only newly created
ones. ones.
. .
.It Sy zfs_ddt_zap_default_ibs Ns = Ns Sy 15 Po 32 KiB Pc Pq int .It Sy ddt_zap_default_ibs Ns = Ns Sy 15 Po 32 KiB Pc Pq int
Default DDT ZAP indirect block size as a power of 2. Note that changing this Default DDT ZAP indirect block size as a power of 2. Note that changing this
after creating a DDT on the pool will not affect existing DDTs, only newly after creating a DDT on the pool will not affect existing DDTs, only newly
created ones. created ones.

View File

@ -248,7 +248,7 @@ static kmem_cache_t *brt_pending_entry_cache;
/* /*
* Enable/disable prefetching of BRT entries that we are going to modify. * Enable/disable prefetching of BRT entries that we are going to modify.
*/ */
int zfs_brt_prefetch = 1; static int brt_zap_prefetch = 1;
#ifdef ZFS_DEBUG #ifdef ZFS_DEBUG
#define BRT_DEBUG(...) do { \ #define BRT_DEBUG(...) do { \
@ -260,8 +260,8 @@ int zfs_brt_prefetch = 1;
#define BRT_DEBUG(...) do { } while (0) #define BRT_DEBUG(...) do { } while (0)
#endif #endif
int brt_zap_leaf_blockshift = 12; static int brt_zap_default_bs = 12;
int brt_zap_indirect_blockshift = 12; static int brt_zap_default_ibs = 12;
static kstat_t *brt_ksp; static kstat_t *brt_ksp;
@ -458,8 +458,7 @@ brt_vdev_create(brt_t *brt, brt_vdev_t *brtvd, dmu_tx_t *tx)
brtvd->bv_mos_entries = zap_create_flags(brt->brt_mos, 0, brtvd->bv_mos_entries = zap_create_flags(brt->brt_mos, 0,
ZAP_FLAG_HASH64 | ZAP_FLAG_UINT64_KEY, DMU_OTN_ZAP_METADATA, ZAP_FLAG_HASH64 | ZAP_FLAG_UINT64_KEY, DMU_OTN_ZAP_METADATA,
brt_zap_leaf_blockshift, brt_zap_indirect_blockshift, DMU_OT_NONE, brt_zap_default_bs, brt_zap_default_ibs, DMU_OT_NONE, 0, tx);
0, tx);
VERIFY(brtvd->bv_mos_entries != 0); VERIFY(brtvd->bv_mos_entries != 0);
BRT_DEBUG("MOS entries created, object=%llu", BRT_DEBUG("MOS entries created, object=%llu",
(u_longlong_t)brtvd->bv_mos_entries); (u_longlong_t)brtvd->bv_mos_entries);
@ -1363,7 +1362,7 @@ brt_prefetch(brt_t *brt, const blkptr_t *bp)
ASSERT(bp != NULL); ASSERT(bp != NULL);
if (!zfs_brt_prefetch) if (!brt_zap_prefetch)
return; return;
brt_entry_fill(bp, &bre, &vdevid); brt_entry_fill(bp, &bre, &vdevid);
@ -1680,9 +1679,10 @@ brt_unload(spa_t *spa)
} }
/* BEGIN CSTYLED */ /* BEGIN CSTYLED */
ZFS_MODULE_PARAM(zfs_brt, zfs_brt_, prefetch, INT, ZMOD_RW, ZFS_MODULE_PARAM(zfs_brt, , brt_zap_prefetch, INT, ZMOD_RW,
"Enable prefetching of BRT entries"); "Enable prefetching of BRT ZAP entries");
#ifdef ZFS_BRT_DEBUG ZFS_MODULE_PARAM(zfs_brt, , brt_zap_default_bs, UINT, ZMOD_RW,
ZFS_MODULE_PARAM(zfs_brt, zfs_brt_, debug, INT, ZMOD_RW, "BRT debug"); "BRT ZAP leaf blockshift");
#endif ZFS_MODULE_PARAM(zfs_brt, , brt_zap_default_ibs, UINT, ZMOD_RW,
"BRT ZAP indirect blockshift");
/* END CSTYLED */ /* END CSTYLED */