Skip to contentSkip to conversation

xfs/015: keep create_file running until growfs finished

PATCH In review [email protected] 2 participants 2 messages Jul 7, 2015 – Jul 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xfs/015: keep create_file running until growfs finished

From: George Wang <[email protected]>

create_file may run over before growfs, which depends on many reasons. such as the schedule algorithm, the workload of testing machine, etc. we should always make sure the create_file run over after growfs, then we can get the valid result of this test.

---
 tests/xfs/015 | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
tests/xfs/015 +13 -3
index 4dbf38a..b8fa437 100755
@@ -43,9 +43,16 @@ create_file()
 {
 	local dir=$1
 	local i=0
-
-	while echo -n >$dir/testfile_$i; do
-		let i=$i+1
+	local in_growfs=false
+
+	# keep running until failed after growfs
+	while true; do
+		[ -f $tmp.growfs ] && in_growfs=true
+		while echo -n >$dir/testfile_$i; do
+			let i=$i+1
+		done
+		$in_growfs && break
+		usleep 1000
 	done
 }
 
@@ -89,6 +96,9 @@ echo "Fork $nr_worker workers to consume free inodes in background" >>$seqres.fu
 echo "Grow fs to $((dblocks * 4)) blocks" >>$seqres.full
 $XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
 
+# mark xfs_growfs finished to create_file
+touch $tmp.growfs
+
 # Wait for background create_file to hit ENOSPC
 wait
 
Signature · 1 line
1.9.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · On Tue, Jul 07, 2015 at 10:20:50AM +0800, [email protected] wrote:

From: George Wang <[email protected]>

create_file may run over before growfs, which depends on many reasons. such as the schedule algorithm, the workload of testing machine, etc. we should always make sure the create_file run over after growfs, then we can get the valid result of this test.

Looks good to me.

Quoted 47 lines
---
 tests/xfs/015 | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
tests/xfs/015 +13 -3
index 4dbf38a..b8fa437 100755
@@ -43,9 +43,16 @@ create_file()
 {
 	local dir=$1
 	local i=0
-
-	while echo -n >$dir/testfile_$i; do
-		let i=$i+1
+	local in_growfs=false
+
+	# keep running until failed after growfs
+	while true; do
+		[ -f $tmp.growfs ] && in_growfs=true
+		while echo -n >$dir/testfile_$i; do
+			let i=$i+1
+		done
+		$in_growfs && break
+		usleep 1000
 	done
 }
 
@@ -89,6 +96,9 @@ echo "Fork $nr_worker workers to consume free inodes in background" >>$seqres.fu
 echo "Grow fs to $((dblocks * 4)) blocks" >>$seqres.full
 $XFS_GROWFS_PROG -D $((dblocks * 4)) $SCRATCH_MNT >>$seqres.full
 
+# mark xfs_growfs finished to create_file
+touch $tmp.growfs
+
 # Wait for background create_file to hit ENOSPC
 wait
 
Signature · 6 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html