From: Eric Sandeen Date: Fri, 5 Feb 2010 17:03:01 +0000 (-0600) Subject: xfstests: routine to create scratch of certain size X-Git-Tag: v1.1.0~199 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e7c87cd480cefd2e4a66cc6d63dbf2f3c4ab0a10;p=xfstests-dev.git xfstests: routine to create scratch of certain size This is needed for later enospc tests to be generic We have to explicitly call the mkfs rather than _scratch_mkfs since extN wants nr-of-blocks as an argument -after- the device name. Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- diff --git a/common.rc b/common.rc index 1edea2f6..0a02a2b9 100644 --- a/common.rc +++ b/common.rc @@ -305,6 +305,29 @@ _scratch_mkfs() esac } +# Create fs of certain size on scratch device +# _scratch_mkfs_sized [optional blocksize] +_scratch_mkfs_sized() +{ + fssize=$1 + blocksize=$2 + [ -z "$blocksize" ] && blocksize=4096 + let blocks=$fssize/$blocksize + + case $FSTYP in + xfs) + _scratch_mkfs_xfs -d size=$fssize -b size=$blocksize + ;; + ext2|ext3|ext4) + /sbin/mkfs.$FSTYP -b $blocksize $SCRATCH_DEV $blocks + ;; + *) + _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized" + ;; + esac + _scratch_mkfs +} + # Emulate an N-data-disk stripe w/ various stripe units # _scratch_mkfs_geom [optional blocksize] _scratch_mkfs_geom()