xfs
[Top] [All Lists]

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

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfstests: routine to create scratch of certain size
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 28 Jan 2010 17:28:09 -0600
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
This is needed for later enospc tests to be generic

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

diff --git a/common.rc b/common.rc
index 97513cc..cf2662a 100644
--- a/common.rc
+++ b/common.rc
@@ -237,6 +237,27 @@ _scratch_mkfs_options()
     echo $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
 }
 
+# arg 1 is size in bytes, arg 2 is (optional) blocksize
+_scratch_mkfs_sized()
+{
+    fssz=$1
+    bsz=$2
+    [ -z "$bsz" ] && bsz=4096
+    let blocks=$fssz/$bsz
+
+    case $FSTYP in
+    xfs)
+        _scratch_mkfs_xfs -d size=$fssz -b size=$bsz 2>&1 >>$here/$seq.full
+    ;;
+    ext2|ext3|ext4)
+        /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS -b $bsz $SCRATCH_DEV $blocks  
2>&1>>$here/$seq.full
+    ;;
+    *)
+    _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
+    ;;
+    esac
+}
+
 _scratch_mkfs_xfs()
 {
     # extra mkfs options can be added by tests

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