Add BRT support to zpool prefetch command

Implement BRT (Block Reference Table) prefetch functionality similar
to existing DDT prefetch.  This allows preloading BRT metadata into
ARC to improve performance for block cloning operations and frees
of earlier cloned blocks.

Make -t parameter optional.  When omitted, prefetch all supported
metadata types (both DDT and BRT now).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com>
Closes #17890
This commit is contained in:
Alexander Motin
2025-11-10 19:16:22 -05:00
committed by Brian Behlendorf
parent 002bc3da6a
commit 41878d57ea
12 changed files with 198 additions and 42 deletions
+6 -2
View File
@@ -1745,9 +1745,13 @@ zpool_prefetch(zpool_handle_t *zhp, zpool_prefetch_type_t type)
error = lzc_pool_prefetch(zhp->zpool_name, type);
if (error != 0) {
const char *typename = "unknown";
if (type == ZPOOL_PREFETCH_DDT)
typename = "ddt";
else if (type == ZPOOL_PREFETCH_BRT)
typename = "brt";
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
"cannot prefetch %s in '%s'"),
type == ZPOOL_PREFETCH_DDT ? "ddt" : "", zhp->zpool_name);
"cannot prefetch %s in '%s'"), typename, zhp->zpool_name);
(void) zpool_standard_error(hdl, error, msg);
return (-1);
}