Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch

This commit is contained in:
Brian Behlendorf 2010-08-09 16:51:26 -07:00
commit acf6f07ace
4 changed files with 40 additions and 3 deletions

View File

@ -691,7 +691,7 @@ typedef struct ddt_histogram {
#define ZFS_DEV "/dev/zfs"
/* general zvol path */
#define ZVOL_DIR "/dev/zvol"
#define ZVOL_DIR "/dev"
#define ZVOL_MAJOR 230
#define ZVOL_MINOR_BITS 4

View File

@ -142,9 +142,22 @@ dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
* which is the same as MAXNAMELEN used in the kernel.
* If ZFS_MAXNAMELEN value is changed, make sure to cleanup all
* places using MAXNAMELEN.
*
* When HAVE_KOBJ_NAME_LEN is defined the maximum safe kobject name
* length is 20 bytes. This 20 bytes is broken down as follows to
* provide a maximum safe <pool>/<dataset>[@snapshot] length of only
* 18 bytes. To ensure bytes are left for <dataset>[@snapshot] the
* <pool> portition is futher limited to 9 bytes. For 2.6.27 and
* newer kernels this limit is set to MAXNAMELEN.
*
* <pool>/<dataset> + <partition> + <newline>
* (18) + (1) + (1)
*/
#ifdef HAVE_KOBJ_NAME_LEN
if (strlen(path) > 18) {
#else
if (strlen(path) >= MAXNAMELEN) {
#endif /* HAVE_KOBJ_NAME_LEN */
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);
@ -303,8 +316,22 @@ pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
* which is the same as MAXNAMELEN used in the kernel.
* If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
* places using MAXNAMELEN.
*
* When HAVE_KOBJ_NAME_LEN is defined the maximum safe kobject name
* length is 20 bytes. This 20 bytes is broken down as follows to
* provide a maximum safe <pool>/<dataset>[@snapshot] length of only
* 18 bytes. To ensure bytes are left for <dataset>[@snapshot] the
* <pool> portition is futher limited to 8 bytes. For 2.6.27 and
* newer kernels this limit is set to MAXNAMELEN.
*
* <pool>/<dataset> + <partition> + <newline>
* (18) + (1) + (1)
*/
#ifdef HAVE_KOBJ_NAME_LEN
if (strlen(pool) > 8) {
#else
if (strlen(pool) >= MAXNAMELEN) {
#endif /* HAVE_KOBJ_NAME_LEN */
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);

View File

@ -1072,6 +1072,15 @@ vdev_open_child(void *arg)
boolean_t
vdev_uses_zvols(vdev_t *vd)
{
/*
* Stacking zpools on top of zvols is unsupported until we implement a method
* for determining if an arbitrary block device is a zvol without using the
* path. Solaris would check the 'zvol' path component but this does not
* exist in the Linux port, so we really should do something like stat the
* file and check the major number. This is complicated by the fact that
* we need to do this portably in user or kernel space.
*/
#if 0
int c;
if (vd->vdev_path && strncmp(vd->vdev_path, ZVOL_DIR,
@ -1080,6 +1089,7 @@ vdev_uses_zvols(vdev_t *vd)
for (c = 0; c < vd->vdev_children; c++)
if (vdev_uses_zvols(vd->vdev_child[c]))
return (B_TRUE);
#endif
return (B_FALSE);
}

View File

@ -1066,7 +1066,7 @@ zvol_alloc(dev_t dev, const char *name)
zv->zv_disk->fops = &zvol_ops;
zv->zv_disk->private_data = zv;
zv->zv_disk->queue = zv->zv_queue;
snprintf(zv->zv_disk->disk_name, DISK_NAME_LEN, "zvol/%s", name);
snprintf(zv->zv_disk->disk_name, DISK_NAME_LEN, "%s", name);
return zv;