View | Details | Raw Unified | Return to bug 230704
Collapse All | Expand All

(-)b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c (-9 / +12 lines)
Lines 415-423 vdev_geom_io(struct g_consumer *cp, int *cmds, void **datas, off_t *offsets, Link Here
415
 * least one valid label was found.
415
 * least one valid label was found.
416
 */
416
 */
417
static int
417
static int
418
vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
418
vdev_geom_read_config(struct g_consumer *cp, nvlist_t **configp)
419
{
419
{
420
	struct g_provider *pp;
420
	struct g_provider *pp;
421
	nvlist_t *config;
421
	vdev_phys_t *vdev_lists[VDEV_LABELS];
422
	vdev_phys_t *vdev_lists[VDEV_LABELS];
422
	char *buf;
423
	char *buf;
423
	size_t buflen;
424
	size_t buflen;
Lines 442-448 vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config) Link Here
442
443
443
	buflen = sizeof(vdev_lists[0]->vp_nvlist);
444
	buflen = sizeof(vdev_lists[0]->vp_nvlist);
444
445
445
	*config = NULL;
446
	/* Create all of the IO requests */
446
	/* Create all of the IO requests */
447
	for (l = 0; l < VDEV_LABELS; l++) {
447
	for (l = 0; l < VDEV_LABELS; l++) {
448
		cmds[l] = BIO_READ;
448
		cmds[l] = BIO_READ;
Lines 458-463 vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config) Link Here
458
	    VDEV_LABELS);
458
	    VDEV_LABELS);
459
459
460
	/* Parse the labels */
460
	/* Parse the labels */
461
	config = *configp = NULL;
461
	nlabels = 0;
462
	nlabels = 0;
462
	for (l = 0; l < VDEV_LABELS; l++) {
463
	for (l = 0; l < VDEV_LABELS; l++) {
463
		if (errors[l] != 0)
464
		if (errors[l] != 0)
Lines 465-489 vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config) Link Here
465
466
466
		buf = vdev_lists[l]->vp_nvlist;
467
		buf = vdev_lists[l]->vp_nvlist;
467
468
468
		if (nvlist_unpack(buf, buflen, config, 0) != 0)
469
		if (nvlist_unpack(buf, buflen, &config, 0) != 0)
469
			continue;
470
			continue;
470
471
471
		if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE,
472
		if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
472
		    &state) != 0 || state > POOL_STATE_L2CACHE) {
473
		    &state) != 0 || state > POOL_STATE_L2CACHE) {
473
			nvlist_free(*config);
474
			nvlist_free(config);
474
			*config = NULL;
475
			continue;
475
			continue;
476
		}
476
		}
477
477
478
		if (state != POOL_STATE_SPARE &&
478
		if (state != POOL_STATE_SPARE &&
479
		    state != POOL_STATE_L2CACHE &&
479
		    state != POOL_STATE_L2CACHE &&
480
		    (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_TXG,
480
		    (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG,
481
		    &txg) != 0 || txg == 0)) {
481
		    &txg) != 0 || txg == 0)) {
482
			nvlist_free(*config);
482
			nvlist_free(config);
483
			*config = NULL;
484
			continue;
483
			continue;
485
		}
484
		}
486
485
486
		if (*configp != NULL)
487
			nvlist_free(*configp);
488
		*configp = config;
489
487
		nlabels++;
490
		nlabels++;
488
	}
491
	}
489
492

Return to bug 230704