Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch
This commit is contained in:
commit
1fcf8bdb82
|
@ -0,0 +1,21 @@
|
||||||
|
dnl #
|
||||||
|
dnl # 2.6.27 API change,
|
||||||
|
dnl # kobject KOBJ_NAME_LEN static limit removed. All users of this
|
||||||
|
dnl # constant were removed prior to 2.6.27, but to be on the safe
|
||||||
|
dnl # side this check ensures the constant is undefined.
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_KOBJ_NAME_LEN], [
|
||||||
|
AC_MSG_CHECKING([whether kernel defines KOBJ_NAME_LEN])
|
||||||
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/kobject.h>
|
||||||
|
],[
|
||||||
|
int val;
|
||||||
|
val = KOBJ_NAME_LEN;
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE(HAVE_KOBJ_NAME_LEN, 1,
|
||||||
|
[kernel defines KOBJ_NAME_LEN])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
])
|
||||||
|
])
|
|
@ -7,6 +7,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
||||||
ZFS_AC_KERNEL_CONFIG
|
ZFS_AC_KERNEL_CONFIG
|
||||||
ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
|
ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
|
||||||
ZFS_AC_KERNEL_TYPE_FMODE_T
|
ZFS_AC_KERNEL_TYPE_FMODE_T
|
||||||
|
ZFS_AC_KERNEL_KOBJ_NAME_LEN
|
||||||
ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
|
ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
|
||||||
ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
|
ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
|
||||||
ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE
|
ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE
|
||||||
|
|
|
@ -691,7 +691,7 @@ typedef struct ddt_histogram {
|
||||||
#define ZFS_DEV "/dev/zfs"
|
#define ZFS_DEV "/dev/zfs"
|
||||||
|
|
||||||
/* general zvol path */
|
/* general zvol path */
|
||||||
#define ZVOL_DIR "/dev/zvol"
|
#define ZVOL_DIR "/dev"
|
||||||
|
|
||||||
#define ZVOL_MAJOR 230
|
#define ZVOL_MAJOR 230
|
||||||
#define ZVOL_MINOR_BITS 4
|
#define ZVOL_MINOR_BITS 4
|
||||||
|
|
|
@ -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.
|
* which is the same as MAXNAMELEN used in the kernel.
|
||||||
* If ZFS_MAXNAMELEN value is changed, make sure to cleanup all
|
* If ZFS_MAXNAMELEN value is changed, make sure to cleanup all
|
||||||
* places using MAXNAMELEN.
|
* 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) {
|
if (strlen(path) >= MAXNAMELEN) {
|
||||||
|
#endif /* HAVE_KOBJ_NAME_LEN */
|
||||||
if (why)
|
if (why)
|
||||||
*why = NAME_ERR_TOOLONG;
|
*why = NAME_ERR_TOOLONG;
|
||||||
return (-1);
|
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.
|
* which is the same as MAXNAMELEN used in the kernel.
|
||||||
* If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
|
* If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
|
||||||
* places using MAXNAMELEN.
|
* 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) {
|
if (strlen(pool) >= MAXNAMELEN) {
|
||||||
|
#endif /* HAVE_KOBJ_NAME_LEN */
|
||||||
if (why)
|
if (why)
|
||||||
*why = NAME_ERR_TOOLONG;
|
*why = NAME_ERR_TOOLONG;
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
|
@ -1072,6 +1072,15 @@ vdev_open_child(void *arg)
|
||||||
boolean_t
|
boolean_t
|
||||||
vdev_uses_zvols(vdev_t *vd)
|
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;
|
int c;
|
||||||
|
|
||||||
if (vd->vdev_path && strncmp(vd->vdev_path, ZVOL_DIR,
|
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++)
|
for (c = 0; c < vd->vdev_children; c++)
|
||||||
if (vdev_uses_zvols(vd->vdev_child[c]))
|
if (vdev_uses_zvols(vd->vdev_child[c]))
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
|
#endif
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1066,7 +1066,7 @@ zvol_alloc(dev_t dev, const char *name)
|
||||||
zv->zv_disk->fops = &zvol_ops;
|
zv->zv_disk->fops = &zvol_ops;
|
||||||
zv->zv_disk->private_data = zv;
|
zv->zv_disk->private_data = zv;
|
||||||
zv->zv_disk->queue = zv->zv_queue;
|
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;
|
return zv;
|
||||||
|
|
||||||
|
|
|
@ -154,14 +154,14 @@ zconfig_test3() {
|
||||||
|
|
||||||
# Partition the volume, for a 400M volume there will be
|
# Partition the volume, for a 400M volume there will be
|
||||||
# 812 cylinders, 16 heads, and 63 sectors per track.
|
# 812 cylinders, 16 heads, and 63 sectors per track.
|
||||||
zconfig_partition /dev/zvol/${FULL_NAME} 0 812
|
zconfig_partition /dev/${FULL_NAME} 0 812
|
||||||
|
|
||||||
# Format the partition with ext3.
|
# Format the partition with ext3.
|
||||||
/sbin/mkfs.ext3 -q /dev/zvol/${FULL_NAME}1 || fail 5
|
/sbin/mkfs.ext3 -q /dev/${FULL_NAME}1 || fail 5
|
||||||
|
|
||||||
# Mount the ext3 filesystem and copy some data to it.
|
# Mount the ext3 filesystem and copy some data to it.
|
||||||
mkdir -p /tmp/${ZVOL_NAME} || fail 6
|
mkdir -p /tmp/${ZVOL_NAME} || fail 6
|
||||||
mount /dev/zvol/${FULL_NAME}1 /tmp/${ZVOL_NAME} || fail 7
|
mount /dev/${FULL_NAME}1 /tmp/${ZVOL_NAME} || fail 7
|
||||||
cp -RL ${SRC_DIR} /tmp/${ZVOL_NAME} || fail 8
|
cp -RL ${SRC_DIR} /tmp/${ZVOL_NAME} || fail 8
|
||||||
|
|
||||||
# Verify the copied files match the original files.
|
# Verify the copied files match the original files.
|
||||||
|
@ -180,12 +180,15 @@ zconfig_test3
|
||||||
|
|
||||||
zconfig_zvol_device_stat() {
|
zconfig_zvol_device_stat() {
|
||||||
local EXPECT=$1
|
local EXPECT=$1
|
||||||
local POOL_NAME=/dev/zvol/$2
|
local POOL_NAME=/dev/$2
|
||||||
local ZVOL_NAME=/dev/zvol/$3
|
local ZVOL_NAME=/dev/$3
|
||||||
local SNAP_NAME=/dev/zvol/$4
|
local SNAP_NAME=/dev/$4
|
||||||
local CLONE_NAME=/dev/zvol/$5
|
local CLONE_NAME=/dev/$5
|
||||||
local COUNT=0
|
local COUNT=0
|
||||||
|
|
||||||
|
# Briefly delay for udev
|
||||||
|
sleep 1
|
||||||
|
|
||||||
# Pool exists
|
# Pool exists
|
||||||
stat ${POOL_NAME} &>/dev/null && let COUNT=$COUNT+1
|
stat ${POOL_NAME} &>/dev/null && let COUNT=$COUNT+1
|
||||||
|
|
||||||
|
@ -216,7 +219,7 @@ zconfig_zvol_device_stat() {
|
||||||
zconfig_test4() {
|
zconfig_test4() {
|
||||||
local POOL_NAME=tank
|
local POOL_NAME=tank
|
||||||
local ZVOL_NAME=volume
|
local ZVOL_NAME=volume
|
||||||
local SNAP_NAME=snapshot
|
local SNAP_NAME=snap
|
||||||
local CLONE_NAME=clone
|
local CLONE_NAME=clone
|
||||||
local FULL_ZVOL_NAME=${POOL_NAME}/${ZVOL_NAME}
|
local FULL_ZVOL_NAME=${POOL_NAME}/${ZVOL_NAME}
|
||||||
local FULL_SNAP_NAME=${POOL_NAME}/${ZVOL_NAME}@${SNAP_NAME}
|
local FULL_SNAP_NAME=${POOL_NAME}/${ZVOL_NAME}@${SNAP_NAME}
|
||||||
|
@ -229,7 +232,7 @@ zconfig_test4() {
|
||||||
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
|
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
|
||||||
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
|
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
|
||||||
${ZFS} create -V 100M ${FULL_ZVOL_NAME} || fail 3
|
${ZFS} create -V 100M ${FULL_ZVOL_NAME} || fail 3
|
||||||
zconfig_partition /dev/zvol/${FULL_ZVOL_NAME} 0 64 || fail 4
|
zconfig_partition /dev/${FULL_ZVOL_NAME} 0 64 || fail 4
|
||||||
${ZFS} snapshot ${FULL_SNAP_NAME} || fail 5
|
${ZFS} snapshot ${FULL_SNAP_NAME} || fail 5
|
||||||
${ZFS} clone ${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 6
|
${ZFS} clone ${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 6
|
||||||
|
|
||||||
|
@ -245,7 +248,7 @@ zconfig_test4() {
|
||||||
${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9
|
${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9
|
||||||
|
|
||||||
# Import the pool, wait 1 second for udev
|
# Import the pool, wait 1 second for udev
|
||||||
${ZPOOL} import ${POOL_NAME} && sleep 1 || fail 10
|
${ZPOOL} import ${POOL_NAME} || fail 10
|
||||||
|
|
||||||
# Verify the devices were created
|
# Verify the devices were created
|
||||||
zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \
|
zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \
|
||||||
|
@ -268,7 +271,7 @@ zconfig_test4
|
||||||
zconfig_test5() {
|
zconfig_test5() {
|
||||||
POOL_NAME=tank
|
POOL_NAME=tank
|
||||||
ZVOL_NAME=volume
|
ZVOL_NAME=volume
|
||||||
SNAP_NAME=snapshot
|
SNAP_NAME=snap
|
||||||
CLONE_NAME=clone
|
CLONE_NAME=clone
|
||||||
FULL_ZVOL_NAME=${POOL_NAME}/${ZVOL_NAME}
|
FULL_ZVOL_NAME=${POOL_NAME}/${ZVOL_NAME}
|
||||||
FULL_SNAP_NAME=${POOL_NAME}/${ZVOL_NAME}@${SNAP_NAME}
|
FULL_SNAP_NAME=${POOL_NAME}/${ZVOL_NAME}@${SNAP_NAME}
|
||||||
|
@ -281,7 +284,7 @@ zconfig_test5() {
|
||||||
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
|
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
|
||||||
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
|
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
|
||||||
${ZFS} create -V 100M ${FULL_ZVOL_NAME} || fail 3
|
${ZFS} create -V 100M ${FULL_ZVOL_NAME} || fail 3
|
||||||
zconfig_partition /dev/zvol/${FULL_ZVOL_NAME} 0 64 || fail 4
|
zconfig_partition /dev/${FULL_ZVOL_NAME} 0 64 || fail 4
|
||||||
${ZFS} snapshot ${FULL_SNAP_NAME} || fail 5
|
${ZFS} snapshot ${FULL_SNAP_NAME} || fail 5
|
||||||
${ZFS} clone ${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 6
|
${ZFS} clone ${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 6
|
||||||
|
|
||||||
|
@ -297,7 +300,7 @@ zconfig_test5() {
|
||||||
${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9
|
${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9
|
||||||
|
|
||||||
# Load the modules, wait 1 second for udev
|
# Load the modules, wait 1 second for udev
|
||||||
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" && sleep 1 || fail 10
|
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 10
|
||||||
|
|
||||||
# Verify the devices were created
|
# Verify the devices were created
|
||||||
zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \
|
zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \
|
||||||
|
|
Loading…
Reference in New Issue