Skip to content

Commit 4629f50

Browse files
committed
tony feedback
Signed-off-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
1 parent e1fd6f2 commit 4629f50

File tree

7 files changed

+28
-5
lines changed

7 files changed

+28
-5
lines changed

man/man4/zfs.4

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,11 @@ because user pages can be placed under write protection in
457457
.Fx
458458
before the Direct I/O write is issued.
459459
.
460+
.It Sy zfs_vdev_large_label_min_size Ns = Ns Sy 1000000000000 Pq uint
461+
Minimum device size to use the large label format, if the feature is enabled.
462+
Note that disks that are too small to store the large label (less than about
463+
1084MiB) will not use it, regardless of the value of this tunable.
464+
.
460465
.It Sy zfs_vdev_min_auto_ashift Ns = Ns Sy ASHIFT_MIN Po 9 Pc Pq uint
461466
Minimum ashift used when creating new top-level vdevs.
462467
.

man/man7/zpool-features.7

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,10 @@ However, because uberblocks always take at least one disk sector, large disk
738738
sectors result in unacceptably small uberblock rings.
739739
The new label format is 256MiB in size, with 128KiB reserved for the expanded
740740
uberblock ring.
741-
When enabled, the new larger size will be used on sufficiently large disks.
741+
When enabled, the new larger size will be used on disks of at least 1TB (by
742+
default, controlled by the
743+
.Sy zfs_vdev_large_label_min_size
744+
tunable).
742745
.Pp
743746
This feature becomes active when a large label is written to any of the disks
744747
in the pool.

module/zfs/vdev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static uint_t zfs_vdev_default_ms_shift = 29;
100100
/* upper limit for metaslab size (16G) */
101101
static uint_t zfs_vdev_max_ms_shift = 34;
102102

103-
uint64_t zfs_vdev_large_label_min_size = 1ULL << 40;
103+
uint64_t zfs_vdev_large_label_min_size = 1000ULL * 1000 * 1000 * 1000;
104104

105105
static int vdev_validate_skip = B_FALSE;
106106

@@ -2289,7 +2289,9 @@ vdev_open(vdev_t *vd)
22892289
spa->spa_create_large_label_ok))
22902290
large_label = B_FALSE;
22912291
else if (vd->vdev_asize == 0 && vd->vdev_ops->vdev_op_leaf)
2292-
large_label = osize > zfs_vdev_large_label_min_size;
2292+
large_label = (osize > zfs_vdev_large_label_min_size) &&
2293+
(osize > SPA_MINDEVSIZE + (VDEV_LARGE_LABEL_SIZE -
2294+
sizeof (vdev_label_t)) * VDEV_LABELS);
22932295
else
22942296
large_label = vd->vdev_large_label;
22952297
uint64_t align;

tests/zfs-tests/include/tunables.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ EMBEDDED_SLOG_MIN_MS embedded_slog_min_ms zfs_embedded_slog_min_ms
4545
INITIALIZE_CHUNK_SIZE initialize_chunk_size zfs_initialize_chunk_size
4646
INITIALIZE_VALUE initialize_value zfs_initialize_value
4747
KEEP_LOG_SPACEMAPS_AT_EXPORT keep_log_spacemaps_at_export zfs_keep_log_spacemaps_at_export
48+
LARGE_LABEL_MIN_SIZE vdev.large_label_min_size zfs_vdev_large_label_min_size
4849
LUA_MAX_MEMLIMIT lua.max_memlimit zfs_lua_max_memlimit
4950
L2ARC_MFUONLY l2arc.mfuonly l2arc_mfuonly
5051
L2ARC_NOPREFETCH l2arc.noprefetch l2arc_noprefetch

tests/zfs-tests/tests/functional/large_label/large_label_001_pos.ksh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@
3636
function cleanup {
3737
log_pos zpool destroy $TESTPOOL
3838
log_must rm $mntpnt/dsk*
39+
log_must restore_tunable LARGE_LABEL_MIN_SIZE
3940
}
4041

4142
log_assert "Verify that new label works for basic pool operation"
4243
log_onexit cleanup
4344

45+
log_must save_tunable LARGE_LABEL_MIN_SIZE
46+
4447
mntpnt="$TESTDIR1"
4548
log_must truncate -s 2T $mntpnt/dsk0
4649

@@ -51,5 +54,14 @@ log_must create_pool -f $TESTPOOL "$DSK"0
5154
log_must zdb -l "$DSK"0
5255
log_must uses_large_label "$DSK"0
5356
log_mustnot uses_old_label "$DSK"0
57+
log_must destroy_pool $TESTPOOL
58+
59+
log_must set_tunable64 LARGE_LABEL_MIN_SIZE 1
60+
log_must truncate -s 64M $mntpnt/dsk1
61+
62+
log_must create_pool -f $TESTPOOL "$DSK"1
63+
log_must zdb -l "$DSK"1
64+
log_mustnot uses_large_label "$DSK"1
65+
log_must uses_old_label "$DSK"1
5466

5567
log_pass "New label works for basic pool operation"

tests/zfs-tests/tests/functional/large_label/large_label_002_pos.ksh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ DSK="$mntpnt/dsk"
4949

5050
log_must create_pool -f $TESTPOOL "$DSK"0 mirror "$DSK"1 "$DSK"2 raidz1 "$DSK"3 "$DSK"4 "$DSK"5 log "$DSK"6 special "$DSK"7
5151

52-
log_must dd if=/dev/urandom of=/$TESTPOOL/f1 bs=1M count=1k
52+
log_must file_write -o create -d 'R' -f /$TESTPOOL/f1 -b 1M -c 1k
5353
log_must sync_pool $TESTPOOL
5454

5555
for i in `seq 0 7`; do

tests/zfs-tests/tests/functional/large_label/large_label_mirror.ksh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ log_must truncate -s 2G $mntpnt/small1
4848

4949
log_must create_pool -f $TESTPOOL $mntpnt/small1
5050
log_must zfs create $TESTPOOL/fs
51-
log_must dd if=/dev/urandom of=/$TESTPOOL/fs/f1 bs=1M count=16
51+
log_must file_write -o create -d 'R' -f /$TESTPOOL/fs/f1 -b 1M -c 16
5252
log_must touch /$TESTPOOL/f2
5353

5454
log_must sync_pool $TESTPOOL

0 commit comments

Comments
 (0)