Skip to contentSkip to conversation

xfstests: 298: fix failure on ext4 with bigalloc

PATCH New Jeffle Xu 1 participant 1 message Apr 24, 2020

lore
Share & tools
lore

Jeffle Xu

author
#0 lore raw

PATCH 1/1 xfstests: 298: fix failure on ext4 with bigalloc

From: Tomas Racek <[email protected]>

It is just a resend of this patch from "Tomas Racek <[email protected]>". Recently we run xfstests on ext4 with 'bigalloc' feature enabled, and come across some failure due to poor adaption for ext4 bigalloc. One if the failed cases is shared/298. I find this patch on internet [1] and it works in my case. I have no idea why this patch have not been merged. Maybe this buddy didn't send this patch at that time, or it was rejected for some reason but I can't find any discussion on internet.

[1] https://lkml.org/lkml/2013/6/18/329

The original commit log:

Count with cluster size instead of block size if bigalloc is used.

---
 tests/shared/298 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tests/shared/298 +9 -3
index 5d6c6cc..86b7cdc 100755
@@ -60,15 +60,21 @@ get_free_sectors()
 {
 	case $FSTYP in
 	ext4)
+	cluster_size=$($DUMPE2FS_PROG $img_file 2>&1 | sed -n 's/Cluster size: *\(.*\)/\1/p')
+	if [ -n "$cluster_size" ]; then
+		blocks_per_cluster=`expr $cluster_size / $block_size`
+	else
+		blocks_per_cluster=1
+	fi
 	$UMOUNT_PROG $loop_mnt
 	$DUMPE2FS_PROG $img_file  2>&1 | grep " Free blocks" | cut -d ":" -f2- | \
 		tr ',' '\n' | $SED_PROG 's/^ //' | \
-		$AWK_PROG -v spb=$sectors_per_block 'BEGIN{FS="-"};
+		$AWK_PROG -v spb=$sectors_per_block -v bpc=$blocks_per_cluster 'BEGIN{FS="-"};
 		     NF {
 			if($2 != "") # range of blocks
-				print spb * $1, spb * ($2 + 1) - 1;
+				print spb * $1, spb * ($2 + bpc) - 1;
 			else		# just single block
-				print spb * $1, spb * ($1 + 1) - 1;
+				print spb * $1, spb * ($1 + bpc) - 1;
 		     }'
 	;;
 	xfs)
Signature · 1 line
1.8.3.1