summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-11-20 10:29:52 -0800
committerBrian Behlendorf <[email protected]>2009-11-20 10:29:52 -0800
commit6d8a17ed454699d4f5c3a306c1b17f164a47a386 (patch)
treebdf3c446952e4f99d60292ced91334f9854b2e51
parent72d0900846228c1b47ec2dbcc2f9bdafd878d233 (diff)
parente007a57d4fdbdbcdf95bcc2c1a050d1191bdc3ad (diff)
Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch
-rw-r--r--config/kernel-bio-rw-syncio.m43
-rw-r--r--config/kernel-blk-end-request.m423
-rw-r--r--config/kernel-blk-rq-bytes.m422
-rw-r--r--config/kernel-rq-for-each_segment.m420
-rw-r--r--config/kernel.m41
-rw-r--r--module/zfs/zfs_rlock.c2
-rw-r--r--scripts/udev-rules/99-zpool.rules.promise41
-rwxr-xr-xscripts/zconfig.sh48
-rw-r--r--scripts/zpool-config/promise-raid0-1x16.sh20
-rw-r--r--scripts/zpool-config/promise-raid10-8x2.sh20
-rw-r--r--scripts/zpool-config/promise-raidz-2x8.sh20
-rw-r--r--scripts/zpool-config/promise-raidz2-2x8.sh20
12 files changed, 235 insertions, 5 deletions
diff --git a/config/kernel-bio-rw-syncio.m4 b/config/kernel-bio-rw-syncio.m4
index 93a32e659..2c80f5c0e 100644
--- a/config/kernel-bio-rw-syncio.m4
+++ b/config/kernel-bio-rw-syncio.m4
@@ -7,7 +7,8 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_SYNCIO], [
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
],[
- int flags = BIO_RW_SYNCIO;
+ int flags;
+ flags = BIO_RW_SYNCIO;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_RW_SYNCIO, 1,
diff --git a/config/kernel-blk-end-request.m4 b/config/kernel-blk-end-request.m4
index 6719516c1..20ad1a926 100644
--- a/config/kernel-blk-end-request.m4
+++ b/config/kernel-blk-end-request.m4
@@ -1,6 +1,8 @@
dnl #
-dnl # 2.6.18 API change
-nl #
+dnl # 2.6.31 API change
+dnl # In 2.6.29 kernels blk_end_request() was a GPL-only symbol, this was
+dnl # changed in 2.6.31 so it may be used by non-GPL modules.
+dnl #
AC_DEFUN([ZFS_AC_KERNEL_BLK_END_REQUEST], [
AC_MSG_CHECKING([whether blk_end_request() is available])
ZFS_LINUX_TRY_COMPILE([
@@ -15,4 +17,21 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_END_REQUEST], [
],[
AC_MSG_RESULT(no)
])
+
+ AC_MSG_CHECKING([whether blk_end_request() is GPL-only])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/module.h>
+ #include <linux/blkdev.h>
+
+ MODULE_LICENSE("CDDL");
+ ],[
+ struct request *req = NULL;
+ (void) blk_end_request(req, 0, 0);
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BLK_END_REQUEST_GPL_ONLY, 1,
+ [blk_end_request() is GPL-only])
+ ])
])
diff --git a/config/kernel-blk-rq-bytes.m4 b/config/kernel-blk-rq-bytes.m4
index 2655a8f00..da83405cb 100644
--- a/config/kernel-blk-rq-bytes.m4
+++ b/config/kernel-blk-rq-bytes.m4
@@ -1,5 +1,8 @@
dnl #
-dnl # 2.6.31 API change
+dnl # 2.6.29 API change
+dnl # In the 2.6.29 kernel blk_rq_bytes() was available as a GPL-only symbol.
+dnl # So we need to check the symbol license as well. As of 2.6.31 the
+dnl blk_rq_bytes() helper was changed to a static inline which we can use.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_BYTES], [
AC_MSG_CHECKING([whether blk_rq_bytes() is available])
@@ -15,4 +18,21 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_BYTES], [
],[
AC_MSG_RESULT(no)
])
+
+ AC_MSG_CHECKING([whether blk_rq_bytes() is GPL-only])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/module.h>
+ #include <linux/blkdev.h>
+
+ MODULE_LICENSE("CDDL");
+ ],[
+ struct request *req = NULL;
+ (void) blk_rq_bytes(req);
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BLK_RQ_BYTES_GPL_ONLY, 1,
+ [blk_rq_bytes() is GPL-only])
+ ])
])
diff --git a/config/kernel-rq-for-each_segment.m4 b/config/kernel-rq-for-each_segment.m4
new file mode 100644
index 000000000..15f030f35
--- /dev/null
+++ b/config/kernel-rq-for-each_segment.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 2.6.x API change
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT], [
+ AC_MSG_CHECKING([whether rq_for_each_segment() is available])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/blkdev.h>
+ ],[
+ struct bio_vec *bv;
+ struct req_iterator iter;
+ struct request *req = NULL;
+ rq_for_each_segment(bv, req, iter) { }
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_RQ_FOR_EACH_SEGMENT, 1,
+ [rq_for_each_segment() is available])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 415c92859..6ff4b05e5 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -19,6 +19,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_BLK_RQ_SECTORS
ZFS_AC_KERNEL_GET_DISK_RO
ZFS_AC_KERNEL_RQ_IS_SYNC
+ ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT
dnl # Kernel build make options
dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build
diff --git a/module/zfs/zfs_rlock.c b/module/zfs/zfs_rlock.c
index 4de8d8a2d..1e4988d7f 100644
--- a/module/zfs/zfs_rlock.c
+++ b/module/zfs/zfs_rlock.c
@@ -460,7 +460,7 @@ static void
zfs_range_unlock_reader(znode_t *zp, rl_t *remove)
{
avl_tree_t *tree = &zp->z_range_avl;
- rl_t *rl, *next;
+ rl_t *rl, *next = NULL;
uint64_t len;
/*
diff --git a/scripts/udev-rules/99-zpool.rules.promise b/scripts/udev-rules/99-zpool.rules.promise
new file mode 100644
index 000000000..8a32a539b
--- /dev/null
+++ b/scripts/udev-rules/99-zpool.rules.promise
@@ -0,0 +1,41 @@
+#
+# /etc/udev/rules.d/99-zpool.rules
+#
+
+ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p"
+
+# Full devices (*:pci*port:*:id-lun)
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:8-lun0", SYMLINK+="disk/zpool/a1"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:9-lun0", SYMLINK+="disk/zpool/a2"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:10-lun0", SYMLINK+="disk/zpool/a3"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:11-lun0", SYMLINK+="disk/zpool/a4"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:12-lun0", SYMLINK+="disk/zpool/a5"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:13-lun0", SYMLINK+="disk/zpool/a6"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:14-lun0", SYMLINK+="disk/zpool/a7"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:15-lun0", SYMLINK+="disk/zpool/a8"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:16-lun0", SYMLINK+="disk/zpool/b1"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:17-lun0", SYMLINK+="disk/zpool/b2"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:18-lun0", SYMLINK+="disk/zpool/b3"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:19-lun0", SYMLINK+="disk/zpool/b4"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:20-lun0", SYMLINK+="disk/zpool/b5"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:21-lun0", SYMLINK+="disk/zpool/b6"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:22-lun0", SYMLINK+="disk/zpool/b7"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="*:07:00.0*0:*:23-lun0", SYMLINK+="disk/zpool/b8"
+
+# Partitions (*:pci*port:*:id-lun)
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:8-lun0", SYMLINK+="disk/zpool/a1-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:9-lun0", SYMLINK+="disk/zpool/a2-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:10-lun0", SYMLINK+="disk/zpool/a3-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:11-lun0", SYMLINK+="disk/zpool/a4-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:12-lun0", SYMLINK+="disk/zpool/a5-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:13-lun0", SYMLINK+="disk/zpool/a6-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:14-lun0", SYMLINK+="disk/zpool/a7-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:15-lun0", SYMLINK+="disk/zpool/a8-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:16-lun0", SYMLINK+="disk/zpool/b1-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:17-lun0", SYMLINK+="disk/zpool/b2-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:18-lun0", SYMLINK+="disk/zpool/b3-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:19-lun0", SYMLINK+="disk/zpool/b4-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:20-lun0", SYMLINK+="disk/zpool/b5-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:21-lun0", SYMLINK+="disk/zpool/b6-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:22-lun0", SYMLINK+="disk/zpool/b7-part%n"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="*:07:00.0*0:*:23-lun0", SYMLINK+="disk/zpool/b8-part%n"
diff --git a/scripts/zconfig.sh b/scripts/zconfig.sh
index 7a215dcee..2968ad8dc 100755
--- a/scripts/zconfig.sh
+++ b/scripts/zconfig.sh
@@ -115,4 +115,52 @@ zconfig_test2() {
}
zconfig_test2
+# ZVOL sanity check
+zconfig_test3() {
+ POOL_NAME=tank
+ ZVOL_NAME=fish
+ FULL_NAME=${POOL_NAME}/${ZVOL_NAME}
+ SRC_DIR=/bin/
+ TMP_FILE1=`mktemp`
+ TMP_CACHE=`mktemp -p /tmp zpool.cache.XXXXXXXX`
+
+ echo -n "test 3 - ZVOL sanity: "
+
+ # Create a pool and volume.
+ ${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
+ ${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
+ ${ZFS} create -V 400M ${FULL_NAME} || fail 3
+
+ # Partition the volume, for a 400M volume there will be
+ # 812 cylinders, 16 heads, and 63 sectors per track.
+ /sbin/sfdisk -q /dev/${FULL_NAME} << EOF &>${TMP_FILE1} || fail 4
+,812
+;
+;
+;
+EOF
+
+ # Format the partition with ext3.
+ /sbin/mkfs.ext3 /dev/${FULL_NAME}1 &>${TMP_FILE1} || fail 5
+
+ # Mount the ext3 filesystem and copy some data to it.
+ mkdir -p /tmp/${ZVOL_NAME} || fail 6
+ mount /dev/${FULL_NAME}1 /tmp/${ZVOL_NAME} || fail 7
+ cp -RL ${SRC_DIR} /tmp/${ZVOL_NAME} || fail 8
+
+ # Verify the copied files match the original files.
+ diff -ur ${SRC_DIR} /tmp/${ZVOL_NAME}${SRC_DIR} || fail 9
+
+ # Remove the files, umount, destroy the volume and pool.
+ rm -Rf /tmp/${ZVOL_NAME}${SRC_DIR}* || fail 10
+ umount /tmp/${ZVOL_NAME} || fail 11
+ ${ZFS} destroy ${FULL_NAME} || fail 12
+ ${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 -d || fail 13
+ rm -f ${TMP_FILE1} || fail 14
+ ${ZFS_SH} -u || fail 15
+
+ pass
+}
+zconfig_test3
+
exit 0
diff --git a/scripts/zpool-config/promise-raid0-1x16.sh b/scripts/zpool-config/promise-raid0-1x16.sh
new file mode 100644
index 000000000..0136fe3a2
--- /dev/null
+++ b/scripts/zpool-config/promise-raid0-1x16.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Flash (White Box) Raid-0 Configuration (1x16)
+#
+
+RANKS=8
+CHANNELS=2
+
+zpool_create() {
+ udev_setup ${UDEVDIR}/99-zpool.rules.promise
+ udev_raid0_setup ${RANKS} ${CHANNELS}
+
+ msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]}
+ ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]} || exit 1
+}
+
+zpool_destroy() {
+ msg ${ZPOOL} destroy ${ZPOOL_NAME}
+ ${ZPOOL} destroy ${ZPOOL_NAME}
+}
diff --git a/scripts/zpool-config/promise-raid10-8x2.sh b/scripts/zpool-config/promise-raid10-8x2.sh
new file mode 100644
index 000000000..a16f0d0f5
--- /dev/null
+++ b/scripts/zpool-config/promise-raid10-8x2.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Flash (White Box) Raid-10 Configuration (10x2(1+1))
+#
+
+RANKS=8
+CHANNELS=2
+
+zpool_create() {
+ udev_setup ${UDEVDIR}/99-zpool.rules.promise
+ udev_raid10_setup ${RANKS} ${CHANNELS}
+
+ msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]}
+ ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]} || exit 1
+}
+
+zpool_destroy() {
+ msg ${ZPOOL} destroy ${ZPOOL_NAME}
+ ${ZPOOL} destroy ${ZPOOL_NAME}
+}
diff --git a/scripts/zpool-config/promise-raidz-2x8.sh b/scripts/zpool-config/promise-raidz-2x8.sh
new file mode 100644
index 000000000..0f6223f38
--- /dev/null
+++ b/scripts/zpool-config/promise-raidz-2x8.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Flash (White Box) Raid-Z Configuration (2x8(7+1))
+#
+
+RANKS=8
+CHANNELS=2
+
+zpool_create() {
+ udev_setup ${UDEVDIR}/99-zpool.rules.promise
+ udev_raidz_setup ${RANKS} ${CHANNELS}
+
+ msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]}
+ ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1
+}
+
+zpool_destroy() {
+ msg ${ZPOOL} destroy ${ZPOOL_NAME}
+ ${ZPOOL} destroy ${ZPOOL_NAME}
+}
diff --git a/scripts/zpool-config/promise-raidz2-2x8.sh b/scripts/zpool-config/promise-raidz2-2x8.sh
new file mode 100644
index 000000000..5b642dd22
--- /dev/null
+++ b/scripts/zpool-config/promise-raidz2-2x8.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Flash (White Box) Raid-Z2 Configuration (2x8(6+2))
+#
+
+RANKS=8
+CHANNELS=2
+
+zpool_create() {
+ udev_setup ${UDEVDIR}/99-zpool.rules.promise
+ udev_raidz2_setup ${RANKS} ${CHANNELS}
+
+ msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]}
+ ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
+}
+
+zpool_destroy() {
+ msg ${ZPOOL} destroy ${ZPOOL_NAME}
+ ${ZPOOL} destroy ${ZPOOL_NAME}
+}