Skip to content

Commit 00b54a3

Browse files
author
Paul Dagnelie
committed
add no-upgrade features
Signed-off-by: Paul Dagnelie <[email protected]>
1 parent 5e38c66 commit 00b54a3

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

include/zfeature_common.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,14 @@ typedef enum zfeature_flags {
104104
/* Activate this feature at the same time it is enabled. */
105105
ZFEATURE_FLAG_ACTIVATE_ON_ENABLE = (1 << 2),
106106
/* Each dataset has a field set if it has ever used this feature. */
107-
ZFEATURE_FLAG_PER_DATASET = (1 << 3)
107+
ZFEATURE_FLAG_PER_DATASET = (1 << 3),
108+
/*
109+
* This feature isn't enabled by zpool upgrade; it must be explicitly
110+
* listed to be enabled. This also applies to compatibility lists. This
111+
* flag can be removed from a given feature once support is sufficiently
112+
* widespread.
113+
*/
114+
ZFEATURE_FLAG_NO_UPGRADE = (1 << 4)
108115
} zfeature_flags_t;
109116

110117
typedef enum zfeature_type {

lib/libzfs/libzfs_pool.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -5109,9 +5109,13 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
51095109
/* special cases (unset), "" and "off" => enable all features */
51105110
if (compat == NULL || compat[0] == '\0' ||
51115111
strcmp(compat, ZPOOL_COMPAT_OFF) == 0) {
5112-
if (features != NULL)
5113-
for (uint_t i = 0; i < SPA_FEATURES; i++)
5114-
features[i] = B_TRUE;
5112+
if (features != NULL) {
5113+
for (uint_t i = 0; i < SPA_FEATURES; i++) {
5114+
if (!(spa_feature_table[i].fi_flags &
5115+
ZFEATURE_FLAG_NO_UPGRADE))
5116+
features[i] = B_TRUE;
5117+
}
5118+
}
51155119
if (report != NULL)
51165120
strlcpy(report, gettext("all features enabled"), rlen);
51175121
return (ZPOOL_COMPATIBILITY_OK);

man/man4/zfs.4

-14
Original file line numberDiff line numberDiff line change
@@ -2509,20 +2509,6 @@ the xattr so as to not accumulate duplicates.
25092509
.
25102510
.It Sy zio_requeue_io_start_cut_in_line Ns = Ns Sy 0 Ns | Ns 1 Pq int
25112511
Prioritize requeued I/O.
2512-
.It Sy zio_dynamic_gang_headers_enable Ns = Ns Sy 0 Ns | Ns 1 Pq int
2513-
Enable dynamically sized gang headers.
2514-
.Pp
2515-
When set to 0 (the default), the dynamic_gang_header feature will never be
2516-
activated, even if it is enabled.
2517-
All gang headers will store at most 3 children, regardless of the header's
2518-
allocated size on disk.
2519-
When set to 1, the dynamic_gang_header feature will be activated once a
2520-
gang allocation is larger than 512 bytes.
2521-
This will cause the gang header to store more more gang children on pools
2522-
with larger ashifts.
2523-
Enabling this flag and the feature will reduce multi-level gang trees,
2524-
but can result in more IOs for individual gang blocks.
2525-
.
25262512
.It Sy zio_taskq_batch_pct Ns = Ns Sy 80 Ns % Pq uint
25272513
Percentage of online CPUs which will run a worker thread for I/O.
25282514
These workers are responsible for I/O work such as compression, encryption,

man/man7/zpool-features.7

+12
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,18 @@ vdev type, or when adding a new
493493
.Sy draid
494494
vdev to an existing pool.
495495
.
496+
.feature com.klarasystems dynamic_gang_header no
497+
This feature enables larger gang headers based on the sector size of the pool.
498+
When enabled, gang headers will use the entire space allocated for them, instead
499+
of always restricting themselves to 512 bytes.
500+
This can reduce the need for nested gang trees in extreme fragmentation scenarios.
501+
.Pp
502+
This feature becomes active when a gang header is written that is larger than
503+
512 bytes.
504+
This feature is not enabled by
505+
.Xr zpool-upgrade 8 .
506+
Instead, it must be manually enabled, or be part of a compatibility file.
507+
.
496508
.feature org.illumos edonr no extensible_dataset
497509
This feature enables the use of the Edon-R hash algorithm for checksum,
498510
including for nopwrite

module/zcommon/zfeature_common.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,8 @@ zpool_feature_init(void)
789789
zfeature_register(SPA_FEATURE_DYNAMIC_GANG_HEADER,
790790
"com.klarasystems:dynamic_gang_header", "dynamic_gang_header",
791791
"Support for dynamically sized gang headers",
792-
ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL,
793-
sfeatures);
792+
ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_NO_UPGRADE,
793+
ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);
794794

795795
zfs_mod_list_supported_free(sfeatures);
796796
}

module/zfs/zio.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ static uint_t zfs_sync_pass_rewrite = 2;
140140
int zio_exclude_metadata = 0;
141141
static int zio_requeue_io_start_cut_in_line = 1;
142142

143-
static int zio_dynamic_gang_headers_enable = 0;
144-
145143
#ifdef ZFS_DEBUG
146144
static const int zio_buf_debug_limit = 16384;
147145
#else
@@ -3207,8 +3205,7 @@ zio_write_gang_block(zio_t *pio, metaslab_class_t *mc)
32073205
bp, gbh_copies, txg, pio == gio ? NULL : gio->io_bp, flags,
32083206
&pio->io_alloc_list, pio->io_allocator, pio);
32093207

3210-
if (spa_feature_is_enabled(spa, SPA_FEATURE_DYNAMIC_GANG_HEADER) &&
3211-
zio_dynamic_gang_headers_enable) {
3208+
if (spa_feature_is_enabled(spa, SPA_FEATURE_DYNAMIC_GANG_HEADER)) {
32123209
gangblocksize = UINT64_MAX;
32133210
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
32143211
for (int dva = 0; dva < BP_GET_NDVAS(bp); dva++) {
@@ -5906,6 +5903,3 @@ ZFS_MODULE_PARAM(zfs_zio, zio_, dva_throttle_enabled, INT, ZMOD_RW,
59065903

59075904
ZFS_MODULE_PARAM(zfs_zio, zio_, deadman_log_all, INT, ZMOD_RW,
59085905
"Log all slow ZIOs, not just those with vdevs");
5909-
5910-
ZFS_MODULE_PARAM(zfs_zio, zio_, dynamic_gang_headers_enable, INT, ZMOD_RW,
5911-
"Enable dynamic gang header creation");

0 commit comments

Comments
 (0)