Deleted Added
full compact
vdev_geom.c (294027) vdev_geom.c (294329)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 47 unchanged lines hidden (view full) ---

56static int vdev_geom_bio_flush_disable;
57SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_flush_disable, CTLFLAG_RWTUN,
58 &vdev_geom_bio_flush_disable, 0, "Disable BIO_FLUSH");
59/* Don't send BIO_DELETE. */
60static int vdev_geom_bio_delete_disable;
61SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RWTUN,
62 &vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE");
63
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 47 unchanged lines hidden (view full) ---

56static int vdev_geom_bio_flush_disable;
57SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_flush_disable, CTLFLAG_RWTUN,
58 &vdev_geom_bio_flush_disable, 0, "Disable BIO_FLUSH");
59/* Don't send BIO_DELETE. */
60static int vdev_geom_bio_delete_disable;
61SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RWTUN,
62 &vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE");
63
64/*
65 * Thread local storage used to indicate when a thread is probing geoms
66 * for their guids. If NULL, this thread is not tasting geoms. If non NULL,
67 * it is looking for a replacement for the vdev_t* that is its value.
68 */
69uint_t zfs_geom_probe_vdev_key;
70
64static void
65vdev_geom_set_rotation_rate(vdev_t *vd, struct g_consumer *cp)
66{
67 int error;
68 uint16_t rate;
69
70 error = g_getattr("GEOM::rotation_rate", cp, &rate);
71 if (error == 0)

--- 249 unchanged lines hidden (view full) ---

321
322 g_destroy_bio(bp);
323 return (error);
324}
325
326static void
327vdev_geom_taste_orphan(struct g_consumer *cp)
328{
71static void
72vdev_geom_set_rotation_rate(vdev_t *vd, struct g_consumer *cp)
73{
74 int error;
75 uint16_t rate;
76
77 error = g_getattr("GEOM::rotation_rate", cp, &rate);
78 if (error == 0)

--- 249 unchanged lines hidden (view full) ---

328
329 g_destroy_bio(bp);
330 return (error);
331}
332
333static void
334vdev_geom_taste_orphan(struct g_consumer *cp)
335{
329
330 KASSERT(1 == 0, ("%s called while tasting %s.", __func__,
331 cp->provider->name));
336 ZFS_LOG(0, "WARNING: Orphan %s while tasting its VDev GUID.",
337 cp->provider->name);
332}
333
334static int
335vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
336{
337 struct g_provider *pp;
338 vdev_label_t *label;
339 char *p, *buf;

--- 230 unchanged lines hidden (view full) ---

570 struct g_geom *gp, *zgp;
571 struct g_provider *pp;
572 struct g_consumer *cp, *zcp;
573 uint64_t pguid, vguid;
574
575 g_topology_assert();
576
577 zgp = g_new_geomf(&zfs_vdev_class, "zfs::vdev::taste");
338}
339
340static int
341vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
342{
343 struct g_provider *pp;
344 vdev_label_t *label;
345 char *p, *buf;

--- 230 unchanged lines hidden (view full) ---

576 struct g_geom *gp, *zgp;
577 struct g_provider *pp;
578 struct g_consumer *cp, *zcp;
579 uint64_t pguid, vguid;
580
581 g_topology_assert();
582
583 zgp = g_new_geomf(&zfs_vdev_class, "zfs::vdev::taste");
578 /* This orphan function should be never called. */
579 zgp->orphan = vdev_geom_taste_orphan;
580 zcp = g_new_consumer(zgp);
581
582 cp = NULL;
583 LIST_FOREACH(mp, &g_classes, class) {
584 if (mp == &zfs_vdev_class)
585 continue;
586 LIST_FOREACH(gp, &mp->geom, geom) {

--- 110 unchanged lines hidden (view full) ---

697vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
698 uint64_t *logical_ashift, uint64_t *physical_ashift)
699{
700 struct g_provider *pp;
701 struct g_consumer *cp;
702 size_t bufsize;
703 int error;
704
584 zgp->orphan = vdev_geom_taste_orphan;
585 zcp = g_new_consumer(zgp);
586
587 cp = NULL;
588 LIST_FOREACH(mp, &g_classes, class) {
589 if (mp == &zfs_vdev_class)
590 continue;
591 LIST_FOREACH(gp, &mp->geom, geom) {

--- 110 unchanged lines hidden (view full) ---

702vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
703 uint64_t *logical_ashift, uint64_t *physical_ashift)
704{
705 struct g_provider *pp;
706 struct g_consumer *cp;
707 size_t bufsize;
708 int error;
709
710 /* Set the TLS to indicate downstack that we should not access zvols*/
711 VERIFY(tsd_set(zfs_geom_probe_vdev_key, vd) == 0);
712
705 /*
706 * We must have a pathname, and it must be absolute.
707 */
708 if (vd->vdev_path == NULL || vd->vdev_path[0] != '/') {
709 vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL;
710 return (EINVAL);
711 }
712

--- 33 unchanged lines hidden (view full) ---

746 * expected GUIDs. The disks might have merely
747 * moved around so try all other GEOM providers
748 * to find one with the right GUIDs.
749 */
750 cp = vdev_geom_open_by_guids(vd);
751 }
752 }
753
713 /*
714 * We must have a pathname, and it must be absolute.
715 */
716 if (vd->vdev_path == NULL || vd->vdev_path[0] != '/') {
717 vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL;
718 return (EINVAL);
719 }
720

--- 33 unchanged lines hidden (view full) ---

754 * expected GUIDs. The disks might have merely
755 * moved around so try all other GEOM providers
756 * to find one with the right GUIDs.
757 */
758 cp = vdev_geom_open_by_guids(vd);
759 }
760 }
761
762 /* Clear the TLS now that tasting is done */
763 VERIFY(tsd_set(zfs_geom_probe_vdev_key, NULL) == 0);
764
754 if (cp == NULL) {
755 ZFS_LOG(1, "Provider %s not found.", vd->vdev_path);
756 error = ENOENT;
757 } else if (cp->provider->sectorsize > VDEV_PAD_SIZE ||
758 !ISP2(cp->provider->sectorsize)) {
759 ZFS_LOG(1, "Provider %s has unsupported sectorsize.",
760 vd->vdev_path);
761

--- 229 unchanged lines hidden ---
765 if (cp == NULL) {
766 ZFS_LOG(1, "Provider %s not found.", vd->vdev_path);
767 error = ENOENT;
768 } else if (cp->provider->sectorsize > VDEV_PAD_SIZE ||
769 !ISP2(cp->provider->sectorsize)) {
770 ZFS_LOG(1, "Provider %s has unsupported sectorsize.",
771 vd->vdev_path);
772

--- 229 unchanged lines hidden ---