mirror_zfs/cmd
Paul Dagnelie 411249498e Add allocation profile export and zhack subcommand for import
When attempting to debug performance problems on large systems, one of
the major factors that affect performance is free space
fragmentation. This heavily affects the allocation process, which is an
area of active development in ZFS. Unfortunately, fragmenting a large
pool for testing purposes is time consuming; it usually involves filling
the pool and then repeatedly overwriting data until the free space
becomes fragmented, which can take many hours. And even if the time is
available, artificial workloads rarely generate the same fragmentation
patterns as the natural workloads they're attempting to mimic.

This patch has two parts. First, in zdb, we add the ability to export
the full allocation map of the pool. It iterates over each vdev,
printing every allocated segment in the ms_allocatable range tree. This
can be done while the pool is online, though in that case the allocation
map may actually be from several different TXGs as new ones are loaded
on demand.

The second is a new subcommand for zhack, zhack metaslab leak (and its
supporting kernel changes). This is a zhack subcommand that imports a
pool and then modified the range trees of the metaslabs, allowing the
sync process to write them out normall. It does not currently store
those allocations anywhere to make them reversible, and there is no
corresponding free subcommand (which would be extremely dangerous); this
is an irreversible process, only intended for performance testing. The
only way to reclaim the space afterwards is to destroy the pool or roll
back to a checkpoint.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #17576
2026-02-11 10:27:01 -08:00
..
raidz_test raidz_test: Restore rand_data protection 2025-12-19 19:55:14 -08:00
zdb Add allocation profile export and zhack subcommand for import 2026-02-11 10:27:01 -08:00
zed zed: prettify slack notification message 2025-08-12 17:24:15 -07:00
zfs Linux 6.17 compat: Fix broken projectquota on 6.17 2025-11-12 09:52:16 -08:00
zinject SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zpool Explicit set ashift for non-leaf vdevs 2025-12-19 19:55:14 -08:00
zpool_influxdb SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zstream SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
arc_summary add uncompressed_size to arc_summary 2025-08-19 10:30:04 -07:00
arcstat.in arcstat: prevent ZeroDivisionError when L2ARC becomes empty 2025-05-28 16:00:28 -07:00
dbufstat.in SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
fsck.zfs.in cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
Makefile.am build: rename FORCEDEBUG_CPPFLAGS to LIBZPOOL_CPPFLAGS 2024-08-27 12:53:27 -07:00
mount_zfs.c SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zfs_ids_to_path.c SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zgenhostid.c SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
zhack.c Add allocation profile export and zhack subcommand for import 2026-02-11 10:27:01 -08:00
zilstat.in SPDX: license tags: CDDL-1.0 2025-04-16 09:59:44 -07:00
ztest.c Revert "Fix incorrect expected error in ztest" 2025-08-12 17:18:40 -07:00
zvol_wait zvol_wait logic may terminate prematurely 2022-10-11 12:12:04 -07:00