performance issue when using zoned.
Hi,
I am experiencing performance issue when copying big files to zoned btrfs volume. When using cp -r for copy files, it achieved about ~35MB/s speed.
I wonder is there any tools or techniques I can use to perf btrfs.
There is my btrfs volume:
Overall:
Device size: 12.73TiB
Device allocated: 11.11TiB
Device unallocated: 1.62TiB
Device missing: 0.00B
Device slack: 0.00B
Device zone unusable: 9.96GiB
Device zone size: 256.00MiB
Used: 11.08TiB
Free (estimated): 1.63TiB (min: 841.44GiB)
Free (statfs, df): 1.63TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 16.00KiB)
Multiple profiles: no
Data,single: Size:11.07TiB, Used:11.06TiB (99.89%)
/dev/sdc 11.07TiB
Metadata,DUP: Size:23.00GiB, Used:13.31GiB (57.87%)
/dev/sdc 46.50GiB
System,DUP: Size:256.00MiB, Used:4.62MiB (1.81%)
/dev/sdc 512.00MiB
Unallocated:
/dev/sdc 1.62TiB
Testing result with same model on same machine (not same device since I am using it).
# fio --name=zbc --filename=/dev/sda --direct=1 --zonemode=zbd --offset=9867150491648 --size=16G --ioengine=libaio --iodepth=1 --rw=write --bs=256k
zbc: (g=0): rw=write, bs=(R) 256KiB-256KiB, (W) 256KiB-256KiB, (T) 256KiB-256KiB, ioengine=libaio, iodepth=1
fio-3.39
Starting 1 process
Jobs: 1 (f=0): [f(1)][100.0%][w=161MiB/s][w=644 IOPS][eta 00m:00s]
zbc: (groupid=0, jobs=1): err= 0: pid=59234: Sun Sep 14 16:34:49 2025
write: IOPS=656, BW=164MiB/s (172MB/s)(16.0GiB/99837msec); 24 zone resets
slat (usec): min=10, max=127, avg=38.03, stdev=18.48
clat (usec): min=465, max=59700, avg=1472.80, stdev=2132.66
lat (usec): min=525, max=59737, avg=1510.83, stdev=2132.41
clat percentiles (usec):
| 1.00th=[ 510], 5.00th=[ 515], 10.00th=[ 519], 20.00th=[ 1237],
| 30.00th=[ 1287], 40.00th=[ 1336], 50.00th=[ 1352], 60.00th=[ 1385],
| 70.00th=[ 1418], 80.00th=[ 1500], 90.00th=[ 1860], 95.00th=[ 1909],
| 99.00th=[ 2114], 99.50th=[24773], 99.90th=[27657], 99.95th=[27657],
| 99.99th=[30540]
bw ( KiB/s): min=142336, max=187392, per=100.00%, avg=168152.93, stdev=9387.46, samples=199
iops : min= 556, max= 732, avg=656.84, stdev=36.67, samples=199
lat (usec) : 500=0.02%, 750=17.85%, 1000=0.24%
lat (msec) : 2=79.36%, 4=1.63%, 10=0.15%, 20=0.02%, 50=0.73%
lat (msec) : 100=0.01%
cpu : usr=0.31%, sys=2.69%, ctx=65620, majf=0, minf=13
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=0,65536,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1Run status group 0 (all jobs):
WRITE: bw=164MiB/s (172MB/s), 164MiB/s-164MiB/s (172MB/s-172MB/s), io=16.0GiB (17.2GB), run=99837-99837msec
Disk stats (read/write):
sda: ios=0/65405, sectors=0/33475072, merge=0/0, ticks=0/98069, in_queue=98070, util=98.32%
dd result. The error is because I forgot to reset zones intended to be written.
dd if=/dev/zero of=/dev/sda seek=37640192 bs=256k oflag=sync
dd: error writing '/dev/sda': Input/output error 30721+0 records in
30720+0 records out
8053063680 bytes (8.1 GB, 7.5 GiB) copied, 302.914 s, 26.6 MB/s
Quoted 10 lines · HAN Yuwei
Hi,
I am experiencing performance issue when copying big files to zoned btrfs volume. When using cp -r for copy files, it achieved about ~35MB/s speed.
I wonder is there any tools or techniques I can use to perf btrfs.There is my btrfs volume:
Overall:
Device size: 12.73TiB
Device allocated: 11.11TiB
Device unallocated: 1.62TiB
The fs is heavily utilized, thus my guess is auto-reclaim is balancing the chunks at background almost all the time.
I guess you're not running the latest v6.17-rc kernels yet, thus if there is some auto-reclaim happening, dmesg should be flooded with messages relocating block groups.
Mind to share the dmesg and kernel version for this?
Quoted 11 lines
Device missing: 0.00B
Device slack: 0.00B
Device zone unusable: 9.96GiB
Device zone size: 256.00MiB
Used: 11.08TiB
Free (estimated): 1.63TiB (min: 841.44GiB)
Free (statfs, df): 1.63TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 16.00KiB)
Multiple profiles: no
And of course, the HDD models and extra zoned related info.
Thanks,
Qu
Quoted 56 lines
Data,single: Size:11.07TiB, Used:11.06TiB (99.89%)
/dev/sdc 11.07TiBMetadata,DUP: Size:23.00GiB, Used:13.31GiB (57.87%)
/dev/sdc 46.50GiBSystem,DUP: Size:256.00MiB, Used:4.62MiB (1.81%)
/dev/sdc 512.00MiBUnallocated:
/dev/sdc 1.62TiBTesting result with same model on same machine (not same device since I am using it).
# fio --name=zbc --filename=/dev/sda --direct=1 --zonemode=zbd --offset=9867150491648 --size=16G --ioengine=libaio --iodepth=1 --rw=write --bs=256k zbc: (g=0): rw=write, bs=(R) 256KiB-256KiB, (W) 256KiB-256KiB, (T) 256KiB-256KiB, ioengine=libaio, iodepth=1 fio-3.39 Starting 1 process Jobs: 1 (f=0): [f(1)][100.0%][w=161MiB/s][w=644 IOPS][eta 00m:00s] zbc: (groupid=0, jobs=1): err= 0: pid=59234: Sun Sep 14 16:34:49 2025 write: IOPS=656, BW=164MiB/s (172MB/s)(16.0GiB/99837msec); 24 zone resets slat (usec): min=10, max=127, avg=38.03, stdev=18.48 clat (usec): min=465, max=59700, avg=1472.80, stdev=2132.66 lat (usec): min=525, max=59737, avg=1510.83, stdev=2132.41 clat percentiles (usec): | 1.00th=[ 510], 5.00th=[ 515], 10.00th=[ 519], 20.00th=[ 1237], | 30.00th=[ 1287], 40.00th=[ 1336], 50.00th=[ 1352], 60.00th=[ 1385], | 70.00th=[ 1418], 80.00th=[ 1500], 90.00th=[ 1860], 95.00th=[ 1909], | 99.00th=[ 2114], 99.50th=[24773], 99.90th=[27657], 99.95th=[27657], | 99.99th=[30540] bw ( KiB/s): min=142336, max=187392, per=100.00%, avg=168152.93, stdev=9387.46, samples=199 iops : min= 556, max= 732, avg=656.84, stdev=36.67, samples=199 lat (usec) : 500=0.02%, 750=17.85%, 1000=0.24% lat (msec) : 2=79.36%, 4=1.63%, 10=0.15%, 20=0.02%, 50=0.73% lat (msec) : 100=0.01% cpu : usr=0.31%, sys=2.69%, ctx=65620, majf=0, minf=13 IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued rwts: total=0,65536,0,0 short=0,0,0,0 dropped=0,0,0,0 latency : target=0, window=0, percentile=100.00%, depth=1Run status group 0 (all jobs):
WRITE: bw=164MiB/s (172MB/s), 164MiB/s-164MiB/s (172MB/s-172MB/s), io=16.0GiB (17.2GB), run=99837-99837msecDisk stats (read/write):
sda: ios=0/65405, sectors=0/33475072, merge=0/0, ticks=0/98069, in_queue=98070, util=98.32%dd result. The error is because I forgot to reset zones intended to be written.
dd if=/dev/zero of=/dev/sda seek=37640192 bs=256k oflag=sync
dd: error writing '/dev/sda': Input/output error 30721+0 records in
30720+0 records out
8053063680 bytes (8.1 GB, 7.5 GiB) copied, 302.914 s, 26.6 MB/s
Quoted 14 lines · Qu Wenruo
Quoted 10 lines · HAN Yuwei
Hi,
I am experiencing performance issue when copying big files to zoned btrfs volume. When using cp -r for copy files, it achieved about ~35MB/s speed.
I wonder is there any tools or techniques I can use to perf btrfs.There is my btrfs volume:
Overall:
Device size: 12.73TiB
Device allocated: 11.11TiB
Device unallocated: 1.62TiB
Quoted 5 lines
The fs is heavily utilized, thus my guess is auto-reclaim is balancing the chunks at background almost all the time.
I guess you're not running the latest v6.17-rc kernels yet, thus if there is some auto-reclaim happening, dmesg should be flooded with messages relocating block groups.
Mind to share the dmesg and kernel version for this?
Kernel version is Linux ninesheep 6.16.4-arch1-1
Yes there is a lot reclaiming chunk and relocating block group. I would paste some example.
[Sun Sep 14 13:59:34 2025] BTRFS info (device sdd): reclaiming chunk 13142599925760 with 73% used 0% reserved 26% unusable [Sun Sep 14 13:59:34 2025] BTRFS info (device sdd): relocating block group 13142599925760 flags metadata|dup [Sun Sep 14 13:59:48 2025] BTRFS info (device sdd): found 12087 extents, stage: move data extents [Sun Sep 14 13:59:52 2025] BTRFS info (device sdd): reclaiming chunk 13152800473088 with 72% used 0% reserved 27% unusable [Sun Sep 14 13:59:52 2025] BTRFS info (device sdd): relocating block group 13152800473088 flags metadata|dup [Sun Sep 14 14:00:07 2025] BTRFS info (device sdd): found 11853 extents, stage: move data extents [Sun Sep 14 14:00:11 2025] BTRFS info (device sdd): reclaiming chunk 13143136796672 with 72% used 0% reserved 27% unusable [Sun Sep 14 14:00:11 2025] BTRFS info (device sdd): relocating block group 13143136796672 flags metadata|dup [Sun Sep 14 14:00:23 2025] BTRFS info (device sdd): found 11955 extents, stage: move data extents [Sun Sep 14 14:00:27 2025] BTRFS info (device sdd): reclaiming chunk 13171054084096 with 64% used 0% reserved 35% unusable [Sun Sep 14 14:00:27 2025] BTRFS info (device sdd): relocating block group 13171054084096 flags metadata|dup [Sun Sep 14 14:00:36 2025] BTRFS info (device sdd): found 10635 extents, stage: move data extents [Sun Sep 14 14:00:43 2025] BTRFS info (device sdd): reclaiming chunk 13171322519552 with 54% used 0% reserved 45% unusable [Sun Sep 14 14:00:43 2025] BTRFS info (device sdd): relocating block group 13171322519552 flags metadata|dup [Sun Sep 14 14:00:51 2025] BTRFS info (device sdd): found 8970 extents, stage: move data extents [Sun Sep 14 14:00:55 2025] BTRFS info (device sdd): reclaiming chunk 13171590955008 with 44% used 0% reserved 55% unusable [Sun Sep 14 14:00:55 2025] BTRFS info (device sdd): relocating block group 13171590955008 flags metadata|dup [Sun Sep 14 14:01:03 2025] BTRFS info (device sdd): found 7312 extents, stage: move data extents [Sun Sep 14 14:12:39 2025] BTRFS info (device sdc): reclaiming chunk 12238777745408 with 2% used 0% reserved 97% unusable [Sun Sep 14 14:12:39 2025] BTRFS info (device sdc): relocating block group 12238777745408 flags data [Sun Sep 14 14:12:39 2025] BTRFS info (device sdc): found 11 extents, stage: move data extents [Sun Sep 14 14:12:39 2025] BTRFS info (device sdc): found 11 extents, stage: update data pointers
Quoted 12 lines
Quoted 11 lines
Device missing: 0.00B
Device slack: 0.00B
Device zone unusable: 9.96GiB
Device zone size: 256.00MiB
Used: 11.08TiB
Free (estimated): 1.63TiB (min: 841.44GiB) Free (statfs, df): 1.63TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 16.00KiB) Multiple profiles: no
Quoted 1 line
And of course, the HDD models and extra zoned related info.
HDD is HC620 (HSH721414ALN6M0) which have 524 conventional zones and 51632 sequential-write-required zone. The zone size is 256MiB.>
Quoted 64 lines
Thanks,
QuQuoted 59 lines
Data,single: Size:11.07TiB, Used:11.06TiB (99.89%) /dev/sdc 11.07TiB
Metadata,DUP: Size:23.00GiB, Used:13.31GiB (57.87%) /dev/sdc 46.50GiB
System,DUP: Size:256.00MiB, Used:4.62MiB (1.81%)
/dev/sdc 512.00MiBUnallocated:
/dev/sdc 1.62TiBTesting result with same model on same machine (not same device since I am using it).
# fio --name=zbc --filename=/dev/sda --direct=1 --zonemode=zbd -- offset=9867150491648 --size=16G --ioengine=libaio --iodepth=1 -- rw=write --bs=256k zbc: (g=0): rw=write, bs=(R) 256KiB-256KiB, (W) 256KiB-256KiB, (T) 256KiB-256KiB, ioengine=libaio, iodepth=1 fio-3.39 Starting 1 process Jobs: 1 (f=0): [f(1)][100.0%][w=161MiB/s][w=644 IOPS][eta 00m:00s] zbc: (groupid=0, jobs=1): err= 0: pid=59234: Sun Sep 14 16:34:49 2025 write: IOPS=656, BW=164MiB/s (172MB/s)(16.0GiB/99837msec); 24 zone resets slat (usec): min=10, max=127, avg=38.03, stdev=18.48 clat (usec): min=465, max=59700, avg=1472.80, stdev=2132.66 lat (usec): min=525, max=59737, avg=1510.83, stdev=2132.41 clat percentiles (usec): | 1.00th=[ 510], 5.00th=[ 515], 10.00th=[ 519], 20.00th=[ 1237], | 30.00th=[ 1287], 40.00th=[ 1336], 50.00th=[ 1352], 60.00th=[ 1385], | 70.00th=[ 1418], 80.00th=[ 1500], 90.00th=[ 1860], 95.00th=[ 1909], | 99.00th=[ 2114], 99.50th=[24773], 99.90th=[27657], 99.95th=[27657], | 99.99th=[30540] bw ( KiB/s): min=142336, max=187392, per=100.00%, avg=168152.93, stdev=9387.46, samples=199 iops : min= 556, max= 732, avg=656.84, stdev=36.67, samples=199 lat (usec) : 500=0.02%, 750=17.85%, 1000=0.24% lat (msec) : 2=79.36%, 4=1.63%, 10=0.15%, 20=0.02%, 50=0.73% lat (msec) : 100=0.01% cpu : usr=0.31%, sys=2.69%, ctx=65620, majf=0, minf=13 IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%,Quoted 1 line
=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
Quoted 1 line
=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
Quoted 1 line
=64=0.0%
issued rwts: total=0,65536,0,0 short=0,0,0,0 dropped=0,0,0,0 latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
WRITE: bw=164MiB/s (172MB/s), 164MiB/s-164MiB/s (172MB/s-172MB/s), io=16.0GiB (17.2GB), run=99837-99837msecDisk stats (read/write):
sda: ios=0/65405, sectors=0/33475072, merge=0/0, ticks=0/98069, in_queue=98070, util=98.32%dd result. The error is because I forgot to reset zones intended to be written.
dd if=/dev/zero of=/dev/sda seek=37640192 bs=256k oflag=sync
dd: error writing '/dev/sda': Input/output error 30721+0 records in
30720+0 records out
8053063680 bytes (8.1 GB, 7.5 GiB) copied, 302.914 s, 26.6 MB/s
I will try v6.17-rc kernel soon.
Quoted 1 line · Yuwei Han
I will try v6.17-rc kernel soon.
v6.17-rc3 contains:
btrfs: zoned: limit active zones to max_open_zones
This in our testing has boosted performance quite a bit.
Quoted 9 lines · Johannes Thumshirn
Quoted 1 line · Yuwei Han
I will try v6.17-rc kernel soon.
v6.17-rc3 contains:
btrfs: zoned: limit active zones to
max_open_zonesThis in our testing has boosted performance quite a bit.
sadly this limit caused kernel to reject my mount. Any fix available?
[ 18.185061] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 18.185848] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 18.217405] BTRFS error (device sdd): open_ctree failed: -5 [ 18.449362] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.450083] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.466405] BTRFS error (device sdc): open_ctree failed: -5
Quoted 12 lines · Yuwei Han
Quoted 1 line
This in our testing has boosted performance quite a bit.
sadly this limit caused kernel to reject my mount. Any fix available? [ 18.185061] BTRFS error (device sdd): zoned: 31419 active zones on
/dev/sddexceedsmax_active_zones128
[ 18.185848] BTRFS error (device sdd): zoned: failed to read device zone info: -5
[ 18.217405] BTRFS error (device sdd):open_ctreefailed: -5 [ 18.449362] BTRFS error (device sdc): zoned: 39020 active zones on/dev/sdcexceedsmax_active_zones128
[ 18.450083] BTRFS error (device sdc): zoned: failed to read device zone info: -5
[ 18.466405] BTRFS error (device sdc):open_ctreefailed: -5
No, I'm working on it!
Quoted 13 lines · Johannes Thumshirn
Quoted 12 lines · Yuwei Han
Quoted 1 line
This in our testing has boosted performance quite a bit.
sadly this limit caused kernel to reject my mount. Any fix available? [ 18.185061] BTRFS error (device sdd): zoned: 31419 active zones on
/dev/sddexceedsmax_active_zones128
[ 18.185848] BTRFS error (device sdd): zoned: failed to read device zone info: -5
[ 18.217405] BTRFS error (device sdd):open_ctreefailed: -5 [ 18.449362] BTRFS error (device sdc): zoned: 39020 active zones on/dev/sdcexceedsmax_active_zones128
[ 18.450083] BTRFS error (device sdc): zoned: failed to read device zone info: -5
[ 18.466405] BTRFS error (device sdc):open_ctreefailed: -5
Quoted 2 lines
No, I'm working on it!
Can you try attached (untested) patch?
From 1b8f19d8e5e53e55d1c1bb1ec7f6f011ed6f7667 Mon Sep 17 00:00:00 2001
From: Johannes Thumshirn <[email protected]>
Date: Tue, 16 Sep 2025 20:31:33 +0200
Subject: [PATCH] btrfs: zoned: don't fail mount needlessly due to too many
active zones
If a zoned block device does not report any number of max active zones nor max open zones zoned btrfs limits the number of max active zones to 128 in order to not overload the device with IOs.
But this results in mount errors on a device with more than 128 zones in a state that active zone tracking recognizes as active.
On a device that does not report any limitations, proceed mounting regardless of the number of active zones.
--- fs/btrfs/zoned.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/zoned.c +3 -1
@@ -513,7 +513,9 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) }if (max_active_zones) { -if (nactive > max_active_zones) { +if (nactive > max_active_zones && +min_not_zero (bdev_max_active_zones (bdev), +bdev_max_open_zones (bdev)) !=0 ) { btrfs_err(device->fs_info, "zoned: %u active zones on %s exceeds max_active_zones %u", nactive, rcu_dereference(device->name),
Signature · 1 line
2.51.0
Quoted 14 lines · Johannes Thumshirn
Quoted 13 lines · Yuwei Han
Quoted 12 lines
Quoted 1 line
This in our testing has boosted performance quite a bit.
sadly this limit caused kernel to reject my mount. Any fix available?
[ 18.185061] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 18.185848] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 18.217405] BTRFS error (device sdd): open_ctree failed: -5 [ 18.449362] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.450083] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.466405] BTRFS error (device sdc): open_ctree failed: -5
Quoted 3 lines
Quoted 2 lines
No, I'm working on it!
Can you try attached (untested) patch?
[ 18.935640] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.937335] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.957042] BTRFS error (device sdc): open_ctree failed: -5 [ 19.037902] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 19.040650] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 19.060349] BTRFS error (device sdd): open_ctree failed: -5
Seems still rejecting mount existing volume.
Quoted 8 lines · HAN Yuwei
Quoted 1 line
Can you try attached (untested) patch?
[ 18.935640] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.937335] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.957042] BTRFS error (device sdc): open_ctree failed: -5 [ 19.037902] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 19.040650] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 19.060349] BTRFS error (device sdd): open_ctree failed: -5Seems still rejecting mount existing volume.
Ok next try attached.
From 029bc1065815f111338ae6c828177b3f577c24dc Mon Sep 17 00:00:00 2001
From: Johannes Thumshirn <[email protected]>
Date: Wed, 17 Sep 2025 08:42:54 +0200
Subject: [PATCH] btrfs: zoned: don't fail mount needlessly due to too many
active zones
If a zoned block device does not report any number of max active zones nor max open zones zoned btrfs limits the number of max active zones to 128 in order to not overload the device with IOs.
But this results in mount errors on a device with more than 128 zones in a state that active zone tracking recognizes as active.
On a device that does not report any limitations, skip limiting the number of active/open zones to not harm backwards compatibility.
--- fs/btrfs/zoned.c | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/zoned.c +0 -2
@@ -422,8 +422,6 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) max_active_zones =min_not_zero (bdev_max_active_zones (bdev),bdev_max_open_zones (bdev)); -if (!max_active_zones && zone_info->nr_zones >BTRFS_DEFAULT_MAX_ACTIVE_ZONES ) - max_active_zones =BTRFS_DEFAULT_MAX_ACTIVE_ZONES ;if (max_active_zones && max_active_zones <BTRFS_MIN_ACTIVE_ZONES ) { btrfs_err(fs_info, "zoned: %s: max active zones %u is too small, need at least %u active zones",
Signature · 1 line
2.51.0
Quoted 11 lines · HAN Yuwei
Quoted 8 lines
Quoted 1 line
Can you try attached (untested) patch?
[ 18.935640] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.937335] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.957042] BTRFS error (device sdc): open_ctree failed: -5 [ 19.037902] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 19.040650] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 19.060349] BTRFS error (device sdd): open_ctree failed: -5Seems still rejecting mount existing volume.
Ok next try attached.
still unable to mount. I added a dmesg line to output these variables.
[ 308.351272] Btrfs loaded, experimental=on, debug=on, assert=on, zoned=yes, fsverity=yes [ 312.379478] BTRFS: device label DATA4 devid 1 transid 7830 /dev/sdc (8:32) scanned by mount (3163) [ 312.383098] BTRFS info (device sdc): first mount of filesystem 2662c5a3-eac0-477a-a82a-b298a16dae02 [ 312.383122] BTRFS info (device sdc): using crc32c (crc32c-lib) checksum algorithm [ 313.327698] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 313.327745] BTRFS error (device sdc): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 313.327931] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 313.344515] BTRFS error (device sdc): open_ctree failed: -5 [ 313.355690] BTRFS: device label DATA2 devid 1 transid 12067 /dev/sdd (8:48) scanned by mount (3163) [ 313.358828] BTRFS info (device sdd): first mount of filesystem 6a75f34b-1b2e-40f5-87ef-d83d980148b8 [ 313.358844] BTRFS info (device sdd): using crc32c (crc32c-lib) checksum algorithm [ 314.175037] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 314.175106] BTRFS error (device sdd): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 314.175326] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 314.200332] BTRFS error (device sdd): open_ctree failed: -5
Quoted 12 lines · HAN Yuwei
Quoted 10 lines · HAN Yuwei
Quoted 8 lines
Quoted 1 line
Can you try attached (untested) patch?
[ 18.935640] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.937335] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.957042] BTRFS error (device sdc): open_ctree failed: -5 [ 19.037902] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 19.040650] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 19.060349] BTRFS error (device sdd): open_ctree failed: -5Seems still rejecting mount existing volume.
Ok next try attached.
still unable to mount. I added a dmesg line to output these variables.
Quoted 15 lines
[ 308.351272] Btrfs loaded, experimental=on, debug=on, assert=on, zoned=yes, fsverity=yes [ 312.379478] BTRFS: device label DATA4 devid 1 transid 7830 /dev/sdc (8:32) scanned by mount (3163) [ 312.383098] BTRFS info (device sdc): first mount of filesystem 2662c5a3-eac0-477a-a82a-b298a16dae02 [ 312.383122] BTRFS info (device sdc): using crc32c (crc32c-lib) checksum algorithm [ 313.327698] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 313.327745] BTRFS error (device sdc): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 313.327931] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 313.344515] BTRFS error (device sdc): open_ctree failed: -5 [ 313.355690] BTRFS: device label DATA2 devid 1 transid 12067 /dev/sdd (8:48) scanned by mount (3163) [ 313.358828] BTRFS info (device sdd): first mount of filesystem 6a75f34b-1b2e-40f5-87ef-d83d980148b8 [ 313.358844] BTRFS info (device sdd): using crc32c (crc32c-lib) checksum algorithm [ 314.175037] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 314.175106] BTRFS error (device sdd): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 314.175326] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 314.200332] BTRFS error (device sdd): open_ctree failed: -5
Ah ok, so this is a bit different from what I've thought.
It isn't that your device is reporting max_open_zones as 0 but 128 (which is the BTRFS default as well so I got the wrong impression).
The quick hack would be to ignore the max_active setting in this case. This should make your device being mountable again and we can have a fix for the next -rc.
The real fix (but a bit more involved) will be to finish all zones above max_active/max_open and eventually balance them to reclaim the half written zones.
Please find the patch attached. I'll send a formal one once it works successful.
fs/btrfs/zoned.c +6 -0
@@ -514,6 +514,11 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)if (max_active_zones) {if (nactive > max_active_zones) { +if (bdev_max_active_zones (bdev) ==0 ) { + max_active_zones =0 ; + zone_info->max_active_zones =0 ; + goto validate; + } btrfs_err(device->fs_info, "zoned: %u active zones on %s exceeds max_active_zones %u", nactive, rcu_dereference(device->name),
@@ -526,6 +531,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)set_bit (BTRFS_FS_ACTIVE_ZONE_TRACKING , &fs_info->flags); } +validate:/* Validate superblock log */ nr_zones =BTRFS_NR_SB_LOG_ZONES ;for (i =0 ; i <BTRFS_SUPER_MIRROR_MAX ; i++) {
Quoted 37 lines · Johannes Thumshirn
Quoted 12 lines · HAN Yuwei
Quoted 10 lines · HAN Yuwei
Quoted 8 lines
Quoted 1 line
Can you try attached (untested) patch?
[ 18.935640] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.937335] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.957042] BTRFS error (device sdc): open_ctree failed: -5 [ 19.037902] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 19.040650] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 19.060349] BTRFS error (device sdd): open_ctree failed: -5Seems still rejecting mount existing volume.
Ok next try attached.
still unable to mount. I added a dmesg line to output these variables.
Quoted 15 lines
[ 308.351272] Btrfs loaded, experimental=on, debug=on, assert=on, zoned=yes, fsverity=yes [ 312.379478] BTRFS: device label DATA4 devid 1 transid 7830 /dev/sdc (8:32) scanned by mount (3163) [ 312.383098] BTRFS info (device sdc): first mount of filesystem 2662c5a3-eac0-477a-a82a-b298a16dae02 [ 312.383122] BTRFS info (device sdc): using crc32c (crc32c-lib) checksum algorithm [ 313.327698] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 313.327745] BTRFS error (device sdc): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 313.327931] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 313.344515] BTRFS error (device sdc): open_ctree failed: -5 [ 313.355690] BTRFS: device label DATA2 devid 1 transid 12067 /dev/sdd (8:48) scanned by mount (3163) [ 313.358828] BTRFS info (device sdd): first mount of filesystem 6a75f34b-1b2e-40f5-87ef-d83d980148b8 [ 313.358844] BTRFS info (device sdd): using crc32c (crc32c-lib) checksum algorithm [ 314.175037] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 314.175106] BTRFS error (device sdd): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 314.175326] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 314.200332] BTRFS error (device sdd): open_ctree failed: -5Ah ok, so this is a bit different from what I've thought.
It isn't that your device is reporting
max_open_zonesas 0 but 128 (which is the BTRFS default as well so I got the wrong impression).The quick hack would be to ignore the
max_activesetting in this case. This should make your device being mountable again and we can have a fix for the next -rc.
Quoted 6 lines
The real fix (but a bit more involved) will be to finish all zones above max_active/max_open and eventually balance them to reclaim the half written zones.
Please find the patch attached. I'll send a formal one once it works successful.
applied this patch only on 6.17.0-rc6 and got successfully mounted, but after initial 170MiB/s speed, it keeps at steady ~30MiB/s using "cp -r". And what I copied is all "big files" (300MiB~6GiB) so there shouldn't be any IOPS issue.
Also, these is my machine's spec. if needed:
Linux dist.: Arch linux
CPU: AMD Ryzen 5 3400G @ 3.7GHz
GPU: AMD Radeon Vage 11 (Integrated GPU)
Memory: 16GiB 2666
Disks: WDC HC620 (HSH721414ALN6M0) fw ver:T108 Power On Hours:26729
Is there any performance metrics I can collect for investigating?
Quoted 42 lines · HAN Yuwei
Quoted 41 lines · Johannes Thumshirn
Quoted 12 lines · HAN Yuwei
Quoted 10 lines · HAN Yuwei
Quoted 8 lines
Quoted 1 line
Can you try attached (untested) patch?
[ 18.935640] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 18.937335] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 18.957042] BTRFS error (device sdc): open_ctree failed: -5 [ 19.037902] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 19.040650] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 19.060349] BTRFS error (device sdd): open_ctree failed: -5Seems still rejecting mount existing volume.
Ok next try attached.
still unable to mount. I added a dmesg line to output these variables.
Quoted 15 lines
[ 308.351272] Btrfs loaded, experimental=on, debug=on, assert=on, zoned=yes, fsverity=yes [ 312.379478] BTRFS: device label DATA4 devid 1 transid 7830 /dev/sdc (8:32) scanned by mount (3163) [ 312.383098] BTRFS info (device sdc): first mount of filesystem 2662c5a3-eac0-477a-a82a-b298a16dae02 [ 312.383122] BTRFS info (device sdc): using crc32c (crc32c-lib) checksum algorithm [ 313.327698] BTRFS error (device sdc): zoned: 39020 active zones on /dev/sdc exceeds max_active_zones 128 [ 313.327745] BTRFS error (device sdc): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 313.327931] BTRFS error (device sdc): zoned: failed to read device zone info: -5 [ 313.344515] BTRFS error (device sdc): open_ctree failed: -5 [ 313.355690] BTRFS: device label DATA2 devid 1 transid 12067 /dev/sdd (8:48) scanned by mount (3163) [ 313.358828] BTRFS info (device sdd): first mount of filesystem 6a75f34b-1b2e-40f5-87ef-d83d980148b8 [ 313.358844] BTRFS info (device sdd): using crc32c (crc32c-lib) checksum algorithm [ 314.175037] BTRFS error (device sdd): zoned: 31419 active zones on /dev/sdd exceeds max_active_zones 128 [ 314.175106] BTRFS error (device sdd): zoned: bdev_max_active_zones: 0 bdev_max_open_zones :128 [ 314.175326] BTRFS error (device sdd): zoned: failed to read device zone info: -5 [ 314.200332] BTRFS error (device sdd): open_ctree failed: -5Ah ok, so this is a bit different from what I've thought.
It isn't that your device is reporting
max_open_zonesas 0 but 128 (which is the BTRFS default as well so I got the wrong impression).The quick hack would be to ignore the
max_activesetting in this case. This should make your device being mountable again and we can have a fix for the next -rc.The real fix (but a bit more involved) will be to finish all zones above max_active/max_open and eventually balance them to reclaim the half written zones.
Quoted 6 lines
Quoted 2 lines
Please find the patch attached. I'll send a formal one once it works successful.
applied this patch only on 6.17.0-rc6 and got successfully mounted, but after initial 170MiB/s speed, it keeps at steady ~30MiB/s using "cp -r". And what I copied is all "big files" (300MiB~6GiB) so there shouldn't be any IOPS issue.
OK that's great! That the patch worked. I'll send a formal one out ASAP.
For the performance side, we're working on this. Limiting the drive to only max_open_zones concurrent zones was one of the fixes, but unfortunately we didn't take existing FSes into account.
Quoted 25 lines · HAN Yuwei
Hi,
I am experiencing performance issue when copying big files to zoned btrfs volume. When using cp -r for copy files, it achieved about ~35MB/s speed.
I wonder is there any tools or techniques I can use to perf btrfs.There is my btrfs volume:
Overall:
Device size: 12.73TiB
Device allocated: 11.11TiB
Device unallocated: 1.62TiB
Device missing: 0.00B
Device slack: 0.00B
Device zone unusable: 9.96GiB
Device zone size: 256.00MiB
Used: 11.08TiB
Free (estimated): 1.63TiB (min: 841.44GiB)
Free (statfs, df): 1.63TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 16.00KiB)
Multiple profiles: noData,single: Size:11.07TiB, Used:11.06TiB (99.89%)
/dev/sdc 11.07TiB
Quoted 9 lines
Metadata,DUP: Size:23.00GiB, Used:13.31GiB (57.87%)
/dev/sdc 46.50GiBSystem,DUP: Size:256.00MiB, Used:4.62MiB (1.81%)
/dev/sdc 512.00MiBUnallocated:
/dev/sdc 1.62TiB
On top of Qu's answer, can you please share your kernel version? We've made some performance related fixes in recent kernels.
Thanks you very much,
Johannes