xfs
[Top] [All Lists]

[PATCH 1/3] xfstests: routine to create scratch of certain size

To: xfs mailing list <xfs@xxxxxxxxxxx>
Subject: [PATCH 1/3] xfstests: routine to create scratch of certain size
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Wed, 03 Feb 2010 15:37:13 -0600
In-reply-to: <4B69EC23.8040207@xxxxxxxxxxx>
References: <4B69EC23.8040207@xxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
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 <sandeen@xxxxxxxxxxx>
---

diff --git a/common.rc b/common.rc
index 1edea2f..0a02a2b 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 <size in bytes> [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 <sunit bytes> <swidth multiplier> [optional blocksize]
 _scratch_mkfs_geom()

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