All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests: common.attr: get block size of test fs not root fs
@ 2012-07-02 10:50 Eryu Guan
  2012-07-04  3:09 ` Eric Sandeen
  0 siblings, 1 reply; 2+ messages in thread
From: Eryu Guan @ 2012-07-02 10:50 UTC (permalink / raw)
  To: xfs; +Cc: Eryu Guan, Eric Sandeen

stat -f $TEST_DEV shows block size of the fs where $TEST_DEV
resides, usually it is the root fs. This will fail 020 on non-4096 block
size ext2/3/4, also 4096 block size ext2/3/4 on ppc64.

Instead, stat -f $TEST_DIR will show block size of the fs to be tested.

Tested and passed on ext2/3/4, xfs, btrfs with all supported block size.

Cc: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common.attr |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common.attr b/common.attr
index 0f1e789..6e2c004 100644
--- a/common.attr
+++ b/common.attr
@@ -187,7 +187,7 @@ _sort_getfattr_output()
 if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then
 	MAX_ATTRS=1000
 else # Assume max ~1 block of attrs
-	BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3`
+	BLOCK_SIZE=`stat -f $TEST_DIR | grep "Block size" | cut -d " " -f3`
 	# user.attribute_XXX="value.XXX" is about 32 bytes; leave some overhead
 	let MAX_ATTRS=$BLOCK_SIZE/40
 fi
@@ -198,7 +198,7 @@ export MAX_ATTRS
 if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then
 	MAX_ATTRVAL_SIZE=64
 else # Assume max ~1 block of attrs
-	BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3`
+	BLOCK_SIZE=`stat -f $TEST_DIR | grep "Block size" | cut -d " " -f3`
 	# leave a little overhead
 	let MAX_ATTRVAL_SIZE=$BLOCK_SIZE-256
 fi
-- 
1.7.10.2

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

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

* Re: [PATCH] xfstests: common.attr: get block size of test fs not root fs
  2012-07-02 10:50 [PATCH] xfstests: common.attr: get block size of test fs not root fs Eryu Guan
@ 2012-07-04  3:09 ` Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2012-07-04  3:09 UTC (permalink / raw)
  To: Eryu Guan; +Cc: xfs

On 7/2/12 5:50 AM, Eryu Guan wrote:
> stat -f $TEST_DEV shows block size of the fs where $TEST_DEV
> resides, usually it is the root fs. This will fail 020 on non-4096 block
> size ext2/3/4, also 4096 block size ext2/3/4 on ppc64.
> 
> Instead, stat -f $TEST_DIR will show block size of the fs to be tested.
> 
> Tested and passed on ext2/3/4, xfs, btrfs with all supported block size.
> 
> Cc: Eric Sandeen <esandeen@redhat.com>
> Signed-off-by: Eryu Guan <eguan@redhat.com>

Whoops, thanks.

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

I'll merge it shortly

> ---
>  common.attr |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common.attr b/common.attr
> index 0f1e789..6e2c004 100644
> --- a/common.attr
> +++ b/common.attr
> @@ -187,7 +187,7 @@ _sort_getfattr_output()
>  if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then
>  	MAX_ATTRS=1000
>  else # Assume max ~1 block of attrs
> -	BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3`
> +	BLOCK_SIZE=`stat -f $TEST_DIR | grep "Block size" | cut -d " " -f3`
>  	# user.attribute_XXX="value.XXX" is about 32 bytes; leave some overhead
>  	let MAX_ATTRS=$BLOCK_SIZE/40
>  fi
> @@ -198,7 +198,7 @@ export MAX_ATTRS
>  if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then
>  	MAX_ATTRVAL_SIZE=64
>  else # Assume max ~1 block of attrs
> -	BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3`
> +	BLOCK_SIZE=`stat -f $TEST_DIR | grep "Block size" | cut -d " " -f3`
>  	# leave a little overhead
>  	let MAX_ATTRVAL_SIZE=$BLOCK_SIZE-256
>  fi
> 


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

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

end of thread, other threads:[~2012-07-04  3:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-02 10:50 [PATCH] xfstests: common.attr: get block size of test fs not root fs Eryu Guan
2012-07-04  3:09 ` Eric Sandeen

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.