mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
More ashift improvements
This commit allow higher ashift values (up to 16) in 'zpool create' The ashift value was previously limited to 13 (8K block) inb41c990because the limited number of uberblocks we could fit in the statically sized (128K) vdev label ring buffer could prevent the ability the safely roll back a pool to recover it. Sinceb02fe35the largest uberblock size we support is 8K: this allow us to store a minimum number of 16 uberblocks in the vdev label, even with higher ashift values. Additionally change 'ashift' pool property behaviour: if set it will be used as the default hint value in subsequent vdev operations ('zpool add', 'attach' and 'replace'). A custom ashift value can still be specified from the command line, if desired. Finally, fix a bug in add-o_ashift.ksh caused by a missing variable. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #2024 Closes #4205 Closes #4740 Closes #5763
This commit is contained in:
@@ -678,6 +678,20 @@ zpool_do_add(int argc, char **argv)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* unless manually specified use "ashift" pool property (if set) */
|
||||
if (!nvlist_exists(props, ZPOOL_CONFIG_ASHIFT)) {
|
||||
int intval;
|
||||
zprop_source_t src;
|
||||
char strval[ZPOOL_MAXPROPLEN];
|
||||
|
||||
intval = zpool_get_prop_int(zhp, ZPOOL_PROP_ASHIFT, &src);
|
||||
if (src != ZPROP_SRC_DEFAULT) {
|
||||
(void) sprintf(strval, "%" PRId32, intval);
|
||||
verify(add_prop_list(ZPOOL_CONFIG_ASHIFT, strval,
|
||||
&props, B_TRUE) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* pass off to get_vdev_spec for processing */
|
||||
nvroot = make_root_vdev(zhp, props, force, !force, B_FALSE, dryrun,
|
||||
argc, argv);
|
||||
@@ -5066,6 +5080,20 @@ zpool_do_attach_or_replace(int argc, char **argv, int replacing)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* unless manually specified use "ashift" pool property (if set) */
|
||||
if (!nvlist_exists(props, ZPOOL_CONFIG_ASHIFT)) {
|
||||
int intval;
|
||||
zprop_source_t src;
|
||||
char strval[ZPOOL_MAXPROPLEN];
|
||||
|
||||
intval = zpool_get_prop_int(zhp, ZPOOL_PROP_ASHIFT, &src);
|
||||
if (src != ZPROP_SRC_DEFAULT) {
|
||||
(void) sprintf(strval, "%" PRId32, intval);
|
||||
verify(add_prop_list(ZPOOL_CONFIG_ASHIFT, strval,
|
||||
&props, B_TRUE) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
nvroot = make_root_vdev(zhp, props, force, B_FALSE, replacing, B_FALSE,
|
||||
argc, argv);
|
||||
if (nvroot == NULL) {
|
||||
|
||||
@@ -698,7 +698,11 @@ make_leaf_vdev(nvlist_t *props, const char *arg, uint64_t is_log)
|
||||
|
||||
if (nvlist_lookup_string(props,
|
||||
zpool_prop_to_name(ZPOOL_PROP_ASHIFT), &value) == 0) {
|
||||
zfs_nicestrtonum(NULL, value, &ashift);
|
||||
if (zfs_nicestrtonum(NULL, value, &ashift) != 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("ashift must be a number.\n"));
|
||||
return (NULL);
|
||||
}
|
||||
if (ashift != 0 &&
|
||||
(ashift < ASHIFT_MIN || ashift > ASHIFT_MAX)) {
|
||||
(void) fprintf(stderr,
|
||||
|
||||
Reference in New Issue
Block a user