Skip to content

Commit

Permalink
Merge branch 'ashift12' into untested
Browse files Browse the repository at this point in the history
Conflicts:
	usr/src/cmd/zpool/zpool_main.c
	usr/src/common/zfs/zfs_prop.c
	usr/src/uts/common/fs/zfs/dsl_prop.c
	usr/src/uts/common/sys/fs/zfs.h

Integrated the ashift12 implementation for maczfs_74 into untested
maczfs_78.  This version compiles, but panics at disk attach.  The
backtrace dies in the file system mount path, and a test with the
unmodified untested branch and a fresh disk image paniced also.
So the panic is most likely not related to the ashift implementation.
  • Loading branch information
BjoKaSH committed Aug 6, 2012
2 parents 6b826d6 + 721b31c commit 70dff54
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
6 changes: 3 additions & 3 deletions usr/src/cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ zpool_do_add(int argc, char **argv)
}

/* pass off to get_vdev_spec for processing */
nvroot = make_root_vdev(zhp, force, !force, B_FALSE, argc, argv);
nvroot = make_root_vdev(zhp, NULL, force, !force, B_FALSE, argc, argv);
if (nvroot == NULL) {
zpool_close(zhp);
return (1);
Expand Down Expand Up @@ -657,7 +657,7 @@ zpool_do_create(int argc, char **argv)
}

/* pass off to get_vdev_spec for bulk processing */
nvroot = make_root_vdev(NULL, force, !force, B_FALSE, argc - 1,
nvroot = make_root_vdev(NULL, props, force, !force, B_FALSE, argc - 1,
argv + 1);
if (nvroot == NULL)
return (1);
Expand Down Expand Up @@ -2264,7 +2264,7 @@ zpool_do_attach_or_replace(int argc, char **argv, int replacing)
return (1);
}

nvroot = make_root_vdev(zhp, force, B_FALSE, replacing, argc, argv);
nvroot = make_root_vdev(zhp, NULL, force, B_FALSE, replacing, argc, argv);
if (nvroot == NULL) {
zpool_close(zhp);
return (1);
Expand Down
2 changes: 1 addition & 1 deletion usr/src/cmd/zpool/zpool_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uint_t num_logs(nvlist_t *nv);
* Virtual device functions
*/

nvlist_t *make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
nvlist_t *make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep,
boolean_t isreplace, int argc, char **argv);

/*
Expand Down
26 changes: 20 additions & 6 deletions usr/src/cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ is_whole_disk(const char *arg)
* xxx Shorthand for /dev/dsk/xxx
*/
static nvlist_t *
make_leaf_vdev(const char *arg, uint64_t is_log)
make_leaf_vdev(nvlist_t *props, const char *arg, uint64_t is_log)
{
char path[MAXPATHLEN];
struct stat64 statbuf;
Expand Down Expand Up @@ -540,6 +540,20 @@ make_leaf_vdev(const char *arg, uint64_t is_log)
(void) close(fd);
}

if (props != NULL) {

uint64_t ashift = 0;
char *value = NULL;

if (nvlist_lookup_string(props,
zpool_prop_to_name(ZPOOL_PROP_ASHIFT), &value) == 0)
zfs_nicestrtonum(NULL, value, &ashift);

if (ashift > 0)
verify(nvlist_add_uint64(vdev, ZPOOL_CONFIG_ASHIFT,
ashift) == 0);
}

return (vdev);
}

Expand Down Expand Up @@ -1180,7 +1194,7 @@ is_grouping(const char *type, int *mindev)
* because the program is just going to exit anyway.
*/
nvlist_t *
construct_spec(int argc, char **argv)
construct_spec(nvlist_t *props, int argc, char **argv)
{
nvlist_t *nvroot, *nv, **top, **spares, **l2cache;
int t, toplevels, mindev, nspares, nlogs, nl2cache;
Expand Down Expand Up @@ -1269,7 +1283,7 @@ construct_spec(int argc, char **argv)
children * sizeof (nvlist_t *));
if (child == NULL)
zpool_no_memory();
if ((nv = make_leaf_vdev(argv[c], B_FALSE))
if ((nv = make_leaf_vdev(props, argv[c], B_FALSE))
== NULL)
return (NULL);
child[children - 1] = nv;
Expand Down Expand Up @@ -1318,7 +1332,7 @@ construct_spec(int argc, char **argv)
* We have a device. Pass off to make_leaf_vdev() to
* construct the appropriate nvlist describing the vdev.
*/
if ((nv = make_leaf_vdev(argv[0], is_log)) == NULL)
if ((nv = make_leaf_vdev(props, argv[0], is_log)) == NULL)
return (NULL);
if (is_log)
nlogs++;
Expand Down Expand Up @@ -1388,7 +1402,7 @@ construct_spec(int argc, char **argv)
* added, even if they appear in use.
*/
nvlist_t *
make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep,
boolean_t isreplacing, int argc, char **argv)
{
nvlist_t *newroot;
Expand All @@ -1400,7 +1414,7 @@ make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
* that we have a valid specification, and that all devices can be
* opened.
*/
if ((newroot = construct_spec(argc, argv)) == NULL)
if ((newroot = construct_spec(props, argc, argv)) == NULL)
return (NULL);

if (zhp && ((poolconfig = zpool_get_config(zhp, NULL)) == NULL))
Expand Down
5 changes: 5 additions & 0 deletions usr/src/common/zfs/zfs_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,15 @@ zfs_prop_init(void)
register_number(ZFS_PROP_COMPRESSRATIO, "compressratio", 0,
PROP_READONLY, ZFS_TYPE_DATASET,
"<1.00x or higher if compressed>", "RATIO");

/* readonly onetime number properties */
register_number(ZPOOL_PROP_ASHIFT, "ashift", 0, PROP_ONETIME,
ZFS_TYPE_POOL, "<ashift, 9-17, or 0=default>", "ASHIFT");
register_number(ZFS_PROP_VOLBLOCKSIZE, "volblocksize", 8192,
PROP_ONETIME,
ZFS_TYPE_VOLUME, "512 to 128k, power of 2", "VOLBLOCK");


/* default number properties */
register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT,
ZFS_TYPE_FILESYSTEM, "<size> | none", "QUOTA");
Expand Down
1 change: 1 addition & 0 deletions usr/src/uts/common/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ typedef enum {
ZPOOL_PROP_AUTOREPLACE,
ZPOOL_PROP_CACHEFILE,
ZPOOL_PROP_FAILUREMODE,
ZPOOL_PROP_ASHIFT,
ZPOOL_NUM_PROPS
} zpool_prop_t;

Expand Down

1 comment on commit 70dff54

@BjoKaSH
Copy link
Owner Author

@BjoKaSH BjoKaSH commented on 70dff54 Aug 8, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note:
I discovered this commit went to the wrong branch. So I moved it from untested to untested_ashift on 2012-08-08. Sorry for the confusion, I hope this doesn't produced to much trouble when pulling from pushing to the untested branch.

Please sign in to comment.