public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests: routine to create scratch of certain size
@ 2010-01-28 23:28 Eric Sandeen
  2010-01-30 10:19 ` Christoph Hellwig
  2010-02-03  1:54 ` [PATCH V2] " Eric Sandeen
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2010-01-28 23:28 UTC (permalink / raw)
  To: xfs-oss

This is needed for later enospc tests to be generic

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfstests: routine to create scratch of certain size
  2010-01-28 23:28 [PATCH] xfstests: routine to create scratch of certain size Eric Sandeen
@ 2010-01-30 10:19 ` Christoph Hellwig
  2010-01-30 16:03   ` Eric Sandeen
  2010-02-03  1:54 ` [PATCH V2] " Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2010-01-30 10:19 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Thu, Jan 28, 2010 at 05:28:09PM -0600, Eric Sandeen wrote:
> This is needed for later enospc tests to be generic
> 
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---
> 
> 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
> +}

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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfstests: routine to create scratch of certain size
  2010-01-30 10:19 ` Christoph Hellwig
@ 2010-01-30 16:03   ` Eric Sandeen
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2010-01-30 16:03 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs-oss

Christoph Hellwig wrote:
> On Thu, Jan 28, 2010 at 05:28:09PM -0600, Eric Sandeen wrote:
>> This is needed for later enospc tests to be generic
>>
>> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>> ---
>>

...

> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2] xfstests: routine to create scratch of certain size
  2010-01-28 23:28 [PATCH] xfstests: routine to create scratch of certain size Eric Sandeen
  2010-01-30 10:19 ` Christoph Hellwig
@ 2010-02-03  1:54 ` Eric Sandeen
  2010-02-03  2:49   ` Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2010-02-03  1:54 UTC (permalink / raw)
  To: xfs-oss

This is needed for later enospc tests to be generic

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

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)

diff --git a/common.rc b/common.rc
index 9c375dc..a6526a3 100644
--- a/common.rc
+++ b/common.rc
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] xfstests: routine to create scratch of certain size
  2010-02-03  1:54 ` [PATCH V2] " Eric Sandeen
@ 2010-02-03  2:49   ` Eric Sandeen
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2010-02-03  2:49 UTC (permalink / raw)
  To: xfs-oss

Eric Sandeen wrote:
> This is needed for later enospc tests to be generic
> 
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---
> 
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-03  2:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28 23:28 [PATCH] xfstests: routine to create scratch of certain size Eric Sandeen
2010-01-30 10:19 ` Christoph Hellwig
2010-01-30 16:03   ` Eric Sandeen
2010-02-03  1:54 ` [PATCH V2] " Eric Sandeen
2010-02-03  2:49   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox