xfs
[Top] [All Lists]

[PATCH v3 02/12] xfstests: _scratch_mkfs_sized() for tmpfs

To: xfs@xxxxxxxxxxx
Subject: [PATCH v3 02/12] xfstests: _scratch_mkfs_sized() for tmpfs
From: Junho Ryu <jayr@xxxxxxxxxx>
Date: Wed, 18 Dec 2013 10:15:53 -0800
Cc: branto@xxxxxxxxxx, hughd@xxxxxxxxxx, tytso@xxxxxxx, Junho Ryu <jayr@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3Y7M0ArSmPGkHW8r36ueAB88BlkgN5zcwE+/1tDH3sg=; b=jq0hvrEnsIG62hBTjsZ4w/b0ocbd0FxdNPPjnzQedsZiO7k6Ff3q+nWRA+jDNLwr0Y aJpZ1S882AcyoX8U2pIdk2DZRlYEGXDNFzrtEw02Oc3wzQixQucRDDvOC7DNzSftlKEN Wbb2oUnfnmeC1+tyF8yUsanmsBpssfF7JlFur9ozj0SEQFpoD3/vTH4yMBuuy2asSW6/ ZdO4N0AIJdvGsMkX8Qw7ouGOSio+Xixgp1/hXd9YpvpxJhWi5/RzBNe2JYQ48nQSNKCA aLlfWqjyfoFgRVGH+tDi87HrxwFU4aBtsmKp5dLHr2XN1y0LqiW5Er9V6TrSWwNgSAyj YBCw==
In-reply-to: <1387390563-27064-1-git-send-email-jayr@xxxxxxxxxx>
References: <1387390563-27064-1-git-send-email-jayr@xxxxxxxxxx>
From: Hugh Dickins <hughd@xxxxxxxxxx>

_scratch_mkfs_sized() avoid blockdev and update MOUNT_OPTIONS with
required size on tmpfs, so those tests using it can now run.

Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
Signed-off-by: Junho Ryu <jayr@xxxxxxxxxx>
---

v3: use -b to check whether SCRATCH_DEV is a block device

v2: check whether SCRATCH_DEV is a block device instead of checking FSTYP

 common/rc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index a2005c9..bfd29c7 100644
--- a/common/rc
+++ b/common/rc
@@ -590,7 +590,7 @@ _scratch_mkfs_sized()
 
     blocks=`expr $fssize / $blocksize`
 
-    if [ "$HOSTOS" == "Linux" ]; then
+    if [ "$HOSTOS" == "Linux" -a -b "$SCRATCH_DEV" ]; then
        devsize=`blockdev --getsize64 $SCRATCH_DEV`
        [ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
     fi
@@ -611,6 +611,9 @@ _scratch_mkfs_sized()
     btrfs)
        $MKFS_BTRFS_PROG $MKFS_OPTIONS -b $fssize $SCRATCH_DEV
        ;;
+    tmpfs)
+       export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
+       ;;
     *)
        _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
        ;;
-- 
1.8.5.1

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