All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Count journal size in test 289
@ 2013-03-20 10:50 Jan Kara
  2013-03-20 14:31 ` Eric Sandeen
  2013-03-20 16:00 ` Rich Johnston
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kara @ 2013-03-20 10:50 UTC (permalink / raw)
  To: xfs; +Cc: Eric Sandeen, Jan Kara

Test 289 ignored the fact that historically journal is not accounted as
fs overhead in ext3. For larger filesystems it is hidden in 1% tolerance
but for filesystems smaller than 12G the test fails. So make the
counting precise to work everywhere.

CC: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 289           |   16 ++++++++++++----
 common.filter |   15 +++++++++++++++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/289 b/289
index b057c20..eb5c63b 100755
--- a/289
+++ b/289
@@ -59,10 +59,18 @@ TOTAL_BLOCKS=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
 FREE_BLOCKS=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
 		| awk '/Free blocks:/{print $3}'`
 
-# nb: kernels today don't count journal blocks  as overhead, but should.
-# For most filesystems this will still be within tolerance.
-# Overhead is all the blocks (already) used by the fs itself:
-OVERHEAD=$(($TOTAL_BLOCKS-$FREE_BLOCKS))
+# ext3 doesn't count journal blocks as overhead, ext4 does.
+if [ $FSTYP = "ext3" ]; then
+	JOURNAL_SIZE=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
+		| awk '/Journal size:/{print $3}' | _filter_size_to_bytes`
+	BLOCK_SIZE=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
+		| awk '/Block size:/{print $3}'`
+	JOURNAL_BLOCKS=$(($JOURNAL_SIZE/$BLOCK_SIZE))
+else
+	JOURNAL_BLOCKS=0
+fi
+
+OVERHEAD=$(($TOTAL_BLOCKS-$FREE_BLOCKS-$JOURNAL_BLOCKS))
 
 #  bsddf|minixdf
 #         Set the behaviour  for  the  statfs  system  call.  The  minixdf
diff --git a/common.filter b/common.filter
index f0f6076..fcd7589 100644
--- a/common.filter
+++ b/common.filter
@@ -229,5 +229,20 @@ _filter_spaces()
        sed -e 's/ [ ]*/ /g'
 }
 
+# Convert string read from stdin like 128K to bytes and print it to stdout
+_filter_size_to_bytes()
+{
+	read size
+	suffix=${size:${#size}-1}
+	mul=1
+	case $suffix in
+		K) mul=1024 ;;
+		M) mul=$((1024*1024)) ;;
+		G) mul=$((1024*1024*1024)) ;;
+		T) mul=$((1024*1024*1024*1024)) ;;
+	esac
+	echo $((${size:0:${#size}-1}*$mul))
+}
+
 # make sure this script returns success
 /bin/true
-- 
1.7.1

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

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

* Re: [PATCH v2] Count journal size in test 289
  2013-03-20 10:50 [PATCH v2] Count journal size in test 289 Jan Kara
@ 2013-03-20 14:31 ` Eric Sandeen
  2013-03-20 14:37   ` Rich Johnston
  2013-03-20 16:00 ` Rich Johnston
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2013-03-20 14:31 UTC (permalink / raw)
  To: Jan Kara; +Cc: xfs

On 3/20/13 5:50 AM, Jan Kara wrote:
> Test 289 ignored the fact that historically journal is not accounted as
> fs overhead in ext3. For larger filesystems it is hidden in 1% tolerance
> but for filesystems smaller than 12G the test fails. So make the
> counting precise to work everywhere.
> 
> CC: Eric Sandeen <sandeen@sandeen.net>
> Signed-off-by: Jan Kara <jack@suse.cz>

Looks fine, thanks.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>


p.s. - sorry, didn't catch this the first time:

_filter_size_to_bytes won't work for lowercase units, which might
be nice.  How about:

> +	case $suffix in
> +		k|K) mul=1024 ;;
> +		m|M) mul=$((1024*1024)) ;;
> +		g|G) mul=$((1024*1024*1024)) ;;
> +		t|T) mul=$((1024*1024*1024*1024)) ;;
> +	esac

SGI guys - maybe could do that as a small fix-up on commit.  Otherwise, if anyone
ever needs lower case they could just add it at the same time, so no big deal.

-Eric

> ---
>  289           |   16 ++++++++++++----
>  common.filter |   15 +++++++++++++++
>  2 files changed, 27 insertions(+), 4 deletions(-)
> 
> diff --git a/289 b/289
> index b057c20..eb5c63b 100755
> --- a/289
> +++ b/289
> @@ -59,10 +59,18 @@ TOTAL_BLOCKS=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
>  FREE_BLOCKS=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
>  		| awk '/Free blocks:/{print $3}'`
>  
> -# nb: kernels today don't count journal blocks  as overhead, but should.
> -# For most filesystems this will still be within tolerance.
> -# Overhead is all the blocks (already) used by the fs itself:
> -OVERHEAD=$(($TOTAL_BLOCKS-$FREE_BLOCKS))
> +# ext3 doesn't count journal blocks as overhead, ext4 does.
> +if [ $FSTYP = "ext3" ]; then
> +	JOURNAL_SIZE=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
> +		| awk '/Journal size:/{print $3}' | _filter_size_to_bytes`
> +	BLOCK_SIZE=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
> +		| awk '/Block size:/{print $3}'`
> +	JOURNAL_BLOCKS=$(($JOURNAL_SIZE/$BLOCK_SIZE))
> +else
> +	JOURNAL_BLOCKS=0
> +fi
> +
> +OVERHEAD=$(($TOTAL_BLOCKS-$FREE_BLOCKS-$JOURNAL_BLOCKS))
>  
>  #  bsddf|minixdf
>  #         Set the behaviour  for  the  statfs  system  call.  The  minixdf
> diff --git a/common.filter b/common.filter
> index f0f6076..fcd7589 100644
> --- a/common.filter
> +++ b/common.filter
> @@ -229,5 +229,20 @@ _filter_spaces()
>         sed -e 's/ [ ]*/ /g'
>  }
>  
> +# Convert string read from stdin like 128K to bytes and print it to stdout
> +_filter_size_to_bytes()
> +{
> +	read size
> +	suffix=${size:${#size}-1}
> +	mul=1
> +	case $suffix in
> +		K) mul=1024 ;;
> +		M) mul=$((1024*1024)) ;;
> +		G) mul=$((1024*1024*1024)) ;;
> +		T) mul=$((1024*1024*1024*1024)) ;;
> +	esac
> +	echo $((${size:0:${#size}-1}*$mul))
> +}
> +
>  # make sure this script returns success
>  /bin/true
> 

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

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

* Re: [PATCH v2] Count journal size in test 289
  2013-03-20 14:31 ` Eric Sandeen
@ 2013-03-20 14:37   ` Rich Johnston
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Johnston @ 2013-03-20 14:37 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Jan Kara, xfs

On 03/20/2013 09:31 AM, Eric Sandeen wrote:
> On 3/20/13 5:50 AM, Jan Kara wrote:
>> Test 289 ignored the fact that historically journal is not accounted as
>> fs overhead in ext3. For larger filesystems it is hidden in 1% tolerance
>> but for filesystems smaller than 12G the test fails. So make the
>> counting precise to work everywhere.
>>
>> CC: Eric Sandeen <sandeen@sandeen.net>
>> Signed-off-by: Jan Kara <jack@suse.cz>
>
> Looks fine, thanks.
>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
>
>
> p.s. - sorry, didn't catch this the first time:
>
> _filter_size_to_bytes won't work for lowercase units, which might
> be nice.  How about:
>
>> +	case $suffix in
>> +		k|K) mul=1024 ;;
>> +		m|M) mul=$((1024*1024)) ;;
>> +		g|G) mul=$((1024*1024*1024)) ;;
>> +		t|T) mul=$((1024*1024*1024*1024)) ;;
>> +	esac
>
> SGI guys - maybe could do that as a small fix-up on commit.  Otherwise, if anyone
> ever needs lower case they could just add it at the same time, so no big deal.

Will do thanks for the review.

--Rich

>
> -Eric


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

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

* Re: [PATCH v2] Count journal size in test 289
  2013-03-20 10:50 [PATCH v2] Count journal size in test 289 Jan Kara
  2013-03-20 14:31 ` Eric Sandeen
@ 2013-03-20 16:00 ` Rich Johnston
  1 sibling, 0 replies; 4+ messages in thread
From: Rich Johnston @ 2013-03-20 16:00 UTC (permalink / raw)
  To: Jan Kara; +Cc: Eric Sandeen, xfs

Thanks Jan for submitting this patch, it has been committed with Eric 
suggestions.

Thanks
--Rich

commit 3574531af49bdde338aff0131100852e87e9d0fd
Author: Jan Kara <jack@suse.cz>
Date:   Wed Mar 20 10:50:48 2013 +0000

     xfstests: count journal size in test 289

     Test 289 ignored the fact that historically journal is not accounted as
     fs overhead in ext3. For larger filesystems it is hidden in 1% 
tolerance
     but for filesystems smaller than 12G the test fails. So make the
     counting precise to work everywhere.

     CC: Eric Sandeen <sandeen@sandeen.net>
     Signed-off-by: Jan Kara <jack@suse.cz>
     Reviewed-by: Eric Sandeen <sandeen@redhat.com>
     [rjohnston@sgi.com: add lower case units to filter]
     Signed-off-by: Rich Johnston <rjohnston@sgi.com>

+	read size
diff --git a/289 b/289
index b057c20..eb5c63b 100755
--- a/289
+++ b/289
@@ -59,10 +59,18 @@ TOTAL_BLOCKS=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
  FREE_BLOCKS=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
  		| awk '/Free blocks:/{print $3}'`

-# nb: kernels today don't count journal blocks  as overhead, but should.
-# For most filesystems this will still be within tolerance.
-# Overhead is all the blocks (already) used by the fs itself:
-OVERHEAD=$(($TOTAL_BLOCKS-$FREE_BLOCKS))
+# ext3 doesn't count journal blocks as overhead, ext4 does.
+if [ $FSTYP = "ext3" ]; then
+	JOURNAL_SIZE=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
+		| awk '/Journal size:/{print $3}' | _filter_size_to_bytes`
+	BLOCK_SIZE=`dumpe2fs -h $SCRATCH_DEV 2>/dev/null \
+		| awk '/Block size:/{print $3}'`
+	JOURNAL_BLOCKS=$(($JOURNAL_SIZE/$BLOCK_SIZE))
+else
+	JOURNAL_BLOCKS=0
+fi
+
+OVERHEAD=$(($TOTAL_BLOCKS-$FREE_BLOCKS-$JOURNAL_BLOCKS))

  #  bsddf|minixdf
  #         Set the behaviour  for  the  statfs  system  call.  The  minixdf
diff --git a/common.filter b/common.filter
index da5675f..bdd6427 100644
--- a/common.filter
+++ b/common.filter
@@ -265,5 +265,20 @@ _filter_size()
  	sed -e "s/[0-9\.]\+\s\?[b|k|m|g|t][b]\?/<SIZE>/ig"
  }

+# Convert string read from stdin like 128K to bytes and print it to stdout
+_filter_size_to_bytes()
+{
+	read size
+	suffix=${size:${#size}-1}
+	mul=1
+	case $suffix in
+		k|K) mul=1024 ;;
+		m|M) mul=$((1024*1024)) ;;
+		g|G) mul=$((1024*1024*1024)) ;;
+		t|T) mul=$((1024*1024*1024*1024)) ;;
+	esac
+	echo $((${size:0:${#size}-1}*$mul))
+}
+
  # make sure this script returns success
  /bin/true

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

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

end of thread, other threads:[~2013-03-20 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20 10:50 [PATCH v2] Count journal size in test 289 Jan Kara
2013-03-20 14:31 ` Eric Sandeen
2013-03-20 14:37   ` Rich Johnston
2013-03-20 16:00 ` Rich Johnston

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.