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:
Lukas Czerner
2014-10-14 17:07:52 +11:00
committed by Dave Chinner
parent 48c45430ce
commit a2a1fc679e
7 changed files with 16 additions and 7 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ rm -f $seqres.full
rm -f $TEST_DIR/aiodio_sparse
logical_block_size=`_min_dio_alignment $TEST_DEV`
fs_block_size=`stat -f $TEST_DIR | grep "Block size:" | awk '{print $3}'`
fs_block_size=`get_block_size $TEST_DIR`
file_size=$((8 * $fs_block_size))
if [ $fs_block_size -le $logical_block_size ]; then
+1 -1
View File
@@ -171,7 +171,7 @@ _scratch_mount
# Test must be able to write files with non-root permissions
chmod 777 $SCRATCH_MNT
block_size=`stat -f $SCRATCH_DEV | grep "Block size" | cut -d " " -f3`
block_size=`get_block_size $SCRATCH_MNT`
_test_full_fs_punch $(( $block_size * 2 )) $block_size 500 $SCRATCH_MNT/252.$$ $block_size
status=0 ; exit
+1 -1
View File
@@ -49,7 +49,7 @@ _require_test
rm -f $seqres.full
echo "Silence is golden"
block_size=`stat -f -c %s $TEST_DIR`
block_size=`get_block_size $TEST_DIR`
# On unpatched ext4, if an extent exists which includes the block right
# before the maximum file offset, and the block for the maximum file offset