From 36f86a8a6a567b3231fbe069c61d3e13d1eb7b64 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sun, 24 Jul 2011 16:01:13 -0700 Subject: [PATCH] Set refquota on when fssize provided When a filesystem of a specific size is requested the the refquota. This is going to be an artificial limit since zfs uses pooled storage but that can be helpful when running tests which are designed to fill the entire filesystem. Additionally, update the scratch fs creation to first destroy the previous dataset and then create a new one. --- common.rc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common.rc b/common.rc index b50c695f8..e00d0183c 100644 --- a/common.rc +++ b/common.rc @@ -313,9 +313,10 @@ _scratch_mkfs() zfs) # SCRATCH_DEV must be of the form 'pool/dataset' /sbin/zfs list -H $SCRATCH_DEV > /dev/null 2>&1 - if [ "$?" != "0" ]; then - /sbin/zfs create -o mountpoint=legacy $SCRATCH_DEV + if [ "$?" = "0" ]; then + /sbin/zfs destroy -f $SCRATCH_DEV fi + /sbin/zfs create -o mountpoint=legacy $SCRATCH_DEV ;; *) /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV @@ -343,12 +344,12 @@ _scratch_mkfs_sized() /sbin/mkfs.$FSTYP $MKFS_OPTIONS $SCRATCH_DEV -b $fssize ;; zfs) - # No size required due to the nature of pooled storage # SCRATCH_DEV must be of the form 'pool/dataset' /sbin/zfs list -H $SCRATCH_DEV > /dev/null 2>&1 - if [ "$?" != "0" ]; then - /sbin/zfs create -o mountpoint=legacy $SCRATCH_DEV + if [ "$?" = "0" ]; then + /sbin/zfs destroy -f $SCRATCH_DEV fi + /sbin/zfs create -o mountpoint=legacy -o refquota=$fssize $SCRATCH_DEV ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"