Yes it works. For example in this RFC patch, generic/075 could be skipped once 'bigalloc' is detected for ext4. I could fix all related test cases in this way, if it is acceptable to the community. Signed-off-by: Jeffle Xu <jefflexu@xxxxxxxxxxxxxxxxx> --- common/rc | 20 ++++++++++++++++++++ tests/generic/075 | 3 +++ 2 files changed, 23 insertions(+) diff --git a/common/rc b/common/rc index f58a542..92245e0 100644 --- a/common/rc +++ b/common/rc @@ -4041,6 +4041,23 @@ _sysfs_dev() min=$(echo "ibase=16; $min" | bc) echo /sys/dev/block/$maj:$min } + +_ext4_get_file_block_size() +{ + local path="$1" + path="$(readlink -m "$path")" + local dev=`$DF_PROG $dir | tail -1 | $AWK_PROG '{print $1}'` + + # The alloc unit size equals block size for ext4 without 'bigalloc'. + if ! (tune2fs -l $dev | grep -q 'Cluster size'); then + _get_block_size "$path" + return + fi + + # Otherwise, call tune2fs acquiring cluster size. + tune2fs -l $dev | sed -n -e 's/^.*Cluster size:\s*\([0-9]*\).*$/\1/p' + +} # Get the minimum block size of a file. Usually this is the # minimum fs block size, but some filesystems (ocfs2) do block @@ -4059,6 +4076,9 @@ _get_file_block_size() "xfs") _xfs_get_file_block_size $1 ;; + "ext4") + _ext4_get_file_block_size $1 + ;; *) _get_block_size $1 ;; diff --git a/tests/generic/075 b/tests/generic/075 index 7467bb7..d269a7c 100755 --- a/tests/generic/075 +++ b/tests/generic/075 @@ -109,6 +109,9 @@ _process_args() _supported_fs generic _require_test +blksz=$(_get_block_size $TEST_DIR) +_require_congruent_file_oplen $TEST_DIR $blksz + size10=`expr 10 \* 1024 \* 1024` # 10 megabytes filelen=$size10 numops1=1000 -- 1.8.3.1