vdev_disk.c revision ecc2d604e885a75cc75e647b5641af99d5a6f4a6
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/zfs_context.h>
#include <sys/vdev_disk.h>
#include <sys/vdev_impl.h>
/*
* Virtual device vector for disks.
*/
extern ldi_ident_t zfs_li;
typedef struct vdev_disk_buf {
static int
{
int error;
/*
* We must have a pathname, and it must be absolute.
*/
return (EINVAL);
}
/*
* When opening a disk device, we want to preserve the user's original
* intent. We always want to open the device by the path the user gave
* us, even if it is one of multiple paths to the save device. But we
* Therefore the sequence of opening devices is:
*
* 1. Try opening the device by path. For legacy pools without the
* 'whole_disk' property, attempt to fix the path by appending 's0'.
*
* 2. If the devid of the device matches the stored value, return
* success.
*
* 3. Otherwise, the device may have moved. Try opening the device
* by the devid instead.
*
*/
return (EINVAL);
}
}
} else {
}
}
/*
* Compare the devid to the stored value.
*/
}
}
/*
* If we succeeded in opening the device, but 'vdev_wholedisk'
* is not yet set, then this must be a slice.
*/
vd->vdev_wholedisk = 0;
}
/*
* If we were unable to open by path, or the devid check fails, open by
* devid instead.
*/
if (error) {
return (error);
}
/*
* Determine the actual size of the device.
*/
return (EINVAL);
}
/*
* If we own the whole disk, try to enable disk write caching.
* We ignore errors because it's OK if we can't do it.
*/
int wce = 1;
}
/*
* Determine the device's minimum transfer size.
* If the ioctl isn't supported, assume DEV_BSIZE.
*/
return (0);
}
static void
{
return;
dprintf("removing disk %s, devid %s\n",
}
static void
{
}
static void
{
}
static void
{
/* XXPOLICY */
if (vdev_is_dead(vd)) {
return;
}
case DKIOCFLUSHWRITECACHE:
if (error == 0) {
/*
* The ioctl will be done asychronously,
* and will call vdev_disk_ioctl_done()
* upon completion.
*/
return;
}
break;
default:
}
return;
}
return;
return;
flags |= B_FAILFAST;
/* XXPOLICY */
if (error) {
return;
}
/* ldi_strategy() will return non-zero only on programming errors */
}
static void
{
}
NULL,
VDEV_TYPE_DISK, /* name of this vdev type */
B_TRUE /* leaf vdev */
};