Mercurial > illumos > illumos-gate
changeset 6623:4fb57ca6f341
6680459 vdc should define Nblocks/Size as dynamic properties
6694540 disks are not correctly exported with EMC powerpath
6695641 assert failure in vds:vd_recv_msg() when resuming a suspended domain
author | achartre |
---|---|
date | Mon, 12 May 2008 17:38:19 -0700 |
parents | 32bad894a7d6 |
children | 65afd9d914d7 |
files | usr/src/uts/sun4v/io/vdc.c usr/src/uts/sun4v/io/vds.c usr/src/uts/sun4v/sys/vdc.h |
diffstat | 3 files changed, 44 insertions(+), 118 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/sun4v/io/vdc.c Mon May 12 17:34:35 2008 -0700 +++ b/usr/src/uts/sun4v/io/vdc.c Mon May 12 17:38:19 2008 -0700 @@ -120,6 +120,8 @@ void *arg, void **resultp); static int vdc_attach(dev_info_t *dip, ddi_attach_cmd_t cmd); static int vdc_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); +static int vdc_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, + int mod_flags, char *name, caddr_t valuep, int *lengthp); /* setup */ static void vdc_min(struct buf *bufp); @@ -129,7 +131,6 @@ static int vdc_create_device_nodes(vdc_t *vdc); static int vdc_create_device_nodes_efi(vdc_t *vdc); static int vdc_create_device_nodes_vtoc(vdc_t *vdc); -static int vdc_create_device_nodes_props(vdc_t *vdc); static void vdc_create_io_kstats(vdc_t *vdc); static void vdc_create_err_kstats(vdc_t *vdc); static void vdc_set_err_kstats(vdc_t *vdc); @@ -285,7 +286,7 @@ nodev, /* cb_mmap */ nodev, /* cb_segmap */ nochpoll, /* cb_chpoll */ - ddi_prop_op, /* cb_prop_op */ + vdc_prop_op, /* cb_prop_op */ NULL, /* cb_str */ D_MP | D_64BIT, /* cb_flag */ CB_REV, /* cb_rev */ @@ -516,10 +517,8 @@ if (ownership_tid != 0) thread_join(ownership_tid); - if (vdc->initialized & VDC_MINOR) { - ddi_prop_remove_all(dip); + if (vdc->initialized & VDC_MINOR) ddi_remove_minor_node(dip, NULL); - } if (vdc->io_stats) { kstat_delete(vdc->io_stats); @@ -701,8 +700,7 @@ mutex_exit(&vdc->lock); /* - * Now that we have the device info we can create the - * device nodes and properties + * Now that we have the device info we can create the device nodes */ status = vdc_create_device_nodes(vdc); if (status) { @@ -710,12 +708,6 @@ instance); goto return_status; } - status = vdc_create_device_nodes_props(vdc); - if (status) { - DMSG(vdc, 0, "[%d] Failed to create device nodes" - " properties (%d)", instance, status); - goto return_status; - } /* * Setup devid @@ -1008,9 +1000,9 @@ * * Description: * This function creates the block and character device nodes under - * /devices along with the node properties. It is called as part of - * the attach(9E) of the instance during the handshake with vds after - * vds has sent the attributes to vdc. + * /devices. It is called as part of the attach(9E) of the instance + * during the handshake with vds after vds has sent the attributes + * to vdc. * * If the device is of type VD_DISK_TYPE_SLICE then the minor node * of 2 is used in keeping with the Solaris convention that slice 2 @@ -1093,88 +1085,38 @@ } /* - * Function: - * vdc_create_device_nodes_props - * - * Description: - * This function creates the block and character device nodes under - * /devices along with the node properties. It is called as part of - * the attach(9E) of the instance during the handshake with vds after - * vds has sent the attributes to vdc. - * - * Parameters: - * vdc - soft state pointer - * - * Return Values - * 0 - Success - * EIO - Failed to create device node property - * EINVAL - Unknown type of disk exported + * Driver prop_op(9e) entry point function. Return the number of blocks for + * the partition in question or forward the request to the property facilities. */ static int -vdc_create_device_nodes_props(vdc_t *vdc) +vdc_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, int mod_flags, + char *name, caddr_t valuep, int *lengthp) { - dev_info_t *dip = NULL; - int instance; - int num_slices = 1; - int64_t size = 0; - dev_t dev; - int rv; - int i; - - ASSERT(vdc != NULL); - - instance = vdc->instance; - dip = vdc->dip; - - switch (vdc->vdisk_type) { - case VD_DISK_TYPE_DISK: - num_slices = V_NUMPAR; - break; - case VD_DISK_TYPE_SLICE: - num_slices = 1; - break; - case VD_DISK_TYPE_UNK: - default: - return (EINVAL); - } - + int instance = ddi_get_instance(dip); + vdc_t *vdc; + uint64_t nblocks; + uint_t blksize; + + vdc = ddi_get_soft_state(vdc_state, instance); + + if (dev == DDI_DEV_T_ANY || vdc == NULL) { + return (ddi_prop_op(dev, dip, prop_op, mod_flags, + name, valuep, lengthp)); + } + + mutex_enter(&vdc->lock); + (void) vdc_validate_geometry(vdc); if (vdc->vdisk_label == VD_DISK_LABEL_UNK) { - /* remove all properties */ - for (i = 0; i < num_slices; i++) { - dev = makedevice(ddi_driver_major(dip), - VD_MAKE_DEV(instance, i)); - (void) ddi_prop_remove(dev, dip, VDC_SIZE_PROP_NAME); - (void) ddi_prop_remove(dev, dip, VDC_NBLOCKS_PROP_NAME); - } - return (0); - } - - for (i = 0; i < num_slices; i++) { - dev = makedevice(ddi_driver_major(dip), - VD_MAKE_DEV(instance, i)); - - size = vdc->slice[i].nblocks * vdc->block_size; - DMSG(vdc, 0, "[%d] sz %ld (%ld Mb) p_size %lx\n", - instance, size, size / (1024 * 1024), - vdc->slice[i].nblocks); - - rv = ddi_prop_update_int64(dev, dip, VDC_SIZE_PROP_NAME, size); - if (rv != DDI_PROP_SUCCESS) { - cmn_err(CE_NOTE, "[%d] Couldn't add '%s' prop of [%ld]", - instance, VDC_SIZE_PROP_NAME, size); - return (EIO); - } - - rv = ddi_prop_update_int64(dev, dip, VDC_NBLOCKS_PROP_NAME, - lbtodb(size)); - if (rv != DDI_PROP_SUCCESS) { - cmn_err(CE_NOTE, "[%d] Couldn't add '%s' prop [%llu]", - instance, VDC_NBLOCKS_PROP_NAME, lbtodb(size)); - return (EIO); - } - } - - return (0); + mutex_exit(&vdc->lock); + return (ddi_prop_op(dev, dip, prop_op, mod_flags, + name, valuep, lengthp)); + } + nblocks = vdc->slice[VDCPART(dev)].nblocks; + blksize = vdc->block_size; + mutex_exit(&vdc->lock); + + return (ddi_prop_op_nblocks_blksize(dev, dip, prop_op, mod_flags, + name, valuep, lengthp, nblocks, blksize)); } /* @@ -7296,8 +7238,7 @@ if (dir == VD_COPYOUT) { /* * The disk label may have changed. Revalidate the disk - * geometry. This will also update the device nodes and - * properties. + * geometry. This will also update the device nodes. */ vdc_validate(vdc); @@ -7471,8 +7412,7 @@ if (dir == VD_COPYOUT) { /* * The disk label may have changed. Revalidate the disk - * geometry. This will also update the device nodes and - * properties. + * geometry. This will also update the device nodes. */ vdc_validate(vdc); return (0); @@ -7818,15 +7758,6 @@ } } - /* if the vtoc has changed, update device nodes properties */ - if (bcmp(vdc->slice, &old_slice, sizeof (vd_slice_t) * V_NUMPAR) != 0) { - - if (vdc_create_device_nodes_props(vdc) != 0) { - DMSG(vdc, 0, "![%d] Failed to update device nodes" - " properties", vdc->instance); - } - } - mutex_exit(&vdc->lock); }
--- a/usr/src/uts/sun4v/io/vds.c Mon May 12 17:34:35 2008 -0700 +++ b/usr/src/uts/sun4v/io/vds.c Mon May 12 17:38:19 2008 -0700 @@ -153,6 +153,7 @@ vd_driver_type_t vds_driver_types[] = { { "dad", VD_DRIVER_DISK }, /* Solaris */ { "did", VD_DRIVER_DISK }, /* Sun Cluster */ + { "emcp", VD_DRIVER_DISK }, /* EMC Powerpath */ { "lofi", VD_DRIVER_VOLUME }, /* Solaris */ { "md", VD_DRIVER_VOLUME }, /* Solaris - SVM */ { "sd", VD_DRIVER_DISK }, /* Solaris */ @@ -5508,6 +5509,11 @@ PRN("Could not create task queue"); return (EIO); } + + /* Allocate the staging buffer */ + vd->max_msglen = sizeof (vio_msg_t); /* baseline vio message size */ + vd->vio_msgp = kmem_alloc(vd->max_msglen, KM_SLEEP); + vd->enabled = 1; /* before callback can dispatch to startq */ @@ -5554,10 +5560,6 @@ return (EIO); } - /* Allocate the staging buffer */ - vd->max_msglen = sizeof (vio_msg_t); /* baseline vio message size */ - vd->vio_msgp = kmem_alloc(vd->max_msglen, KM_SLEEP); - /* store initial state */ vd->state = VD_STATE_INIT;
--- a/usr/src/uts/sun4v/sys/vdc.h Mon May 12 17:34:35 2008 -0700 +++ b/usr/src/uts/sun4v/sys/vdc.h Mon May 12 17:38:19 2008 -0700 @@ -64,13 +64,6 @@ #define VDC_HANDSHAKE_STOP 0x0200 /* stop further handshakes */ /* - * Definitions of strings to be used to create device node properties. - * (vdc uses the capitalised versions of these properties as they are 64-bit) - */ -#define VDC_NBLOCKS_PROP_NAME "Nblocks" -#define VDC_SIZE_PROP_NAME "Size" - -/* * Definitions of MD nodes/properties. */ #define VDC_MD_CHAN_NAME "channel-endpoint"