Merge commit 'refs/top-bases/linux-kernel-mem' into linux-kernel-mem

This commit is contained in:
Brian Behlendorf 2009-01-20 17:04:16 -08:00
commit e87b476e37
3 changed files with 55 additions and 23 deletions

View File

@ -3,5 +3,5 @@ EXTRA_DIST = common.sh zfs-update.sh zfs.sh zpool-create.sh
check: check:
./zfs.sh -v ./zfs.sh -v
./zpios.sh -c lo-raid0 -t tiny -v ./zpios.sh -c file-raid0 -t tiny -v
./zfs.sh -vu ./zfs.sh -vu

View File

@ -0,0 +1,31 @@
#!/bin/bash
#
# 4 Device File Raid-0 Configuration
#
FILES="/tmp/zpool-vdev0 \
/tmp/zpool-vdev1 \
/tmp/zpool-vdev2 \
/tmp/zpool-vdev3"
zpool_create() {
for FILE in ${FILES}; do
msg "Creating ${FILE}"
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 status=noxfer &>/dev/null ||
die "Error $? creating ${FILE}"
done
msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES}
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} || exit 1
}
zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
msg "Removing ${FILE}"
rm -f ${FILE} || exit 1
done
}

View File

@ -1,38 +1,39 @@
#!/bin/bash #!/bin/bash
# #
# 5 Device Loopback Raid-0 Configuration # 4 Device Loopback Raid-0 Configuration
# #
DEVICES="/tmp/zpool-vdev0 \ FILES="/tmp/zpool-vdev0 \
/tmp/zpool-vdev1 \ /tmp/zpool-vdev1 \
/tmp/zpool-vdev2 \ /tmp/zpool-vdev2 \
/tmp/zpool-vdev3 \ /tmp/zpool-vdev3"
/tmp/zpool-vdev4" DEVICES=""
zpool_create() { zpool_create() {
for DEV in ${DEVICES}; do for FILE in ${FILES}; do
LO=`/sbin/losetup -f` DEVICE=`/sbin/losetup -f`
msg "Creating ${DEV} using loopback device ${LO}" msg "Creating ${FILE} using loopback device ${DEVICE}"
rm -f ${DEV} || exit 1 rm -f ${FILE} || exit 1
dd if=/dev/zero of=${DEV} bs=1024k count=256 status=noxfer &>/dev/null || dd if=/dev/zero of=${FILE} bs=1024k count=256 status=noxfer &>/dev/null ||
die "Error $? creating ${DEV}" die "Error $? creating ${FILE}"
losetup ${LO} ${DEV} || losetup ${DEVICE} ${FILE} ||
die "Error $? creating ${DEV} -> ${LO} loopback" die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES="${DEVICES} ${DEVICE}"
done done
msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES}
${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} || exit 1
} }
zpool_destroy() { zpool_destroy() {
msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for DEV in ${DEVICES}; do for FILE in ${FILES}; do
LO=`/sbin/losetup -a | grep ${DEV} | head -n1 | cut -f1 -d:` DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1 | cut -f1 -d:`
msg "Removing ${DEV} using loopback device ${LO}" msg "Removing ${FILE} using loopback device ${DEVICE}"
losetup -d ${LO} || losetup -d ${DEVICE} ||
die "Error $? destroying ${DEV} -> ${LO} loopback" die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${DEV} || exit 1 rm -f ${FILE} || exit 1
done done
} }