From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796468484; b=rI1v2d1HxHKMBExWYh7NIWHow0kZXSOEom4dou3RWKYUy3Nwroy+bnkTU01Jbqmt7nuU mlGArpplvpUdHYqQAogNEv/9KfvyXMugTnOc6u9cS82O2tY8N+zD1tFDnYoNuDRSTOJ0D AfDkL8viuyw47iuQRn5GyvAiqvpB1hyTZI8SuOWWjkX67OchGNt/CPT/LxTY3f9Je+Gr0 987krAY+sqYD271O+ZEVLiiBrgBJYC1LlHsYstHUbw2ULV32Hlrnn0G7gbd1wYsLcHaz1 cPHxo9/eFeH43MOEhgIJJSKOSp9LnRUE6r8s4KexGw9RCOdfAArEtFc2JTJNNQoSW7A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796468484; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=YlagM5tkkSy6ZRdX5B8niLEJSgupZ7KX2rrYTZVBbVg=; b=p1QVEHNs0H8J5P+/pk4pZqeCVl+PVFCiriy/cjGQVF7QupfbUeXQgNLhIkvae/t3aZl0 90vHt9/vNT79MDIGWOs+6XGoIKtV95hGrodMEXWQDoX1au+UlvHjgWhMi+/w8FIsAQXs6 7Ghsn0/HUQo4redcaiPZYdclhzOKKHGMSLeINyTykWkuesGX2fNdR/DznG9QgzOdcU0ZN IV112TdD8ib/a5TH8Ox+r+WmQQZUZinjDALVTd1r5I2uZepLYqwKfaHJnioS5cdVOhRBL 4HLWbgYuqlyztXzWHMihw7lp/DdC2Pkk0neJIlDrwSTCErbFekF75M1IW4kBI+cg9ew== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kWkgbZxe; arc=none smtp.remote-ip=209.85.218.43 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF021606A322 for ; Sat, 5 Dec 2026 11:01:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BF021606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kWkgbZxe Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-c526cd606f0so167011766b.3 for ; Sat, 05 Dec 2026 03:01:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796468482; x=1797073282; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=YlagM5tkkSy6ZRdX5B8niLEJSgupZ7KX2rrYTZVBbVg=; b=kWkgbZxeXVLDUhKXLQ9cqdZhHq823Rg2y2poyRb4/rgVufr7CJbgLeCo35fOiRWe8l rkqsPUBt92WWBX0NvsJtEC37eYZvYt0lKMtZq5dhsKWgfDC3SBf9M2xFMIoB8dxB4p6J 0vanOP0TJmb8wzV0zPyFtWFpMsGxRiK5GbAKZ1gzNxmkdZ+KOYrrt308msIhSwmA5PyK wTJ3PYkXxa1fgo7jHL3Dctg11/T72RjDJtMpjaCrKn5vORNqAQWXVJp/6E9E7nx1HOMR hOXryWmmlCfJREP9tHilKaxYRZLjGuf2cAI+vd14867XxzfiH25ADBtXvVpFnwHhDDcq xX9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796468482; x=1797073282; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=YlagM5tkkSy6ZRdX5B8niLEJSgupZ7KX2rrYTZVBbVg=; b=OJvECNvfsOva/HIpP2mVCDZO4jpLomOh1TCjmLMnDNAsjcVS8DaeQtoCYrEsSmKvsU 5tgsaVukEO+YIZ9rd63QoU8t0Ei8uBQfk245FqaA/08/C3HRZleSH4lvaYhnVEeR4UXD BVBJz8KJ7kXPIbN1z3MPvktiTLIQrOBjdqeJrKhGwbzlFMGJNvSuk2U8r7R0F4BQ9Zt3 L7xO8/QhSm2HQ9HeuDqayANj0/N1CFjFOnNqFXstchjRmHtlMRqJr5xW5bXQVY8PBISa GxGablAA6ux85OjBYUvgYa7r7L4ZA8BgPD5UmLzw+qXivA1WZ7UBhzV4SoQzhVDZ8dYF CF9A== X-Gm-Message-State: APuU4Z+OLa1nc4uMt2beds62G/ONXATzeKoD+3PtzEVFlHlBeQL0Urdu Q8jpTxeer9hhqkbIiS4Zj71lTq9QuHz4K/56uFUL3ZzVSA2yv/Z3ZPdwGLoCNg== X-Gm-Gg: AZFdTZdfWB4m9JJJd8aZr0vgFiix8KIRXRBIKRXwXi9QRMPcGNFMhWroy7W8g7HLqJo ssfWUJsoWZiS42J5fmLaT6eQ7gO2SfWYaGI4gcepNUSwL9j25Ex6QhazTnPAgmyi/7soqonr6NL iZOZ4DESL3TnCNB0V5Q4IR7NLQtgmc/VEEaflHQOly/Gr+7cxi3FXdgCbrg8L8wtKRUgnq11hqE 7vn5IzhHERtPes+wsfXRKyNSBee+J+kvvM64Fn1QIdt9Iq9ifOtOKgGe8c8O72sgDLi68rczQCl HT9u1VWvdldUGB5z9AwcYR+KKy1LWGrcXXBQ0a1Qf/7wcaTkZphKGza74m8g2itMtmZBBbh9njg ZDElDP50qDX3OwRUcZ1F3/RlQ0c6vwjxCBLAlNTC+V+VYD0jL8ofkiDfUI6gqiHwtGt/gj7Ze+k jhTUaU4Whb4HkSYm2EeymCRZqfRGPfzw08mV2Xc2kixonqvc2EXjeMhffLesej+gT5qyDONjCL3 cVywkQM1Mzz0sww6HU4SDqDpc8hu0+gdRj5E8kaG/l63ZA+B8Mau5kNp3Vopl5ROJjES2poPSnn PSDBjv06jR6wTAN0/FuYycaCYpuNjqRU5SsZ99yQ/co9bFPUKe/pTQTSj8ahSXRR1nPbUwIpMky uVA== X-Received: by 2002:a17:906:ce50:b0:c54:17e2:e535 with SMTP id a640c23a62f3a-c5417e2e82bmr75836766b.35.1796468481885; Sat, 05 Dec 2026 03:01:21 -0800 (PST) Received: from localhost.localdomain (87-205-122-125.dynamic.inetia.pl. [87.205.122.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c525b2b9296sm240987266b.9.2026.12.05.03.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 03:01:20 -0800 (PST) From: Kyrylo Biryuk To: linux-btrfs@vger.kernel.org Cc: David Sterba , Naohiro Aota Subject: [BUG] btrfs: zoned: ENOSPC during fsync commit forces filesystem read-only Date: Sat, 5 Dec 2026 12:01:17 +0100 Message-ID: <20261205110118.3543-1-illofspeed@gmail.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, On a freshly formatted 2 GiB zoned btrfs (null_blk), a loop that creates and fsyncs 4 KiB files reports ENOSPC at zero-based index 6857 (the 6858th file, about 27 MiB of file data). In the rc4 trace below, the fsync task hits a warning in btrfs_remove_from_free_space_tree() while running delayed refs during a transaction commit. btrfs reports -ENOSPC at free-space-tree.c:869, aborts the transaction and forces the filesystem read-only. The abort dump shows 3.75 MiB used and 1.37 GiB zone_unusable in the primary metadata space_info. Tested: - v7.4-rc5 (7.4.0-rc5-srm5: official rc5 tarball, only a LOCALVERSION suffix), with the btrfs module from that kernel build; the kernel was not tainted before the first warning. Three runs with the reproducer below: each fails at index 6857 at the same warning site (free-space-tree.c:869, same offset as in the rc4 trace), and after the failure metadata total_bytes=1543503872, bytes_used=3932160 and bytes_zone_unusable=1472462848. The script took 19, 14 and 15 s. - v7.4-rc4 (7.4.0-rc4-srm), three runs: same failing index and the same three sysfs values. Here btrfs was built separately as an unmodified rc4 baseline (taints O and E: out-of-tree, unsigned); I do not have an exact source commit or a module srcversion for that build. The trace and the df samples below are from these rc4 runs. - Not tested on btrfs for-next, on a non-zoned device, or with other mkfs options. - btrfs-progs v6.14. QEMU guest (Q35). Device: one null_blk device, host-managed zoned, memory backed, 2 GiB, 32 zones of 64 MiB (zone capacity 64 MiB), no conventional zones, max open zones 16, no active zone limit, 4096-byte blocks. mkfs: mkfs.btrfs -f -O zoned -d single -m single -n 16384 /dev/wcz0 Features from mkfs: extref, skinny-metadata, no-holes, free-space-tree, zoned. Sector size 4096. Mount options: none (/proc/mounts shows rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/). The reproducer, repro22.sh, is at the end of this mail. It is for root in a fresh disposable VM with no existing wcz0 or /mnt/repro22. It creates the null_blk device through configfs, runs the mkfs above (formatting the test device), attempts to clear dmesg, mounts the file system, and by default creates up to 10000 files of 4 KiB with one fsync each. It then prints "btrfs filesystem df", the metadata sysfs values and dmesg. Selected metadata samples from "btrfs filesystem df". The index is the last completed file, counting from zero: index total used zone_unusable 500 128.00MiB 448.00KiB 76.80MiB 2500 512.00MiB 1.45MiB 489.22MiB 5000 1.06GiB 2.78MiB 1.01GiB 6500 1.38GiB 3.55MiB 1.35GiB In three runs on rc4 with COUNT=10000, the loop reported "[Errno 28] No space left on device" at index 6857. The sampled metadata df values, the aborted transaction ID (6872), and the metadata sysfs values after the failure matched across the runs; timestamps, pids, CPU and fsids differed. Mount message to first WARNING was 14.1, 20.0 and 13.4 seconds, respectively. The rc5 runs (see Tested) gave the same failing index and the same sysfs values; I did not compare their df samples. At abort, primary METADATA is marked full but reports 56688640 bytes free. Used + reserved + zone_unusable equals 22 zones; free + may_use equals one zone. These are space_info totals; I do not have per-block-group measurements showing how those bytes are distributed. The sysfs values read after the failure, total_bytes=1543503872, bytes_used=3932160 and bytes_zone_unusable=1472462848, have bytes_zone_unusable 114688 bytes above the abort dump (1472348160), so they were read a little later. The difference equals reserved=114688 in the dump. The DATA, METADATA and SYSTEM totals in the dump account for 1, 23 and 1 zone-equivalents respectively. Zones 0 and 1 are reserved for the superblock log. In these runs I did not measure metadata-treelog or data-reloc, or collect reclaim counters (reclaim_count, reclaim_errors). I do not know how the other five zones were accounted for or whether reclaim ran before the abort. Run 1 on rc4, from the warning through the final Btrfs error (the earlier lines are the mount messages; module list trimmed): [ 28.173043] ------------[ cut here ]------------ [ 28.173236] WARNING: free-space-tree.c:869 at btrfs_remove_from_free_space_tree+0x2df/0x470 [btrfs], CPU#6: python3/884 [ 28.175290] Modules linked in: null_blk btrfs(OE) [other modules trimmed, none with taint flags] [last unloaded: btrfs] [ 28.181554] CPU: 6 UID: 0 PID: 884 Comm: python3 Tainted: G OE 7.4.0-rc4-srm #srm PREEMPT(lazy) [ 28.182013] Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE [ 28.182391] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 [ 28.183752] RIP: 0010:btrfs_remove_from_free_space_tree+0x2df/0x470 [btrfs] [ 28.184734] Code: 05 80 0a 00 00 f0 48 0f ba 28 02 0f 82 5a 05 03 00 41 8d 44 24 1e 83 f8 19 77 0f ba 01 00 04 02 48 0f a3 c2 0f 82 23 05 03 00 <0f> 0b e9 1c 05 03 00 4c 89 fe 31 c9 48 89 ea 31 ff e8 5b e2 ff ff [ 28.186123] RSP: 0018:ffffcb57819978c0 EFLAGS: 00010292 [ 28.186392] RAX: 0000000000000002 RBX: ffff8a3cfbe0bd10 RCX: 0000000000000000 [ 28.186728] RDX: 0000000002040001 RSI: 0000000000000000 RDI: ffff8a3b7b00d980 [ 28.187088] RBP: ffff8a3ac49fb700 R08: 0000000000000000 R09: 00000000ffffffe4 [ 28.187998] R10: ffff8a3ac65bf000 R11: 00000000ffffffff R12: 00000000ffffffe4 [ 28.188917] R13: 0000000015ac9000 R14: 0000000000001000 R15: ffff8a3b7b00d800 [ 28.189845] FS: 00007f5793abb780(0000) GS:ffff8a40a03a7000(0000) knlGS:0000000000000000 [ 28.190701] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 28.190994] CR2: 00007f6416ec816c CR3: 0000000103fec001 CR4: 0000000000f72ef0 [ 28.191331] PKRU: 55555554 [ 28.191496] Call Trace: [ 28.191655] [ 28.191930] ? alloc_reserved_file_extent+0x1e0/0x300 [btrfs] [ 28.192535] alloc_reserved_extent+0x1f/0xe0 [btrfs] [ 28.193235] __btrfs_run_delayed_refs+0x539/0x1120 [btrfs] [ 28.194127] btrfs_run_delayed_refs+0x3d/0xe0 [btrfs] [ 28.194915] btrfs_commit_transaction+0x68/0xeb0 [btrfs] [ 28.195720] btrfs_sync_file+0x46a/0x590 [btrfs] [ 28.196283] do_fsync+0x50/0xc0 [ 28.196470] ? kmem_cache_free+0x251/0x3c0 [ 28.196711] __x64_sys_fsync+0x13/0x20 [ 28.196917] do_syscall_64+0xc4/0x570 [ 28.197125] ? do_file_open+0xe4/0x1a0 [ 28.197332] ? do_sys_openat2+0x7a/0xe0 [ 28.197542] ? __x64_sys_openat+0x54/0xa0 [ 28.197757] ? do_syscall_64+0x101/0x570 [ 28.197972] ? do_sys_openat2+0x7a/0xe0 [ 28.198378] ? __x64_sys_openat+0x54/0xa0 [ 28.198966] ? do_syscall_64+0x101/0x570 [ 28.199550] ? __x64_sys_close+0x3d/0x80 [ 28.200209] ? do_syscall_64+0x101/0x570 [ 28.200789] ? do_syscall_64+0x101/0x570 [ 28.201363] ? do_syscall_64+0x278/0x570 [ 28.201633] ? do_syscall_64+0x101/0x570 [ 28.201845] ? do_syscall_64+0x35/0x570 [ 28.202052] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 28.202308] RIP: 0033:0x7f5793b4f3a7 [ 28.202520] Code: 48 89 fa 4c 89 df e8 78 b3 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff [ 28.203307] RSP: 002b:00007fff6b14ac40 EFLAGS: 00000202 ORIG_RAX: 000000000000004a [ 28.204282] RAX: ffffffffffffffda RBX: 00007f5793abb780 RCX: 00007f5793b4f3a7 [ 28.205207] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 [ 28.206128] RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000 [ 28.207098] R10: 0000000000000000 R11: 0000000000000202 R12: 00007f5793a59300 [ 28.208029] R13: 0000000000a84590 R14: 0000000000a84590 R15: 00007f57938fb088 [ 28.208391] [ 28.208536] ---[ end trace 0000000000000000 ]--- [ 28.208944] BTRFS error (device wcz0 state A): Transaction 6872 aborted (-ENOSPC) [ 28.209005] BTRFS info (device wcz0 state A): dumping space info: [ 28.209058] BTRFS info (device wcz0 state A): space_info DATA (sub-group id 0) has 39018496 free, is not full [ 28.209113] BTRFS info (device wcz0 state A): space_info total=67108864, used=28086272, pinned=0, reserved=4096, may_use=0, readonly=0 zone_unusable=0 [ 28.209168] BTRFS info (device wcz0 state A): space_info METADATA (sub-group id 0) has 56688640 free, is full [ 28.209223] BTRFS info (device wcz0 state A): space_info total=1543503872, used=3932160, pinned=0, reserved=114688, may_use=10420224, readonly=0 zone_unusable=1472348160 [ 28.209283] BTRFS info (device wcz0 state A): space_info SYSTEM (sub-group id 0) has 66469888 free, is not full [ 28.209337] BTRFS info (device wcz0 state A): space_info total=67108864, used=16384, pinned=0, reserved=0, may_use=0, readonly=0 zone_unusable=622592 [ 28.209394] BTRFS info (device wcz0 state A): global_block_rsv: size 5767168 reserved 5767168 [ 28.209449] BTRFS info (device wcz0 state A): trans_block_rsv: size 0 reserved 0 [ 28.209503] BTRFS info (device wcz0 state A): chunk_block_rsv: size 0 reserved 0 [ 28.209557] BTRFS info (device wcz0 state A): remap_block_rsv: size 0 reserved 0 [ 28.209611] BTRFS info (device wcz0 state A): delayed_block_rsv: size 524288 reserved 524288 [ 28.209665] BTRFS info (device wcz0 state A): delayed_refs_rsv: size 7864320 reserved 4128768 [ 28.209720] BTRFS: error (device wcz0 state A) in btrfs_remove_from_free_space_tree:869: errno=-28 No space left [ 28.209777] BTRFS info (device wcz0 state EA): forced readonly [ 28.209830] BTRFS error (device wcz0 state EA): failed to run delayed ref for logical 363630592 num_bytes 4096 type 178 action 1 ref_mod 1: -28 [ 28.209886] BTRFS: error (device wcz0 state EA) in btrfs_run_delayed_refs:2248: errno=-28 No space left Is the transaction abort expected under this kind of zoned metadata pressure? I would have expected an operation to fail with ENOSPC without forcing the filesystem read-only. The stack shows a full commit in the fsync task at the warning. In one further rc5 run with a line added to print /sys/fs/btrfs//generation every 500 files, the generation was 9 at index 0, 509 at index 500 and 6514 at index 6500, about one per file, so the earlier fsyncs appear to commit a transaction each as well. That run failed at the same index and gave the same four df samples as the table above. I do not know why delayed refs could not finish this commit. I have not found the cause. I can send the full logs of the rc4 and rc5 runs. Disclosure: I used an LLM assistant to help run the tests and to draft this report. I checked the numbers against the logs. Kyrylo Biryuk ==== repro22.sh ==== #!/bin/bash # repro22.sh - small-file fsync load on one zoned btrfs (null_blk, 2 GiB, 32 x 64 MiB zones). # Root only, for a throw-away test VM. It loads null_blk, creates and removes one # zoned device, and mounts a file system on it at /mnt/repro22. # Needs: null_blk with configfs, btrfs-progs, python3 (3.9 or newer), util-linux. set -u DEV_NAME=wcz0 DEV=/dev/$DEV_NAME CFG=/sys/kernel/config/nullb/$DEV_NAME MNT=/mnt/repro22 COUNT=${COUNT:-10000} [ "$(id -u)" -eq 0 ] || { echo "run as root" >&2; exit 1; } [ ! -e "$CFG" ] || { echo "$CFG already exists" >&2; exit 1; } [ ! -e "$MNT" ] || { echo "$MNT already exists" >&2; exit 1; } cleanup() { cd / mountpoint -q "$MNT" 2>/dev/null && umount "$MNT" rmdir "$MNT" 2>/dev/null if [ -d "$CFG" ]; then echo 0 > "$CFG/power" 2>/dev/null rmdir "$CFG" 2>/dev/null fi } trap cleanup EXIT # Device: zoned null_blk through configfs. modprobe null_blk nr_devices=0 || exit 1 mountpoint -q /sys/kernel/config || mount -t configfs none /sys/kernel/config mkdir "$CFG" || exit 1 set_attr() { echo "$2" > "$CFG/$1" || { echo "cannot set $1" >&2; exit 1; }; } set_attr size 2048 set_attr blocksize 4096 set_attr memory_backed 1 set_attr cache_size 64 set_attr fua 1 set_attr mbps 0 set_attr zoned 1 set_attr zone_size 64 set_attr zone_capacity 64 set_attr zone_nr_conv 0 set_attr zone_max_open 16 set_attr zone_max_active 0 set_attr power 1 udevadm settle 2>/dev/null [ -b "$DEV" ] || { echo "$DEV did not appear" >&2; exit 1; } dmesg -C 2>/dev/null || true mkfs.btrfs -f -O zoned -d single -m single -n 16384 "$DEV" || exit 1 mkdir "$MNT" && mount "$DEV" "$MNT" || exit 1 uname -r cat /sys/module/btrfs/srcversion 2>/dev/null grep " $MNT " /proc/mounts # Workload: COUNT files of 4 KiB, one fsync each. python3 -I - "$MNT" "$COUNT" <<'EOF' import os, random, subprocess, sys mnt, count = sys.argv[1], int(sys.argv[2]) d = mnt + "/d" os.mkdir(d) try: for i in range(count): fd = os.open("%s/file-%08d" % (d, i), os.O_CREAT | os.O_WRONLY | os.O_EXCL, 0o644) os.write(fd, random.Random(1 + i).randbytes(4096)) os.fsync(fd) os.close(fd) if i % 500 == 0: print("files:", i, flush=True) subprocess.run("btrfs filesystem df %s | grep Metadata" % mnt, shell=True) print("done:", count, "files") except OSError as e: print("failed at file %d: %s" % (i, e)) EOF echo "== btrfs filesystem df" btrfs filesystem df "$MNT" echo "== metadata space_info (sysfs)" UUID=$(blkid -s UUID -o value "$DEV") for f in total_bytes bytes_used bytes_zone_unusable; do printf '%s=%s\n' "$f" "$(cat /sys/fs/btrfs/$UUID/allocation/metadata/$f)" done echo "== dmesg" dmesg