Skip to contentSkip to conversation

xfstests: routine to create scratch of certain size

PATCH Superseded Eric Sandeen 2 participants 5 messages Jan 28, 2010 – Feb 3, 2010

lore
Share & tools
lore
#0 lore raw

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

This is needed for later enospc tests to be generic

---

common.rc +21 -0
index 97513cc..cf2662a 100644
@@ -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

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 23 lines · Eric Sandeen

This is needed for later enospc tests to be generic

---

common.rc +10 -0
index 97513cc..cf2662a 100644
@@ -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)

common.rc _scratch_mkfs_options() · line 259

Quoted 10 lines
common.rc +10 -0
+        _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
+}

Looks good, the only questions is why you're using $MKFS_OPTIONS for extN, but not for xfs?

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Eric Sandeen

This is needed for later enospc tests to be generic

---

...

Quoted 3 lines

Looks good, the only questions is why you're using $MKFS_OPTIONS for extN, but not for xfs?

Hm, oversight I guess. Will test w/ that.

Thanks,
-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw

PATCH v2 1/1 xfstests: routine to create scratch of certain size

In reply to Eric Sandeen

This is needed for later enospc tests to be generic

---

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 _scratch_mkfs

(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)

common.rc +23 -0
index 9c375dc..a6526a3 100644
@@ -297,6 +297,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)
+	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]
 _scratch_mkfs_geom()

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 5 lines · Eric Sandeen

This is needed for later enospc tests to be generic

---

Quoted 8 lines

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 _scratch_mkfs

(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)

Scratch that, I'm not being diligent enough and didn't test this :/ (yay for "simple" changes)

mke2fs takes the size arg at the end, after the device, so we cannot just set up MKFS_OPTIONS

Sorry for the noise.

-Eric (who will try to be more dilient now...)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs