[Top] [All Lists]

[PATCH V2] xfstests: routine to create scratch of certain size

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH V2] xfstests: routine to create scratch of certain size
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 02 Feb 2010 19:54:34 -0600
In-reply-to: <4B621D89.8070800@xxxxxxxxxxx>
References: <4B621D89.8070800@xxxxxxxxxxx>
User-agent: Thunderbird (Macintosh/20090812)
This is needed for later enospc tests to be generic

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>

V2: Address Christoph's comment about use of MKFS_OPTIONS;
just do it like the other geom helper and explicitly -set-
MKFS_OPTIONS for scratch, to set the size, then just call

(this would override any global MKFS_OPTIONS setting, but
I think that's ok for now, and not sure how these options might
interact w/ previously set MKFS_OPTIONS anyway)

diff --git a/common.rc b/common.rc
index 9c375dc..a6526a3 100644
--- a/common.rc
+++ b/common.rc
@@ -297,6 +297,29 @@ _scratch_mkfs()
+# Create fs of certain size on scratch device
+# _scratch_mkfs_sized <size in bytes> [optional blocksize]
+    fssize=$1
+    blocksize=$2
+    [ -z "$blocksize" ] && blocksize=4096
+    let blocks=$fssize/$blocksize
+    case $FSTYP in
+    xfs)
+       MKFS_OPTIONS="-d size=$fssize -b size=$blocksize"
+       ;;
+    ext2|ext3|ext4)
+       MKFS_OPTIONS="-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 <sunit bytes> <swidth multiplier> [optional blocksize]

<Prev in Thread] Current Thread [Next in Thread>