Date: Sun, 28 Oct 2012 15:54:15 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r242235 - stable/8/sys/boot/zfs Message-ID: <201210281554.q9SFsF8K043413@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Sun Oct 28 15:54:15 2012 New Revision: 242235 URL: http://svn.freebsd.org/changeset/base/242235 Log: MFC r241292: zfs loader: treat plain pool name as a name of its root dataset Modified: stable/8/sys/boot/zfs/zfs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/8/sys/boot/zfs/zfs.c ============================================================================== --- stable/8/sys/boot/zfs/zfs.c Sun Oct 28 15:54:01 2012 (r242234) +++ stable/8/sys/boot/zfs/zfs.c Sun Oct 28 15:54:15 2012 (r242235) @@ -533,12 +533,9 @@ zfs_parsedev(struct zfs_devdesc *dev, co if (!spa) return (ENXIO); dev->pool_guid = spa->spa_guid; - if (rootname[0] != '\0') { - rv = zfs_lookup_dataset(spa, rootname, &dev->root_guid); - if (rv != 0) - return (rv); - } else - dev->root_guid = 0; + rv = zfs_lookup_dataset(spa, rootname, &dev->root_guid); + if (rv != 0) + return (rv); if (path != NULL) *path = (*end == '\0') ? end : end + 1; dev->d_dev = &zfs_dev; @@ -558,9 +555,10 @@ zfs_fmtdev(void *vdev) if (dev->d_type != DEVT_ZFS) return (buf); - if (dev->pool_guid == 0) + if (dev->pool_guid == 0) { spa = STAILQ_FIRST(&zfs_pools); - else + dev->pool_guid = spa->spa_guid; + } else spa = spa_find_by_guid(dev->pool_guid); if (spa == NULL) { printf("ZFS: can't find pool by guid\n"); @@ -598,19 +596,17 @@ zfs_list(const char *name) if (dsname != NULL) { len = dsname - name; dsname++; - } + } else + dsname = ""; memcpy(poolname, name, len); poolname[len] = '\0'; spa = spa_find_by_name(poolname); if (!spa) return (ENXIO); - if (dsname != NULL) - rv = zfs_lookup_dataset(spa, dsname, &objid); - else - rv = zfs_get_root(spa, &objid); + rv = zfs_lookup_dataset(spa, dsname, &objid); if (rv != 0) return (rv); rv = zfs_list_dataset(spa, objid); - return (0); + return (rv); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210281554.q9SFsF8K043413>