mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: Introduce get_block_size() helper
Currently many tests and other functions uses it's own way to get block size of the file system. Introduce get_block_size(), a generic way to get block size of mounted file system and use that instead. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
48c45430ce
commit
a2a1fc679e
+2
-2
@@ -249,7 +249,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_DIR | grep "Block size" | cut -d " " -f3`
|
||||
BLOCK_SIZE=`get_block_size $TEST_DIR`
|
||||
# user.attribute_XXX="value.XXX" is about 32 bytes; leave some overhead
|
||||
let MAX_ATTRS=$BLOCK_SIZE/40
|
||||
fi
|
||||
@@ -260,7 +260,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_DIR | grep "Block size" | cut -d " " -f3`
|
||||
BLOCK_SIZE=`get_block_size $TEST_DIR`
|
||||
# leave a little overhead
|
||||
let MAX_ATTRVAL_SIZE=$BLOCK_SIZE-256
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user