Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ zpool_do_add(int argc, char **argv)

/* pass off to make_root_vdev for processing */
nvroot = make_root_vdev(zhp, props, !check_inuse,
check_replication, B_FALSE, dryrun, argc, argv);
check_replication, B_FALSE, dryrun, B_FALSE, argc, argv);
if (nvroot == NULL) {
zpool_close(zhp);
return (1);
Expand Down Expand Up @@ -2159,7 +2159,7 @@ zpool_do_create(int argc, char **argv)

/* pass off to make_root_vdev for bulk processing */
nvroot = make_root_vdev(NULL, props, force, !force, B_FALSE, dryrun,
argc - 1, argv + 1);
B_FALSE, argc - 1, argv + 1);
if (nvroot == NULL)
goto errout;

Expand Down Expand Up @@ -7628,6 +7628,7 @@ zpool_do_attach_or_replace(int argc, char **argv, int replacing)
boolean_t force = B_FALSE;
boolean_t rebuild = B_FALSE;
boolean_t wait = B_FALSE;
boolean_t shadow = B_FALSE;
int c;
nvlist_t *nvroot;
char *poolname, *old_disk, *new_disk;
Expand All @@ -7637,7 +7638,7 @@ zpool_do_attach_or_replace(int argc, char **argv, int replacing)
int ret;

/* check options */
while ((c = getopt(argc, argv, "fo:sw")) != -1) {
while ((c = getopt(argc, argv, "fo:sSw")) != -1) {
switch (c) {
case 'f':
force = B_TRUE;
Expand All @@ -7658,6 +7659,9 @@ zpool_do_attach_or_replace(int argc, char **argv, int replacing)
case 's':
rebuild = B_TRUE;
break;
case 'S':
shadow = B_TRUE;
break;
case 'w':
wait = B_TRUE;
break;
Expand Down Expand Up @@ -7735,7 +7739,7 @@ zpool_do_attach_or_replace(int argc, char **argv, int replacing)
}

nvroot = make_root_vdev(zhp, props, force, B_FALSE, replacing, B_FALSE,
argc, argv);
shadow, argc, argv);
if (nvroot == NULL) {
zpool_close(zhp);
nvlist_free(props);
Expand Down
4 changes: 2 additions & 2 deletions cmd/zpool/zpool_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ char *zpool_get_cmd_search_path(void);
*/

nvlist_t *make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force,
int check_rep, boolean_t replacing, boolean_t dryrun, int argc,
char **argv);
int check_rep, boolean_t replacing, boolean_t dryrun, boolean_t shadow,
int argc, char **argv);
nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname,
nvlist_t *props, splitflags_t flags, int argc, char **argv);

Expand Down
14 changes: 10 additions & 4 deletions cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ draid_config_by_type(nvlist_t *nv, const char *type, uint64_t width,
* because the program is just going to exit anyway.
*/
static nvlist_t *
construct_spec(nvlist_t *props, int argc, char **argv)
construct_spec(nvlist_t *props, boolean_t shadow, int argc, char **argv)
{
nvlist_t *nvroot, *nv, **top, **spares, **l2cache;
int t, toplevels, mindev, maxdev, nspares, nlogs, nl2cache;
Expand Down Expand Up @@ -1895,6 +1895,10 @@ construct_spec(nvlist_t *props, int argc, char **argv)

verify(nvlist_add_uint64(nv,
ZPOOL_CONFIG_IS_LOG, is_log) == 0);
if (shadow) {
fnvlist_add_boolean(nv,
ZPOOL_VDEV_CONFIG_SHADOW);
}
if (is_log) {
verify(nvlist_add_string(nv,
ZPOOL_CONFIG_ALLOCATION_BIAS,
Expand Down Expand Up @@ -1974,7 +1978,8 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props,
uint_t c, children;

if (argc > 0) {
if ((newroot = construct_spec(props, argc, argv)) == NULL) {
if ((newroot = construct_spec(props, B_FALSE, argc, argv)) ==
NULL) {
(void) fprintf(stderr, gettext("Unable to build a "
"pool from the specified devices\n"));
return (NULL);
Expand Down Expand Up @@ -2048,7 +2053,8 @@ num_normal_vdevs(nvlist_t *nvroot)
*/
nvlist_t *
make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep,
boolean_t replacing, boolean_t dryrun, int argc, char **argv)
boolean_t replacing, boolean_t dryrun, boolean_t shadow, int argc,
char **argv)
{
nvlist_t *newroot;
nvlist_t *poolconfig = NULL;
Expand All @@ -2059,7 +2065,7 @@ make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep,
* that we have a valid specification, and that all devices can be
* opened.
*/
if ((newroot = construct_spec(props, argc, argv)) == NULL)
if ((newroot = construct_spec(props, shadow, argc, argv)) == NULL)
return (NULL);

if (zhp && ((poolconfig = zpool_get_config(zhp, NULL)) == NULL)) {
Expand Down
2 changes: 2 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ typedef enum {
VDEV_PROP_FGROUP,
VDEV_PROP_ALLOC_BIAS,
VDEV_PROP_ROTATIONAL,
VDEV_PROP_SHADOW,
VDEV_NUM_PROPS
} vdev_prop_t;

Expand Down Expand Up @@ -879,6 +880,7 @@ typedef struct zpool_load_policy {
#define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */
#define ZPOOL_CONFIG_CONDENSE_STATS "com.klarasystems:condense_stats"
#define ZPOOL_CONFIG_INDIRECT_SIZE "indirect_size" /* not stored on disk */
#define ZPOOL_VDEV_CONFIG_SHADOW "com.klarasystems:shadow_vdev"

/* container nvlist of extended stats */
#define ZPOOL_CONFIG_VDEV_STATS_EX "vdev_stats_ex"
Expand Down
2 changes: 2 additions & 0 deletions include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ struct vdev {
boolean_t vdev_kobj_flag; /* kobj event record */
boolean_t vdev_attaching; /* vdev attach ashift handling */
boolean_t vdev_is_blkdev; /* vdev is backed by block device */
/* vdev is shadow drive or has shadow children */
boolean_t vdev_shadow;
vdev_queue_t vdev_queue; /* I/O deadline schedule queue */
spa_aux_vdev_t *vdev_aux; /* for l2cache and spares vdevs */
zio_t *vdev_probe_zio; /* root of current probe */
Expand Down
1 change: 1 addition & 0 deletions include/zfeature_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ typedef enum spa_feature {
SPA_FEATURE_BLOCK_CLONING_ENDIAN,
SPA_FEATURE_PHYSICAL_REWRITE,
SPA_FEATURE_DRAID_FAIL_DOMAINS,
SPA_FEATURE_SHADOW_MIRROR,
SPA_FEATURES
} spa_feature_t;

Expand Down
Loading