Skip to contentSkip to conversation

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

PATCH Superseded Johannes Thumshirn 3 participants 4 messages Jun 26, 2025 – Aug 14, 2025 Btrfs file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 tests/btrfs/237 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tests/btrfs/237 +7 -2
index 2839f6e4..25ed7bcf 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 |\
+		head -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 |\
+		head -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.49.0
#1 lore raw
Quoted 33 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.

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

---
  tests/btrfs/237 | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
tests/btrfs/237 +2 -2
index 2839f6e4..25ed7bcf 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 |\
+		head -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

tests/btrfs/237 get_data_bg_physical() · line 49

Quoted 10 lines
tests/btrfs/237 +5 -0
+	        grep -Eo 'offset [[:digit:]]+'| cut -d ' ' -f 2 |\
+		head -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))

Johannes,

The test case still fails on a zone device with no conventional zones. However, if we use tail -1, it works fine—with or without a conventional zone.

$ modprobe scsi_debug zbc=host-managed zone_size_mb=256 zone_cap_mb=256 zone_nr_conv=0 dev_size_mb=4096 num_tgts=2
$ ./check btrfs/237
::
btrfs/237 5s ... [failed, exit status 1]- output mismatch (see /Volumes/work/ws/fstests/results//btrfs/237.out.bad)
    --- tests/btrfs/237.out	2025-07-01 17:41:30.943699725 +0800
    +++ /Volumes/work/ws/fstests/results//btrfs/237.out.bad	2025-07-12 
21:39:03.756275219 +0800
    @@ -1,2 +1,3 @@
     QA output created by 237
    -Silence is golden
    +Old wptr still at 0x073338
    +(see /Volumes/work/ws/fstests/results//btrfs/237.full for details)

Following diff fixes the issue.

-----
index 2839f6e42797..7f460c1415bc 100755

tests/btrfs/237 +0 -0
@@ -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 -1

}

get_data_bg_physical()
@@ -36,7 +37,8 @@ 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 -1

}

sdev="$(_short_dev $SCRATCH_DEV)"

#2 lore raw
Quoted 9 lines · Anand Jain

Review

Quoted 6 lines

+$BLKZONE_PROG report $SCRATCH_DEV | grep -q -e "nw" && \

(quoted diff) +2 -0
+	_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))

Johannes,

Quoted 4 lines

The test case still fails on a zone device with no conventional zones. However, if we use tail -1, it works fine—with or without a conventional zone.

But if the data is placed in a conventional zone and we recalim it, the write pointer will not be reset (as there is none) and you'll still see:

-Silence is golden
+Old wptr still at 0x073338

Quoted 35 lines
$ modprobe scsi_debug zbc=host-managed zone_size_mb=256 zone_cap_mb=256
zone_nr_conv=0 dev_size_mb=4096 num_tgts=2
$ ./check btrfs/237
::
btrfs/237 5s ... [failed, exit status 1]- output mismatch (see
/Volumes/work/ws/fstests/results//btrfs/237.out.bad)
      --- tests/btrfs/237.out	2025-07-01 17:41:30.943699725 +0800
      +++ /Volumes/work/ws/fstests/results//btrfs/237.out.bad	2025-07-12
21:39:03.756275219 +0800
      @@ -1,2 +1,3 @@
       QA output created by 237
      -Silence is golden
      +Old wptr still at 0x073338
      +(see /Volumes/work/ws/fstests/results//btrfs/237.full for details)

Following diff fixes the issue.

-----
index 2839f6e42797..7f460c1415bc 100755

tests/btrfs/237 +2 -1
@@ -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 -1
   }
 

get_data_bg_physical()

tests/btrfs/237 get_data_bg_physical() · line 43

Quoted 8 lines
tests/btrfs/237 +2 -1
@@ -36,7 +37,8 @@ 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 -1
   }

Oh OK, then tail vs head it is. Still there shouldn't be more than one, IMHO.

#3 lore raw
Quoted 54 lines · Johannes Thumshirn
Quoted 9 lines · Anand Jain

Review

Quoted 6 lines

+$BLKZONE_PROG report $SCRATCH_DEV | grep -q -e "nw" && \

(quoted diff) +2 -0
+	_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))

Johannes,

Quoted 4 lines

The test case still fails on a zone device with no conventional zones. However, if we use tail -1, it works fine—with or without a conventional zone.

But if the data is placed in a conventional zone and we recalim it, the write pointer will not be reset (as there is none) and you'll still see:

(quoted diff) +1 -1
-Silence is golden
+Old wptr still at 0x073338
Quoted 34 lines
$ modprobe scsi_debug zbc=host-managed zone_size_mb=256 zone_cap_mb=256
zone_nr_conv=0 dev_size_mb=4096 num_tgts=2
$ ./check btrfs/237
::
btrfs/237 5s ... [failed, exit status 1]- output mismatch (see
/Volumes/work/ws/fstests/results//btrfs/237.out.bad)
       --- tests/btrfs/237.out	2025-07-01 17:41:30.943699725 +0800
       +++ /Volumes/work/ws/fstests/results//btrfs/237.out.bad	2025-07-12
21:39:03.756275219 +0800
       @@ -1,2 +1,3 @@
        QA output created by 237
       -Silence is golden
       +Old wptr still at 0x073338
       +(see /Volumes/work/ws/fstests/results//btrfs/237.full for details)

Following diff fixes the issue.

-----
index 2839f6e42797..7f460c1415bc 100755

tests/btrfs/237 +2 -1
@@ -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 -1
    }
 
Quoted 13 lines

tests/btrfs/237 get_data_bg_physical() · line 43

Quoted 10 lines

get_data_bg_physical()

tests/btrfs/237 +2 -1
@@ -36,7 +37,8 @@ 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 -1
    }

Oh OK, then tail vs head it is. Still there shouldn't be more than one, IMHO.

Yeah.. for now it should be fine. Are you sending a v2 for this?

Thanks, Anand