Skip to contentSkip to conversation

tests: btrfs/237: skip test on devices with conventional zones

PATCH In review Johannes Thumshirn 2 participants 2 messages Aug 18, 2025 – Aug 22, 2025 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests: btrfs/237: skip test on devices with conventional zones

From: Johannes Thumshirn <[email protected]>

Skip btrfs/237 on devices with conventional zones, as we cannot force data allocation on a sequential zone at the moment and conventional zones cannot be reset, making the test invalid.

Furthermore limit the output of get_data_bg() and get_data_bg_physical() to the first address.

---
Changes in v2:
- Use 'tail' instead of 'head'

---
 tests/btrfs/237 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tests/btrfs/237 +7 -2
index 2839f6e4..675f4c42 100755
@@ -28,7 +28,8 @@ get_data_bg()
 {
 	$BTRFS_UTIL_PROG inspect-internal dump-tree -t CHUNK $SCRATCH_DEV |\
 		grep -A 1 "CHUNK_ITEM" | grep -B 1 "type DATA" |\
-		grep -Eo "CHUNK_ITEM [[:digit:]]+" | cut -d ' ' -f 2
+		grep -Eo "CHUNK_ITEM [[:digit:]]+" | cut -d ' ' -f 2 |\
+		tail -n 1
 }
 
 get_data_bg_physical()
@@ -36,9 +37,13 @@ get_data_bg_physical()
 	# Assumes SINGLE data profile
 	$BTRFS_UTIL_PROG inspect-internal dump-tree -t CHUNK $SCRATCH_DEV |\
 		grep -A 4 CHUNK_ITEM | grep -A 3 'type DATA\|SINGLE' |\
-	        grep -Eo 'offset [[:digit:]]+'| cut -d ' ' -f 2
+	        grep -Eo 'offset [[:digit:]]+'| cut -d ' ' -f 2 |\
+		tail -n 1
 }
 
+$BLKZONE_PROG report $SCRATCH_DEV | grep -q -e "nw" && \
+	_notrun "test is unreliable on devices with conventional zones"
+
 sdev="$(_short_dev $SCRATCH_DEV)"
 zone_size=$(($(cat /sys/block/${sdev}/queue/chunk_sectors) << 9))
 fssize=$((zone_size * 16))
Signature · 1 line
2.50.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Johannes Thumshirn

From: Johannes Thumshirn <[email protected]>

Skip btrfs/237 on devices with conventional zones, as we cannot force data allocation on a sequential zone at the moment and conventional zones cannot be reset, making the test invalid.

Quoted 8 lines

Furthermore limit the output of get_data_bg() and get_data_bg_physical() to the first address.

---
Changes in v2:
- Use 'tail' instead of 'head'

Thanks, Anand

Quoted 33 lines
---
  tests/btrfs/237 | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
tests/btrfs/237 +7 -2
index 2839f6e4..675f4c42 100755
@@ -28,7 +28,8 @@ get_data_bg()
  {
  	$BTRFS_UTIL_PROG inspect-internal dump-tree -t CHUNK $SCRATCH_DEV |\
  		grep -A 1 "CHUNK_ITEM" | grep -B 1 "type DATA" |\
-		grep -Eo "CHUNK_ITEM [[:digit:]]+" | cut -d ' ' -f 2
+		grep -Eo "CHUNK_ITEM [[:digit:]]+" | cut -d ' ' -f 2 |\
+		tail -n 1
  }
 
  get_data_bg_physical()
@@ -36,9 +37,13 @@ get_data_bg_physical()
  	# Assumes SINGLE data profile
  	$BTRFS_UTIL_PROG inspect-internal dump-tree -t CHUNK $SCRATCH_DEV |\
  		grep -A 4 CHUNK_ITEM | grep -A 3 'type DATA\|SINGLE' |\
-	        grep -Eo 'offset [[:digit:]]+'| cut -d ' ' -f 2
+	        grep -Eo 'offset [[:digit:]]+'| cut -d ' ' -f 2 |\
+		tail -n 1
  }
 
+$BLKZONE_PROG report $SCRATCH_DEV | grep -q -e "nw" && \
+	_notrun "test is unreliable on devices with conventional zones"
+
  sdev="$(_short_dev $SCRATCH_DEV)"
  zone_size=$(($(cat /sys/block/${sdev}/queue/chunk_sectors) << 9))
  fssize=$((zone_size * 16))