]> git.hungrycats.org Git - linux/commitdiff
export: re-export from misc-next testing 86f7f846934c (zb64 d411e967283c)
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 6 Nov 2026 10:49:12 +0000 (05:49 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 6 Nov 2026 10:49:12 +0000 (05:49 -0500)
After the br1105, dl1106 and fl1106 promotions.  Base 83cd81353093; no
public commit on kdave/btrfs/linus has its tree, so the mails carry no
base-commit line.

exclude.txt: the patches by others that the covers name as posted
separately (Josef Bacik's data integrity fixes v2 2/5-5/5, Cheng
Yongkang's devid kobject fix) are left out of the mails; the topics keep
them.  Series: stripe-alloc 86, replace-fixes 10, allocator-hints 12,
dev-extent-defrag 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
221 files changed:
fixups/post-merge.patch
scripts/exclude.txt
topics/allocator-hints/0000-cover-letter.patch
topics/allocator-hints/0001-btrfs-add-new-Kconfig-option-for-btrfs-allocator-hin.patch
topics/allocator-hints/0002-btrfs-add-flags-to-give-a-hint-to-the-chunk-allocato.patch
topics/allocator-hints/0003-btrfs-export-dev_item.type-in-sys-fs-btrfs-uuid-devi.patch
topics/allocator-hints/0004-btrfs-change-the-DEV_ITEM-type-field-via-sysfs.patch
topics/allocator-hints/0005-btrfs-add-allocator_hint-mode.patch
topics/allocator-hints/0006-btrfs-add-allocator_hint-for-no-allocation-preferred.patch
topics/allocator-hints/0007-btrfs-add-allocator_hint-to-disable-allocation-compl.patch
topics/allocator-hints/0008-btrfs-honor-allocator-hints-for-fixed-width-mirrors.patch
topics/allocator-hints/0009-btrfs-allocator-hints-move-the-hint-values-out-of-th.patch
topics/allocator-hints/0010-btrfs-allocator-hints-keep-the-hint-across-device-re.patch
topics/allocator-hints/0011-btrfs-allocator-hints-don-t-run-a-transaction-from-t.patch
topics/allocator-hints/0012-btrfs-allocator-hints-make-the-available-space-estim.patch
topics/balance-resume/0000-cover-letter.patch
topics/balance-resume/0001-btrfs-free-queued-remap-chunks-when-balance-bails-ou.patch
topics/balance-resume/0002-btrfs-replace-the-balance-resume-heuristics-with-a-v.patch [new file with mode: 0644]
topics/balance-resume/0002-btrfs-replace-the-usage-90-balance-resume-heuristic-.patch [deleted file]
topics/balance-resume/0003-btrfs-keep-the-old-resume-filters-for-balance-items-.patch [new file with mode: 0644]
topics/balance-resume/0003-btrfs-keep-the-usage-90-resume-heuristic-for-balance.patch [deleted file]
topics/compress-fixes/0000-cover-letter.patch
topics/compress-fixes/0001-btrfs-dont-propagate-nodatacow-mount-option-on-files.patch [new file with mode: 0644]
topics/compress-fixes/0001-btrfs-fix-nodatacow-vs-compression-inode-flag-confli.patch [deleted file]
topics/compress-fixes/0002-btrfs-do-not-leave-COMPRESS-on-an-inode-that-gets-NO.patch [deleted file]
topics/compress-fixes/0002-btrfs-export-btrfs_match_compress_type-move-it-to-co.patch [new file with mode: 0644]
topics/compress-fixes/0003-btrfs-allow-NODATACOW-NOCOMPRESS.patch [deleted file]
topics/compress-fixes/0003-btrfs-also-validate-compression-levels-in-btrfs_comp.patch [new file with mode: 0644]
topics/compress-fixes/0004-btrfs-add-per-inode-compression-levels-in-xattrs.patch [new file with mode: 0644]
topics/compress-fixes/0004-btrfs-props-add-per-inode-compression-level-support.patch [deleted file]
topics/compress-fixes/0005-btrfs-props-validate-compression-property-values-str.patch [deleted file]
topics/compress-fixes/0005-btrfs-support-inheritance-for-per-inode-compression-.patch [new file with mode: 0644]
topics/compress-fixes/0006-btrfs-add-btrfs_compress_typelevel2str-helper.patch [new file with mode: 0644]
topics/compress-fixes/0007-btrfs-preserve-btrfs.compression-when-setting-inode-.patch [new file with mode: 0644]
topics/compress-fixes/0008-btrfs-fix-nodatacow-vs-compression-inode-flag-confli.patch [new file with mode: 0644]
topics/compress-fixes/0009-btrfs-allow-NODATACOW-NOCOMPRESS.patch [new file with mode: 0644]
topics/compress-fixes/0010-btrfs-props-reject-NUL-bytes-in-btrfs.compression-va.patch [new file with mode: 0644]
topics/compress-fixes/0011-btrfs-props-keep-compressing-inodes-with-legacy-comp.patch [new file with mode: 0644]
topics/deadlock-fixes/0000-cover-letter.patch
topics/deadlock-fixes/0001-btrfs-fix-flushoncommit-deadlock-when-cloning-an-inl.patch
topics/deadlock-fixes/0002-btrfs-reflink-never-block-on-space-reservations-whil.patch
topics/deadlock-fixes/0003-btrfs-relocation-reserve-all-of-a-folio-s-slices-bef.patch
topics/dedupe-fixes/0000-cover-letter.patch
topics/dedupe-fixes/0001-btrfs-get-rid-of-maximum-dedupe-length.patch
topics/dedupe-mtime/0000-cover-letter.patch
topics/dedupe-mtime/0001-btrfs-don-t-update-mtime-and-ctime-when-deduping-a-r.patch
topics/delalloc-fixes/0000-cover-letter.patch
topics/delalloc-fixes/0001-btrfs-drain-pending-NOCOW-writes-before-making-a-blo.patch
topics/dev-extent-defrag/0000-cover-letter.patch
topics/dev-extent-defrag/0001-btrfs-allow-changing-system-dev_extent-size-via-sysf.patch
topics/dev-extent-defrag/0002-btrfs-prefer-aligned-dev_extent-holes-when-allocatin.patch [new file with mode: 0644]
topics/dev-stats/0000-cover-letter.patch
topics/dev-stats/0001-btrfs-write-dirty-device-stats-when-no-transaction-i.patch
topics/logical-ino-costs/0000-cover-letter.patch
topics/logical-ino-costs/0001-btrfs-backref-detect-tree-mod-log-rewind-cycles-in-a.patch
topics/logical-ino-costs/0002-btrfs-resume-the-delayed-ref-merge-walk-instead-of-r.patch
topics/logical-ino-costs/0003-btrfs-avoid-RCU-stall-during-backref-list-constructi.patch
topics/low-space/0000-cover-letter.patch
topics/low-space/0001-btrfs-print-the-error-when-reclaim-fails-to-relocate.patch
topics/low-space/0002-btrfs-hold-block-groups-free-for-relocation.patch
topics/low-space/0003-btrfs-relocation-flush-fully-before-failing-a-merge-.patch
topics/prealloc-size/0000-cover-letter.patch
topics/prealloc-size/0001-btrfs-use-BTRFS_MAX_EXTENT_SIZE-in-prealloc.patch
topics/raid56-fixes/0000-cover-letter.patch
topics/raid56-fixes/0001-btrfs-fix-racy-bio_list-changes-for-failed-RMW-rbio.patch [deleted file]
topics/raid56-fixes/0001-btrfs-log-a-message-when-dropping-an-extent-due-to-I.patch [new file with mode: 0644]
topics/raid56-fixes/0002-btrfs-don-t-cache-rbio-if-an-error-is-hit.patch [deleted file]
topics/raid56-fixes/0002-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch [new file with mode: 0644]
topics/raid56-fixes/0003-btrfs-don-t-drop-the-error-of-the-last-split-bio.patch [new file with mode: 0644]
topics/raid56-fixes/0003-btrfs-log-a-message-when-dropping-an-extent-due-to-I.patch [deleted file]
topics/raid56-fixes/0004-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch [new file with mode: 0644]
topics/raid56-fixes/0004-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch [deleted file]
topics/raid56-fixes/0005-btrfs-propagate-a-split-bio-s-error-when-the-failing.patch [deleted file]
topics/raid56-fixes/0005-btrfs-raid56-verify-reconstructed-tree-blocks.patch [new file with mode: 0644]
topics/raid56-fixes/0006-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch [deleted file]
topics/raid56-fixes/0006-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch [new file with mode: 0644]
topics/raid56-fixes/0007-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch [new file with mode: 0644]
topics/raid56-fixes/0007-btrfs-raid56-verify-reconstructed-tree-blocks.patch [deleted file]
topics/raid56-fixes/0008-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch [deleted file]
topics/raid56-fixes/0008-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch [new file with mode: 0644]
topics/raid56-fixes/0009-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch [new file with mode: 0644]
topics/raid56-fixes/0009-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch [deleted file]
topics/raid56-fixes/0010-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch [deleted file]
topics/raid56-fixes/0010-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch [new file with mode: 0644]
topics/raid56-fixes/0011-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch [deleted file]
topics/raid56-fixes/0012-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch [deleted file]
topics/raid56-scrub-replace/0000-cover-letter.patch
topics/raid56-scrub-replace/0001-btrfs-scrub-check-raid56-parity-of-the-rows-without-.patch
topics/raid56-scrub-replace/0002-btrfs-scrub-copy-raid56-parity-of-unrepairable-rows-.patch
topics/raid56-scrub-replace/0003-btrfs-scrub-copy-unrepaired-raid56-data-sectors-to-t.patch
topics/raid56-scrub-replace/0004-btrfs-scrub-copy-every-sector-of-raid56-data-stripes.patch
topics/raid56-scrub-replace/0005-btrfs-scrub-only-avoid-the-replace-source-device-for.patch
topics/raid56-scrub-replace/0006-btrfs-scrub-read-raid56-sectors-without-an-extent-fr.patch
topics/raid56-scrub-replace/0007-btrfs-don-t-abort-raid56-data-scrub-on-first-uncorre.patch
topics/raid56-scrub-replace/0008-btrfs-scrub-do-not-write-raid56-parity-in-a-read-onl.patch
topics/raid56-scrub-replace/0009-btrfs-scrub-rebuild-a-raid6-data-stripe-that-both-P-.patch
topics/raid56-scrub-replace/0010-btrfs-scrub-count-raid56-parity-mismatches-as-corrup.patch
topics/raid56-scrub-replace/0011-btrfs-scrub-name-the-device-a-raid56-data-sector-was.patch
topics/raid56-scrub-replace/0012-btrfs-scrub-count-the-raid56-data-repairs-made-by-a-.patch
topics/read-policies/0000-cover-letter.patch
topics/read-policies/0001-btrfs-add-io-read-stats-per-device-to-devinfo.patch
topics/read-policies/0002-btrfs-move-read-policies-out-of-experimental.patch
topics/read-policies/0003-btrfs-add-in-flight-queue-read-policy.patch
topics/read-policies/0004-btrfs-move-age-io-stat-out-of-CONFIG_BTRFS_PER_DEVIC.patch
topics/read-policies/0005-btrfs-break-queue-read-ties-by-mirror-age.patch
topics/read-policies/0006-btrfs-add-read-latency-health-stats-to-per-device-io.patch
topics/read-policies/0007-btrfs-add-queue-adaptive-read-policy.patch
topics/read-policies/0008-btrfs-scale-adaptive-queue-guard-with-latency.patch
topics/read-policies/0009-btrfs-count-unstable-read-health-snapshots.patch
topics/read-repair-fixes/0000-cover-letter.patch
topics/read-repair-fixes/0001-btrfs-give-the-read-repair-bio-an-end_io-for-submit-.patch
topics/read-repair-fixes/0002-btrfs-look-up-a-repair-read-s-csums-in-the-same-root.patch
topics/read-repair-fixes/0003-btrfs-do-not-write-back-a-read-repair-after-a-transa.patch
topics/read-repair-fixes/0004-btrfs-scrub-do-not-write-back-repairs-after-a-transa.patch
topics/reclaim-fixes/0000-cover-letter.patch
topics/reclaim-fixes/0001-btrfs-do-not-reclaim-block-groups-on-an-errored-file.patch
topics/reclaim-fixes/0002-btrfs-log-block-group-reclaim-at-debug-level.patch
topics/reclaim-fixes/0003-btrfs-back-off-block-group-reclaim-after-repeated-EN.patch
topics/reflink-inline-fixes/0000-cover-letter.patch
topics/reflink-inline-fixes/0001-btrfs-reflink-zero-the-right-part-of-the-folio-after.patch
topics/reflink-inline-fixes/0002-btrfs-reflink-undo-delalloc-if-inline-extent-decompr.patch
topics/replace-fixes/0000-cover-letter.patch
topics/replace-fixes/0001-btrfs-commit-the-canceled-state-when-a-device-replac.patch
topics/replace-fixes/0002-btrfs-scrub-do-not-count-write-errors-twice-or-on-th.patch
topics/replace-fixes/0003-btrfs-dev-replace-count-uncorrectable-read-errors.patch
topics/replace-fixes/0004-btrfs-dev-replace-do-not-warn-when-a-resumed-replace.patch
topics/replace-fixes/0005-btrfs-dev-replace-count-write-errors-to-the-target-a.patch
topics/replace-fixes/0006-btrfs-dev-replace-do-not-skip-the-rest-of-a-chunk-wh.patch
topics/replace-fixes/0007-btrfs-dev-replace-report-the-progress-of-a-canceled-.patch
topics/replace-fixes/0008-btrfs-dev-replace-optionally-abort-on-uncorrectable-.patch
topics/replace-fixes/0009-btrfs-mount-a-single-device-filesystem-with-a-device.patch
topics/replace-fixes/0010-btrfs-scrub-stop-scrub-and-device-replace-when-the-f.patch
topics/resize-missing/0000-cover-letter.patch
topics/resize-missing/0001-btrfs-resize-allow-shrinking-a-missing-device.patch
topics/stripe-alloc/0000-cover-letter.patch
topics/stripe-alloc/0001-btrfs-add-btrfs_claim_free_stripe_run-for-stripe-exc.patch
topics/stripe-alloc/0002-btrfs-add-open-stripe-run-tracking-for-stripe-exclus.patch
topics/stripe-alloc/0003-btrfs-add-the-stripe_alloc-allocation-policy-for-rai.patch
topics/stripe-alloc/0004-btrfs-stripe_alloc-control-the-policy-with-a-filesys.patch
topics/stripe-alloc/0005-btrfs-report-stripe-run-data-IO-through-the-ordered-.patch
topics/stripe-alloc/0006-btrfs-retire-stripe-runs-at-commit-and-gate-stripe_a.patch
topics/stripe-alloc/0007-btrfs-account-stripe_alloc-trapped-free-space-for-ho.patch
topics/stripe-alloc/0008-btrfs-stripe_alloc-keep-an-open-run-per-size-band-to.patch
topics/stripe-alloc/0009-btrfs-stripe_alloc-grow-the-frontier-run-instead-of-.patch
topics/stripe-alloc/0010-btrfs-raid56-batch-stripe_alloc-partial-writes-into-.patch
topics/stripe-alloc/0011-btrfs-stripe_alloc-private-per-inode-stripe-runs-for.patch
topics/stripe-alloc/0012-btrfs-raid56-pad-sub-stripe-writes-to-full-stripes-i.patch
topics/stripe-alloc/0013-btrfs-raid56-expose-parking-statistics-in-sysfs.patch
topics/stripe-alloc/0014-btrfs-stripe_alloc-count-open-stripe-run-remainders-.patch
topics/stripe-alloc/0015-btrfs-stripe_alloc-pessimistic-data-reservation-marg.patch
topics/stripe-alloc/0016-btrfs-stripe_alloc-claim-fully-free-stripes-that-spa.patch
topics/stripe-alloc/0017-btrfs-stripe_alloc-warn-when-raid56-metadata-is-not-.patch
topics/stripe-alloc/0018-btrfs-stripe_alloc-report-read-modify-write-of-uncov.patch
topics/stripe-alloc/0019-btrfs-stripe_alloc-tunable-park-deadlines-and-say-wh.patch
topics/stripe-alloc/0020-btrfs-stripe_alloc-trace-why-padding-declined-at-the.patch
topics/stripe-alloc/0021-btrfs-stripe_alloc-complete-parked-writes-on-allocat.patch
topics/stripe-alloc/0022-btrfs-stripe_alloc-track-per-sector-liveness-and-pad.patch
topics/stripe-alloc/0023-btrfs-stripe_alloc-count-claimable-whole-stripe-supp.patch
topics/stripe-alloc/0024-btrfs-raid56-adaptive-park-deadline-from-the-parked-.patch
topics/stripe-alloc/0025-btrfs-stripe_alloc-gate-data-admission-on-claimable-.patch
topics/stripe-alloc/0026-btrfs-stripe_alloc-show-per-group-trapped-bytes-in-t.patch
topics/stripe-alloc/0027-btrfs-stripe_alloc-count-whole-stripes-stranded-behi.patch
topics/stripe-alloc/0028-btrfs-stripe_alloc-count-nocow-run-lifecycles-and-st.patch
topics/stripe-alloc/0029-btrfs-stripe_alloc-say-at-mount-whether-the-policy-i.patch
topics/stripe-alloc/0030-btrfs-stripe_alloc-keep-relocation-s-stripe-runs-unt.patch
topics/stripe-alloc/0031-btrfs-stripe_alloc-keep-a-stripe-in-the-rbio-cache-u.patch
topics/stripe-alloc/0032-btrfs-stripe_alloc-pad-a-stripe-s-allocated-sectors-.patch
topics/stripe-alloc/0033-btrfs-stripe_alloc-count-refused-rbio-pins-and-track.patch
topics/stripe-alloc/0034-btrfs-stripe_alloc-skip-RAID5-6-groups-that-are-mapp.patch
topics/stripe-alloc/0035-btrfs-stripe_alloc-do-not-count-a-writeback-ENOSPC-d.patch
topics/stripe-alloc/0036-btrfs-stripe_alloc-isolate-nodatacow-and-preallocate.patch
topics/stripe-alloc/0037-btrfs-stripe_alloc-count-nocow-run-lifecycles-and-st.patch
topics/stripe-alloc/0038-btrfs-stripe_alloc-keep-a-stripe-in-the-rbio-cache-u.patch
topics/stripe-alloc/0039-btrfs-stripe_alloc-pad-a-stripe-s-allocated-sectors-.patch
topics/stripe-alloc/0040-btrfs-stripe_alloc-allow-rmw-policy-and-write-in-pla.patch
topics/stripe-alloc/0041-btrfs-stripe_alloc-tunable-park-deadlines-and-say-wh.patch
topics/stripe-alloc/0042-btrfs-stripe_alloc-track-per-sector-liveness-and-pad.patch
topics/stripe-alloc/0043-btrfs-stripe_alloc-persist-nocow-runs-across-commits.patch
topics/stripe-alloc/0044-btrfs-stripe_alloc-count-open-stripe-run-remainders-.patch
topics/stripe-alloc/0045-btrfs-stripe_alloc-hand-groups-full-of-trapped-free-.patch
topics/stripe-alloc/0046-btrfs-stripe_alloc-count-whole-stripes-stranded-behi.patch
topics/stripe-alloc/0047-btrfs-stripe_alloc-compact-mostly-live-groups-instea.patch
topics/stripe-alloc/0048-btrfs-stripe_alloc-keep-relocation-s-stripe-runs-unt.patch
topics/stripe-alloc/0049-btrfs-stripe_alloc-log-compaction-and-trapped-bytes-.patch
topics/stripe-alloc/0050-btrfs-stripe_alloc-add-stripe_reclaim_now-to-reclaim.patch
topics/stripe-alloc/0051-btrfs-stripe_alloc-back-off-stripe-reclaim-after-rep.patch
topics/stripe-alloc/0052-btrfs-stripe_alloc-settle-a-logged-extent-s-stripes-.patch
topics/stripe-alloc/0053-btrfs-stripe_alloc-count-open-stripe-run-remainders-.patch
topics/stripe-alloc/0054-btrfs-stripe_alloc-allow-rmw-policy-and-write-in-pla.patch
topics/stripe-alloc/0055-btrfs-stripe_alloc-carry-an-inode-s-log-tail-forward.patch
topics/stripe-alloc/0056-btrfs-stripe_alloc-allow-rmw-policy-and-write-in-pla.patch
topics/stripe-alloc/0057-btrfs-stripe_alloc-share-LOG-data-runs-per-log-trans.patch
topics/stripe-alloc/0058-btrfs-add-a-write-hole-invariant-checker-to-the-raid.patch
topics/stripe-alloc/0059-btrfs-stripe_alloc-report-read-modify-write-of-uncov.patch
topics/stripe-alloc/0060-btrfs-stripe_alloc-say-at-mount-whether-the-policy-i.patch
topics/stripe-alloc/0061-btrfs-stripe_alloc-allow-rmw-policy-and-write-in-pla.patch
topics/stripe-alloc/0062-btrfs-stripe_alloc-attribute-each-data-read-modify-w.patch
topics/stripe-alloc/0063-btrfs-stripe_alloc-optionally-audit-data-read-modify.patch
topics/stripe-alloc/0064-btrfs-stripe_alloc-break-rbio-pins-and-open-stripe-r.patch
topics/stripe-alloc/0065-btrfs-stripe_alloc-count-and-log-ordered-extents-tha.patch
topics/stripe-alloc/0066-btrfs-stripe_alloc-log-the-space-counters-when-data-.patch
topics/stripe-alloc/0067-btrfs-stripe_alloc-do-not-count-a-writeback-ENOSPC-d.patch
topics/stripe-alloc/0068-btrfs-stripe_meta-allocate-tree-blocks-by-whole-stri.patch
topics/stripe-alloc/0069-btrfs-stripe_alloc-keep-a-stripe-in-the-rbio-cache-u.patch
topics/stripe-alloc/0070-btrfs-stripe_alloc-skip-RAID5-6-groups-that-are-mapp.patch
topics/stripe-alloc/0071-btrfs-stripe_meta-extend-stripe-reclaim-to-metadata-.patch
topics/stripe-alloc/0072-btrfs-stripe_meta-hold-back-whole-stripes-so-tree-bl.patch
topics/stripe-alloc/0073-btrfs-stripe_alloc-count-whole-stripes-stranded-behi.patch
topics/stripe-alloc/0074-btrfs-stripe_alloc-do-not-count-a-writeback-ENOSPC-d.patch
topics/stripe-alloc/0075-btrfs-stripe_meta-cover-raid56-system-chunks.patch
topics/stripe-alloc/0076-btrfs-stripe_alloc-skip-RAID5-6-groups-that-are-mapp.patch
topics/stripe-alloc/0077-btrfs-stripe_alloc-give-each-log-commit-its-own-meta.patch
topics/stripe-alloc/0078-btrfs-stripe_alloc-share-LOG-data-runs-per-log-trans.patch
topics/stripe-alloc/0079-btrfs-stripe_alloc-count-and-log-ordered-extents-tha.patch
topics/stripe-alloc/0080-btrfs-raid56-say-whether-a-metadata-read-modify-writ.patch
topics/stripe-alloc/0081-btrfs-stripe_alloc-tunable-park-deadlines-and-say-wh.patch
topics/stripe-alloc/0082-btrfs-stripe_alloc-trace-why-padding-declined-at-the.patch
topics/stripe-alloc/0083-btrfs-stripe_alloc-attribute-each-data-read-modify-w.patch
topics/stripe-alloc/0084-btrfs-raid56-adaptive-park-deadline-from-the-parked-.patch
topics/stripe-alloc/0085-btrfs-stripe_alloc-keep-a-stripe-in-the-rbio-cache-u.patch
topics/stripe-alloc/0086-btrfs-stripe_alloc-drop-the-extract-hooks-of-the-str.patch [new file with mode: 0644]

index 4b3c8b54cf45508115292239588a44c93aedab48..1bc54150631babd956f53e84a9e4d335988d604d 100644 (file)
@@ -403,10 +403,10 @@ index 1644b1edfe15a6f98308e7377a40e9ebd520274d..90b62d7d59ffe1546cf1e27a5dd5cc87
   * Information about one device.
   *
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index c1eb4f95ce7b9811c24d8ded80e3a0387ee900ce..9b09e06dd7587301f14706684721046e8800ca51 100644
+index 068dd5d168b4e02b2e2fe136ea4a018d32ed95c0..a067b76455eef3cdb5004e7592c0efe02ae8c66e 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6967,7 +6967,293 @@ bool btrfs_chunk_raid56_mirrored(struct btrfs_fs_info *fs_info, u64 logical)
+@@ -7055,7 +7055,293 @@ bool btrfs_chunk_raid56_mirrored(struct btrfs_fs_info *fs_info, u64 logical)
        return ret;
  }
  
index 5e91f6fb870428f2cf37825044fa8c2b46c533cd..4593aed4c2ced690ff1a3fcfb636711a97bf254e 100644 (file)
@@ -18,3 +18,13 @@ topic dm-stripfault
 # raid56 rbio cache size knob, into this test-only topic.  Both commits
 # carry the marker; listed so the topic directory never appears.
 topic test-knobs
+
+# 2026-11-06: patches by others that the covers name as posted separately
+# (Josef Bacik's "btrfs: data integrity fixes" v2 2/5-5/5, 2026-11-03;
+# Cheng Yongkang's v2, 2026-10-26).  The lanes carry them at the head of
+# the topic that needs them; the mails do not re-send them.
+subject btrfs: clear dirty blocks after a delalloc failure
+subject btrfs: wait for ordered extent IO in fast fsync
+subject btrfs: don't report success for a skipped log sync
+subject btrfs: don't trim the target of a device replace
+subject btrfs: remove devid kobject when deleting a missing device
index a38ef713a0feaffd9ffcd02cedc141dbd5cc4a47..943394df17dd46d241ea9d3cafedef966114d036 100644 (file)
@@ -1,6 +1,6 @@
-From b3af80d4e58b937314a4840129845611db1b825e Mon Sep 17 00:00:00 2001
+From df0e45e0fe79ddc8c332cba8ab8678b37e55c160 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:05 -0400
+Date: Fri, 6 Nov 2026 05:48:16 -0500
 Subject: [PATCH 00/12] btrfs: allocator hints (Kai Krakow's series)
 To: linux-btrfs@vger.kernel.org
 
@@ -86,7 +86,6 @@ Zygo Blaxell (4):
  8 files changed, 496 insertions(+), 21 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index c8936fec8318c7c55764258053f2900ced754e3c..25b929e5f812fa77c5925e5129b5b7e82f40e899 100644 (file)
@@ -1,4 +1,4 @@
-From af409ce5aeba16510d02a8c344f94001beabe239 Mon Sep 17 00:00:00 2001
+From 70b8869bdde1abe1cda61a670281adccd8644b11 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Fri, 10 Jul 2026 23:49:05 +0200
 Subject: [PATCH 01/12] btrfs: add new Kconfig option for btrfs allocator hints
index d0341a45d36644c3983b304338f0231c7265ba39..76c74b050306b96794a191badee1e15396ec067f 100644 (file)
@@ -1,4 +1,4 @@
-From 87fc4b5c2c1974db3f65fb1efc730af62045eeb2 Mon Sep 17 00:00:00 2001
+From 025e6cb878674de3e63be998690d8f91cedc8e86 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 11 Jul 2026 00:51:17 +0200
 Subject: [PATCH 02/12] btrfs: add flags to give a hint to the chunk allocator
index ee0a0c9efed749f557cefbafe5c17d880c8caa0a..ea5c838fc182767a3c2a1ae799cb71436d30080d 100644 (file)
@@ -1,4 +1,4 @@
-From 91e0e6d3c504d907e3884bda1192d6ccb934fef8 Mon Sep 17 00:00:00 2001
+From 19e88b66354301a0a91ea82fef201b32b6dd343a Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 11 Jul 2026 00:22:50 +0200
 Subject: [PATCH 03/12] btrfs: export dev_item.type in
index 6fea688c90766b19343c4e2cfec7ed1489bb1049..a18e9fc136aeb596e2aa32e61b3c95892d72c4c1 100644 (file)
@@ -1,4 +1,4 @@
-From d908265472c1ecc2ec5422d102772c8d1a8b892d Mon Sep 17 00:00:00 2001
+From fa8f8e9aa28a809cf539c833e4c0b8e3e8445abb Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 11 Jul 2026 00:25:21 +0200
 Subject: [PATCH 04/12] btrfs: change the DEV_ITEM 'type' field via sysfs
index bd76e916b11689310984eeac3412af43666841d0..8de898b996fdbef8c2c6aa5e83fb93a5e1f8faa7 100644 (file)
@@ -1,4 +1,4 @@
-From 6c61b29687de931f3b71949d973babca0bfc6c7c Mon Sep 17 00:00:00 2001
+From e69b32add2614ea47fb1b77cb9e73d1b103146a5 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 11 Jul 2026 00:18:02 +0200
 Subject: [PATCH 05/12] btrfs: add allocator_hint mode
@@ -71,7 +71,7 @@ index ce9863bfc54d5..e2b0e1cc28d0e 100644
          instead of relying on df only.
  
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index ce78a9441c64f..7af7af717c9ba 100644
+index 3d4ef6725de0e..ab2c610cd24fa 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -185,6 +185,21 @@ enum btrfs_raid_types __attribute_const__ btrfs_bg_flags_to_raid_index(u64 flags
@@ -96,7 +96,7 @@ index ce78a9441c64f..7af7af717c9ba 100644
  const char *btrfs_bg_type_to_raid_name(u64 flags)
  {
        const int index = btrfs_bg_flags_to_raid_index(flags);
-@@ -5576,13 +5591,20 @@ static int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info,
+@@ -5588,13 +5603,20 @@ static int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info,
  }
  
  /*
@@ -118,7 +118,7 @@ index ce78a9441c64f..7af7af717c9ba 100644
        if (di_a->max_avail > di_b->max_avail)
                return -1;
        if (di_a->max_avail < di_b->max_avail)
-@@ -5953,16 +5975,97 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -5965,16 +5987,97 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                devices_info[ndevs].max_avail = max_avail;
                devices_info[ndevs].total_avail = total_avail;
                devices_info[ndevs].dev = device;
@@ -217,7 +217,7 @@ index ce78a9441c64f..7af7af717c9ba 100644
  }
  
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 75b1179776c80..3cd7d94554151 100644
+index 891bc2432870a..da7c03871b838 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -603,6 +603,9 @@ struct btrfs_device_info {
index e748834d0b76feda5a69d78ec3fa7ed09922b013..39381a87b8a33ea96a5e964c9acf3af242c79a82 100644 (file)
@@ -1,4 +1,4 @@
-From e6522b0e9a45322c222d5498159e533a775a3107 Mon Sep 17 00:00:00 2001
+From 0e062c9666d8bdf4036bb08f1014deca2eacb770 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 11 Jul 2026 00:09:55 +0200
 Subject: [PATCH 06/12] btrfs: add allocator_hint for no allocation preferred
@@ -50,7 +50,7 @@ index a3ccfe3dbcafc..931fd4b5a6559 100644
        default:
                return false;
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 7af7af717c9ba..c1fc62270289d 100644
+index ab2c610cd24fa..b8ef5f66ec982 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -196,6 +196,7 @@ static const int alloc_hint_map[BTRFS_DEV_ALLOCATION_MASK_COUNT] = {
@@ -61,7 +61,7 @@ index 7af7af717c9ba..c1fc62270289d 100644
        /* the other values are set to 0 */
  };
  #endif /* CONFIG_BTRFS_ALLOCATOR_HINTS */
-@@ -6012,7 +6013,10 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6024,7 +6025,10 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                         * sort also by hint (metadata hint
                         * higher priority)
                         */
index 4274a110cb4bd68a49936a8b34bfcdabfb699ba8..f64f41d92e094a3c54fcb423d9196496eac246d4 100644 (file)
@@ -1,4 +1,4 @@
-From 957e128e0135432355d6d9f352d2ab6556f1d456 Mon Sep 17 00:00:00 2001
+From 15e8021ae885879813111e630ededa70628175f7 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Fri, 10 Jul 2026 23:51:46 +0200
 Subject: [PATCH 07/12] btrfs: add allocator_hint to disable allocation
@@ -59,7 +59,7 @@ index 931fd4b5a6559..16912c8f4f9e6 100644
        default:
                return false;
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index c1fc62270289d..00ecf2b1b30f4 100644
+index b8ef5f66ec982..586fb9edb19b3 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -192,6 +192,7 @@ enum btrfs_raid_types __attribute_const__ btrfs_bg_flags_to_raid_index(u64 flags
@@ -70,7 +70,7 @@ index c1fc62270289d..00ecf2b1b30f4 100644
        [BTRFS_DEV_ALLOCATION_DATA_ONLY] = -1,
        [BTRFS_DEV_ALLOCATION_PREFERRED_DATA] = 0,
        [BTRFS_DEV_ALLOCATION_PREFERRED_METADATA] = 1,
-@@ -5994,6 +5995,11 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6006,6 +6007,11 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                         */
                        if (BTRFS_DEV_ALLOCATION_METADATA_ONLY == hint)
                                continue;
@@ -82,7 +82,7 @@ index c1fc62270289d..00ecf2b1b30f4 100644
                        /*
                         * if a data chunk must be allocated,
                         * sort also by hint (data disk
-@@ -6008,6 +6014,11 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6020,6 +6026,11 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                         */
                        if (BTRFS_DEV_ALLOCATION_DATA_ONLY == hint)
                                continue;
index b96eb745a135d952cd8459c6054e47febc3bd9e6..627ef9e062f923a323a055d7bbbb41f95989f6f9 100644 (file)
@@ -1,4 +1,4 @@
-From ea8ce1d15132db90dc7067e3fbd4bdb5bebf77d9 Mon Sep 17 00:00:00 2001
+From 6ef13f21e247ac4d1ad203cfbfc58826646f66e7 Mon Sep 17 00:00:00 2001
 From: KeinNiemand <18308201+KeinNiemand@users.noreply.github.com>
 Date: Sun, 30 Aug 2026 14:50:54 +0200
 Subject: [PATCH 08/12] btrfs: honor allocator hints for fixed-width mirrors
@@ -44,10 +44,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  1 file changed, 13 insertions(+)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 00ecf2b1b30f4..eba473441b55a 100644
+index 586fb9edb19b3..3bde22ffbd7c0 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6064,6 +6064,19 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6076,6 +6076,19 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                        break;
        }
  
index f21c77bd7567ce5e858c68a985f2d6f840a6207f..f1e4f183aab5dadc5f89cdd14341d8d7510605f7 100644 (file)
@@ -1,4 +1,4 @@
-From fa99f98d377069191545f2d42062ad5c1c3aad65 Mon Sep 17 00:00:00 2001
+From 7fbece5a12d5b4477bd520ac74756a3b3b0aa12a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 4 Oct 2026 00:44:02 -0400
 Subject: [PATCH 09/12] btrfs: allocator hints: move the hint values out of the
@@ -19,14 +19,13 @@ Only fs/btrfs uses the values, so move them to fs/btrfs/volumes.h, still
 under the Kconfig guard.  That keeps them out of userspace, which was the
 intent, without the leak.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/volumes.h              | 21 +++++++++++++++++++++
  include/uapi/linux/btrfs_tree.h | 25 -------------------------
  2 files changed, 21 insertions(+), 25 deletions(-)
 
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 3cd7d94554151..ae48bcec15a94 100644
+index da7c03871b838..91efbea27d04c 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -598,6 +598,27 @@ struct btrfs_io_context {
index f5e3fc929f5d336393fc8796fe253f449dde4444..50904d6d08e0a5c75721552e3ef0f878e34b70b3 100644 (file)
@@ -1,4 +1,4 @@
-From 57b6931d10a94b5031d8e352a07386f48b1dde10 Mon Sep 17 00:00:00 2001
+From 1e8e85d87b5bea59f545e977e229199963980318 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 4 Oct 2026 00:44:58 -0400
 Subject: [PATCH 10/12] btrfs: allocator hints: keep the hint across device
@@ -27,7 +27,6 @@ devid, and for the source of a running or suspended replace.  An -ENOENT
 that still gets past these checks (remove, or a replace that finishes
 after them) ends the transaction without aborting it and returns -ENODEV.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/Kconfig       |  9 +++++----
  fs/btrfs/dev-replace.c |  6 ++++++
@@ -55,10 +54,10 @@ index e14cddb83c8a3..038626bd24a68 100644
          You are advised to watch your free space closely with btrfs tools
          instead of relying on df only.
 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
-index cdfe093e5c5c4..ac0e3e99ac653 100644
+index 3c48cc714fef2..903501370cbb1 100644
 --- a/fs/btrfs/dev-replace.c
 +++ b/fs/btrfs/dev-replace.c
-@@ -990,6 +990,12 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
+@@ -989,6 +989,12 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                          btrfs_dev_name(tgt_device));
        clear_bit(BTRFS_DEV_STATE_REPLACE_TGT, &tgt_device->dev_state);
        tgt_device->devid = src_device->devid;
index f72be6c967d48bfa0aa7df9d3ea2f719c45e3814..c77333730bddf6a7f4bd0db8e40b4d60c94a4334 100644 (file)
@@ -1,4 +1,4 @@
-From 6bf6a73de3e2ea08417c5094587ac931b29fed85 Mon Sep 17 00:00:00 2001
+From 719bd5945ed892368c908d1fd3e5e5f04d8083c2 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 4 Oct 2026 10:55:00 -0400
 Subject: [PATCH 11/12] btrfs: allocator hints: don't run a transaction from
@@ -49,7 +49,6 @@ half), and btrfs_update_device() reads the type with READ_ONCE(), so the
 commit cannot write the old type and clear the bit on a weakly ordered
 machine.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/Kconfig       |  9 ++---
  fs/btrfs/dev-replace.c |  3 ++
@@ -80,10 +79,10 @@ index 038626bd24a68..f097f9631a857 100644
          You are advised to watch your free space closely with btrfs tools
          instead of relying on df only.
 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
-index ac0e3e99ac653..8c6f156524332 100644
+index 903501370cbb1..062fd114f5088 100644
 --- a/fs/btrfs/dev-replace.c
 +++ b/fs/btrfs/dev-replace.c
-@@ -996,6 +996,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
+@@ -995,6 +995,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
         * on the target writes type 0 over it.
         */
        tgt_device->type = src_device->type;
@@ -228,10 +227,10 @@ index 6457b74d67f93..6e1d0636f9af9 100644
  BTRFS_ATTR_RW(devid, type, btrfs_devinfo_type_show, btrfs_devinfo_type_store);
  #endif /* CONFIG_BTRFS_ALLOCATOR_HINTS */
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index d265fac023e58..39d2718256019 100644
+index cd7dff5ba59b6..4171a5200bede 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
-@@ -2285,6 +2285,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2280,6 +2280,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                        goto lockdep_trans_commit_start_release;
        }
  
@@ -242,10 +241,10 @@ index d265fac023e58..39d2718256019 100644
  
        if (!test_bit(BTRFS_TRANS_DIRTY_BG_RUN, &cur_trans->flags)) {
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index eba473441b55a..4017a4c07ce0c 100644
+index 3bde22ffbd7c0..34ef420d35ce8 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -3267,7 +3267,7 @@ int btrfs_update_device(struct btrfs_trans_handle *trans, struct btrfs_device *d
+@@ -3279,7 +3279,7 @@ int btrfs_update_device(struct btrfs_trans_handle *trans, struct btrfs_device *d
        dev_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dev_item);
  
        btrfs_set_device_id(leaf, dev_item, device->devid);
@@ -254,7 +253,7 @@ index eba473441b55a..4017a4c07ce0c 100644
        btrfs_set_device_io_align(leaf, dev_item, device->io_align);
        btrfs_set_device_io_width(leaf, dev_item, device->io_width);
        btrfs_set_device_sector_size(leaf, dev_item, device->sector_size);
-@@ -8730,6 +8730,61 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
+@@ -8742,6 +8742,61 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
        return ret;
  }
  
@@ -317,7 +316,7 @@ index eba473441b55a..4017a4c07ce0c 100644
  {
        btrfs_dev_stat_inc(dev, index);
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index ae48bcec15a94..f4dd7fd5e4d97 100644
+index 91efbea27d04c..df5c6db129869 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -110,6 +110,8 @@ static_assert(BTRFS_RAID_RAID1C4 == 8);
@@ -329,7 +328,7 @@ index ae48bcec15a94..f4dd7fd5e4d97 100644
  
  /* Special value encoding failure to write primary super block. */
  #define BTRFS_SUPER_PRIMARY_WRITE_ERROR               (INT_MAX / 2)
-@@ -820,6 +822,11 @@ int btrfs_init_devices_late(struct btrfs_fs_info *fs_info);
+@@ -819,6 +821,11 @@ int btrfs_init_devices_late(struct btrfs_fs_info *fs_info);
  int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info);
  int btrfs_init_writeback_bio_size(struct btrfs_fs_info *fs_info);
  int btrfs_run_dev_stats(struct btrfs_trans_handle *trans);
index 01f3f6efe24c892f16b0ca18d0058e3bff148ccc..38cf4022a1ec8e63d0f220f4baed630485d08a86 100644 (file)
@@ -1,4 +1,4 @@
-From b3af80d4e58b937314a4840129845611db1b825e Mon Sep 17 00:00:00 2001
+From df0e45e0fe79ddc8c332cba8ab8678b37e55c160 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 18 Oct 2026 15:50:43 -0400
 Subject: [PATCH 12/12] btrfs: allocator hints: make the available space
@@ -60,7 +60,6 @@ With this change the reproducer fills metadata to a clean ENOSPC with no
 abort and no lost files, and statfs reports the space data can really
 use.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/space-info.c |   3 +-
  fs/btrfs/super.c      |   4 +
@@ -112,7 +111,7 @@ index 6e1d0636f9af9..3732f58439c67 100644
  
        /* We don't want to do full transaction commit from inside sysfs */
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 4017a4c07ce0c..39235ea12b746 100644
+index 34ef420d35ce8..30e4e217bbe64 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -200,7 +200,101 @@ static const int alloc_hint_map[BTRFS_DEV_ALLOCATION_MASK_COUNT] = {
@@ -217,7 +216,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
  
  const char *btrfs_bg_type_to_raid_name(u64 flags)
  {
-@@ -5634,7 +5728,7 @@ static int btrfs_cmp_device_info(const void *a, const void *b)
+@@ -5646,7 +5740,7 @@ static int btrfs_cmp_device_info(const void *a, const void *b)
   */
  static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
                               struct btrfs_device_info *devices_info,
@@ -226,7 +225,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
                               u64 *allocated)
  {
        const struct btrfs_raid_attr *raid_attr = &btrfs_raid_array[type];
-@@ -5654,6 +5748,13 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
+@@ -5666,6 +5760,13 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
                    test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state))
                        continue;
  
@@ -240,7 +239,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
                if (device->total_bytes > device->bytes_used +
                                device->per_profile_allocated)
                        avail = device->total_bytes - device->bytes_used -
-@@ -5688,6 +5789,16 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
+@@ -5700,6 +5801,16 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
        }
        sort(devices_info, ndevs, sizeof(struct btrfs_device_info),
             btrfs_cmp_device_info, NULL);
@@ -257,7 +256,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
        ndevs = rounddown(ndevs, raid_attr->devs_increment);
        if (ndevs < raid_attr->devs_min)
                return -ENOSPC;
-@@ -5710,7 +5821,7 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
+@@ -5722,7 +5833,7 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
  }
  
  static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
@@ -266,7 +265,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
                                  u64 *result_ret)
  {
        struct btrfs_device_info *devices_info = NULL;
-@@ -5738,7 +5849,8 @@ static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
+@@ -5750,7 +5861,8 @@ static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
        list_for_each_entry(device, &fs_devices->alloc_list, dev_alloc_list)
                device->per_profile_allocated = 0;
  
@@ -276,7 +275,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
                result += allocated;
  
  out:
-@@ -5749,10 +5861,19 @@ static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
+@@ -5761,10 +5873,19 @@ static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
        return 0;
  }
  
@@ -298,7 +297,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
        int ret;
  
        /*
-@@ -5762,21 +5883,33 @@ void btrfs_update_per_profile_avail(struct btrfs_fs_info *fs_info)
+@@ -5774,21 +5895,33 @@ void btrfs_update_per_profile_avail(struct btrfs_fs_info *fs_info)
        if (btrfs_is_zoned(fs_info))
                goto error;
  
@@ -340,7 +339,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
        spin_unlock(&fs_info->fs_devices->per_profile_lock);
  }
  
-@@ -5979,56 +6112,9 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -5991,56 +6124,9 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                devices_info[ndevs].dev = device;
  
  #ifdef CONFIG_BTRFS_ALLOCATOR_HINTS
@@ -400,7 +399,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
  #endif /* CONFIG_BTRFS_ALLOCATOR_HINTS */
  
                ++ndevs;
-@@ -6054,28 +6140,8 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6066,28 +6152,8 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
         * select the minimum set of disks grouped by hint that
         * can host the chunk
         */
@@ -432,7 +431,7 @@ index 4017a4c07ce0c..39235ea12b746 100644
        BUG_ON(ndevs > ctl->ndevs);
        ctl->ndevs = ndevs;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index f4dd7fd5e4d97..3fd0200e8ec73 100644
+index df5c6db129869..31538a7bf7fa6 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -337,6 +337,13 @@ enum btrfs_read_policy {
@@ -466,7 +465,7 @@ index f4dd7fd5e4d97..3fd0200e8ec73 100644
        spinlock_t per_profile_lock;
  };
  
-@@ -948,18 +957,26 @@ const char *btrfs_bg_type_to_raid_name(u64 flags);
+@@ -947,18 +956,26 @@ const char *btrfs_bg_type_to_raid_name(u64 flags);
  int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info);
  bool btrfs_verify_dev_items(const struct btrfs_fs_info *fs_info);
  void btrfs_update_per_profile_avail(struct btrfs_fs_info *fs_info);
index eab277914f565c9c3be10f915ab0cff84d8f3672..7769891a3544d6b6699bb32202bf0ab5eb56e77e 100644 (file)
@@ -1,6 +1,6 @@
-From 46b25327a7470027c3c6ad6314e9bef9c6da6a4e Mon Sep 17 00:00:00 2001
+From e38f7c20705d1ff55bd3ed96b2e3c83650037984 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:03:59 -0400
+Date: Fri, 6 Nov 2026 05:48:14 -0500
 Subject: [PATCH 0/3] btrfs: balance resume selects what the original request selected
 To: linux-btrfs@vger.kernel.org
 
@@ -130,17 +130,15 @@ Testing (KASAN kernels):
 
 Zygo Blaxell (3):
   btrfs: free queued remap chunks when balance bails out
-  btrfs: replace the usage=90 balance resume heuristic with a vrange
-    bound
-  btrfs: keep the usage=90 resume heuristic for balance items without a
-    vrange
+  btrfs: replace the balance resume heuristics with a vrange bound
+  btrfs: keep the old resume filters for balance items without a vrange
 
- fs/btrfs/fs.h      |  6 +++
- fs/btrfs/volumes.c | 92 +++++++++++++++++++++++++++++++++++++++-------
- 2 files changed, 85 insertions(+), 13 deletions(-)
+ fs/btrfs/fs.h      |   6 ++
+ fs/btrfs/volumes.c | 215 +++++++++++++++++++++++++++++++++++----------
+ fs/btrfs/volumes.h |   6 ++
+ 3 files changed, 181 insertions(+), 46 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 7689834e6894539b77163b39abbddb1d04b61e58..0f1f4dbb2c0ab17d8f41050b0acb8dd72bb6f08a 100644 (file)
@@ -1,4 +1,4 @@
-From 3a4e04bb5fbc61a0b85d7919e17d3364357862a6 Mon Sep 17 00:00:00 2001
+From d0136e6493082d001aa33ed4174dae6062abb49a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 13 Oct 2026 01:05:21 -0400
 Subject: [PATCH 1/3] btrfs: free queued remap chunks when balance bails out
@@ -18,16 +18,15 @@ taken inside balance_remap_chunks(), so a queued entry holds no block
 group and none is left read-only.
 
 Fixes: 81e5a4551c32 ("btrfs: allow balancing remap tree")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/volumes.c | 8 ++++++++
  1 file changed, 8 insertions(+)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index ce78a9441c64f..2ed57bc7a9905 100644
+index 3d4ef6725de0e..788f60910acf5 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -4744,6 +4744,14 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
+@@ -4756,6 +4756,14 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
                }
        }
  error:
diff --git a/topics/balance-resume/0002-btrfs-replace-the-balance-resume-heuristics-with-a-v.patch b/topics/balance-resume/0002-btrfs-replace-the-balance-resume-heuristics-with-a-v.patch
new file mode 100644 (file)
index 0000000..bd61bc2
--- /dev/null
@@ -0,0 +1,378 @@
+From d406ea315d237d2860e238c0cccdf9dc2c94b3c0 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Wed, 16 Sep 2026 02:29:10 -0400
+Subject: [PATCH 2/3] btrfs: replace the balance resume heuristics with a
+ vrange bound
+To: linux-btrfs@vger.kernel.org
+
+When a balance is resumed after a pause or an unmount,
+update_balance_args() adds a usage=90 filter to every chunk type that is
+not being converted.  That changes the set of block groups the original
+request selected.  It skips full block groups the interrupted balance had
+not reached yet, so the resumed balance can finish without having done
+what was asked, and it selects again any block group the interrupted
+balance created that is less than 90% full, relocating the same data a
+second time.  For the chunk types that are being converted it adds the
+soft filter instead, so the resume does not convert again the block
+groups the interrupted balance converted, but it also skips the ones
+that already had the target profile when the balance started, which the
+original request selected.
+
+Replace it with a bound fixed when the balance starts.  Before the
+balance item is written, limit the vrange filter of each chunk type to
+the addresses below the next chunk to be allocated: add a 0..end range
+when the request had no vrange filter, or lower the end of the one it
+had.  Every block group that existed when the balance started stays
+selected until the balance relocates it.
+
+New chunks are allocated after the last chunk, but relocation can remove
+the highest chunks without allocating any (their data fits in free space
+lower down), and the next chunk would then reuse their addresses, below
+the bound.  A resumed balance would select it again, although the
+interrupted one, walking downward, never would have.  So while a balance
+item exists, find_next_chunk() never returns an address below the bound:
+an in-memory floor, set when the balance starts and when the balance
+item is recovered at mount, and cleared when the item is deleted.  Every
+chunk allocated in that time, relocation targets included, stays outside
+the range, on the first run and after a resume.  The gap the floor can
+leave in the logical address space is harmless.
+
+A resume now uses the arguments exactly as they were stored: the bound
+already keeps out every block group the interrupted balance created,
+converted ones included, so neither the usage filter nor the soft filter
+is needed, and update_balance_args() goes away.
+
+The bound does not move as the balance progresses.  Block groups the
+balance has relocated are gone, so on resume the walk only revisits the
+chunks it left in place above the point where it stopped (filtered out,
+ENOSPC, active swapfile) and checks them against the filters again.
+Nothing is skipped.
+
+Because the bound is written with the balance item and never changes,
+there is no progress to persist: a resume after an unmount or a crash
+needs no extra writes.
+
+A balance item recovered at mount is limited in the same way before the
+floor is set from it: a vrange 0..end is added to each chunk type that
+has none, and a vrange that ends above the next chunk is lowered to it.
+That covers items written by older kernels, which have no vrange or a
+vrange the user gave, which can end anywhere (a 1 TiB end would put
+every new chunk at 1 TiB and above).  A bound written by this kernel
+changes only when relocation removed the highest chunks and allocated
+none above it; no chunk exists between the next chunk and the old end,
+so lowering it drops nothing.  When the recovered arguments change,
+they are written back to the balance item once, when the balance
+resumes, so a resume that is interrupted again resumes with the same
+bound and not with a new one that includes the chunks the first resume
+allocated.
+
+A balance item written by an older kernel therefore resumes with the
+bound and without the usage or soft filter: the resumed balance restarts
+from the beginning, relocating again every block group the request
+selects, including the ones the interrupted run created or converted,
+but it skips none.
+
+The bound is visible: `btrfs balance status -v`, the
+BTRFS_IOC_BALANCE_PROGRESS ioctl and the "balance: start" and "balance:
+resume" log lines show a vrange the user did not give.
+
+---
+ fs/btrfs/fs.h      |   6 ++
+ fs/btrfs/volumes.c | 178 ++++++++++++++++++++++++++++++++-------------
+ fs/btrfs/volumes.h |   6 ++
+ 3 files changed, 140 insertions(+), 50 deletions(-)
+
+diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
+index 2dd167c32d612..a42aa4de2bcc6 100644
+--- a/fs/btrfs/fs.h
++++ b/fs/btrfs/fs.h
+@@ -785,6 +785,12 @@ struct btrfs_fs_info {
+       atomic_t balance_cancel_req;
+       struct btrfs_balance_control *balance_ctl;
+       wait_queue_head_t balance_wait_q;
++      /*
++       * 0, or the end of the balance's vrange bound: while a balance item
++       * exists (running or paused) find_next_chunk() allocates at or above
++       * it, so the balance never selects a chunk it allocated.
++       */
++      u64 balance_chunk_floor;
+ 
+       /* Cancellation requests for chunk relocation */
+       atomic_t reloc_cancel_req;
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
+index 788f60910acf5..9251087396828 100644
+--- a/fs/btrfs/volumes.c
++++ b/fs/btrfs/volumes.c
+@@ -2035,7 +2035,7 @@ static u64 find_next_chunk(struct btrfs_fs_info *fs_info)
+       }
+       read_unlock(&fs_info->mapping_tree_lock);
+ 
+-      return ret;
++      return max(ret, READ_ONCE(fs_info->balance_chunk_floor));
+ }
+ 
+ static noinline int find_next_devid(struct btrfs_fs_info *fs_info,
+@@ -3970,13 +3970,27 @@ static void btrfs_cpu_balance_args_to_disk(struct btrfs_disk_balance_args *disk,
+       disk->stripes_max = cpu_to_le32(cpu->stripes_max);
+ }
+ 
++static void set_balance_item(struct extent_buffer *leaf,
++                           struct btrfs_balance_item *item,
++                           const struct btrfs_balance_control *bctl)
++{
++      struct btrfs_disk_balance_args disk_bargs;
++
++      btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->data);
++      btrfs_set_balance_data(leaf, item, &disk_bargs);
++      btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->meta);
++      btrfs_set_balance_meta(leaf, item, &disk_bargs);
++      btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->sys);
++      btrfs_set_balance_sys(leaf, item, &disk_bargs);
++      btrfs_set_balance_flags(leaf, item, bctl->flags & ~BTRFS_BALANCE_RESUME);
++}
++
+ static int insert_balance_item(struct btrfs_fs_info *fs_info,
+                              struct btrfs_balance_control *bctl)
+ {
+       struct btrfs_root *root = fs_info->tree_root;
+       struct btrfs_trans_handle *trans;
+       struct btrfs_balance_item *item;
+-      struct btrfs_disk_balance_args disk_bargs;
+       struct btrfs_path *path;
+       struct extent_buffer *leaf;
+       struct btrfs_key key;
+@@ -4005,14 +4019,7 @@ static int insert_balance_item(struct btrfs_fs_info *fs_info,
+       item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_balance_item);
+ 
+       memzero_extent_buffer(leaf, (unsigned long)item, sizeof(*item));
+-
+-      btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->data);
+-      btrfs_set_balance_data(leaf, item, &disk_bargs);
+-      btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->meta);
+-      btrfs_set_balance_meta(leaf, item, &disk_bargs);
+-      btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->sys);
+-      btrfs_set_balance_sys(leaf, item, &disk_bargs);
+-      btrfs_set_balance_flags(leaf, item, bctl->flags);
++      set_balance_item(leaf, item, bctl);
+ out:
+       btrfs_free_path(path);
+       if (ret == 0)
+@@ -4023,6 +4030,43 @@ static int insert_balance_item(struct btrfs_fs_info *fs_info,
+       return ret;
+ }
+ 
++/* Write the arguments of a resumed balance to its existing item. */
++static int update_balance_item(struct btrfs_fs_info *fs_info,
++                             const struct btrfs_balance_control *bctl)
++{
++      struct btrfs_root *root = fs_info->tree_root;
++      struct btrfs_trans_handle *trans;
++      BTRFS_PATH_AUTO_FREE(path);
++      struct btrfs_key key;
++      int ret;
++
++      path = btrfs_alloc_path();
++      if (!path)
++              return -ENOMEM;
++
++      trans = btrfs_start_transaction(root, 0);
++      if (IS_ERR(trans))
++              return PTR_ERR(trans);
++
++      key.objectid = BTRFS_BALANCE_OBJECTID;
++      key.type = BTRFS_TEMPORARY_ITEM_KEY;
++      key.offset = 0;
++
++      ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
++      if (ret > 0)
++              ret = -ENOENT;
++      if (ret < 0) {
++              btrfs_end_transaction(trans);
++              return ret;
++      }
++
++      set_balance_item(path->nodes[0],
++                       btrfs_item_ptr(path->nodes[0], path->slots[0],
++                                      struct btrfs_balance_item), bctl);
++      btrfs_release_path(path);
++      return btrfs_commit_transaction(trans);
++}
++
+ static int del_balance_item(struct btrfs_fs_info *fs_info)
+ {
+       struct btrfs_root *root = fs_info->tree_root;
+@@ -4064,47 +4108,61 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
+       return ret;
+ }
+ 
++static bool limit_balance_vrange(struct btrfs_balance_args *bargs, u64 end)
++{
++      if (!(bargs->flags & BTRFS_BALANCE_ARGS_VRANGE)) {
++              bargs->flags |= BTRFS_BALANCE_ARGS_VRANGE;
++              bargs->vstart = 0;
++              bargs->vend = end;
++              return true;
++      }
++      if (bargs->vend <= end)
++              return false;
++      bargs->vend = end;
++      return true;
++}
++
+ /*
+- * This is a heuristic used to reduce the number of chunks balanced on
+- * resume after balance was interrupted.
++ * Limit the request to the chunks that exist now.  The bound is written with
++ * the balance item and never moves, so there is no progress to persist.  New
++ * chunks are allocated after the last chunk, but once relocation has removed
++ * the highest chunks the last chunk is lower than the bound, so while the
++ * balance item exists find_next_chunk() also observes balance_chunk_floor:
++ * every chunk allocated in that time, relocation targets included, stays
++ * outside the range, on this run and after a resume.
++ *
++ * Return true if any of the arguments changed.
+  */
+-static void update_balance_args(struct btrfs_balance_control *bctl)
++static bool limit_balance_to_existing_chunks(struct btrfs_fs_info *fs_info,
++                                           struct btrfs_balance_control *bctl)
+ {
+-      /*
+-       * Turn on soft mode for chunk types that were being converted.
+-       */
+-      if (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT)
+-              bctl->data.flags |= BTRFS_BALANCE_ARGS_SOFT;
+-      if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT)
+-              bctl->sys.flags |= BTRFS_BALANCE_ARGS_SOFT;
+-      if (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)
+-              bctl->meta.flags |= BTRFS_BALANCE_ARGS_SOFT;
++      const u64 end = find_next_chunk(fs_info);
++      bool changed = false;
+ 
+-      /*
+-       * Turn on usage filter if is not already used.  The idea is
+-       * that chunks that we have already balanced should be
+-       * reasonably full.  Don't do it for chunks that are being
+-       * converted - that will keep us from relocating unconverted
+-       * (albeit full) chunks.
+-       */
+-      if (!(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE) &&
+-          !(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
+-          !(bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT)) {
+-              bctl->data.flags |= BTRFS_BALANCE_ARGS_USAGE;
+-              bctl->data.usage = 90;
+-      }
+-      if (!(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE) &&
+-          !(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
+-          !(bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT)) {
+-              bctl->sys.flags |= BTRFS_BALANCE_ARGS_USAGE;
+-              bctl->sys.usage = 90;
+-      }
+-      if (!(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE) &&
+-          !(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
+-          !(bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)) {
+-              bctl->meta.flags |= BTRFS_BALANCE_ARGS_USAGE;
+-              bctl->meta.usage = 90;
+-      }
++      if (bctl->flags & BTRFS_BALANCE_DATA)
++              changed |= limit_balance_vrange(&bctl->data, end);
++      if (bctl->flags & BTRFS_BALANCE_METADATA)
++              changed |= limit_balance_vrange(&bctl->meta, end);
++      if (bctl->flags & BTRFS_BALANCE_SYSTEM)
++              changed |= limit_balance_vrange(&bctl->sys, end);
++      return changed;
++}
++
++/* The highest vrange end of the selected chunk types, 0 if none has one. */
++static u64 balance_chunk_floor(const struct btrfs_balance_control *bctl)
++{
++      u64 floor = 0;
++
++      if ((bctl->flags & BTRFS_BALANCE_DATA) &&
++          (bctl->data.flags & BTRFS_BALANCE_ARGS_VRANGE))
++              floor = max(floor, bctl->data.vend);
++      if ((bctl->flags & BTRFS_BALANCE_METADATA) &&
++          (bctl->meta.flags & BTRFS_BALANCE_ARGS_VRANGE))
++              floor = max(floor, bctl->meta.vend);
++      if ((bctl->flags & BTRFS_BALANCE_SYSTEM) &&
++          (bctl->sys.flags & BTRFS_BALANCE_ARGS_VRANGE))
++              floor = max(floor, bctl->sys.vend);
++      return floor;
+ }
+ 
+ /*
+@@ -4123,6 +4181,7 @@ static void reset_balance_state(struct btrfs_fs_info *fs_info)
+ 
+       kfree(bctl);
+       ret = del_balance_item(fs_info);
++      WRITE_ONCE(fs_info->balance_chunk_floor, 0);
+       if (ret)
+               btrfs_handle_fs_error(fs_info, ret, NULL);
+ }
+@@ -5088,6 +5147,9 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
+                               btrfs_bg_type_to_raid_name(data_target));
+       }
+ 
++      if (!(bctl->flags & BTRFS_BALANCE_RESUME))
++              limit_balance_to_existing_chunks(fs_info, bctl);
++
+       ret = insert_balance_item(fs_info, bctl);
+       if (ret && ret != -EEXIST)
+               goto out;
+@@ -5098,11 +5160,16 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
+               spin_lock(&fs_info->balance_lock);
+               fs_info->balance_ctl = bctl;
+               spin_unlock(&fs_info->balance_lock);
++              WRITE_ONCE(fs_info->balance_chunk_floor,
++                         balance_chunk_floor(bctl));
+       } else {
+               BUG_ON(ret != -EEXIST);
+-              spin_lock(&fs_info->balance_lock);
+-              update_balance_args(bctl);
+-              spin_unlock(&fs_info->balance_lock);
++              if (bctl->update_item) {
++                      ret = update_balance_item(fs_info, bctl);
++                      if (ret)
++                              goto out;
++                      bctl->update_item = false;
++              }
+       }
+ 
+       ASSERT(!test_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags));
+@@ -5255,6 +5322,17 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
+       btrfs_balance_sys(leaf, item, &disk_bargs);
+       btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs);
+ 
++      /*
++       * Bound the request as a new balance would be: an item written by an
++       * older kernel has no vrange, and one a user gave to such a kernel can
++       * end anywhere.  The floor is still 0, so find_next_chunk() returns the
++       * end of the last chunk, and lowering a vend above it drops no block
++       * group from the range.  The bound is written back to the item when
++       * the balance resumes, so a resume that is interrupted again keeps it.
++       */
++      bctl->update_item = limit_balance_to_existing_chunks(fs_info, bctl);
++      WRITE_ONCE(fs_info->balance_chunk_floor, balance_chunk_floor(bctl));
++
+       /*
+        * This should never happen, as the paused balance state is recovered
+        * during mount without any chance of other exclusive ops to collide.
+diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
+index 891bc2432870a..e7112257014e8 100644
+--- a/fs/btrfs/volumes.h
++++ b/fs/btrfs/volumes.h
+@@ -665,6 +665,12 @@ struct btrfs_balance_control {
+ 
+       u64 flags;
+ 
++      /*
++       * The arguments recovered at mount were bounded and differ from the
++       * balance item: write them back when the balance resumes.
++       */
++      bool update_item;
++
+       struct btrfs_balance_progress stat;
+ };
+ 
+-- 
+2.47.3
+
diff --git a/topics/balance-resume/0002-btrfs-replace-the-usage-90-balance-resume-heuristic-.patch b/topics/balance-resume/0002-btrfs-replace-the-usage-90-balance-resume-heuristic-.patch
deleted file mode 100644 (file)
index baaf83f..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-From cff18d11ec6e4922138d46fdf89802343fab4c70 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Wed, 16 Sep 2026 02:29:10 -0400
-Subject: [PATCH 2/3] btrfs: replace the usage=90 balance resume heuristic with
- a vrange bound
-To: linux-btrfs@vger.kernel.org
-
-When a balance is resumed after a pause or an unmount,
-update_balance_args() adds a usage=90 filter to every chunk type that is
-not being converted.  That changes the set of block groups the original
-request selected.  It skips full block groups the interrupted balance had
-not reached yet, so the resumed balance can finish without having done
-what was asked, and it selects again any block group the interrupted
-balance created that is less than 90% full, relocating the same data a
-second time.
-
-Replace it with a bound fixed when the balance starts.  Before the
-balance item is written, limit the vrange filter of each chunk type to
-the addresses below the next chunk to be allocated: add a 0..end range
-when the request had no vrange filter, or lower the end of the one it
-had.  Every block group that existed when the balance started stays
-selected until the balance relocates it.
-
-New chunks are allocated after the last chunk, but relocation can remove
-the highest chunks without allocating any (their data fits in free space
-lower down), and the next chunk would then reuse their addresses, below
-the bound.  A resumed balance would select it again, although the
-interrupted one, walking downward, never would have.  So while a balance
-item exists, find_next_chunk() never returns an address below the bound:
-an in-memory floor, set when the balance starts and when the balance
-item is recovered at mount, and cleared when the item is deleted.  Every
-chunk allocated in that time, relocation targets included, stays outside
-the range, on the first run and after a resume.  The gap the floor can
-leave in the logical address space is harmless.
-
-The bound does not move as the balance progresses.  Block groups the
-balance has relocated are gone, so on resume the walk only revisits the
-chunks it left in place above the point where it stopped (filtered out,
-ENOSPC, active swapfile) and checks them against the filters again.
-Nothing is skipped.
-
-Because the bound is written with the balance item and never changes,
-there is no progress to persist: a resume after an unmount or a crash
-needs no extra writes.
-
-A balance item written by an older kernel has no bound and now resumes
-without the usage filter: the resumed balance restarts from the
-beginning, relocating again every block group the request selects,
-including the ones the interrupted run created, but it skips none.
-
-The bound is visible: `btrfs balance status -v`, the
-BTRFS_IOC_BALANCE_PROGRESS ioctl and the "balance: start" and "balance:
-resume" log lines show a vrange the user did not give.
-
-Assisted-by: Codex:gpt-5
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/fs.h      |  6 ++++
- fs/btrfs/volumes.c | 87 ++++++++++++++++++++++++++++++----------------
- 2 files changed, 64 insertions(+), 29 deletions(-)
-
-diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
-index 2dd167c32d612..a42aa4de2bcc6 100644
---- a/fs/btrfs/fs.h
-+++ b/fs/btrfs/fs.h
-@@ -785,6 +785,12 @@ struct btrfs_fs_info {
-       atomic_t balance_cancel_req;
-       struct btrfs_balance_control *balance_ctl;
-       wait_queue_head_t balance_wait_q;
-+      /*
-+       * 0, or the end of the balance's vrange bound: while a balance item
-+       * exists (running or paused) find_next_chunk() allocates at or above
-+       * it, so the balance never selects a chunk it allocated.
-+       */
-+      u64 balance_chunk_floor;
- 
-       /* Cancellation requests for chunk relocation */
-       atomic_t reloc_cancel_req;
-diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 2ed57bc7a9905..1996ebaeadc76 100644
---- a/fs/btrfs/volumes.c
-+++ b/fs/btrfs/volumes.c
-@@ -2035,7 +2035,7 @@ static u64 find_next_chunk(struct btrfs_fs_info *fs_info)
-       }
-       read_unlock(&fs_info->mapping_tree_lock);
- 
--      return ret;
-+      return max(ret, READ_ONCE(fs_info->balance_chunk_floor));
- }
- 
- static noinline int find_next_devid(struct btrfs_fs_info *fs_info,
-@@ -4052,10 +4052,7 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
-       return ret;
- }
- 
--/*
-- * This is a heuristic used to reduce the number of chunks balanced on
-- * resume after balance was interrupted.
-- */
-+/* Update balance arguments when resuming an interrupted balance. */
- static void update_balance_args(struct btrfs_balance_control *bctl)
- {
-       /*
-@@ -4067,34 +4064,58 @@ static void update_balance_args(struct btrfs_balance_control *bctl)
-               bctl->sys.flags |= BTRFS_BALANCE_ARGS_SOFT;
-       if (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)
-               bctl->meta.flags |= BTRFS_BALANCE_ARGS_SOFT;
-+}
- 
--      /*
--       * Turn on usage filter if is not already used.  The idea is
--       * that chunks that we have already balanced should be
--       * reasonably full.  Don't do it for chunks that are being
--       * converted - that will keep us from relocating unconverted
--       * (albeit full) chunks.
--       */
--      if (!(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE) &&
--          !(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
--          !(bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT)) {
--              bctl->data.flags |= BTRFS_BALANCE_ARGS_USAGE;
--              bctl->data.usage = 90;
--      }
--      if (!(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE) &&
--          !(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
--          !(bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT)) {
--              bctl->sys.flags |= BTRFS_BALANCE_ARGS_USAGE;
--              bctl->sys.usage = 90;
--      }
--      if (!(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE) &&
--          !(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
--          !(bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)) {
--              bctl->meta.flags |= BTRFS_BALANCE_ARGS_USAGE;
--              bctl->meta.usage = 90;
-+static void limit_balance_vrange(struct btrfs_balance_args *bargs, u64 end)
-+{
-+      if (bargs->flags & BTRFS_BALANCE_ARGS_VRANGE) {
-+              bargs->vend = min(bargs->vend, end);
-+      } else {
-+              bargs->flags |= BTRFS_BALANCE_ARGS_VRANGE;
-+              bargs->vstart = 0;
-+              bargs->vend = end;
-       }
- }
- 
-+/*
-+ * Limit the request to the chunks that exist now.  The bound is written with
-+ * the balance item and never moves, so there is no progress to persist.  New
-+ * chunks are allocated after the last chunk, but once relocation has removed
-+ * the highest chunks the last chunk is lower than the bound, so while the
-+ * balance item exists find_next_chunk() also observes balance_chunk_floor:
-+ * every chunk allocated in that time, relocation targets included, stays
-+ * outside the range, on this run and after a resume.
-+ */
-+static void limit_balance_to_existing_chunks(struct btrfs_fs_info *fs_info,
-+                                           struct btrfs_balance_control *bctl)
-+{
-+      const u64 end = find_next_chunk(fs_info);
-+
-+      if (bctl->flags & BTRFS_BALANCE_DATA)
-+              limit_balance_vrange(&bctl->data, end);
-+      if (bctl->flags & BTRFS_BALANCE_METADATA)
-+              limit_balance_vrange(&bctl->meta, end);
-+      if (bctl->flags & BTRFS_BALANCE_SYSTEM)
-+              limit_balance_vrange(&bctl->sys, end);
-+}
-+
-+/* The highest vrange end of the selected chunk types, 0 if none has one. */
-+static u64 balance_chunk_floor(const struct btrfs_balance_control *bctl)
-+{
-+      u64 floor = 0;
-+
-+      if ((bctl->flags & BTRFS_BALANCE_DATA) &&
-+          (bctl->data.flags & BTRFS_BALANCE_ARGS_VRANGE))
-+              floor = max(floor, bctl->data.vend);
-+      if ((bctl->flags & BTRFS_BALANCE_METADATA) &&
-+          (bctl->meta.flags & BTRFS_BALANCE_ARGS_VRANGE))
-+              floor = max(floor, bctl->meta.vend);
-+      if ((bctl->flags & BTRFS_BALANCE_SYSTEM) &&
-+          (bctl->sys.flags & BTRFS_BALANCE_ARGS_VRANGE))
-+              floor = max(floor, bctl->sys.vend);
-+      return floor;
-+}
-+
- /*
-  * Clear the balance status in fs_info and delete the balance item from disk.
-  */
-@@ -4111,6 +4132,7 @@ static void reset_balance_state(struct btrfs_fs_info *fs_info)
- 
-       kfree(bctl);
-       ret = del_balance_item(fs_info);
-+      WRITE_ONCE(fs_info->balance_chunk_floor, 0);
-       if (ret)
-               btrfs_handle_fs_error(fs_info, ret, NULL);
- }
-@@ -5076,6 +5098,9 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
-                               btrfs_bg_type_to_raid_name(data_target));
-       }
- 
-+      if (!(bctl->flags & BTRFS_BALANCE_RESUME))
-+              limit_balance_to_existing_chunks(fs_info, bctl);
-+
-       ret = insert_balance_item(fs_info, bctl);
-       if (ret && ret != -EEXIST)
-               goto out;
-@@ -5086,6 +5111,8 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
-               spin_lock(&fs_info->balance_lock);
-               fs_info->balance_ctl = bctl;
-               spin_unlock(&fs_info->balance_lock);
-+              WRITE_ONCE(fs_info->balance_chunk_floor,
-+                         balance_chunk_floor(bctl));
-       } else {
-               BUG_ON(ret != -EEXIST);
-               spin_lock(&fs_info->balance_lock);
-@@ -5243,6 +5270,8 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
-       btrfs_balance_sys(leaf, item, &disk_bargs);
-       btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs);
- 
-+      WRITE_ONCE(fs_info->balance_chunk_floor, balance_chunk_floor(bctl));
-+
-       /*
-        * This should never happen, as the paused balance state is recovered
-        * during mount without any chance of other exclusive ops to collide.
--- 
-2.47.3
-
diff --git a/topics/balance-resume/0003-btrfs-keep-the-old-resume-filters-for-balance-items-.patch b/topics/balance-resume/0003-btrfs-keep-the-old-resume-filters-for-balance-items-.patch
new file mode 100644 (file)
index 0000000..45f3174
--- /dev/null
@@ -0,0 +1,98 @@
+From e38f7c20705d1ff55bd3ed96b2e3c83650037984 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Tue, 13 Oct 2026 14:24:01 -0400
+Subject: [PATCH 3/3] btrfs: keep the old resume filters for balance items
+ without a vrange
+To: linux-btrfs@vger.kernel.org
+
+This patch is optional.  It is offered so that reviewers can take it or
+drop it; the author's preference is to drop it.  The previous patches do
+not depend on it.
+
+A balance item written by a kernel without the vrange bound has no vrange
+filter.  With the previous patch alone, a balance that was paused or
+interrupted on such a kernel and is resumed on a new one restarts from
+the beginning: every block group the original request selects is
+relocated again, including the ones the interrupted run created.
+
+This patch restores the old resume adjustments for exactly those items.
+When a chunk type has no vrange filter in the stored item, the resume
+changes its arguments as before: it adds the soft filter if the type is
+being converted, and usage=90 if it has no usage, usage range or convert
+filter.  This is decided when the item is recovered at mount, before
+the previous patch adds the bound, and is written back with the bound.
+A chunk type with a vrange, which is every balance started by a kernel
+with the previous patch and any balance the user gave a vrange, relies
+on the vrange and is resumed unchanged.
+
+The trade-off: the legacy resume neither completes the original request
+(block groups more than 90% full are skipped, and so are the ones being
+converted that already had the target profile) nor avoids much work on a
+filesystem that is more than 90% full, and keeping it adds a layer of
+surprising behavior and code for a case that only arises once, when a
+balance spans the kernel upgrade.  Without it, such a balance repeats
+work but skips nothing.
+
+---
+ fs/btrfs/volumes.c | 37 +++++++++++++++++++++++++++++++++++++
+ 1 file changed, 37 insertions(+)
+
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
+index 9251087396828..baf824b1d72a3 100644
+--- a/fs/btrfs/volumes.c
++++ b/fs/btrfs/volumes.c
+@@ -4108,6 +4108,41 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
+       return ret;
+ }
+ 
++/*
++ * A balance item written by a kernel without the vrange bound has no vrange
++ * filter.  Resume it as those kernels did.  A chunk type with a vrange relies
++ * on it and is resumed unchanged.
++ */
++static void update_legacy_balance_args(struct btrfs_balance_args *bargs)
++{
++      if (bargs->flags & BTRFS_BALANCE_ARGS_VRANGE)
++              return;
++
++      /* Turn on soft mode for chunk types that were being converted. */
++      if (bargs->flags & BTRFS_BALANCE_ARGS_CONVERT) {
++              bargs->flags |= BTRFS_BALANCE_ARGS_SOFT;
++              return;
++      }
++
++      /*
++       * Turn on the usage filter if it is not already used.  The idea is
++       * that chunks that we have already balanced should be reasonably full.
++       */
++      if (!(bargs->flags & (BTRFS_BALANCE_ARGS_USAGE |
++                            BTRFS_BALANCE_ARGS_USAGE_RANGE))) {
++              bargs->flags |= BTRFS_BALANCE_ARGS_USAGE;
++              bargs->usage = 90;
++      }
++}
++
++/* Update the arguments of a balance item recovered at mount. */
++static void update_balance_args(struct btrfs_balance_control *bctl)
++{
++      update_legacy_balance_args(&bctl->data);
++      update_legacy_balance_args(&bctl->sys);
++      update_legacy_balance_args(&bctl->meta);
++}
++
+ static bool limit_balance_vrange(struct btrfs_balance_args *bargs, u64 end)
+ {
+       if (!(bargs->flags & BTRFS_BALANCE_ARGS_VRANGE)) {
+@@ -5329,7 +5364,9 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
+        * end of the last chunk, and lowering a vend above it drops no block
+        * group from the range.  The bound is written back to the item when
+        * the balance resumes, so a resume that is interrupted again keeps it.
++       * Adjust the chunk types that have no vrange on disk first.
+        */
++      update_balance_args(bctl);
+       bctl->update_item = limit_balance_to_existing_chunks(fs_info, bctl);
+       WRITE_ONCE(fs_info->balance_chunk_floor, balance_chunk_floor(bctl));
+ 
+-- 
+2.47.3
+
diff --git a/topics/balance-resume/0003-btrfs-keep-the-usage-90-resume-heuristic-for-balance.patch b/topics/balance-resume/0003-btrfs-keep-the-usage-90-resume-heuristic-for-balance.patch
deleted file mode 100644 (file)
index 205fb79..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-From 46b25327a7470027c3c6ad6314e9bef9c6da6a4e Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Tue, 13 Oct 2026 14:24:01 -0400
-Subject: [PATCH 3/3] btrfs: keep the usage=90 resume heuristic for balance
- items without a vrange
-To: linux-btrfs@vger.kernel.org
-
-This patch is optional.  It is offered so that reviewers can take it or
-drop it; the author's preference is to drop it.  The previous patches do
-not depend on it.
-
-A balance item written by a kernel without the vrange bound has no vrange
-filter.  With the previous patch alone, a balance that was paused or
-interrupted on such a kernel and is resumed on a new one restarts from
-the beginning: every block group the original request selects is
-relocated again, including the ones the interrupted run created.
-
-This patch restores the old heuristic for exactly those items: when a
-chunk type has no usage, convert or vrange filter, the resume adds
-usage=90 as before.  Items with a vrange, which is every balance started
-by a kernel with the previous patch and any balance the user gave a
-vrange, rely on the vrange and are unaffected.
-
-The trade-off: the legacy resume neither completes the original request
-(block groups more than 90% full are skipped) nor avoids much work on a
-filesystem that is more than 90% full, and keeping it adds a layer of
-surprising behavior and code for a case that only arises once, when a
-balance spans the kernel upgrade.  Without it, such a balance repeats
-work but skips nothing.
-
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/volumes.c | 29 +++++++++++++++++++++++++++++
- 1 file changed, 29 insertions(+)
-
-diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 1996ebaeadc76..09fcc5d981d8a 100644
---- a/fs/btrfs/volumes.c
-+++ b/fs/btrfs/volumes.c
-@@ -4064,6 +4064,35 @@ static void update_balance_args(struct btrfs_balance_control *bctl)
-               bctl->sys.flags |= BTRFS_BALANCE_ARGS_SOFT;
-       if (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)
-               bctl->meta.flags |= BTRFS_BALANCE_ARGS_SOFT;
-+
-+      /*
-+       * A balance item written by a kernel without the vrange bound has no
-+       * vrange filter.  Resume it as those kernels did: turn on the usage
-+       * filter if no usage, convert or vrange filter is used, on the idea
-+       * that the chunks already balanced should be reasonably full.  Items
-+       * with a vrange rely on it instead.
-+       */
-+      if (!(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE) &&
-+          !(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
-+          !(bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
-+          !(bctl->data.flags & BTRFS_BALANCE_ARGS_VRANGE)) {
-+              bctl->data.flags |= BTRFS_BALANCE_ARGS_USAGE;
-+              bctl->data.usage = 90;
-+      }
-+      if (!(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE) &&
-+          !(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
-+          !(bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
-+          !(bctl->sys.flags & BTRFS_BALANCE_ARGS_VRANGE)) {
-+              bctl->sys.flags |= BTRFS_BALANCE_ARGS_USAGE;
-+              bctl->sys.usage = 90;
-+      }
-+      if (!(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE) &&
-+          !(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) &&
-+          !(bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
-+          !(bctl->meta.flags & BTRFS_BALANCE_ARGS_VRANGE)) {
-+              bctl->meta.flags |= BTRFS_BALANCE_ARGS_USAGE;
-+              bctl->meta.usage = 90;
-+      }
- }
- 
- static void limit_balance_vrange(struct btrfs_balance_args *bargs, u64 end)
--- 
-2.47.3
-
index f07794da8fb51c7ad33411bd84ea99e14b74ef93..ba4c572b2b6203d0819b8301dcf4bc475467d9a2 100644 (file)
@@ -1,7 +1,7 @@
-From 420b87ed47953436d52528ef49be054222d039b7 Mon Sep 17 00:00:00 2001
+From 464a17c7110ff10889f59c0230001ef8fde4ca92 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:03:59 -0400
-Subject: [PATCH 0/11] btrfs: fix and simplify inode flag vs compression interactions
+Date: Fri, 6 Nov 2026 05:48:14 -0500
+Subject: [PATCH 00/11] btrfs: fix and simplify inode flag vs compression interactions
 To: linux-btrfs@vger.kernel.org
 
 This series fixes problems in the interaction between btrfs inode flags
@@ -105,6 +105,13 @@ Filipe Manana (1):
   btrfs: dont propagate nodatacow mount option on files with inherited
     compression
 
+Zygo Blaxell (4):
+  btrfs: fix nodatacow vs compression inode flag conflict check
+  btrfs: allow NODATACOW | NOCOMPRESS
+  btrfs: props: reject NUL bytes in btrfs.compression values
+  btrfs: props: keep compressing inodes with legacy compression property
+    values
+
 koraynilay (6):
   btrfs: export btrfs_match_compress_type(), move it to compression.h
   btrfs: also validate compression levels in
@@ -114,24 +121,17 @@ koraynilay (6):
   btrfs: add btrfs_compress_typelevel2str() helper
   btrfs: preserve btrfs.compression when setting inode flags
 
-Zygo Blaxell (4):
-  btrfs: fix nodatacow vs compression inode flag conflict check
-  btrfs: allow NODATACOW | NOCOMPRESS
-  btrfs: props: reject NUL bytes in btrfs.compression values
-  btrfs: props: keep compressing inodes with legacy compression property
-    values
-
  fs/btrfs/btrfs_inode.h |  1 +
- fs/btrfs/compression.c | 55 +++++++++++++++++++++++++++++--
+ fs/btrfs/compression.c | 55 ++++++++++++++++++++++++--
  fs/btrfs/compression.h |  5 ++-
- fs/btrfs/inode.c       | 29 ++++++++++++++---
- fs/btrfs/ioctl.c       | 87 ++++++++++++++++++++++++++++++++++----------------
- fs/btrfs/props.c       | 78 +++++++++++++++++++++++++++++++++-----------
- fs/btrfs/props.h       |  9 ++++++
- fs/btrfs/super.c       |  8 -----
+ fs/btrfs/inode.c       | 29 +++++++++++---
+ fs/btrfs/ioctl.c       | 87 ++++++++++++++++++++++++++++--------------
+ fs/btrfs/props.c       | 78 ++++++++++++++++++++++++++++---------
+ fs/btrfs/props.h       |  9 +++++
+ fs/btrfs/super.c       |  8 ----
  8 files changed, 208 insertions(+), 64 deletions(-)
 
-base-commit: 83cd81353093be02aa7e60874c413ec340e55bce
+
 -- 
 2.47.3
 
diff --git a/topics/compress-fixes/0001-btrfs-dont-propagate-nodatacow-mount-option-on-files.patch b/topics/compress-fixes/0001-btrfs-dont-propagate-nodatacow-mount-option-on-files.patch
new file mode 100644 (file)
index 0000000..e40bd56
--- /dev/null
@@ -0,0 +1,117 @@
+From f6f89b848e57b05d5cbda97b4bcd8670519930e0 Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Mon, 2 Nov 2026 19:55:04 +0000
+Subject: [PATCH 01/11] btrfs: dont propagate nodatacow mount option on files
+ with inherited compression
+To: linux-btrfs@vger.kernel.org
+
+If we set the compression property on a directory and the filesystem was
+mounted with the nodatacow option, then when creating a file under that
+directory we get both the compression and nodatacow attributes set on the
+file. These are incompatible attributes as compression requires COW.
+
+This has a couple unexpected behaviours:
+
+1) If later a user sets another attribute on the file, like immutability
+   or append writing mode for example, the chattr command will fail with
+   -EINVAL since we in the setattr callback (btrfs_fileattr_set()) we do
+   some validation, through a call to check_fsflags(), that rejects having
+   both the nodatacow and compression flags set.
+
+   I.e, doing a simple:
+
+     $ chattr +i file
+     /usr/bin/chattr: Invalid argument while setting flags on file
+
+2) The file ends up not being compressed, which is unexpected since the
+   compression attribute set on a directory/file should have precedence
+   over the global nodatacow mount option.
+
+Example reproducer:
+
+   $ cat test.sh
+   #!/bin/bash
+
+   DEV=/dev/sdi
+   MNT=/mnt/sdi
+
+   mkfs.btrfs -f $DEV
+   mount -o nodatacow $DEV $MNT
+
+  # Create a directory with the compression attribute, so that all files
+  # created under it inherit the compression attribute.
+  mkdir $MNT/dir
+  chattr +c $MNT/dir
+
+  # Now create a file with some data inside the directory.
+  xfs_io -f -c "pwrite 0 128K" $MNT/dir/foo
+
+  # Now try to make the file immutable, it should work.
+  chattr +i $MNT/dir/foo
+
+  umount $MNT
+
+  # Check the file has a compressed extent. It should have since
+  # despite the fs being mounted with nodatacow, the directory has
+  # the compression flag set and so that should take priority and
+  # it's what makes sense.
+  btrfs inspect-internal dump-tree -t 5 $DEV | grep -A 5 'EXTENT_DATA 0'
+
+Running it:
+
+  $ ./test.sh
+  (...)
+  chattr: Invalid argument while setting flags on /mnt/sdi/dir/foo
+        item 11 key (258 EXTENT_DATA 0) itemoff 15529 itemsize 53
+             generation 9 type 1 (regular)
+             extent data disk byte 13631488 nr 131072
+             extent data offset 0 nr 131072 ram 131072
+             extent compression 0 (none)
+             extent encryption 0
+
+Fix this by updating btrfs_create_new_inode() to not apply the mount
+options nodatacow and nodatasum on a file that has inherited compression
+from its parent directory.
+
+A test case will follow soon for fstests.
+
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Link: https://lore.kernel.org/r/1c729c63075e727042efdeb07df10a70b0ba1a0d.1793647368.git.fdmanana@suse.com
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+---
+ fs/btrfs/inode.c | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
+index abaa334714566..0bc668c9ec883 100644
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -6654,11 +6654,20 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
+ 
+       btrfs_set_inode_mapping_order(BTRFS_I(inode));
+       if (S_ISREG(inode->i_mode)) {
+-              if (btrfs_test_opt(fs_info, NODATASUM))
+-                      BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
+-              if (btrfs_test_opt(fs_info, NODATACOW))
+-                      BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW |
+-                              BTRFS_INODE_NODATASUM;
++              /*
++               * If we inherited compression from the parent directory, it
++               * takes precedence to nodatacow/nodatasum and we don't set
++               * compression along with nodatacow/nodatasun, otherwise if a
++               * user attempts to change some other attribute (say chattr +i),
++               * it will fail at -EINVAL.
++               */
++              if (!(BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS)) {
++                      if (btrfs_test_opt(fs_info, NODATASUM))
++                              BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
++                      if (btrfs_test_opt(fs_info, NODATACOW))
++                              BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW |
++                                      BTRFS_INODE_NODATASUM;
++              }
+               btrfs_update_inode_mapping_flags(BTRFS_I(inode));
+       }
+ 
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0001-btrfs-fix-nodatacow-vs-compression-inode-flag-confli.patch b/topics/compress-fixes/0001-btrfs-fix-nodatacow-vs-compression-inode-flag-confli.patch
deleted file mode 100644 (file)
index ba69604..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-From 4abdf8c9bc525c0b8b990d4938b26228e9309178 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 16 Aug 2025 22:20:01 -0400
-Subject: [PATCH 1/5] btrfs: fix nodatacow vs compression inode flag conflict
- check
-To: linux-btrfs@vger.kernel.org
-
-Applications expect inode flags to be orthogonal: changes can be combined
-or applied separately in any order, as long as each intermediate state is
-valid and unchanged flags are left untouched.
-
-Commit f37c563bab42 ("btrfs: add missing check for nocow and compression
-inode flags") intended to forbid combining FS_NOCOW_FL with either
-FS_NOCOMP_FL or FS_COMPR_FL. The implementation contained a bug and
-introduced multiple regressions.
-
-Bug: FS_NOCOW_FL (+C) and FS_NOCOMP_FL (+m) can still be set together in
-a single FS_IOC_SETFLAGS call, even though the commit message states this
-combination should be rejected.
-
-Regression 1: Switching from +C+m back to -C-m only works if both flag
-changes are combined into one ioctl; separate -C and -m calls are
-rejected.
-
-Regression 2: Switching between +C-c and -C+c only works if the changes
-are split across multiple ioctls; a combined -C+c call is rejected.
-
-Regression 3: Inodes created on kernels before commit f37c563bab42
-("btrfs: add missing check for nocow and compression inode flags") with
-both COMPR and NOCOW set cannot have any other fsattrs changed on newer
-kernels. Even unrelated operations (such as adding +i, or clearing just
-one of the compression bits) fail with EINVAL, because the conflict
-check rejects the entire ioctl whenever conflicting bits are present,
-even if those bits are not being modified. This makes it impossible to
-manage older files without first undoing their existing flags.
-
-Fix by:
- * Rewriting the conflict checks so FS_NOCOW_FL cannot be combined with
-   FS_NOCOMP_FL or FS_COMPR_FL in any ioctl (fixes the original bug and
-   regressions 1-2).
- * Allowing existing conflicting flags to remain if they are not modified
-   by the ioctl (fixes regression 3).
- * Moving the check later in the flag-validation sequence so that it
-   occurs after handling the long-standing rule that FS_NOCOW_FL changes
-   are silently ignored on non-empty files. This preserves the pre-existing
-   behavior while still applying the corrected conflict logic.
-
-Also commit the new inode flags to the inode before setting the
-compression property, restoring them if the property cannot be set:
-property validation rejects compression on nodatacow inodes based on
-the inode's current flags, which would otherwise reject a single ioctl
-that both clears NOCOW and sets COMPR (regression 2) even with the
-conflict check corrected.
-
-Fixes: f37c563bab42 ("btrfs: add missing check for nocow and compression inode flags")
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
----
- fs/btrfs/ioctl.c | 60 ++++++++++++++++++++++++++++++++++++------------
- 1 file changed, 45 insertions(+), 15 deletions(-)
-
-diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
-index ac070c745b0eb..55762f77006e0 100644
---- a/fs/btrfs/ioctl.c
-+++ b/fs/btrfs/ioctl.c
-@@ -216,9 +216,9 @@ void btrfs_sync_inode_flags_to_i_flags(struct btrfs_inode *inode)
- 
- /*
-  * Check if @flags are a supported and valid set of FS_*_FL flags and that
-- * the old and new flags are not conflicting
-+ * the flags are not conflicting
-  */
--static int check_fsflags(unsigned int old_flags, unsigned int flags)
-+static int check_fsflags(unsigned int flags)
- {
-       if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
-                     FS_NOATIME_FL | FS_NODUMP_FL | \
-@@ -227,19 +227,10 @@ static int check_fsflags(unsigned int old_flags, unsigned int flags)
-                     FS_NOCOW_FL))
-               return -EOPNOTSUPP;
- 
--      /* COMPR and NOCOMP on new/old are valid */
-+      /* Only one of COMPR and NOCOMP is valid at a time */
-       if ((flags & FS_NOCOMP_FL) && (flags & FS_COMPR_FL))
-               return -EINVAL;
- 
--      if ((flags & FS_COMPR_FL) && (flags & FS_NOCOW_FL))
--              return -EINVAL;
--
--      /* NOCOW and compression options are mutually exclusive */
--      if ((old_flags & FS_NOCOW_FL) && (flags & (FS_COMPR_FL | FS_NOCOMP_FL)))
--              return -EINVAL;
--      if ((flags & FS_NOCOW_FL) && (old_flags & (FS_COMPR_FL | FS_NOCOMP_FL)))
--              return -EINVAL;
--
-       return 0;
- }
- 
-@@ -288,6 +279,7 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
-       unsigned int fsflags, old_fsflags;
-       int ret;
-       const char *comp = NULL;
-+      u32 old_inode_flags;
-       u32 inode_flags;
-       bool prop_set = false;
- 
-@@ -299,7 +291,7 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
- 
-       fsflags = btrfs_mask_fsflags_for_type(&inode->vfs_inode, fa->flags);
-       old_fsflags = btrfs_inode_flags_to_fsflags(inode);
--      ret = check_fsflags(old_fsflags, fsflags);
-+      ret = check_fsflags(fsflags);
-       if (ret)
-               return ret;
- 
-@@ -355,6 +347,30 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
-               } else {
-                       inode_flags |= BTRFS_INODE_NODATACOW;
-               }
-+              /*
-+               * NODATACOW files will ignore COMPRESS, so forbid
-+               * COMPRESS | NODATACOW.
-+               *
-+               * We do this check here, after we've decided whether
-+               * to silently drop the NODATACOW bit for non-empty files.
-+               *
-+               * NODATACOW files will inherit flags from NODATACOW
-+               * directories, so COMPRESS is forbidden for them too.
-+               *
-+               * Old kernels allowed the forbidden combination of flags
-+               * to be set, and they may still be found on existing
-+               * filesystems.  If the forbidden combination of flags
-+               * are already set, we will allow an application to set
-+               * or clear unrelated flags (like IMMUTABLE or NOATIME)
-+               * as long as the existing COMPRESS | NODATACOW flags
-+               * are not changed.
-+               */
-+              if ((inode_flags & BTRFS_INODE_NODATACOW) &&
-+                  (fsflags & (FS_COMPR_FL | FS_NOCOMP_FL))) {
-+                      if ((old_fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)) !=
-+                          (fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)))
-+                              return -EINVAL;
-+              }
-       } else {
-               /* We can only change NODATACOW for zero-sized regular file. */
-               if (S_ISREG(inode->vfs_inode.i_mode) && (inode->vfs_inode.i_size == 0)) {
-@@ -434,18 +450,32 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
-       if (IS_ERR(trans))
-               return PTR_ERR(trans);
- 
-+      /*
-+       * Commit the new flags to the inode before setting the compression
-+       * property: property validation rejects compression on nodatacow
-+       * inodes based on the inode's current flags, which would incorrectly
-+       * reject a single ioctl that both clears NOCOW and sets COMPR.
-+       * Restore the original flags if the property cannot be set.
-+       */
-+      old_inode_flags = inode->flags;
-+      inode->flags = inode_flags;
-+
-       if (comp) {
-               ret = btrfs_set_prop(trans, inode, "btrfs.compression",
-                                    comp, strlen(comp), 0);
--              if (ret)
-+              if (ret) {
-+                      inode->flags = old_inode_flags;
-                       goto out_end_trans;
-+              }
-               prop_set = true;
-       } else {
-               ret = btrfs_set_prop(trans, inode, "btrfs.compression", NULL, 0, 0);
-               prop_set = (ret == 0);
-               /* If ret == -ENODATA ignore and proceed to update inode item. */
--              if (ret && ret != -ENODATA)
-+              if (ret && ret != -ENODATA) {
-+                      inode->flags = old_inode_flags;
-                       goto out_end_trans;
-+              }
-       }
- 
- update_flags:
--- 
-2.47.3
-
diff --git a/topics/compress-fixes/0002-btrfs-do-not-leave-COMPRESS-on-an-inode-that-gets-NO.patch b/topics/compress-fixes/0002-btrfs-do-not-leave-COMPRESS-on-an-inode-that-gets-NO.patch
deleted file mode 100644 (file)
index 879db07..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-From e862b18927ec88f831323b2ac4f050b837fbaf54 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 15:44:15 -0400
-Subject: [PATCH 2/5] btrfs: do not leave COMPRESS on an inode that gets
- NODATACOW at creation
-To: linux-btrfs@vger.kernel.org
-
-btrfs_fileattr_set() refuses to combine FS_NOCOW_FL with FS_COMPR_FL, and
-property validation refuses compression on nodatacow inodes, because
-NODATACOW data is never compressed.  Inode creation can still produce the
-combination: btrfs_inherit_iflags() copies COMPRESS from a parent directory
-with chattr +c, and btrfs_create_new_inode() then adds NODATACOW for a
-regular file when the filesystem is mounted with -o nodatacow.  A parent
-directory that already carries both flags (set by a kernel before
-f37c563bab42 ("btrfs: add missing check for nocow and compression inode
-flags")) passes both on to every new inode as well.
-
-The result is an inode that lsattr shows as "cC", which FS_IOC_SETFLAGS
-would refuse to create, and on kernels before the previous commit could
-not have any of its flags changed at all.
-
-Drop COMPRESS whenever NODATACOW is set on a new inode, from either source.
-NOCOMPRESS is left alone: it is valid together with NODATACOW.
-
-Reproducer: mkdir d; chattr +c d; mount -o nodatacow; touch d/f;
-lsattr d/f shows "cC" without this patch and "C" with it
-(compress-props-test.sh, "inherit" phase, in the raid56-wh-harness).
-
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/inode.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b071ed59a583f..ea4a2fb26e4d1 100644
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -6551,6 +6551,8 @@ static void btrfs_inherit_iflags(struct btrfs_inode *inode, struct btrfs_inode *
-               inode->flags |= BTRFS_INODE_NODATACOW;
-               if (S_ISREG(inode->vfs_inode.i_mode))
-                       inode->flags |= BTRFS_INODE_NODATASUM;
-+              /* NODATACOW data is never compressed, and the two conflict. */
-+              inode->flags &= ~BTRFS_INODE_COMPRESS;
-       }
- 
-       btrfs_sync_inode_flags_to_i_flags(inode);
-@@ -6656,9 +6658,12 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
-       if (S_ISREG(inode->i_mode)) {
-               if (btrfs_test_opt(fs_info, NODATASUM))
-                       BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
--              if (btrfs_test_opt(fs_info, NODATACOW))
-+              if (btrfs_test_opt(fs_info, NODATACOW)) {
-                       BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW |
-                               BTRFS_INODE_NODATASUM;
-+                      /* Not COMPRESS inherited from the parent directory. */
-+                      BTRFS_I(inode)->flags &= ~BTRFS_INODE_COMPRESS;
-+              }
-               btrfs_update_inode_mapping_flags(BTRFS_I(inode));
-       }
- 
--- 
-2.47.3
-
diff --git a/topics/compress-fixes/0002-btrfs-export-btrfs_match_compress_type-move-it-to-co.patch b/topics/compress-fixes/0002-btrfs-export-btrfs_match_compress_type-move-it-to-co.patch
new file mode 100644 (file)
index 0000000..3756233
--- /dev/null
@@ -0,0 +1,80 @@
+From 09b5474f55d329cfae8d8ab89862153f559df67f Mon Sep 17 00:00:00 2001
+From: koraynilay <koray.fra@gmail.com>
+Date: Tue, 3 Nov 2026 20:47:29 +0100
+Subject: [PATCH 02/11] btrfs: export btrfs_match_compress_type(), move it to
+ compression.h
+To: linux-btrfs@vger.kernel.org
+
+Export btrfs_match_compress_type() from being a static and locally used
+function in super.c and move it to compression.c, exporting it in
+compression.h.  This allows it to be used in the next patches as
+validation for compression algorithm names.
+
+Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.5
+Signed-off-by: koraynilay <koray.fra@gmail.com>
+Link: https://lore.kernel.org/r/20261103194734.598182-2-koray.fra@gmail.com
+---
+ fs/btrfs/compression.c | 17 +++++++++++++++++
+ fs/btrfs/compression.h |  1 +
+ fs/btrfs/super.c       |  8 --------
+ 3 files changed, 18 insertions(+), 8 deletions(-)
+
+diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
+index b12b7f1b31fdf..9f0e42424e865 100644
+--- a/fs/btrfs/compression.c
++++ b/fs/btrfs/compression.c
+@@ -1646,3 +1646,20 @@ int btrfs_compress_str2level(unsigned int type, const char *str, int *level_ret)
+       *level_ret = btrfs_compress_set_level(type, level);
+       return 0;
+ }
++
++/**
++ * btrfs_match_compress_type - Check if the string matches the compression type
++ * @string:         The string to check
++ * @type:           The compression type string (name) to match against (e.g. "zstd")
++ * @may_have_level: If true, the string may have a level suffix (e.g., ":1")
++ *
++ * Return: %true if the string matches the type and, if %may_have_level is %true,
++ * has a level suffix, %false otherwise.
++ */
++bool btrfs_match_compress_type(const char *string, const char *type, bool may_have_level)
++{
++      const int len = strlen(type);
++
++      return (strncmp(string, type, len) == 0) &&
++              ((may_have_level && string[len] == ':') || string[len] == '\0');
++}
+diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
+index 1022dc53ec51e..e67ba47b4cdc5 100644
+--- a/fs/btrfs/compression.h
++++ b/fs/btrfs/compression.h
+@@ -97,6 +97,7 @@ void btrfs_submit_compressed_write(struct btrfs_ordered_extent *ordered,
+ void btrfs_submit_compressed_read(struct btrfs_bio *bbio);
+ 
+ int btrfs_compress_str2level(unsigned int type, const char *str, int *level_ret);
++bool btrfs_match_compress_type(const char *string, const char *type, bool may_have_level);
+ 
+ struct folio *btrfs_alloc_compr_folio(struct btrfs_fs_info *fs_info, gfp_t gfp);
+ void btrfs_free_compr_folio(struct folio *folio);
+diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
+index b424cc836bd4a..372d4e75bfb60 100644
+--- a/fs/btrfs/super.c
++++ b/fs/btrfs/super.c
+@@ -270,14 +270,6 @@ static const struct fs_parameter_spec btrfs_fs_parameters[] = {
+       {}
+ };
+ 
+-static bool btrfs_match_compress_type(const char *string, const char *type, bool may_have_level)
+-{
+-      const int len = strlen(type);
+-
+-      return (strncmp(string, type, len) == 0) &&
+-              ((may_have_level && string[len] == ':') || string[len] == '\0');
+-}
+-
+ static int btrfs_parse_compress(struct btrfs_fs_context *ctx,
+                               const struct fs_parameter *param, int opt)
+ {
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0003-btrfs-allow-NODATACOW-NOCOMPRESS.patch b/topics/compress-fixes/0003-btrfs-allow-NODATACOW-NOCOMPRESS.patch
deleted file mode 100644 (file)
index 27c2736..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-From b87ce7ce09a2d2703dcd5aa193ae9f1e624578b5 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 17 Aug 2025 16:57:07 -0400
-Subject: [PATCH 3/5] btrfs: allow NODATACOW | NOCOMPRESS
-To: linux-btrfs@vger.kernel.org
-
-Commit f37c563bab42 ("btrfs: add missing check for nocow and compression
-inode flags") added conflict checks for certain inode flag combinations,
-and commit 0e852ab8974c ("btrfs: do not allow compression on nodatacow
-files") extended the same logic to xattrs.
-
-Both commits also forbade the combination of FS_NOCOW_FL (NODATACOW)
-and FS_NOCOMP_FL (NOCOMPRESS).  This restriction is undocumented, has
-no technical basis, and provides no benefit.  NODATACOW files cannot be
-compressed in any case, so the NOCOMPRESS bit is a no-op:  behavior is
-the same whether the flag is present or not.
-
-Forcing an unnecessary conflict makes inode flags harder to use.
-Portable applications may inherit COMPRESS, NOCOMPRESS, or NODATACOW bits
-from parent directories and combine them with unrelated flags such as
-IMMUTABLE or NOATIME.  Rejecting otherwise valid flag sets with EINVAL
-creates surprises for applications that do not know about btrfs-specific
-interactions and only touch the flags they care about.
-
-Fix by permitting the combination of NODATACOW and NOCOMPRESS, both via
-FS_IOC_SETFLAGS and by setting btrfs.compression to "no"/"none" through
-xattrs.
-
-Fixes: f37c563bab42 ("btrfs: add missing check for nocow and compression inode flags")
-Fixes: 0e852ab8974c ("btrfs: do not allow compression on nodatacow files")
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
----
- fs/btrfs/ioctl.c | 6 +++---
- fs/btrfs/props.c | 8 ++++----
- 2 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
-index 55762f77006e0..0de6a06e3c3e8 100644
---- a/fs/btrfs/ioctl.c
-+++ b/fs/btrfs/ioctl.c
-@@ -366,9 +366,9 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
-                * are not changed.
-                */
-               if ((inode_flags & BTRFS_INODE_NODATACOW) &&
--                  (fsflags & (FS_COMPR_FL | FS_NOCOMP_FL))) {
--                      if ((old_fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)) !=
--                          (fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)))
-+                  (fsflags & FS_COMPR_FL)) {
-+                      if ((old_fsflags & (FS_NOCOW_FL | FS_COMPR_FL)) !=
-+                          (fsflags & (FS_NOCOW_FL | FS_COMPR_FL)))
-                               return -EINVAL;
-               }
-       } else {
-diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
-index 7cc82366a1dfc..9e0e17c348cfd 100644
---- a/fs/btrfs/props.c
-+++ b/fs/btrfs/props.c
-@@ -295,14 +295,14 @@ int btrfs_load_inode_props(struct btrfs_inode *inode, struct btrfs_path *path)
- static int prop_compression_validate(const struct btrfs_inode *inode,
-                                    const char *value, size_t len)
- {
--      if (!btrfs_inode_can_compress(inode))
--              return -EINVAL;
--
-       if (!value)
-               return 0;
- 
--      if (btrfs_compress_is_valid_type(value, len))
-+      if (btrfs_compress_is_valid_type(value, len)) {
-+              if (!btrfs_inode_can_compress(inode))
-+                      return -EINVAL;
-               return 0;
-+      }
- 
-       if ((len == 2 && strncmp("no", value, 2) == 0) ||
-           (len == 4 && strncmp("none", value, 4) == 0))
--- 
-2.47.3
-
diff --git a/topics/compress-fixes/0003-btrfs-also-validate-compression-levels-in-btrfs_comp.patch b/topics/compress-fixes/0003-btrfs-also-validate-compression-levels-in-btrfs_comp.patch
new file mode 100644 (file)
index 0000000..d8efeab
--- /dev/null
@@ -0,0 +1,127 @@
+From 067b8b770e2ee07a755241860e663376a2316a05 Mon Sep 17 00:00:00 2001
+From: koraynilay <koray.fra@gmail.com>
+Date: Tue, 3 Nov 2026 20:47:30 +0100
+Subject: [PATCH 03/11] btrfs: also validate compression levels in
+ btrfs_compress_is_valid_type()
+To: linux-btrfs@vger.kernel.org
+
+Change btrfs_compress_is_valid_type() to use btrfs_match_compress_type()
+and btrfs_compress_str2level() instead of a simple strncmp(), which would
+validate even incorrect strings (e.g. "zstd:invalid" or "zstdinvalid").
+
+This also makes the function validate levels in the same way the
+compress= option gets parsed, allowing bigger or smaller values, but
+still clamping them to the min or max supported.
+
+Furthermore, remove the len parameter, since now it requires a
+NUL-terminated string because of btrfs_compress_str2level(); this change
+is fine because btrfs_compress_is_valid_type() is used only once in
+props.c by prop_compression_validate(), which now uses a stack-based
+buffer and memcpy() to convert the user-supplied xattr value to a
+NUL-terminated string.
+
+Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.5
+Signed-off-by: koraynilay <koray.fra@gmail.com>
+Link: https://lore.kernel.org/r/20261103194734.598182-3-koray.fra@gmail.com
+---
+ fs/btrfs/compression.c | 18 +++++++++++++++---
+ fs/btrfs/compression.h |  2 +-
+ fs/btrfs/props.c       | 18 +++++++++++++++++-
+ 3 files changed, 33 insertions(+), 5 deletions(-)
+
+diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
+index 9f0e42424e865..b1f8323fffe7d 100644
+--- a/fs/btrfs/compression.c
++++ b/fs/btrfs/compression.c
+@@ -70,18 +70,30 @@ static struct compressed_bio *alloc_compressed_bio(struct btrfs_inode *inode,
+       return to_compressed_bio(bbio);
+ }
+ 
+-bool btrfs_compress_is_valid_type(const char *str, size_t len)
++/**
++ * btrfs_compress_is_valid_type - Check if a string is a valid compression type.
++ * @str: The compression string to check. Must be null-terminated.
++ *
++ * Return: %true if the string is a valid compression algorithm (optionally with
++ * a level suffix, e.g. "zstd" or "zstd:9"), %false otherwise.
++ */
++bool btrfs_compress_is_valid_type(const char *str)
+ {
++      size_t len = strlen(str);
+       int i;
+ 
+       for (i = 1; i < ARRAY_SIZE(btrfs_compress_types); i++) {
+               size_t comp_len = strlen(btrfs_compress_types[i]);
++              const char *comp_type = btrfs_compress_types[i];
++              int tmp_level;
+ 
+               if (len < comp_len)
+                       continue;
+ 
+-              if (!strncmp(btrfs_compress_types[i], str, comp_len))
+-                      return true;
++              if (btrfs_match_compress_type(str, comp_type, true)) {
++                      if (btrfs_compress_str2level(i, str + comp_len, &tmp_level) == 0)
++                              return true;
++              }
+       }
+       return false;
+ }
+diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
+index e67ba47b4cdc5..c63bed9f4152e 100644
+--- a/fs/btrfs/compression.h
++++ b/fs/btrfs/compression.h
+@@ -132,7 +132,7 @@ extern const struct btrfs_compress_levels btrfs_lzo_compress;
+ extern const struct btrfs_compress_levels btrfs_zstd_compress;
+ 
+ const char* btrfs_compress_type2str(enum btrfs_compression_type type);
+-bool btrfs_compress_is_valid_type(const char *str, size_t len);
++bool btrfs_compress_is_valid_type(const char *str);
+ 
+ int btrfs_compress_heuristic(struct btrfs_inode *inode, u64 start, u64 end);
+ 
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index 7cc82366a1dfc..d196b73f4ffa1 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -18,6 +18,15 @@
+ #include "super.h"
+ #include "dir-item.h"
+ 
++/*
++ * Max length of compression algorithm:level string.
++ *
++ * For now the longest possible string is "zstd:-15", which is
++ * 8 characters + 1 terminating null byte.
++ * Rounding it up to the closest power of 2 gives 16.
++ */
++#define BTRFS_COMPRESS_PROP_MAX_LEN 16
++
+ #define BTRFS_PROP_HANDLERS_HT_BITS 8
+ static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS);
+ 
+@@ -295,13 +304,20 @@ int btrfs_load_inode_props(struct btrfs_inode *inode, struct btrfs_path *path)
+ static int prop_compression_validate(const struct btrfs_inode *inode,
+                                    const char *value, size_t len)
+ {
++      char value_str[BTRFS_COMPRESS_PROP_MAX_LEN];
++
+       if (!btrfs_inode_can_compress(inode))
+               return -EINVAL;
+ 
+       if (!value)
+               return 0;
+ 
+-      if (btrfs_compress_is_valid_type(value, len))
++      if (len >= BTRFS_COMPRESS_PROP_MAX_LEN)
++              return -EINVAL;
++
++      memcpy(value_str, value, len);
++      value_str[len] = '\0';
++      if (btrfs_compress_is_valid_type(value_str))
+               return 0;
+ 
+       if ((len == 2 && strncmp("no", value, 2) == 0) ||
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0004-btrfs-add-per-inode-compression-levels-in-xattrs.patch b/topics/compress-fixes/0004-btrfs-add-per-inode-compression-levels-in-xattrs.patch
new file mode 100644 (file)
index 0000000..1d1fb5e
--- /dev/null
@@ -0,0 +1,132 @@
+From 028a26fdfebc49832d0f7401b20019df7f93962d Mon Sep 17 00:00:00 2001
+From: koraynilay <koray.fra@gmail.com>
+Date: Tue, 3 Nov 2026 20:47:31 +0100
+Subject: [PATCH 04/11] btrfs: add per-inode compression levels in xattrs
+To: linux-btrfs@vger.kernel.org
+
+Add support for specifying algo:level using
+btrfs property set /path/to/file compression "algo:level".
+
+Add a signed 8 bit prop_compress_level property to btrfs_inode, which
+can support from level -128 to 127, plenty for the currently supported
+algo:level(s).
+
+Change prop_compression_apply() to use the already present
+btrfs_match_compress_type() and btrfs_compress_str2level() to parse the
+xattr, using a stack-based buffer and memcpy() to convert the
+user-supplied xattr value to a NUL-terminated string to be used by
+btrfs_compress_str2level().
+
+Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.5
+Signed-off-by: koraynilay <koray.fra@gmail.com>
+Link: https://lore.kernel.org/r/20261103194734.598182-4-koray.fra@gmail.com
+---
+ fs/btrfs/btrfs_inode.h |  1 +
+ fs/btrfs/inode.c       | 10 ++++++++++
+ fs/btrfs/props.c       | 31 ++++++++++++++++++++++++++++---
+ 3 files changed, 39 insertions(+), 3 deletions(-)
+
+diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
+index 0782f917fcccb..58ee9bbd7b5bf 100644
+--- a/fs/btrfs/btrfs_inode.h
++++ b/fs/btrfs/btrfs_inode.h
+@@ -137,6 +137,7 @@ struct btrfs_inode {
+ 
+       /* Cached value of inode property 'compression'. */
+       u8 prop_compress;
++      s8 prop_compress_level;
+ 
+       /*
+        * Force compression on the file using the defrag ioctl, could be
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
+index 0bc668c9ec883..2078a3b004fe9 100644
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -945,6 +945,11 @@ static void compress_file_range(struct btrfs_work *work)
+               compress_level = inode->defrag_compress_level;
+       } else if (inode->prop_compress) {
+               compress_type = inode->prop_compress;
++              if (inode->prop_compress_level)
++                      compress_level = inode->prop_compress_level;
++              else if (compress_type != fs_info->compress_type)
++                      compress_level = 0;
++              /* else use fs_info->compress_level */
+       }
+ 
+       /* Compression level is applied here. */
+@@ -2330,6 +2335,11 @@ static int run_delalloc_inline(struct btrfs_inode *inode, struct folio *locked_f
+                       compress_level = inode->defrag_compress_level;
+               } else if (inode->prop_compress) {
+                       compress_type = inode->prop_compress;
++                      if (inode->prop_compress_level)
++                              compress_level = inode->prop_compress_level;
++                      else if (compress_type != fs_info->compress_type)
++                              compress_level = 0;
++                      /* else use fs_info->compress_level */
+               }
+               /*
+                * We need to pass blocksize and not i_size, otherwise we can't
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index d196b73f4ffa1..effc2daa2e3df 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -332,6 +332,10 @@ static int prop_compression_apply(struct btrfs_inode *inode, const char *value,
+ {
+       struct btrfs_fs_info *fs_info = inode->root->fs_info;
+       int type;
++      int level = 0;
++      int ret = 0;
++      char value_str[BTRFS_COMPRESS_PROP_MAX_LEN];
++      int level_pos = 0;
+ 
+       /* Reset to defaults */
+       if (len == 0) {
+@@ -351,21 +355,42 @@ static int prop_compression_apply(struct btrfs_inode *inode, const char *value,
+               return 0;
+       }
+ 
+-      if (!strncmp("lzo", value, 3)) {
++      if (len >= BTRFS_COMPRESS_PROP_MAX_LEN)
++              return -EINVAL;
++
++      memcpy(value_str, value, len);
++      value_str[len] = '\0';
++
++      if (btrfs_match_compress_type(value_str, "lzo", true)) {
+               type = BTRFS_COMPRESS_LZO;
+               btrfs_set_fs_incompat(fs_info, COMPRESS_LZO);
+-      } else if (!strncmp("zlib", value, 4)) {
++      } else if (btrfs_match_compress_type(value_str, "zlib", true)) {
+               type = BTRFS_COMPRESS_ZLIB;
+-      } else if (!strncmp("zstd", value, 4)) {
++              level_pos = 4;
++      } else if (btrfs_match_compress_type(value_str, "zstd", true)) {
+               type = BTRFS_COMPRESS_ZSTD;
++              level_pos = 4;
+               btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD);
+       } else {
+               return -EINVAL;
+       }
+ 
++      /* Parse level if the algorithm supports it */
++      if (level_pos > 0) {
++              const char *level_str = value_str + level_pos;
++
++              /* and if user specified it */
++              if (level_str[0] == ':') {
++                      ret = btrfs_compress_str2level(type, level_str, &level);
++                      if (ret < 0)
++                              return ret;
++              }
++      }
++
+       inode->flags &= ~BTRFS_INODE_NOCOMPRESS;
+       inode->flags |= BTRFS_INODE_COMPRESS;
+       inode->prop_compress = type;
++      inode->prop_compress_level = level;
+ 
+       return 0;
+ }
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0004-btrfs-props-add-per-inode-compression-level-support.patch b/topics/compress-fixes/0004-btrfs-props-add-per-inode-compression-level-support.patch
deleted file mode 100644 (file)
index 601ef25..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-From 627b9f25057fbb9eb7abfb968f7528499df41cd1 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 6 Aug 2026 21:39:01 -0400
-Subject: [PATCH 4/5] btrfs: props: add per-inode compression level support
-To: linux-btrfs@vger.kernel.org
-
-Setting a per-file compression level is an often requested feature, and
-the btrfs.compression property has silently accepted level suffixes
-("zstd:9") since compression types were added to it:  the property
-validator only matches the algorithm name prefix, the verbatim string is
-stored in the xattr and returned by getxattr, and everything after the
-algorithm name is ignored when the value is parsed into the in-memory
-compression type.
-
-All of the pieces needed to honor the level already exist:  the level is
-a per-call argument down the whole compression path, per-inode levels
-are already implemented for the defrag ioctl (defrag_compress_level),
-and btrfs_compress_str2level() already parses and clamps ":level"
-suffixes for the mount options.  Wire the property path up to them:
-
- * Cache the parsed level in a new btrfs_inode::prop_compress_level,
-   with 0 meaning no level was specified, in which case the level from
-   the mount options is used as before.  The field is signed to allow
-   negative (realtime) zstd levels.
-
- * Parse an optional ":level" suffix in prop_compression_apply().
-   Values stored by old kernels were never validated, so an unparseable
-   suffix falls back to the default level rather than making the inode's
-   properties fail to load.  Levels for lzo parse and clamp to nothing,
-   matching commit 6db1df415d73 ("btrfs: accept and ignore compression
-   level for lzo").
-
- * Use the level in compress_file_range() and the inline compression
-   path in run_delalloc_inline().  The defrag ioctl retains precedence.
-
- * Regenerate the canonical "type:level" string with a new helper,
-   btrfs_prop_compression_extract(), so that directory inheritance
-   propagates the level to new inodes, and so that FS_IOC_SETFLAGS,
-   which rewrites the property when setting FS_COMPR_FL, preserves the
-   level instead of truncating the value to the bare algorithm name.
-   The prop_handler extract hook itself is unchanged: it still returns
-   a static string, and the inheritance loop regenerates the leveled
-   value only for the compression property.
-
-There is no disk format change:  the level lives in the already-existing
-xattr value string.  Note that levels stored by old kernels (which were
-accepted but ignored) become effective after this change.
-
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Assisted-by: Claude:claude-fable-5
----
- fs/btrfs/btrfs_inode.h |  7 +++++
- fs/btrfs/inode.c       |  4 +++
- fs/btrfs/ioctl.c       | 18 ++++++-----
- fs/btrfs/props.c       | 71 ++++++++++++++++++++++++++++++++++++++++++
- fs/btrfs/props.h       |  3 ++
- 5 files changed, 96 insertions(+), 7 deletions(-)
-
-diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
-index f7aa0d1451851..a9ccdd0a1f693 100644
---- a/fs/btrfs/btrfs_inode.h
-+++ b/fs/btrfs/btrfs_inode.h
-@@ -138,6 +138,13 @@ struct btrfs_inode {
-       /* Cached value of inode property 'compression'. */
-       u8 prop_compress;
- 
-+      /*
-+       * Cached compression level from the 'compression' property.  0 means
-+       * no level was specified, in which case the mount option level is
-+       * used.
-+       */
-+      s8 prop_compress_level;
-+
-       /*
-        * Force compression on the file using the defrag ioctl, could be
-        * different from prop_compress and takes precedence if set.
-diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index ea4a2fb26e4d1..9cac6f5866a1f 100644
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -945,6 +945,8 @@ static void compress_file_range(struct btrfs_work *work)
-               compress_level = inode->defrag_compress_level;
-       } else if (inode->prop_compress) {
-               compress_type = inode->prop_compress;
-+              if (inode->prop_compress_level)
-+                      compress_level = inode->prop_compress_level;
-       }
- 
-       /* Compression level is applied here. */
-@@ -2330,6 +2332,8 @@ static int run_delalloc_inline(struct btrfs_inode *inode, struct folio *locked_f
-                       compress_level = inode->defrag_compress_level;
-               } else if (inode->prop_compress) {
-                       compress_type = inode->prop_compress;
-+                      if (inode->prop_compress_level)
-+                              compress_level = inode->prop_compress_level;
-               }
-               /*
-                * We need to pass blocksize and not i_size, otherwise we can't
-diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
-index 0de6a06e3c3e8..bb1c989c53dcb 100644
---- a/fs/btrfs/ioctl.c
-+++ b/fs/btrfs/ioctl.c
-@@ -280,6 +280,7 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
-       int ret;
-       const char *comp = NULL;
-       u32 old_inode_flags;
-+      char comp_buf[16];
-       u32 inode_flags;
-       bool prop_set = false;
- 
-@@ -431,13 +432,16 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
-                * Inodes with the compress flag set but no property keep using
-                * the mount default, so they behave as before.
-                */
--              if (inode->prop_compress)
--                      comp_type = inode->prop_compress;
--              else if (fs_info->compress_type)
--                      comp_type = fs_info->compress_type;
--              else
--                      comp_type = BTRFS_COMPRESS_ZLIB;
--              comp = btrfs_compress_type2str(comp_type);
-+              if (btrfs_prop_compression_extract(inode, comp_buf,
-+                                                 sizeof(comp_buf)) > 0) {
-+                      comp = comp_buf;
-+              } else {
-+                      if (fs_info->compress_type)
-+                              comp_type = fs_info->compress_type;
-+                      else
-+                              comp_type = BTRFS_COMPRESS_ZLIB;
-+                      comp = btrfs_compress_type2str(comp_type);
-+              }
-       } else {
-               inode_flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS);
-       }
-diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
-index 9e0e17c348cfd..efef14c80e39a 100644
---- a/fs/btrfs/props.c
-+++ b/fs/btrfs/props.c
-@@ -317,11 +317,15 @@ static int prop_compression_apply(struct btrfs_inode *inode, const char *value,
-       struct btrfs_fs_info *fs_info = inode->root->fs_info;
-       int type;
- 
-+      size_t type_len;
-+      int level = 0;
-+
-       /* Reset to defaults */
-       if (len == 0) {
-               inode->flags &= ~BTRFS_INODE_COMPRESS;
-               inode->flags &= ~BTRFS_INODE_NOCOMPRESS;
-               inode->prop_compress = BTRFS_COMPRESS_NONE;
-+              inode->prop_compress_level = 0;
-               return 0;
-       }
- 
-@@ -331,29 +335,86 @@ static int prop_compression_apply(struct btrfs_inode *inode, const char *value,
-               inode->flags |= BTRFS_INODE_NOCOMPRESS;
-               inode->flags &= ~BTRFS_INODE_COMPRESS;
-               inode->prop_compress = BTRFS_COMPRESS_NONE;
-+              inode->prop_compress_level = 0;
- 
-               return 0;
-       }
- 
-       if (!strncmp("lzo", value, 3)) {
-               type = BTRFS_COMPRESS_LZO;
-+              type_len = 3;
-               btrfs_set_fs_incompat(fs_info, COMPRESS_LZO);
-       } else if (!strncmp("zlib", value, 4)) {
-               type = BTRFS_COMPRESS_ZLIB;
-+              type_len = 4;
-       } else if (!strncmp("zstd", value, 4)) {
-               type = BTRFS_COMPRESS_ZSTD;
-+              type_len = 4;
-               btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD);
-       } else {
-               return -EINVAL;
-       }
- 
-+      /*
-+       * Parse an optional ":level" suffix.  Old kernels accepted and
-+       * silently ignored arbitrary suffixes after the algorithm name, and
-+       * such values may still exist on disk, so fall back to the default
-+       * level instead of returning an error when the suffix cannot be
-+       * parsed, otherwise the inode's properties could not be loaded.
-+       */
-+      if (len > type_len && value[type_len] == ':') {
-+              char str[16];
-+              size_t suffix_len = len - type_len;
-+
-+              if (suffix_len < sizeof(str)) {
-+                      memcpy(str, value + type_len, suffix_len);
-+                      str[suffix_len] = 0;
-+                      if (btrfs_compress_str2level(type, str, &level) < 0)
-+                              level = 0;
-+              }
-+      }
-+
-       inode->flags &= ~BTRFS_INODE_NOCOMPRESS;
-       inode->flags |= BTRFS_INODE_COMPRESS;
-       inode->prop_compress = type;
-+      inode->prop_compress_level = level;
- 
-       return 0;
- }
- 
-+/*
-+ * Regenerate the canonical "type" or "type:level" value of the
-+ * compression property from the inode's cached fields.  Used where the
-+ * property is rewritten rather than parsed: FS_IOC_SETFLAGS preserving
-+ * an existing property, and directory inheritance.
-+ */
-+ssize_t btrfs_prop_compression_extract(const struct btrfs_inode *inode,
-+                                     char *buf, size_t size)
-+{
-+      int len;
-+
-+      switch (inode->prop_compress) {
-+      case BTRFS_COMPRESS_ZLIB:
-+      case BTRFS_COMPRESS_LZO:
-+      case BTRFS_COMPRESS_ZSTD:
-+              break;
-+      default:
-+              return -ENODATA;
-+      }
-+
-+      if (inode->prop_compress_level)
-+              len = snprintf(buf, size, "%s:%d",
-+                             btrfs_compress_type2str(inode->prop_compress),
-+                             inode->prop_compress_level);
-+      else
-+              len = snprintf(buf, size, "%s",
-+                             btrfs_compress_type2str(inode->prop_compress));
-+      if (len >= size)
-+              return -EOVERFLOW;
-+
-+      return len;
-+}
-+
- static bool prop_compression_ignore(const struct btrfs_inode *inode)
- {
-       /*
-@@ -411,6 +472,7 @@ int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
-       for (i = 0; i < ARRAY_SIZE(prop_handlers); i++) {
-               const struct prop_handler *h = &prop_handlers[i];
-               const char *value;
-+              char buf[16];
-               u64 num_bytes = 0;
- 
-               if (!h->inheritable)
-@@ -423,6 +485,15 @@ int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
-               if (!value)
-                       continue;
- 
-+              /*
-+               * The extract hooks return static strings, which cannot
-+               * carry the compression property's optional ":level"
-+               * suffix; regenerate the full value for inheritance.
-+               */
-+              if (h->extract == prop_compression_extract &&
-+                  btrfs_prop_compression_extract(parent, buf, sizeof(buf)) > 0)
-+                      value = buf;
-+
-               /*
-                * This is not strictly necessary as the property should be
-                * valid, but in case it isn't, don't propagate it further.
-diff --git a/fs/btrfs/props.h b/fs/btrfs/props.h
-index 15d9a025c923d..86a004be4e469 100644
---- a/fs/btrfs/props.h
-+++ b/fs/btrfs/props.h
-@@ -24,6 +24,9 @@ bool btrfs_ignore_prop(const struct btrfs_inode *inode, const char *name);
- 
- int btrfs_load_inode_props(struct btrfs_inode *inode, struct btrfs_path *path);
- 
-+ssize_t btrfs_prop_compression_extract(const struct btrfs_inode *inode,
-+                                     char *buf, size_t size);
-+
- int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
-                             struct btrfs_inode *inode,
-                             const struct btrfs_inode *dir);
--- 
-2.47.3
-
diff --git a/topics/compress-fixes/0005-btrfs-props-validate-compression-property-values-str.patch b/topics/compress-fixes/0005-btrfs-props-validate-compression-property-values-str.patch
deleted file mode 100644 (file)
index 2feb494..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-From 420b87ed47953436d52528ef49be054222d039b7 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 19 Jul 2026 14:33:53 -0400
-Subject: [PATCH 5/5] btrfs: props: validate compression property values
- strictly
-To: linux-btrfs@vger.kernel.org
-
-The btrfs.compression property validator matches only the algorithm
-name prefix, so values like "zstdgarbage" or "zstd:banana" are accepted
-and stored verbatim.  Now that ":level" suffixes are meaningful,
-validate new values strictly:  accept exactly an algorithm name,
-optionally followed by a ":level" suffix that btrfs_compress_str2level()
-can parse, mirroring the mount option validation from commit
-b98b20830057 ("btrfs: reject invalid compression level").  Out of range
-levels are clamped, also matching the mount options.  "no" and "none"
-are accepted as before.  Embedded NUL bytes are rejected before parsing
-the length-delimited xattr value:  otherwise the temporary
-NUL-terminated suffix buffer would let a value such as "zstd:3" followed
-by a NUL and junk pass validation and be stored verbatim.
-
-Values stored by old kernels are not affected:  property loading goes
-through the apply hook, which remains permissive, so existing inodes
-with sloppy stored values keep working; only new setxattr calls see the
-stricter checks.
-
-This is a user-visible behavior change:  applications that set malformed
-property values, which were previously accepted and ignored, will now
-receive EINVAL.  It is split into its own commit so that it can be
-accepted or rejected independently of per-inode compression level
-support.
-
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Codex:gpt-5
----
- fs/btrfs/props.c | 42 +++++++++++++++++++++++++++++++++++++-----
- 1 file changed, 37 insertions(+), 5 deletions(-)
-
-diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
-index efef14c80e39a..59f1835d57dc3 100644
---- a/fs/btrfs/props.c
-+++ b/fs/btrfs/props.c
-@@ -295,19 +295,51 @@ int btrfs_load_inode_props(struct btrfs_inode *inode, struct btrfs_path *path)
- static int prop_compression_validate(const struct btrfs_inode *inode,
-                                    const char *value, size_t len)
- {
-+      size_t type_len;
-+      int type;
-+
-       if (!value)
-               return 0;
-+      if (memchr(value, '\0', len))
-+              return -EINVAL;
- 
--      if (btrfs_compress_is_valid_type(value, len)) {
--              if (!btrfs_inode_can_compress(inode))
--                      return -EINVAL;
-+      if ((len == 2 && strncmp("no", value, 2) == 0) ||
-+          (len == 4 && strncmp("none", value, 4) == 0))
-               return 0;
-+
-+      if (len >= 3 && strncmp("lzo", value, 3) == 0) {
-+              type = BTRFS_COMPRESS_LZO;
-+              type_len = 3;
-+      } else if (len >= 4 && strncmp("zlib", value, 4) == 0) {
-+              type = BTRFS_COMPRESS_ZLIB;
-+              type_len = 4;
-+      } else if (len >= 4 && strncmp("zstd", value, 4) == 0) {
-+              type = BTRFS_COMPRESS_ZSTD;
-+              type_len = 4;
-+      } else {
-+              return -EINVAL;
-       }
- 
--      if ((len == 2 && strncmp("no", value, 2) == 0) ||
--          (len == 4 && strncmp("none", value, 4) == 0))
-+      if (!btrfs_inode_can_compress(inode))
-+              return -EINVAL;
-+
-+      if (len == type_len)
-               return 0;
- 
-+      /* Only a valid ":level" suffix may follow the algorithm name. */
-+      if (value[type_len] == ':') {
-+              char str[16];
-+              size_t suffix_len = len - type_len;
-+              int level;
-+
-+              if (suffix_len >= sizeof(str))
-+                      return -EINVAL;
-+              memcpy(str, value + type_len, suffix_len);
-+              str[suffix_len] = 0;
-+              if (btrfs_compress_str2level(type, str, &level) == 0)
-+                      return 0;
-+      }
-+
-       return -EINVAL;
- }
- 
--- 
-2.47.3
-
diff --git a/topics/compress-fixes/0005-btrfs-support-inheritance-for-per-inode-compression-.patch b/topics/compress-fixes/0005-btrfs-support-inheritance-for-per-inode-compression-.patch
new file mode 100644 (file)
index 0000000..6287483
--- /dev/null
@@ -0,0 +1,78 @@
+From f1ed856e732f62ca0a0dc413068937e8d856ff8c Mon Sep 17 00:00:00 2001
+From: koraynilay <koray.fra@gmail.com>
+Date: Tue, 3 Nov 2026 20:47:32 +0100
+Subject: [PATCH 05/11] btrfs: support inheritance for per-inode compression
+ levels
+To: linux-btrfs@vger.kernel.org
+
+Change prop_handler's extract() signature to take an output buffer and
+its length. This allows for the algo:level string to be generated
+dynamically, but now the caller is in charge of managing that buffer
+memory. Before this patch prop_compression_extract() would return only
+the address of statically compiled string without being able to add the
+level, now it concatenates the level to that statically compiled string.
+
+This signature change is fine because the only currently supported prop
+is compression, so there is only 1 extract() function.
+
+Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.5
+Signed-off-by: koraynilay <koray.fra@gmail.com>
+Link: https://lore.kernel.org/r/20261103194734.598182-5-koray.fra@gmail.com
+---
+ fs/btrfs/props.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index effc2daa2e3df..9427be2f28e02 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -36,7 +36,7 @@ struct prop_handler {
+       int (*validate)(const struct btrfs_inode *inode, const char *value,
+                       size_t len);
+       int (*apply)(struct btrfs_inode *inode, const char *value, size_t len);
+-      const char *(*extract)(const struct btrfs_inode *inode);
++      const char *(*extract)(const struct btrfs_inode *inode, char *buf, size_t len);
+       bool (*ignore)(const struct btrfs_inode *inode);
+       int inheritable;
+ };
+@@ -411,12 +411,19 @@ static bool prop_compression_ignore(const struct btrfs_inode *inode)
+       return false;
+ }
+ 
+-static const char *prop_compression_extract(const struct btrfs_inode *inode)
++static const char *prop_compression_extract(const struct btrfs_inode *inode,
++                                          char *buf, size_t len)
+ {
+       switch (inode->prop_compress) {
+       case BTRFS_COMPRESS_ZLIB:
+       case BTRFS_COMPRESS_LZO:
+       case BTRFS_COMPRESS_ZSTD:
++              if (inode->prop_compress_level) {
++                      snprintf(buf, len, "%s:%d",
++                               btrfs_compress_type2str(inode->prop_compress),
++                               inode->prop_compress_level);
++                      return buf;
++              }
+               return btrfs_compress_type2str(inode->prop_compress);
+       default:
+               break;
+@@ -453,6 +460,7 @@ int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
+               const struct prop_handler *h = &prop_handlers[i];
+               const char *value;
+               u64 num_bytes = 0;
++              char buf[BTRFS_COMPRESS_PROP_MAX_LEN];
+ 
+               if (!h->inheritable)
+                       continue;
+@@ -460,7 +468,7 @@ int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
+               if (h->ignore(inode))
+                       continue;
+ 
+-              value = h->extract(parent);
++              value = h->extract(parent, buf, sizeof(buf));
+               if (!value)
+                       continue;
+ 
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0006-btrfs-add-btrfs_compress_typelevel2str-helper.patch b/topics/compress-fixes/0006-btrfs-add-btrfs_compress_typelevel2str-helper.patch
new file mode 100644 (file)
index 0000000..fbc8170
--- /dev/null
@@ -0,0 +1,94 @@
+From 65af9f44ec1ecd3ad14f509a27caf469ce11bb1f Mon Sep 17 00:00:00 2001
+From: koraynilay <koray.fra@gmail.com>
+Date: Tue, 3 Nov 2026 20:47:33 +0100
+Subject: [PATCH 06/11] btrfs: add btrfs_compress_typelevel2str() helper
+To: linux-btrfs@vger.kernel.org
+
+Add the type:level equivalent of btrfs_compress_type2str() and use it
+in prop_compression_extract() .
+
+Signed-off-by: koraynilay <koray.fra@gmail.com>
+Link: https://lore.kernel.org/r/20261103194734.598182-6-koray.fra@gmail.com
+---
+ fs/btrfs/compression.c | 20 ++++++++++++++++++++
+ fs/btrfs/compression.h |  2 ++
+ fs/btrfs/props.c       | 19 +++----------------
+ 3 files changed, 25 insertions(+), 16 deletions(-)
+
+diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
+index b1f8323fffe7d..068c24576b71e 100644
+--- a/fs/btrfs/compression.c
++++ b/fs/btrfs/compression.c
+@@ -53,6 +53,26 @@ const char* btrfs_compress_type2str(enum btrfs_compression_type type)
+       return NULL;
+ }
+ 
++const char* btrfs_compress_typelevel2str(enum btrfs_compression_type type,
++                                       int level, char *buf, size_t len)
++{
++      switch (type) {
++      case BTRFS_COMPRESS_ZLIB:
++      case BTRFS_COMPRESS_LZO:
++      case BTRFS_COMPRESS_ZSTD:
++              if (level) {
++                      snprintf(buf, len, "%s:%d",
++                               btrfs_compress_type2str(type), level);
++                      return buf;
++              }
++              return btrfs_compress_type2str(type);
++      default:
++              break;
++      }
++
++      return NULL;
++}
++
+ static inline struct compressed_bio *to_compressed_bio(struct btrfs_bio *bbio)
+ {
+       return container_of(bbio, struct compressed_bio, bbio);
+diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
+index c63bed9f4152e..b9cc1bdd3ccbf 100644
+--- a/fs/btrfs/compression.h
++++ b/fs/btrfs/compression.h
+@@ -132,6 +132,8 @@ extern const struct btrfs_compress_levels btrfs_lzo_compress;
+ extern const struct btrfs_compress_levels btrfs_zstd_compress;
+ 
+ const char* btrfs_compress_type2str(enum btrfs_compression_type type);
++const char* btrfs_compress_typelevel2str(enum btrfs_compression_type type,
++                                       int level, char *buf, size_t len);
+ bool btrfs_compress_is_valid_type(const char *str);
+ 
+ int btrfs_compress_heuristic(struct btrfs_inode *inode, u64 start, u64 end);
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index 9427be2f28e02..3edda1f11a741 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -414,22 +414,9 @@ static bool prop_compression_ignore(const struct btrfs_inode *inode)
+ static const char *prop_compression_extract(const struct btrfs_inode *inode,
+                                           char *buf, size_t len)
+ {
+-      switch (inode->prop_compress) {
+-      case BTRFS_COMPRESS_ZLIB:
+-      case BTRFS_COMPRESS_LZO:
+-      case BTRFS_COMPRESS_ZSTD:
+-              if (inode->prop_compress_level) {
+-                      snprintf(buf, len, "%s:%d",
+-                               btrfs_compress_type2str(inode->prop_compress),
+-                               inode->prop_compress_level);
+-                      return buf;
+-              }
+-              return btrfs_compress_type2str(inode->prop_compress);
+-      default:
+-              break;
+-      }
+-
+-      return NULL;
++      return btrfs_compress_typelevel2str(inode->prop_compress,
++                                          inode->prop_compress_level,
++                                          buf, len);
+ }
+ 
+ static struct prop_handler prop_handlers[] = {
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0007-btrfs-preserve-btrfs.compression-when-setting-inode-.patch b/topics/compress-fixes/0007-btrfs-preserve-btrfs.compression-when-setting-inode-.patch
new file mode 100644 (file)
index 0000000..93584a8
--- /dev/null
@@ -0,0 +1,132 @@
+From 2e91da3ba65a1d8973f07a857c6641b8d32ec121 Mon Sep 17 00:00:00 2001
+From: koraynilay <koray.fra@gmail.com>
+Date: Tue, 3 Nov 2026 20:47:34 +0100
+Subject: [PATCH 07/11] btrfs: preserve btrfs.compression when setting inode
+ flags
+To: linux-btrfs@vger.kernel.org
+
+Commit e8a0095c7df170 ("btrfs: preserve the compression property when
+other inode flags change") fixed an issue where any call to
+FS_IOC_SETFLAGS (e.g. via chattr) would overwrite the btrfs.compression
+property with the mount default compression type, even when no flag bits
+change and even for flags unrelated to compression.
+
+Update the fixed code to also preserve the newly introduced level
+specification by using the new btrfs_compress_typelevel2str() helper.
+
+Also move BTRFS_COMPRESS_PROP_MAX_LEN from props.c to props.h so it can
+be used by ioctl.c, since it now requires a temporary buffer to write the
+property string to.
+
+[ Commit message and code adapted from Zygo's patch for this same issue ]
+
+Reported-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Suggested-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.7
+Signed-off-by: koraynilay <koray.fra@gmail.com>
+Link: https://lore.kernel.org/r/20261103194734.598182-7-koray.fra@gmail.com
+---
+ fs/btrfs/ioctl.c | 27 ++++++++++++++-------------
+ fs/btrfs/props.c |  9 ---------
+ fs/btrfs/props.h |  9 +++++++++
+ 3 files changed, 23 insertions(+), 22 deletions(-)
+
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
+index 215e3220df7fa..ecf0f334514db 100644
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -288,6 +288,7 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+       unsigned int fsflags, old_fsflags;
+       int ret;
+       const char *comp = NULL;
++      char comp_buf[BTRFS_COMPRESS_PROP_MAX_LEN];
+       u32 inode_flags;
+       bool prop_set = false;
+ 
+@@ -397,7 +398,6 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+               inode_flags &= ~BTRFS_INODE_COMPRESS;
+               inode_flags |= BTRFS_INODE_NOCOMPRESS;
+       } else if (fsflags & FS_COMPR_FL) {
+-              enum btrfs_compression_type comp_type;
+ 
+               if (IS_SWAPFILE(&inode->vfs_inode))
+                       return -ETXTBSY;
+@@ -406,22 +406,23 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+               inode_flags &= ~BTRFS_INODE_NOCOMPRESS;
+ 
+               /*
+-               * Keep the algorithm recorded in the compression property,
+-               * otherwise changing an unrelated attribute would reset it to
+-               * the mount default, since FS_IOC_SETFLAGS callers write back
+-               * the whole flag set they got from FS_IOC_GETFLAGS and that
+-               * includes FS_COMPR_FL for any inode carrying the property.
++               * If compression is already enabled, we must reconstruct the
++               * full "algo:level" property string and write it back.
++               * Otherwise changing an unrelated attribute would reset it to
++               * the mount default and drop the level, since FS_IOC_SETFLAGS
++               * callers write back the whole flag set they got from
++               * FS_IOC_GETFLAGS, and that includes FS_COMPR_FL.
+                *
+                * Inodes with the compress flag set but no property keep using
+                * the mount default, so they behave as before.
+                */
+-              if (inode->prop_compress)
+-                      comp_type = inode->prop_compress;
+-              else if (fs_info->compress_type)
+-                      comp_type = fs_info->compress_type;
+-              else
+-                      comp_type = BTRFS_COMPRESS_ZLIB;
+-              comp = btrfs_compress_type2str(comp_type);
++              comp = btrfs_compress_typelevel2str(inode->prop_compress,
++                                                  inode->prop_compress_level,
++                                                  comp_buf, sizeof(comp_buf));
++              if (!comp || comp[0] == 0)
++                      comp = btrfs_compress_type2str(fs_info->compress_type);
++              if (!comp || comp[0] == 0)
++                      comp = btrfs_compress_type2str(BTRFS_COMPRESS_ZLIB);
+       } else {
+               inode_flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS);
+       }
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index 3edda1f11a741..05e594ce613b0 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -18,15 +18,6 @@
+ #include "super.h"
+ #include "dir-item.h"
+ 
+-/*
+- * Max length of compression algorithm:level string.
+- *
+- * For now the longest possible string is "zstd:-15", which is
+- * 8 characters + 1 terminating null byte.
+- * Rounding it up to the closest power of 2 gives 16.
+- */
+-#define BTRFS_COMPRESS_PROP_MAX_LEN 16
+-
+ #define BTRFS_PROP_HANDLERS_HT_BITS 8
+ static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS);
+ 
+diff --git a/fs/btrfs/props.h b/fs/btrfs/props.h
+index 15d9a025c923d..93b55a85a728a 100644
+--- a/fs/btrfs/props.h
++++ b/fs/btrfs/props.h
+@@ -9,6 +9,15 @@
+ #include <linux/types.h>
+ #include <linux/compiler_types.h>
+ 
++/*
++ * Max length of compression algorithm:level string.
++ *
++ * For now the longest possible string is "zstd:-15", which is
++ * 8 characters + 1 terminating null byte.
++ * Rounding it up to the closest power of 2 gives 16.
++ */
++#define BTRFS_COMPRESS_PROP_MAX_LEN 16
++
+ struct btrfs_inode;
+ struct btrfs_path;
+ struct btrfs_trans_handle;
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0008-btrfs-fix-nodatacow-vs-compression-inode-flag-confli.patch b/topics/compress-fixes/0008-btrfs-fix-nodatacow-vs-compression-inode-flag-confli.patch
new file mode 100644 (file)
index 0000000..c66438f
--- /dev/null
@@ -0,0 +1,183 @@
+From e535624aac207911db5b934f43979a556f9687ea Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Sat, 16 Aug 2025 22:20:01 -0400
+Subject: [PATCH 08/11] btrfs: fix nodatacow vs compression inode flag conflict
+ check
+To: linux-btrfs@vger.kernel.org
+
+Applications expect inode flags to be orthogonal: changes can be combined
+or applied separately in any order, as long as each intermediate state is
+valid and unchanged flags are left untouched.
+
+Commit f37c563bab42 ("btrfs: add missing check for nocow and compression
+inode flags") intended to forbid combining FS_NOCOW_FL with either
+FS_NOCOMP_FL or FS_COMPR_FL. The implementation contained a bug and
+introduced multiple regressions.
+
+Bug: FS_NOCOW_FL (+C) and FS_NOCOMP_FL (+m) can still be set together in
+a single FS_IOC_SETFLAGS call, even though the commit message states this
+combination should be rejected.
+
+Regression 1: Switching from +C+m back to -C-m only works if both flag
+changes are combined into one ioctl; separate -C and -m calls are
+rejected.
+
+Regression 2: Switching between +C-c and -C+c only works if the changes
+are split across multiple ioctls; a combined -C+c call is rejected.
+
+Regression 3: Inodes created on kernels before commit f37c563bab42
+("btrfs: add missing check for nocow and compression inode flags") with
+both COMPR and NOCOW set cannot have any other fsattrs changed on newer
+kernels. Even unrelated operations (such as adding +i, or clearing just
+one of the compression bits) fail with EINVAL, because the conflict
+check rejects the entire ioctl whenever conflicting bits are present,
+even if those bits are not being modified. This makes it impossible to
+manage older files without first undoing their existing flags.
+
+Fix by:
+ * Rewriting the conflict checks so FS_NOCOW_FL cannot be combined with
+   FS_NOCOMP_FL or FS_COMPR_FL in any ioctl (fixes the original bug and
+   regressions 1-2).
+ * Allowing existing conflicting flags to remain if they are not modified
+   by the ioctl (fixes regression 3).
+ * Moving the check later in the flag-validation sequence so that it
+   occurs after handling the long-standing rule that FS_NOCOW_FL changes
+   are silently ignored on non-empty files. This preserves the pre-existing
+   behavior while still applying the corrected conflict logic.
+
+Also commit the new inode flags to the inode before setting the
+compression property, restoring them if the property cannot be set:
+property validation rejects compression on nodatacow inodes based on
+the inode's current flags, which would otherwise reject a single ioctl
+that both clears NOCOW and sets COMPR (regression 2) even with the
+conflict check corrected.
+
+Fixes: f37c563bab42 ("btrfs: add missing check for nocow and compression inode flags")
+Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+---
+ fs/btrfs/ioctl.c | 60 ++++++++++++++++++++++++++++++++++++------------
+ 1 file changed, 45 insertions(+), 15 deletions(-)
+
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
+index ecf0f334514db..5b597ec81db9d 100644
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -216,9 +216,9 @@ void btrfs_sync_inode_flags_to_i_flags(struct btrfs_inode *inode)
+ 
+ /*
+  * Check if @flags are a supported and valid set of FS_*_FL flags and that
+- * the old and new flags are not conflicting
++ * the flags are not conflicting
+  */
+-static int check_fsflags(unsigned int old_flags, unsigned int flags)
++static int check_fsflags(unsigned int flags)
+ {
+       if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
+                     FS_NOATIME_FL | FS_NODUMP_FL | \
+@@ -227,19 +227,10 @@ static int check_fsflags(unsigned int old_flags, unsigned int flags)
+                     FS_NOCOW_FL))
+               return -EOPNOTSUPP;
+ 
+-      /* COMPR and NOCOMP on new/old are valid */
++      /* Only one of COMPR and NOCOMP is valid at a time */
+       if ((flags & FS_NOCOMP_FL) && (flags & FS_COMPR_FL))
+               return -EINVAL;
+ 
+-      if ((flags & FS_COMPR_FL) && (flags & FS_NOCOW_FL))
+-              return -EINVAL;
+-
+-      /* NOCOW and compression options are mutually exclusive */
+-      if ((old_flags & FS_NOCOW_FL) && (flags & (FS_COMPR_FL | FS_NOCOMP_FL)))
+-              return -EINVAL;
+-      if ((flags & FS_NOCOW_FL) && (old_flags & (FS_COMPR_FL | FS_NOCOMP_FL)))
+-              return -EINVAL;
+-
+       return 0;
+ }
+ 
+@@ -289,6 +280,7 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+       int ret;
+       const char *comp = NULL;
+       char comp_buf[BTRFS_COMPRESS_PROP_MAX_LEN];
++      u32 old_inode_flags;
+       u32 inode_flags;
+       bool prop_set = false;
+ 
+@@ -300,7 +292,7 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+ 
+       fsflags = btrfs_mask_fsflags_for_type(&inode->vfs_inode, fa->flags);
+       old_fsflags = btrfs_inode_flags_to_fsflags(inode);
+-      ret = check_fsflags(old_fsflags, fsflags);
++      ret = check_fsflags(fsflags);
+       if (ret)
+               return ret;
+ 
+@@ -356,6 +348,30 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+               } else {
+                       inode_flags |= BTRFS_INODE_NODATACOW;
+               }
++              /*
++               * NODATACOW files will ignore COMPRESS, so forbid
++               * COMPRESS | NODATACOW.
++               *
++               * We do this check here, after we've decided whether
++               * to silently drop the NODATACOW bit for non-empty files.
++               *
++               * NODATACOW files will inherit flags from NODATACOW
++               * directories, so COMPRESS is forbidden for them too.
++               *
++               * Old kernels allowed the forbidden combination of flags
++               * to be set, and they may still be found on existing
++               * filesystems.  If the forbidden combination of flags
++               * are already set, we will allow an application to set
++               * or clear unrelated flags (like IMMUTABLE or NOATIME)
++               * as long as the existing COMPRESS | NODATACOW flags
++               * are not changed.
++               */
++              if ((inode_flags & BTRFS_INODE_NODATACOW) &&
++                  (fsflags & (FS_COMPR_FL | FS_NOCOMP_FL))) {
++                      if ((old_fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)) !=
++                          (fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)))
++                              return -EINVAL;
++              }
+       } else {
+               /* We can only change NODATACOW for zero-sized regular file. */
+               if (S_ISREG(inode->vfs_inode.i_mode) && (inode->vfs_inode.i_size == 0)) {
+@@ -435,18 +451,32 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+       if (IS_ERR(trans))
+               return PTR_ERR(trans);
+ 
++      /*
++       * Commit the new flags to the inode before setting the compression
++       * property: property validation rejects compression on nodatacow
++       * inodes based on the inode's current flags, which would incorrectly
++       * reject a single ioctl that both clears NOCOW and sets COMPR.
++       * Restore the original flags if the property cannot be set.
++       */
++      old_inode_flags = inode->flags;
++      inode->flags = inode_flags;
++
+       if (comp) {
+               ret = btrfs_set_prop(trans, inode, "btrfs.compression",
+                                    comp, strlen(comp), 0);
+-              if (ret)
++              if (ret) {
++                      inode->flags = old_inode_flags;
+                       goto out_end_trans;
++              }
+               prop_set = true;
+       } else {
+               ret = btrfs_set_prop(trans, inode, "btrfs.compression", NULL, 0, 0);
+               prop_set = (ret == 0);
+               /* If ret == -ENODATA ignore and proceed to update inode item. */
+-              if (ret && ret != -ENODATA)
++              if (ret && ret != -ENODATA) {
++                      inode->flags = old_inode_flags;
+                       goto out_end_trans;
++              }
+       }
+ 
+ update_flags:
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0009-btrfs-allow-NODATACOW-NOCOMPRESS.patch b/topics/compress-fixes/0009-btrfs-allow-NODATACOW-NOCOMPRESS.patch
new file mode 100644 (file)
index 0000000..b60e270
--- /dev/null
@@ -0,0 +1,83 @@
+From f2dd82de6a73ea3041f029b85aa2c1d2a2a4748e Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Sun, 17 Aug 2025 16:57:07 -0400
+Subject: [PATCH 09/11] btrfs: allow NODATACOW | NOCOMPRESS
+To: linux-btrfs@vger.kernel.org
+
+Commit f37c563bab42 ("btrfs: add missing check for nocow and compression
+inode flags") added conflict checks for certain inode flag combinations,
+and commit 0e852ab8974c ("btrfs: do not allow compression on nodatacow
+files") extended the same logic to xattrs.
+
+Both commits also forbade the combination of FS_NOCOW_FL (NODATACOW)
+and FS_NOCOMP_FL (NOCOMPRESS).  This restriction is undocumented, has
+no technical basis, and provides no benefit.  NODATACOW files cannot be
+compressed in any case, so the NOCOMPRESS bit is a no-op:  behavior is
+the same whether the flag is present or not.
+
+Forcing an unnecessary conflict makes inode flags harder to use.
+Portable applications may inherit COMPRESS, NOCOMPRESS, or NODATACOW bits
+from parent directories and combine them with unrelated flags such as
+IMMUTABLE or NOATIME.  Rejecting otherwise valid flag sets with EINVAL
+creates surprises for applications that do not know about btrfs-specific
+interactions and only touch the flags they care about.
+
+Fix by permitting the combination of NODATACOW and NOCOMPRESS, both via
+FS_IOC_SETFLAGS and by setting btrfs.compression to "no"/"none" through
+xattrs.
+
+Fixes: f37c563bab42 ("btrfs: add missing check for nocow and compression inode flags")
+Fixes: 0e852ab8974c ("btrfs: do not allow compression on nodatacow files")
+Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+---
+ fs/btrfs/ioctl.c | 6 +++---
+ fs/btrfs/props.c | 8 ++++----
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
+index 5b597ec81db9d..5d35b2072886f 100644
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -367,9 +367,9 @@ int btrfs_fileattr_set(const struct mnt_idmap *idmap,
+                * are not changed.
+                */
+               if ((inode_flags & BTRFS_INODE_NODATACOW) &&
+-                  (fsflags & (FS_COMPR_FL | FS_NOCOMP_FL))) {
+-                      if ((old_fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)) !=
+-                          (fsflags & (FS_NOCOW_FL | FS_COMPR_FL | FS_NOCOMP_FL)))
++                  (fsflags & FS_COMPR_FL)) {
++                      if ((old_fsflags & (FS_NOCOW_FL | FS_COMPR_FL)) !=
++                          (fsflags & (FS_NOCOW_FL | FS_COMPR_FL)))
+                               return -EINVAL;
+               }
+       } else {
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index 05e594ce613b0..adc4dc540840c 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -297,9 +297,6 @@ static int prop_compression_validate(const struct btrfs_inode *inode,
+ {
+       char value_str[BTRFS_COMPRESS_PROP_MAX_LEN];
+ 
+-      if (!btrfs_inode_can_compress(inode))
+-              return -EINVAL;
+-
+       if (!value)
+               return 0;
+ 
+@@ -308,8 +305,11 @@ static int prop_compression_validate(const struct btrfs_inode *inode,
+ 
+       memcpy(value_str, value, len);
+       value_str[len] = '\0';
+-      if (btrfs_compress_is_valid_type(value_str))
++      if (btrfs_compress_is_valid_type(value_str)) {
++              if (!btrfs_inode_can_compress(inode))
++                      return -EINVAL;
+               return 0;
++      }
+ 
+       if ((len == 2 && strncmp("no", value, 2) == 0) ||
+           (len == 4 && strncmp("none", value, 4) == 0))
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0010-btrfs-props-reject-NUL-bytes-in-btrfs.compression-va.patch b/topics/compress-fixes/0010-btrfs-props-reject-NUL-bytes-in-btrfs.compression-va.patch
new file mode 100644 (file)
index 0000000..989d7fe
--- /dev/null
@@ -0,0 +1,44 @@
+From a41f99c734a9d5e3a5344cb2d0371b3cc16ff586 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Tue, 3 Nov 2026 18:41:30 -0500
+Subject: [PATCH 10/11] btrfs: props: reject NUL bytes in btrfs.compression
+ values
+To: linux-btrfs@vger.kernel.org
+
+The btrfs.compression xattr value is length-delimited, and
+prop_compression_validate() copies it into a NUL-terminated buffer before
+btrfs_compress_is_valid_type() parses it.  An embedded NUL byte ends the
+string early in the copy, so a value such as "zstd:3" followed by a NUL
+and arbitrary junk passes validation and is stored verbatim, junk and
+all, where getxattr returns it.
+
+No algorithm name or level contains a NUL byte, so reject such values
+before the copy.  "no" and "none" were already compared with an exact
+length and are not affected.
+
+---
+ fs/btrfs/props.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index adc4dc540840c..0fabd64cffd2b 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -303,6 +303,14 @@ static int prop_compression_validate(const struct btrfs_inode *inode,
+       if (len >= BTRFS_COMPRESS_PROP_MAX_LEN)
+               return -EINVAL;
+ 
++      /*
++       * The value is length-delimited and may contain NUL bytes, which the
++       * NUL-terminated copy would hide from the parser:  "zstd:3" followed
++       * by a NUL and junk would pass and be stored verbatim.
++       */
++      if (memchr(value, '\0', len))
++              return -EINVAL;
++
+       memcpy(value_str, value, len);
+       value_str[len] = '\0';
+       if (btrfs_compress_is_valid_type(value_str)) {
+-- 
+2.47.3
+
diff --git a/topics/compress-fixes/0011-btrfs-props-keep-compressing-inodes-with-legacy-comp.patch b/topics/compress-fixes/0011-btrfs-props-keep-compressing-inodes-with-legacy-comp.patch
new file mode 100644 (file)
index 0000000..2fc408a
--- /dev/null
@@ -0,0 +1,105 @@
+From 464a17c7110ff10889f59c0230001ef8fde4ca92 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Tue, 3 Nov 2026 18:41:31 -0500
+Subject: [PATCH 11/11] btrfs: props: keep compressing inodes with legacy
+ compression property values
+To: linux-btrfs@vger.kernel.org
+
+Older kernels matched btrfs.compression values by algorithm name prefix
+only, both in the property validator and in prop_compression_apply(),
+so values such as "zstd:banana", "zstd:", "zstd:3x", "zstdgarbage", or
+anything longer than BTRFS_COMPRESS_PROP_MAX_LEN were accepted, stored
+verbatim, and compressed with the named algorithm.  Such values are
+still found on existing filesystems.
+
+Since per-inode compression levels were added, prop_compression_apply()
+parses the value strictly and rejects these with -EINVAL.  The property is
+loaded with the inode, and inode_prop_iterator() only warns about a
+failed apply, so these inodes silently stop compressing, with a warning
+every time the inode is loaded.
+
+Keep compressing them as older kernels did:  in prop_compression_apply(),
+match the algorithm by name prefix again, and treat a level suffix that
+does not parse, or a value too long to hold a valid level, as an
+unspecified level (prop_compress_level = 0).  The compression paths then
+pick the level as for a value with no level at all:  the mount option's
+level if the mount option uses the same algorithm, otherwise the
+algorithm's default level.
+
+setxattr still goes through prop_compression_validate(), which keeps
+rejecting these values, so only values that are already stored take this
+path.
+
+---
+ fs/btrfs/props.c | 35 ++++++++++++++++++++---------------
+ 1 file changed, 20 insertions(+), 15 deletions(-)
+
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index 0fabd64cffd2b..4d58c14ff9427 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -332,8 +332,8 @@ static int prop_compression_apply(struct btrfs_inode *inode, const char *value,
+       struct btrfs_fs_info *fs_info = inode->root->fs_info;
+       int type;
+       int level = 0;
+-      int ret = 0;
+       char value_str[BTRFS_COMPRESS_PROP_MAX_LEN];
++      size_t copy_len = min(len, sizeof(value_str) - 1);
+       int level_pos = 0;
+ 
+       /* Reset to defaults */
+@@ -354,19 +354,23 @@ static int prop_compression_apply(struct btrfs_inode *inode, const char *value,
+               return 0;
+       }
+ 
+-      if (len >= BTRFS_COMPRESS_PROP_MAX_LEN)
+-              return -EINVAL;
+-
+-      memcpy(value_str, value, len);
+-      value_str[len] = '\0';
++      /*
++       * Older kernels matched only the algorithm name prefix and stored the
++       * rest of the value without validation, and inodes with such values
++       * are still out there.  Keep compressing them with the named
++       * algorithm, as those kernels did:  match the prefix here, and leave
++       * the strict checks to prop_compression_validate().
++       */
++      memcpy(value_str, value, copy_len);
++      value_str[copy_len] = '\0';
+ 
+-      if (btrfs_match_compress_type(value_str, "lzo", true)) {
++      if (strncmp(value_str, "lzo", 3) == 0) {
+               type = BTRFS_COMPRESS_LZO;
+               btrfs_set_fs_incompat(fs_info, COMPRESS_LZO);
+-      } else if (btrfs_match_compress_type(value_str, "zlib", true)) {
++      } else if (strncmp(value_str, "zlib", 4) == 0) {
+               type = BTRFS_COMPRESS_ZLIB;
+               level_pos = 4;
+-      } else if (btrfs_match_compress_type(value_str, "zstd", true)) {
++      } else if (strncmp(value_str, "zstd", 4) == 0) {
+               type = BTRFS_COMPRESS_ZSTD;
+               level_pos = 4;
+               btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD);
+@@ -378,12 +382,13 @@ static int prop_compression_apply(struct btrfs_inode *inode, const char *value,
+       if (level_pos > 0) {
+               const char *level_str = value_str + level_pos;
+ 
+-              /* and if user specified it */
+-              if (level_str[0] == ':') {
+-                      ret = btrfs_compress_str2level(type, level_str, &level);
+-                      if (ret < 0)
+-                              return ret;
+-              }
++              /*
++               * and if user specified it.  A level that does not parse, or a
++               * value too long to be one, counts as unspecified.
++               */
++              if (len == copy_len && level_str[0] == ':' &&
++                  btrfs_compress_str2level(type, level_str, &level) < 0)
++                      level = 0;
+       }
+ 
+       inode->flags &= ~BTRFS_INODE_NOCOMPRESS;
+-- 
+2.47.3
+
index 00827480564bd82408373aac773cead93e2b1885..c16c18435e2aba164bb1638ff2dafa93fab4e7fb 100644 (file)
@@ -1,6 +1,6 @@
-From 0b2a2621fdc37ab3063892db73bfa0cff0f0e29c Mon Sep 17 00:00:00 2001
+From a4a830eb6b96cfcf9bc52dc145cf41f4dc927b7a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:00 -0400
+Date: Fri, 6 Nov 2026 05:48:14 -0500
 Subject: [PATCH 0/3] btrfs: deadlocks between reflink, relocation and space reservation
 To: linux-btrfs@vger.kernel.org
 
@@ -57,12 +57,11 @@ Zygo Blaxell (3):
     range has delalloc
   btrfs: relocation: reserve all of a folio's slices before dirtying any
 
- fs/btrfs/reflink.c    | 296 +++++++++++++++++++++++++++---------------
- fs/btrfs/relocation.c |  81 ++++++++++--
- 2 files changed, 259 insertions(+), 118 deletions(-)
+ fs/btrfs/reflink.c    | 249 ++++++++++++++++++++++++------------------
+ fs/btrfs/relocation.c |  74 +++++++++++--
+ 2 files changed, 205 insertions(+), 118 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 08a4171f776ca36327e85945d04e839dcd8016c7..b181ff7c943c49715e3bd4e3fe926fa2ce484aa1 100644 (file)
@@ -1,4 +1,4 @@
-From 4ec553632d4497d4ae8a2ccf6a546d152d32b16f Mon Sep 17 00:00:00 2001
+From 740693bb3d78f9d17b6d1c253e2c59214969838b Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 15 Aug 2026 22:21:10 -0400
 Subject: [PATCH 1/3] btrfs: fix flushoncommit deadlock when cloning an inline
@@ -50,13 +50,12 @@ dirtied beyond EOF is still written back instead of being discarded by
 folio invalidation.
 
 Fixes: 05a5a7621ce6 ("Btrfs: implement full reflink support for inline extents")
-Assisted-by: Claude:claude-fable-5
 ---
- fs/btrfs/reflink.c | 177 +++++++++++++++++++--------------------------
- 1 file changed, 74 insertions(+), 103 deletions(-)
+ fs/btrfs/reflink.c | 158 ++++++++++++++++-----------------------------
+ 1 file changed, 55 insertions(+), 103 deletions(-)
 
 diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
-index b5d2c094941df..c487ab4a63322 100644
+index b5d2c094941df..7a2f5095682ed 100644
 --- a/fs/btrfs/reflink.c
 +++ b/fs/btrfs/reflink.c
 @@ -65,7 +65,6 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
@@ -67,7 +66,7 @@ index b5d2c094941df..c487ab4a63322 100644
        struct folio *folio = NULL;
        struct address_space *mapping = inode->vfs_inode.i_mapping;
        int ret;
-@@ -74,16 +73,12 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
+@@ -74,16 +73,9 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
               file_offset, block_size);
  
        /*
@@ -75,11 +74,8 @@ index b5d2c094941df..c487ab4a63322 100644
 -       * inodes, we also have locked the inodes, so we are safe to do a
 -       * reservation here. Also we must not do the reservation while holding
 -       * a transaction open, otherwise we would deadlock.
-+       * Our caller has reserved data and metadata space for our block and
-+       * holds an open transaction handle. The reservation can not be done
-+       * here since reserving space while holding a transaction open can
-+       * deadlock, and the transaction must be started before dirtying the
-+       * folio below (see clone_copy_inline_extent()).
++       * Our caller reserved space for our block and started the transaction
++       * before we dirty the folio, see clone_copy_inline_extent().
         */
 -      ret = btrfs_delalloc_reserve_space(inode, &data_reserved, file_offset,
 -                                         block_size);
@@ -89,7 +85,7 @@ index b5d2c094941df..c487ab4a63322 100644
        folio = __filemap_get_folio(mapping, file_offset >> PAGE_SHIFT,
                                        FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
                                        btrfs_alloc_write_mask(mapping));
-@@ -101,13 +96,11 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
+@@ -101,13 +93,11 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
                goto out_unlock;
  
        /*
@@ -108,7 +104,7 @@ index b5d2c094941df..c487ab4a63322 100644
         * when we finish cloning all extents, since a transaction is started
         * after finding each extent to clone.
         */
-@@ -147,12 +140,6 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
+@@ -147,12 +137,6 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
                folio_unlock(folio);
                folio_put(folio);
        }
@@ -121,7 +117,7 @@ index b5d2c094941df..c487ab4a63322 100644
  
        return ret;
  }
-@@ -178,16 +165,12 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
+@@ -178,16 +162,12 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
                                      fs_info->sectorsize);
        struct btrfs_trans_handle *trans = NULL;
        struct btrfs_drop_extents_args drop_args = { 0 };
@@ -141,7 +137,7 @@ index b5d2c094941df..c487ab4a63322 100644
  
        key.objectid = btrfs_ino(inode);
        key.type = BTRFS_EXTENT_DATA_KEY;
-@@ -290,73 +273,7 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
+@@ -290,73 +270,7 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
        if (unlikely(ret))
                btrfs_abort_transaction(trans, ret);
  out:
@@ -216,7 +212,7 @@ index b5d2c094941df..c487ab4a63322 100644
        if (ret && trans)
                btrfs_end_transaction(trans);
        if (!ret)
-@@ -367,17 +284,71 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
+@@ -367,17 +281,55 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
  copy_to_page:
        /*
         * Release our path because we don't need it anymore and also because
@@ -233,29 +229,13 @@ index b5d2c094941df..c487ab4a63322 100644
        btrfs_release_path(path);
  
 +      /*
-+       * Reserve space and start the transaction for the inode item update
-+       * BEFORE copying the inline extent's data into a folio and dirtying
-+       * it.
-+       *
-+       * We hold the destination range locked in the inode's io tree for the
-+       * whole duration of the clone, so once we dirty a folio in that range
-+       * we must not block waiting for a transaction commit: with the
-+       * flushoncommit mount option the committing task flushes dirty inodes
-+       * through the generic writeback path, which knows nothing about
-+       * BTRFS_INODE_NO_DELALLOC_FLUSH, and its flusher then blocks forever
-+       * in find_lock_delalloc_range() on our locked range while we wait for
-+       * that same commit - a deadlock. This is a variant of the one fixed
-+       * by commit b48c980b6a7e ("btrfs: fix deadlock between reflink and
-+       * transaction commit when using flushoncommit"), with the folio
-+       * inside i_size so the flusher writes it back instead of invalidating
-+       * it.
-+       *
-+       * While the locked range is still clean the flusher has no reason to
-+       * touch it, so it is safe to block here, and once we hold the open
-+       * transaction handle we can no longer block waiting for a commit.
-+       * The space reservation must stay ordered before the transaction
-+       * start, since reserving space may flush and wait for a transaction
-+       * commit.
++       * Reserve space and start the transaction before dirtying the folio. We
++       * hold the destination range locked for the whole clone, and with
++       * flushoncommit a commit writes back dirty inodes through the generic
++       * writeback path, which ignores BTRFS_INODE_NO_DELALLOC_FLUSH and would
++       * block on our locked range while we wait for that commit. While the
++       * range is clean, blocking here is safe. Reserve first, since reserving
++       * space may itself wait for a commit.
 +       */
 +      ret = btrfs_delalloc_reserve_space(inode, &data_reserved,
 +                                         new_key->offset,
@@ -263,7 +243,7 @@ index b5d2c094941df..c487ab4a63322 100644
 +      if (ret)
 +              goto out;
 +
-+      /* 1 unit to update the inode item after copying the inline extent. */
++      /* 1 unit to update inode item */
 +      trans = btrfs_start_transaction(root, 1);
 +      if (IS_ERR(trans)) {
 +              ret = PTR_ERR(trans);
index 7bd58c255a45e620964922e6b6689beddee70f8b..1b3bfd4a5e9a5c80411c5fc2c82e81ba5111d4f3 100644 (file)
@@ -1,4 +1,4 @@
-From 52896b16014356c4176587554d6c379201533d36 Mon Sep 17 00:00:00 2001
+From 9a8355ccedd983d8f3b284a3ae3aa086bb9e2541 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 16 Aug 2026 03:31:14 -0400
 Subject: [PATCH 2/3] btrfs: reflink: never block on space reservations while
@@ -67,17 +67,15 @@ remained, and one of them was captured live on a test box within hours:
    userspace (e.g. a dedupe agent) retry the same range forever.
 
 Fixes: 05a5a7621ce6 ("Btrfs: implement full reflink support for inline extents")
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
- fs/btrfs/reflink.c | 133 +++++++++++++++++++++++++++++++++++++++++----
- 1 file changed, 122 insertions(+), 11 deletions(-)
+ fs/btrfs/reflink.c | 105 ++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 94 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
-index c487ab4a63322..b7b7437482ead 100644
+index 7a2f5095682ed..976eaa8b51efc 100644
 --- a/fs/btrfs/reflink.c
 +++ b/fs/btrfs/reflink.c
-@@ -157,7 +157,8 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
+@@ -154,7 +154,8 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
                                    const u64 size,
                                    const u8 comp_type,
                                    char *inline_data,
@@ -87,7 +85,7 @@ index c487ab4a63322..b7b7437482ead 100644
  {
        struct btrfs_root *root = inode->root;
        struct btrfs_fs_info *fs_info = root->fs_info;
-@@ -340,13 +341,17 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
+@@ -321,13 +322,17 @@ static int clone_copy_inline_extent(struct btrfs_inode *inode,
                btrfs_delalloc_release_space(inode, data_reserved,
                                             new_key->offset,
                                             fs_info->sectorsize, true);
@@ -112,7 +110,7 @@ index c487ab4a63322..b7b7437482ead 100644
        }
        btrfs_delalloc_release_extents(inode, fs_info->sectorsize);
  
-@@ -380,6 +385,8 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
+@@ -361,6 +366,8 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
        const u64 len = olen_aligned;
        u64 last_dest_end = destoff;
        u64 prev_extent_end = off;
@@ -121,7 +119,7 @@ index c487ab4a63322..b7b7437482ead 100644
  
        ret = -ENOMEM;
        buf = kvmalloc(fs_info->nodesize, GFP_KERNEL);
-@@ -406,6 +413,7 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
+@@ -387,6 +394,7 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
                u64 datao = 0, datal = 0;
                u8 comp;
                u64 drop_start;
@@ -129,7 +127,7 @@ index c487ab4a63322..b7b7437482ead 100644
  
                /* Note the key will change type as we walk through the tree */
                ret = btrfs_search_slot(NULL, src->root, &key, path, 0, 0);
-@@ -554,7 +562,8 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
+@@ -535,7 +543,8 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
  
                        ret = clone_copy_inline_extent(inode, path, &new_key,
                                                       drop_start, datal, size,
@@ -139,25 +137,17 @@ index c487ab4a63322..b7b7437482ead 100644
                        if (ret)
                                goto out;
                }
-@@ -585,6 +594,29 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
+@@ -566,6 +575,21 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
                                                destoff, olen, no_time_update);
                if (ret)
                        goto out;
 +              /*
-+               * Copying an inline extent's data into a folio left delalloc
-+               * inside our caller's locked destination range.  The rest of
-+               * the clone starts transactions and reserves space, which must
-+               * not block while the lock covers dirty data: under the
-+               * flushoncommit mount option, a transaction commit (including
-+               * one issued to satisfy a metadata reservation ticket) flushes
-+               * dirty inodes through the generic writeback path, and its
-+               * flusher would block forever on our extent lock while we wait
-+               * for that same commit or ticket.  Unlock the dirtied block
-+               * now: every byte still locked is clean, so writeback never
-+               * needs our lock, and the inode's i_rwsem (held for the whole
-+               * remap) keeps writers away from the unlocked block until the
-+               * clone finishes.  The inode item for the copied data was
-+               * already updated by clone_finish_inode_update() above.
++               * The inline copy left delalloc in our caller's locked range,
++               * and the rest of the clone may wait for a commit or a
++               * reservation ticket whose flushoncommit writeback would block
++               * on our lock. Unlock the dirtied block so that only clean data
++               * stays locked; i_rwsem keeps writers out of it until the clone
++               * finishes.
 +               */
 +              if (copied_to_page) {
 +                      unlocked_start = new_key.offset;
@@ -169,20 +159,17 @@ index c487ab4a63322..b7b7437482ead 100644
                if (new_key.offset + datal >= destoff + len)
                        break;
  
-@@ -636,6 +668,22 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
+@@ -617,6 +641,19 @@ static int btrfs_clone(struct btrfs_inode *src, struct btrfs_inode *inode,
        }
  
  out:
 +      /*
-+       * Our caller unlocks the whole destination range when we return, so
-+       * lock the block we unlocked above again, or the caller would unlock
-+       * it a second time, possibly dropping a lock that writeback or a read
-+       * took on it in the meantime.  This cannot deadlock once the path is
-+       * released: we hold no transaction handle or tree lock, writeback of
-+       * the copied block has no reason to lock the rest of our range (it
-+       * has no delalloc), and btrfs_lock_extent() drops the part of a range
-+       * it got before waiting for the rest, so a read covering more than
-+       * the block does not keep it while waiting for us.
++       * Our caller unlocks the whole destination range, so lock the block
++       * unlocked above again, or its unlock could drop a lock that writeback
++       * or a read took meanwhile. With the path released we hold no
++       * transaction or tree lock, and nobody holding this block waits for the
++       * rest of our range (it is clean, and btrfs_lock_extent() drops a
++       * partial range before it waits), so this cannot deadlock.
 +       */
 +      if (unlocked_end) {
 +              btrfs_release_path(path);
@@ -192,32 +179,19 @@ index c487ab4a63322..b7b7437482ead 100644
        clear_bit(BTRFS_INODE_NO_DELALLOC_FLUSH, &inode->runtime_flags);
  
        return ret;
-@@ -669,8 +717,47 @@ static int btrfs_extent_same_range(struct btrfs_inode *src, u64 loff, u64 len,
+@@ -650,8 +687,34 @@ static int btrfs_extent_same_range(struct btrfs_inode *src, u64 loff, u64 len,
         * we are safe from concurrency with relocation of source extents
         * because we have already locked the inode's i_mmap_lock in exclusive
         * mode.
 +       *
-+       * The locked range must also have no delalloc: the clone below starts
-+       * transactions and reserves space while holding the lock, and under
-+       * the flushoncommit mount option a transaction commit (including one
-+       * issued to satisfy a metadata reservation ticket) flushes dirty
-+       * inodes through the generic writeback path, whose flusher blocks on
-+       * our extent lock while we may be blocked waiting on that very commit
-+       * or ticket - a deadlock.  The ranges were flushed before locking,
-+       * but compressed writeback is asynchronous and may leave delalloc
-+       * behind by the time we lock; both inodes' i_rwsem are held, so once
-+       * the range is clean and locked nothing can dirty it again (the only
-+       * exception, copying an inline extent's data into a folio, unlocks
-+       * the dirtied block before the clone continues - see btrfs_clone()).
-+       *
-+       * Each wait below writes back and waits for whatever delalloc is left
-+       * in the range.  Nothing can create more meanwhile: both inodes'
-+       * i_rwsem and i_mmap_lock are held exclusively, so neither write(2) nor
-+       * a page fault can dirty the range.  Delalloc that survives two waits
-+       * is therefore a leaked EXTENT_DELALLOC bit (e.g. left behind by a
-+       * failed error path) that no amount of retrying clears, and cloning
-+       * over it would reopen the deadlock above.  Report it and fail with
-+       * -EUCLEAN; -EAGAIN would invite userspace to retry forever.
++       * The locked range must also have no delalloc: the clone reserves space
++       * and starts transactions under the lock, and with flushoncommit a
++       * commit (including one serving a reservation ticket) writes back dirty
++       * inodes and would block on our lock. Compressed writeback is
++       * asynchronous and can leave delalloc after the pre-lock flush, so wait
++       * and retry. Both inodes' i_rwsem and i_mmap_lock are held, so delalloc
++       * that survives two waits is a leaked EXTENT_DELALLOC bit: fail with
++       * -EUCLEAN, since -EAGAIN would have userspace retry forever.
         */
 -      btrfs_lock_extent(&dst->io_tree, dst_loff, end, &cached_state);
 +      for (int i = 0; ; i++) {
@@ -241,17 +215,14 @@ index c487ab4a63322..b7b7437482ead 100644
        ret = btrfs_clone(src, dst, loff, len, ALIGN(len, bs), dst_loff, true);
        btrfs_unlock_extent(&dst->io_tree, dst_loff, end, &cached_state);
  
-@@ -770,8 +857,32 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
+@@ -750,9 +813,29 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
+        * we are safe from concurrency with relocation of source extents
         * because we have already locked the inode's i_mmap_lock in exclusive
         * mode.
++       *
++       * The locked range must also have no delalloc, see
++       * btrfs_extent_same_range().
         */
-+      /*
-+       * The locked range must also have no delalloc before the clone starts
-+       * transactions or reserves space under the lock - see the comment in
-+       * btrfs_extent_same_range() for the flushoncommit deadlock this
-+       * prevents, and for why delalloc left after the waits is reported as
-+       * -EUCLEAN.
-+       */
        end = round_up(destoff + len, bs) - 1;
 -      btrfs_lock_extent(&inode->io_tree, destoff, end, &cached_state);
 +      for (int i = 0; ; i++) {
index b89a71cea867ba3a44defd6b84dc1272a70b3736..00c15e9dead68545e074f2386ac94bf40ef397d3 100644 (file)
@@ -1,4 +1,4 @@
-From 0b2a2621fdc37ab3063892db73bfa0cff0f0e29c Mon Sep 17 00:00:00 2001
+From a4a830eb6b96cfcf9bc52dc145cf41f4dc927b7a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 16 Aug 2026 16:26:54 -0400
 Subject: [PATCH 3/3] btrfs: relocation: reserve all of a folio's slices before
@@ -106,24 +106,22 @@ ticket and no writeback task ever blocked on a folio: the reservation
 still tickets and still flushes, it just no longer traps the flusher.
 
 Fixes: c2832898126f ("btrfs: make relocate_one_page() handle subpage case")
-Assisted-by: Claude:claude-fable-5
 ---
- fs/btrfs/relocation.c | 81 +++++++++++++++++++++++++++++++++++++------
- 1 file changed, 70 insertions(+), 11 deletions(-)
+ fs/btrfs/relocation.c | 74 ++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 63 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
-index b2ac5b836b217..8d034cca6313f 100644
+index b2ac5b836b217..be997d32b97d9 100644
 --- a/fs/btrfs/relocation.c
 +++ b/fs/btrfs/relocation.c
-@@ -2899,6 +2899,30 @@ static u64 get_cluster_boundary_end(const struct file_extent_cluster *cluster,
+@@ -2899,6 +2899,29 @@ static u64 get_cluster_boundary_end(const struct file_extent_cluster *cluster,
        return cluster->boundary[cluster_nr + 1] - 1;
  }
  
 +/*
-+ * Release the per-slice delalloc metadata reservations taken up front by
-+ * relocate_one_folio() for the cluster extent slices covering [cur, end].
-+ * @nr is the cluster extent index of the slice containing @cur.  Walks the
-+ * same slice geometry as the reservation pass so the releases pair exactly.
++ * Release the reservations relocate_one_folio() took for the cluster extent
++ * slices covering [cur, end]. @nr is the cluster extent index of the slice
++ * containing @cur.
 + */
 +static void release_cluster_slice_reservations(struct btrfs_inode *inode,
 +                                             const struct file_extent_cluster *cluster,
@@ -146,7 +144,7 @@ index b2ac5b836b217..8d034cca6313f 100644
  static int relocate_one_folio(struct reloc_control *rc,
                              struct file_ra_state *ra,
                              int *cluster_nr, u64 *file_offset_ret)
-@@ -2915,6 +2939,7 @@ static int relocate_one_folio(struct reloc_control *rc,
+@@ -2915,6 +2938,7 @@ static int relocate_one_folio(struct reloc_control *rc,
        u64 folio_start;
        u64 folio_end;
        u64 cur;
@@ -154,23 +152,17 @@ index b2ac5b836b217..8d034cca6313f 100644
        int ret;
        const bool use_rst = btrfs_need_stripe_tree_update(fs_info, rc->block_group->flags);
  
-@@ -2977,6 +3002,47 @@ static int relocate_one_folio(struct reloc_control *rc,
+@@ -2977,6 +3001,41 @@ static int relocate_one_folio(struct reloc_control *rc,
         * inside the folio.
         */
        cur = max(folio_start, cluster->boundary[*cluster_nr] - offset);
 +
 +      /*
-+       * Reserve the delalloc metadata for every cluster extent slice in
-+       * this folio up front, while the folio is still clean.  Once a slice
-+       * has been dirtied, a flushing reservation for the next one can
-+       * sleep on a ticket that is only satisfiable by writing this inode
-+       * back (FLUSH_DELALLOC, or a transaction commit, which with
-+       * flushoncommit waits for the same writeback) -- and writeback
-+       * blocks in __folio_lock() on the folio we hold.  A clean locked
-+       * folio, by contrast, is invisible to writeback, so flushing is
-+       * still safe here.  With one extent slice per folio (4K pages) this
-+       * degenerates to the old single reservation; multiple slices happen
-+       * with large folios or sub-page sector sizes.
++       * Reserve metadata for every extent slice of this folio while the folio
++       * is still clean. Once a slice is dirty, a flushing reservation for the
++       * next one can wait for writeback of this inode (FLUSH_DELALLOC, or a
++       * commit under flushoncommit), which blocks on the folio lock we hold.
++       * Writeback ignores a clean folio, so flushing is safe here.
 +       */
 +      {
 +              int nr = *cluster_nr;
@@ -202,7 +194,7 @@ index b2ac5b836b217..8d034cca6313f 100644
        while (cur <= folio_end) {
                struct extent_state *cached_state = NULL;
                u64 extent_start = cluster->boundary[*cluster_nr] - offset;
-@@ -2986,13 +3052,6 @@ static int relocate_one_folio(struct reloc_control *rc,
+@@ -2986,13 +3045,6 @@ static int relocate_one_folio(struct reloc_control *rc,
                u64 clamped_end = min(folio_end, extent_end);
                u32 clamped_len = clamped_end + 1 - clamped_start;
  
@@ -216,7 +208,7 @@ index b2ac5b836b217..8d034cca6313f 100644
                /* Mark the range delalloc and dirty for later writeback */
                btrfs_lock_extent(&BTRFS_I(inode)->io_tree, clamped_start,
                                  clamped_end, &cached_state);
-@@ -3003,10 +3062,10 @@ static int relocate_one_folio(struct reloc_control *rc,
+@@ -3003,10 +3055,10 @@ static int relocate_one_folio(struct reloc_control *rc,
                                               clamped_start, clamped_end,
                                               EXTENT_LOCKED | EXTENT_BOUNDARY,
                                               &cached_state);
index 79ee8e50f4b06f1c8c87b5edad977aa65e376eed..d1674c394a34a844f474f71b153c731e3e31c1f8 100644 (file)
@@ -1,6 +1,6 @@
-From 53bbc18925a7d71dec81c68ff49a0c61b7f1c700 Mon Sep 17 00:00:00 2001
+From 1bfce31eb38de064ba209595df90676627d9d621 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:00 -0400
+Date: Fri, 6 Nov 2026 05:48:14 -0500
 Subject: [PATCH 0/1] btrfs: one dedupe request, one extent reference
 To: linux-btrfs@vger.kernel.org
 
@@ -33,7 +33,6 @@ Zygo Blaxell (1):
  1 file changed, 2 insertions(+), 19 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index c824cb6e88a4016b9fdfca6f700704f7fd4fd095..3b7400a01db17d8d21400e4dd72aec0d7fc89a61 100644 (file)
@@ -1,4 +1,4 @@
-From 53bbc18925a7d71dec81c68ff49a0c61b7f1c700 Mon Sep 17 00:00:00 2001
+From 1bfce31eb38de064ba209595df90676627d9d621 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Mon, 11 Nov 2024 20:32:54 -0500
 Subject: [PATCH 1/1] btrfs: get rid of maximum dedupe length
index 8ee7a903fa41b3f4d37776904987c3bf14ee3eac..ea669e194dfec64e4602e05f9026907530d19ce1 100644 (file)
@@ -1,6 +1,6 @@
-From b94af22598cb3e54b002e912db55bd91d27a7bd2 Mon Sep 17 00:00:00 2001
+From 5093b6bc045bef47c57792653482019b952e2cce Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:05 -0400
+Date: Fri, 6 Nov 2026 05:48:16 -0500
 Subject: [PATCH 0/1] btrfs: keep mtime and ctime when a dedupe ends in a hole
 To: linux-btrfs@vger.kernel.org
 
@@ -40,7 +40,6 @@ Ivan Kozik (1):
  5 files changed, 13 insertions(+), 13 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index b59b41014714e21574b0380b7a325cf7197a3b27..f0f59456fa0b7c1c74b2b0942b165470b3092d0a 100644 (file)
@@ -1,4 +1,4 @@
-From b94af22598cb3e54b002e912db55bd91d27a7bd2 Mon Sep 17 00:00:00 2001
+From 5093b6bc045bef47c57792653482019b952e2cce Mon Sep 17 00:00:00 2001
 From: Ivan Kozik <ivan@ludios.org>
 Date: Wed, 30 Sep 2026 06:27:48 +0000
 Subject: [PATCH 1/1] btrfs: don't update mtime and ctime when deduping a range
@@ -115,10 +115,10 @@ index d7df81388cbee..8fbbae07bc713 100644
                           struct btrfs_trans_handle **trans_out);
  int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b071ed59a583f..ee7543aef34e0 100644
+index abaa334714566..c8d068a3a858b 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -9135,7 +9135,6 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent(
+@@ -9132,7 +9132,6 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent(
        extent_info.file_offset = file_offset;
        extent_info.extent_buf = (char *)&stack_fi;
        extent_info.is_new_extent = true;
@@ -126,7 +126,7 @@ index b071ed59a583f..ee7543aef34e0 100644
        extent_info.qgroup_reserved = qgroup_released;
        extent_info.insertions = 0;
  
-@@ -9146,7 +9145,7 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent(
+@@ -9143,7 +9142,7 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent(
        }
  
        ret = btrfs_replace_file_extents(inode, path, file_offset,
index 28a6276ef536ec4d12596c9d75febee79fb1ae3b..c525c77f96b9b742deef2f88dbbe599a6a972692 100644 (file)
@@ -1,6 +1,6 @@
-From 1a0d757caa9243c08178c666fde88445e2c0d102 Mon Sep 17 00:00:00 2001
+From 928af994881cc3904fc6572ec9be509e84d6acab Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:00 -0400
+Date: Fri, 6 Nov 2026 05:48:14 -0500
 Subject: [PATCH 0/1] btrfs: drain pending NOCOW writes before a block group goes read-only
 To: linux-btrfs@vger.kernel.org
 
@@ -43,7 +43,6 @@ Zygo Blaxell (1):
  5 files changed, 102 insertions(+), 5 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index a728aea10b77db29af89818b52bf6cd16a5aa932..ad44e9a6fe70b067aa60770757c92a77a30c7dea 100644 (file)
@@ -1,4 +1,4 @@
-From 1a0d757caa9243c08178c666fde88445e2c0d102 Mon Sep 17 00:00:00 2001
+From 928af994881cc3904fc6572ec9be509e84d6acab Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 12 Sep 2026 02:16:28 -0400
 Subject: [PATCH 1/1] btrfs: drain pending NOCOW writes before making a block
@@ -31,7 +31,6 @@ while the group is still writable, before the transaction is joined and
 the group flipped.  The block is lifted if the transition fails and when
 the group returns to read-write.
 
-Assisted-by: Claude:claude-opus-4-8
 ---
  fs/btrfs/block-group.c | 58 ++++++++++++++++++++++++++++++++++++++++++
  fs/btrfs/block-group.h |  9 +++++++
@@ -219,7 +218,7 @@ index 2dd167c32d612..652cad91edfee 100644
  
        /* This protects tree_mod_log and tree_mod_seq_list */
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b071ed59a583f..aaf8b04623bd1 100644
+index abaa334714566..39e186cc4c8c0 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -7370,10 +7370,20 @@ static bool btrfs_extent_readonly(struct btrfs_fs_info *fs_info, u64 bytenr)
index 009bab2f63497a24e75181daad77143f98bb0ef6..323605d3430a38e909e2ab82982f6d2350cb3253 100644 (file)
@@ -1,7 +1,7 @@
-From 7573a1e62c50390c9cbbdd8e2b30426a8f73cfc9 Mon Sep 17 00:00:00 2001
+From ba3c140a9b37784b18760540abbdf9e6d7a392b0 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:00 -0400
-Subject: [PATCH 0/1] btrfs: allow setting the system chunk size through sysfs
+Date: Fri, 6 Nov 2026 05:48:14 -0500
+Subject: [PATCH 0/2] btrfs: allow setting the system chunk size through sysfs
 To: linux-btrfs@vger.kernel.org
 
 Data and metadata chunk sizes can be set through
@@ -39,14 +39,15 @@ starts at N GiB + 1 MiB from the second or third round on (3 of 3 runs,
 with patch 2); with the system chunks left at 32 MiB the layout
 never gets there and the 32 MiB dev_extents multiply.
 
-Zygo Blaxell (1):
+Zygo Blaxell (2):
   btrfs: allow changing system dev_extent size via sysfs
+  btrfs: prefer aligned dev_extent holes when allocating chunks
 
- fs/btrfs/sysfs.c | 22 +++++++++++++---------
- 1 file changed, 13 insertions(+), 9 deletions(-)
+ fs/btrfs/sysfs.c   | 22 +++++++++++++---------
+ fs/btrfs/volumes.c | 39 +++++++++++++++++++++++++++++----------
+ 2 files changed, 42 insertions(+), 19 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 10629a026e856be1b7f7af3f720de65bb93128fd..d50a517fd97c20d625c75b3dba0216643888e74b 100644 (file)
@@ -1,7 +1,7 @@
-From 7573a1e62c50390c9cbbdd8e2b30426a8f73cfc9 Mon Sep 17 00:00:00 2001
+From b42812e5e0a7f6a814164b882ed6f753ac71fc93 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 30 Sep 2023 02:47:08 -0400
-Subject: [PATCH 1/1] btrfs: allow changing system dev_extent size via sysfs
+Subject: [PATCH 1/2] btrfs: allow changing system dev_extent size via sysfs
 To: linux-btrfs@vger.kernel.org
 
 When a filesystem using striped profiles such as raid0, raid10, raid5,
diff --git a/topics/dev-extent-defrag/0002-btrfs-prefer-aligned-dev_extent-holes-when-allocatin.patch b/topics/dev-extent-defrag/0002-btrfs-prefer-aligned-dev_extent-holes-when-allocatin.patch
new file mode 100644 (file)
index 0000000..3646fef
--- /dev/null
@@ -0,0 +1,104 @@
+From ba3c140a9b37784b18760540abbdf9e6d7a392b0 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Wed, 14 Feb 2024 00:10:23 -0500
+Subject: [PATCH 2/2] btrfs: prefer aligned dev_extent holes when allocating
+ chunks
+To: linux-btrfs@vger.kernel.org
+
+With the previous patch, the data, metadata and system chunk sizes can
+all be set to 1 GiB, so that every dev_extent is 1 GiB long.  The holes
+between them are only 1 GiB long as well if the dev_extents also start
+on a common grid.  Every device reserves its first 1 MiB, so that grid
+is N GiB + 1 MiB.  A dev_extent placed off the grid splits the holes on
+either side into pieces shorter than 1 GiB, and the fragmentation
+described in the previous patch can start from there.
+
+find_free_dev_extent() takes the first hole that is large enough,
+wherever it starts.  Make it prefer a hole on the grid: walk the holes in
+device order as before, and take the first one that is large enough and
+starts at N GiB + 1 MiB.  If there is none, take the first hole that is
+large enough, which is what the function returned before.  If no hole is
+large enough, the largest hole is still returned, with -ENOSPC.  The
+hole after the last dev_extent is checked the same way.
+
+Unless a hole on the grid is found, the search now visits every
+dev_extent of the device instead of stopping at the first hole that is
+large enough.
+
+On a device where every dev_extent is 1 GiB long and on the grid, every
+hole starts on the grid too, and the result is the same as before.  On a
+device that has off-grid dev_extents, new chunks fill the aligned holes
+first, so balancing the off-grid ones moves them onto the grid.
+
+---
+ fs/btrfs/volumes.c | 39 +++++++++++++++++++++++++++++----------
+ 1 file changed, 29 insertions(+), 10 deletions(-)
+
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
+index 3d4ef6725de0e..8ac535d438713 100644
+--- a/fs/btrfs/volumes.c
++++ b/fs/btrfs/volumes.c
+@@ -1907,21 +1907,25 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
+                       dev_extent_hole_check(device, &search_start, &hole_size,
+                                             num_bytes);
+ 
+-                      if (hole_size > max_hole_size) {
++                      /*
++                       * Once we find a hole of sufficient size we
++                       * ignore any larger holes that may appear at
++                       * higher device offsets.  If we later find a
++                       * hole that is sufficiently large, but aligned,
++                       * we'll use that instead.
++                       */
++                      if (hole_size > max_hole_size && max_hole_size < num_bytes) {
+                               max_hole_start = search_start;
+                               max_hole_size = hole_size;
+                       }
+ 
+                       /*
+-                       * If this free space is greater than which we need,
+-                       * it must be the max free space that we have found
+-                       * until now, so max_hole_start must point to the start
+-                       * of this free space and the length of this free space
+-                       * is stored in max_hole_size. Thus, we return
+-                       * max_hole_start and max_hole_size and go back to the
+-                       * caller.
++                       * If we find a hole that is aligned and as large
++                       * as we need, then exit early with that hole.
+                        */
+-                      if (hole_size >= num_bytes) {
++                      if (hole_size >= num_bytes && (search_start & (SZ_1G - 1)) == SZ_1M) {
++                              max_hole_start = search_start;
++                              max_hole_size = hole_size;
+                               ret = 0;
+                               goto out;
+                       }
+@@ -1946,9 +1950,24 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
+               hole_size = search_end - search_start;
+               dev_extent_hole_check(device, &search_start, &hole_size, num_bytes);
+ 
+-              if (hole_size > max_hole_size) {
++              /*
++               * If this is a larger hole it might not be aligned.
++               * Keep the hole we found above if it was large enough.
++               */
++              if (hole_size > max_hole_size && max_hole_size < num_bytes) {
++                      max_hole_start = search_start;
++                      max_hole_size = hole_size;
++              }
++
++              /*
++               * The last hole may be aligned and longer than any other,
++               * so do the aligned check and exit early again.
++               */
++              if (hole_size >= num_bytes && (search_start & (SZ_1G - 1)) == SZ_1M) {
+                       max_hole_start = search_start;
+                       max_hole_size = hole_size;
++                      ret = 0;
++                      goto out;
+               }
+       }
+ 
+-- 
+2.47.3
+
index 42a387f34add8f3565765f71ff72f2681224188e..7b2a84fe92d65e792e7656b6a365b9b397103fc9 100644 (file)
@@ -1,6 +1,6 @@
-From ed41a6944651a6be3b301d67d2e7c479a69a98b1 Mon Sep 17 00:00:00 2001
+From 8b54332c3af675c544b8744e56c02a236319f7a9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:06 -0400
+Date: Fri, 6 Nov 2026 05:48:17 -0500
 Subject: [PATCH 0/1] btrfs: persist device stats counted without a transaction
 To: linux-btrfs@vger.kernel.org
 
@@ -40,7 +40,6 @@ Zygo Blaxell (1):
  6 files changed, 82 insertions(+), 13 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index d144c915d9faac384912278264ce7d82fd4ab7e1..4d3a04cdc18be8b41f4efcf701c54afbcaf27c4b 100644 (file)
@@ -1,4 +1,4 @@
-From ed41a6944651a6be3b301d67d2e7c479a69a98b1 Mon Sep 17 00:00:00 2001
+From 8b54332c3af675c544b8744e56c02a236319f7a9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 22:15:41 -0400
 Subject: [PATCH 1/1] btrfs: write dirty device stats when no transaction is
@@ -56,7 +56,6 @@ may reasonably reject this patch.
 Read-only mounts are unchanged and still lose their counts at unmount,
 as do a crash and a shutdown or aborted filesystem.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/disk-io.c     | 14 +++++++++++++-
  fs/btrfs/super.c       |  9 +++++++++
@@ -67,7 +66,7 @@ Assisted-by: Claude:claude-opus-5-5
  6 files changed, 82 insertions(+), 13 deletions(-)
 
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index c628c5081d923..0955228f81201 100644
+index 6afcd6ca2a8a8..210172773d584 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -1559,6 +1559,12 @@ static int transaction_kthread(void *arg)
@@ -126,7 +125,7 @@ index b424cc836bd4a..587eee55d10fd 100644
         * We've set the superblock to RO mode, so we might have made the
         * cleaner task sleep without running all pending delayed iputs. Go
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index d265fac023e58..0f5c5a9e1e36c 100644
+index cd7dff5ba59b6..b4b6f41d4462d 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
 @@ -2079,6 +2079,41 @@ int btrfs_commit_current_transaction(struct btrfs_root *root)
@@ -184,10 +183,10 @@ index 684b46e5f2e9a..05f2a3728065f 100644
  bool btrfs_should_end_transaction(struct btrfs_trans_handle *trans);
  void btrfs_throttle(struct btrfs_fs_info *fs_info);
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index ce78a9441c64f..e69f444a46622 100644
+index 3d4ef6725de0e..21211e1ea4a39 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -8528,6 +8528,28 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
+@@ -8540,6 +8540,28 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
        return ret;
  }
  
@@ -216,7 +215,7 @@ index ce78a9441c64f..e69f444a46622 100644
  /*
   * called from commit_transaction. Writes all changed device stats to disk.
   */
-@@ -8538,7 +8560,6 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
+@@ -8550,7 +8572,6 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
        struct btrfs_device *device;
        int stats_cnt;
        int ret = 0;
@@ -224,7 +223,7 @@ index ce78a9441c64f..e69f444a46622 100644
  
        /*
         * Do an initial pass using RCU to see if we need to update any dev
-@@ -8556,17 +8577,7 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
+@@ -8568,17 +8589,7 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
         * transaction commit, no one can be concurrently adding or removing a
         * device.
         */
@@ -244,10 +243,10 @@ index ce78a9441c64f..e69f444a46622 100644
  
        mutex_lock(&fs_devices->device_list_mutex);
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 75b1179776c80..969826cc4fe1b 100644
+index 891bc2432870a..bc8a2c26b2e5d 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -795,6 +795,7 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
+@@ -794,6 +794,7 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
  int btrfs_init_devices_late(struct btrfs_fs_info *fs_info);
  int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info);
  int btrfs_init_writeback_bio_size(struct btrfs_fs_info *fs_info);
index 2e9047aa02240c538df48cfe3e8f1dab8f15c49e..1126a6cee3bde3582906077787529474a869a6a6 100644 (file)
@@ -1,6 +1,6 @@
-From e0cc444349ea61d819ae8e23a77546608d8340d1 Mon Sep 17 00:00:00 2001
+From 46393acd1f98b9b78a4ca490c822bd4922b38216 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:03:59 -0400
+Date: Fri, 6 Nov 2026 05:48:14 -0500
 Subject: [PATCH 0/3] btrfs: reducing LOGICAL_INO costs
 To: linux-btrfs@vger.kernel.org
 
@@ -69,7 +69,6 @@ Zygo Blaxell (2):
  4 files changed, 127 insertions(+), 21 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 5953b11593f8aa837a6861cb2e23f684ef8b8c90..25be63b066831e74c04d24931c3a8876f1362ed7 100644 (file)
@@ -1,4 +1,4 @@
-From 843be22c1b284a27d19ef3a1a4a0b87cccb86c65 Mon Sep 17 00:00:00 2001
+From f845118d35c2103f22ba3c00a668ffb87eb62235 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 17 Jul 2026 23:13:26 -0400
 Subject: [PATCH 1/3] btrfs: backref: detect tree mod log rewind cycles in
@@ -108,8 +108,6 @@ which attaches a fresh tree mod log sequence number with a consistent
 baseline.
 
 Link: https://lore.kernel.org/linux-btrfs/Y28XvZmK0bAS4Ht/@hungrycats.org/
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 ---
  fs/btrfs/backref.c | 32 ++++++++++++++++++++++++++++++
@@ -249,10 +247,10 @@ index 817171028413c..02fb813ffb98f 100644
                                        goto out_unlock;
                                else if (ret > 0)
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b071ed59a583f..2886e24a20514 100644
+index abaa334714566..2944c66336d82 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -10434,7 +10434,20 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
+@@ -10431,7 +10431,20 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
  
                ret = btrfs_is_data_extent_shared(BTRFS_I(inode), disk_bytenr,
                                                  extent_gen, backref_ctx);
index 270fc3082f1849595e2c9289b0890b9b52035199..fe67b89771191a841a4d25b8790c3391d2f05771 100644 (file)
@@ -1,4 +1,4 @@
-From 2054b07c5457979a47e886f6bfdd4bb9edfe4c35 Mon Sep 17 00:00:00 2001
+From 89c214f0311d9c08bbacdd1f4a7cc04bdb3b0481 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 12:36:42 -0400
 Subject: [PATCH 2/3] btrfs: resume the delayed-ref merge walk instead of
@@ -89,7 +89,6 @@ call.
 The restart has had this shape since commit 0e0adbcfdc90 ("btrfs: track
 refs in a rb_tree instead of a list") in v4.15.
 
-Assisted-by: Claude:claude-opus-5
 ---
  fs/btrfs/delayed-ref.c | 49 ++++++++++++++++++++++++++++++++++++------
  1 file changed, 42 insertions(+), 7 deletions(-)
index b28f07ea7f6491135e20467afc18e7e492356abc..26740c00aaf416b30eaadbe48db60f763d3f8e89 100644 (file)
@@ -1,4 +1,4 @@
-From e0cc444349ea61d819ae8e23a77546608d8340d1 Mon Sep 17 00:00:00 2001
+From 46393acd1f98b9b78a4ca490c822bd4922b38216 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Mon, 23 Jun 2025 13:56:36 +0200
 Subject: [PATCH 3/3] btrfs: avoid RCU stall during backref list construction
index 80e1a8e1827ebe72b2f0918c2f88550e0f39b6bc..177f0d5e5a4b95afb90bc1aae2c59d8ddd7f019a 100644 (file)
@@ -1,6 +1,6 @@
-From 206f44fec60d023c07b8ebb664fa68bfbeb45902 Mon Sep 17 00:00:00 2001
+From 426b7892a9eb425bb1372bdae4a2aa7fb9f15bd0 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:05 -0400
+Date: Fri, 6 Nov 2026 05:48:16 -0500
 Subject: [PATCH 0/3] btrfs: keep room to relocate on a full filesystem
 To: linux-btrfs@vger.kernel.org
 
@@ -160,7 +160,6 @@ Zygo Blaxell (3):
  13 files changed, 700 insertions(+), 10 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 prerequisite-patch-id: d27f13acdb7e1fb211a9524027f3f1c8c119f80b
 prerequisite-patch-id: 3ba444b908adb7eb7dd36a0bac6a3816516935c4
 prerequisite-patch-id: 9eebec1e5af9c3767f7de46e5a2406a7d140b135
@@ -249,6 +248,7 @@ prerequisite-patch-id: e8adf3fd375f57f415cb06749ceafa012578e527
 prerequisite-patch-id: f1ddaf798fd2a1e0edafa0d5e0d1f6e69833909f
 prerequisite-patch-id: 4887cec5ae407264b668f6b0516b62ca97d1da5b
 prerequisite-patch-id: 2583346498570387d00120057670c87fd71412a1
+prerequisite-patch-id: 81f1548d694232cc14036224b720b31f9bed3e40
 -- 
 2.47.3
 
index c7820bea65c0501f256f4ff369bdb2a677e4bc1b..016a10d230d074b5e0a80970e4c4516a1c69d633 100644 (file)
@@ -1,4 +1,4 @@
-From 94fe7c66de3f69133168923088dc46b4596d7d8d Mon Sep 17 00:00:00 2001
+From b0d57426978bef334b03ae6079cb3c860ea2b992 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 27 Sep 2026 15:02:40 -0400
 Subject: [PATCH 1/3] btrfs: print the error when reclaim fails to relocate a
@@ -15,7 +15,6 @@ path.
 
 Print the error code.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
index e6c13266cc3e6697fd7a9b839e83d974a568017e..dd2259476de520cc4fc17cec8bed044b6e5eb80f 100644 (file)
@@ -1,4 +1,4 @@
-From b9b09749cf786650d281e2a005bed5c80b427e5a Mon Sep 17 00:00:00 2001
+From 4ebff52cc7993f8bf6b6365486ddd76437d411ac Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Mon, 28 Sep 2026 18:14:56 -0400
 Subject: [PATCH 2/3] btrfs: hold block groups free for relocation
@@ -134,7 +134,6 @@ of space per space_info -- up to 10% of the writable space on small
 filesystems, where the chunk allocator caps a chunk at that -- and a
 filesystem needs room for the reserve beside its working block groups.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 436 +++++++++++++++++++++++++++++++++++-
  fs/btrfs/block-group.h      |  26 +++
@@ -720,7 +719,7 @@ index 605e040421e45..b28f36ebcc5cd 100644
  void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limit);
  void btrfs_reclaim_bgs_work(struct work_struct *work);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 27faf262898f7..ff4e7b38f9f1e 100644
+index a91fc9e510ba2..1aed34e4bf92e 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -1520,6 +1520,9 @@ static int cleaner_kthread(void *arg)
@@ -1189,10 +1188,10 @@ index 213001078a2ab..f77f709d2cbcd 100644
        BTRFS_ATTR_PTR(space_info, chunk_size),
        BTRFS_ATTR_PTR(space_info, size_classes),
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 9f689c4c9d7f8..6a68ecc752d25 100644
+index 6c2a9e391dae7..6286a43d458c5 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -3723,8 +3723,16 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
+@@ -3735,8 +3735,16 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
                                   bg->start);
        }
  
@@ -1209,7 +1208,7 @@ index 9f689c4c9d7f8..6a68ecc752d25 100644
                ret = PTR_ERR(trans);
                btrfs_handle_fs_error(root->fs_info, ret, NULL);
                return ret;
-@@ -3733,6 +3741,10 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
+@@ -3745,6 +3753,10 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
        /* Step two, delete the device extents and the chunk tree entries. */
        ret = btrfs_remove_chunk(trans, bg->start);
        btrfs_end_transaction(trans);
@@ -1220,7 +1219,7 @@ index 9f689c4c9d7f8..6a68ecc752d25 100644
  
        return ret;
  }
-@@ -4351,6 +4363,25 @@ static int should_balance_chunk(struct extent_buffer *leaf, struct btrfs_chunk *
+@@ -4363,6 +4375,25 @@ static int should_balance_chunk(struct extent_buffer *leaf, struct btrfs_chunk *
                return false;
        }
  
index dd84d84c5303d9e03d02de3e72bcdb65b29075b4..9c82c53b0eb231e9b86bf5b535aa8125de61120b 100644 (file)
@@ -1,4 +1,4 @@
-From 206f44fec60d023c07b8ebb664fa68bfbeb45902 Mon Sep 17 00:00:00 2001
+From 426b7892a9eb425bb1372bdae4a2aa7fb9f15bd0 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 21 Oct 2026 12:48:13 -0400
 Subject: [PATCH 3/3] btrfs: relocation: flush fully before failing a merge
@@ -130,7 +130,6 @@ base, 3 of 3 reclaim runs went read-only in merge_reloc_roots().  With
 the patch, 6 runs had no merge failure.
 
 Fixes: 44d354abf33e ("btrfs: relocation: review the call sites which can be interrupted by signal")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/relocation.c | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
index 0eaf395453e121791e529ae2ff390efb58610dce..7577d85b27055dd38a3992a935799bca5a3ae834 100644 (file)
@@ -1,6 +1,6 @@
-From 34bdaeed875088260f83d6c1ad6212c858199eb1 Mon Sep 17 00:00:00 2001
+From 67df719ccdefbcc38d0f9167a1e42b9318f0ef98 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:01 -0400
+Date: Fri, 6 Nov 2026 05:48:14 -0500
 Subject: [PATCH 0/1] btrfs: limit preallocated extents to 128 MiB
 To: linux-btrfs@vger.kernel.org
 
@@ -27,7 +27,6 @@ Zygo Blaxell (1):
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 770866a1f647717343b50adf7746ef6bd8dd91c3..bd44ae45e7f91a6df000d30fddc8f60cccddd8c3 100644 (file)
@@ -1,4 +1,4 @@
-From 34bdaeed875088260f83d6c1ad6212c858199eb1 Mon Sep 17 00:00:00 2001
+From 67df719ccdefbcc38d0f9167a1e42b9318f0ef98 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 21 Dec 2024 10:48:03 -0500
 Subject: [PATCH 1/1] btrfs: use BTRFS_MAX_EXTENT_SIZE in prealloc
@@ -23,10 +23,10 @@ Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b071ed59a583f..0202108393361 100644
+index abaa334714566..fed5bab60a000 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -9185,7 +9185,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9182,7 +9182,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
        u64 end = start + num_bytes - 1;
  
        while (num_bytes > 0) {
index 15e59e6f2739e71e1c85fe84162ea1838a3be959..f311875d1ef0d1afce92689e124df0554ad5b0ca 100644 (file)
@@ -1,6 +1,6 @@
-From a4b35a2e9704dbbb331f8931774d6d433c4bffeb Mon Sep 17 00:00:00 2001
+From 3b022e96c7a88a5ad5c389f756b75ff8d3dcafa5 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:01 -0400
+Date: Fri, 6 Nov 2026 05:48:14 -0500
 Subject: [PATCH 00/10] btrfs: raid56: rbio lifetime and cache fixes, error reporting
 To: linux-btrfs@vger.kernel.org
 
@@ -118,7 +118,6 @@ Zygo Blaxell (9):
  6 files changed, 601 insertions(+), 40 deletions(-)
 
 
-base-commit: 83cd81353093be02aa7e60874c413ec340e55bce
 -- 
 2.47.3
 
diff --git a/topics/raid56-fixes/0001-btrfs-fix-racy-bio_list-changes-for-failed-RMW-rbio.patch b/topics/raid56-fixes/0001-btrfs-fix-racy-bio_list-changes-for-failed-RMW-rbio.patch
deleted file mode 100644 (file)
index 23f0d4e..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-From 61de2dcc3af6651d7612d23fd7192fa2838c1278 Mon Sep 17 00:00:00 2001
-From: Qu Wenruo <wqu@suse.com>
-Date: Wed, 28 Oct 2026 17:00:46 +1030
-Subject: [PATCH 01/12] btrfs: fix racy bio_list changes for failed RMW rbio
-To: linux-btrfs@vger.kernel.org
-
-If an RMW work failed early, e.g. alloc_rbio_parity_pages() failed, it
-won't get RBIO_RMW_LOCKED_BIT set, and get rbio_orig_end_io() called.
-
-In that case, there can be a race between bio_list_get() on the rbio,
-and new incoming bio merging into the rbio:
-
- A is the rbio that rbio_orig_end_io() is running on.
- a is the higher layer bio that generated the rbio A.
-
- B is the new rbio that will be merged into A.
- b is the higher layer bio that generated the rbio B.
-
-   rbio_orig_end_io(A) worker         |       lock_stripe_add(B)
---------------------------------------+---------------------------------
-rbio_orig_end_io(A)                   | lock_stripe_add(B)
-|- cur = bio_list_get(A)              | |- rbio_can_merge(A, B)
-|  |- bio = A->bio_list.head;         | |  which returned true
-|  |  which bio a is returned.        | |
-|  |                                  | |
-|  |- A->bio_list.tail = NULL;        | |
-|  |                                  | |
-|  |                                  | |- merge_rbio(A, B)
-|  |                                  | |  |- bio_list_merge_init()
-|  |                                  | |     |- if (A->bio_list.tail)
-|  |                                  | |     |  A->bio_list.tail is
-|  |                                  | |     |  still NULL
-|  |                                  | |     |
-|  |                                  | |     |- A->bio_list.head = b
-|  |                                  | |     |- A->bio_list.tail = b
-|  |- A->bio_list.head = NULL;        | |- return 1;
-|  |- return bio;                     |    Caller expect rbio A to
-|     which is bio a.                 |    complete bio b.
-|
-|- extra = bio_list_get()
-|  Which is NULL
-|
-|- rbio_endio_bio_list(cur);
-   Which only ends bio a.
-
-In above case, the bio_list race can get bio b lost, and never ended.
-Thankfully this race window is very tiny, so not practical in the real
-world.
-
-Fix it by setting RBIO_RMW_LOCKED_BIT for error path before calling
-rbio_orig_end_io().
-And since we're ensuring all RMW rbios have RBIO_RMW_LOCKED_BIT bit set
-before calling rbio_orig_end_io(), add two ASSERT()s for that and remove
-the old comment.
-
-Fixes: 5eb30ee26fa4 ("btrfs: raid56: introduce the main entrance for RMW path")
-Assisted-by: LLM (find and analyze the bug)
-Reviewed-by: Filipe Manana <fdmanana@suse.com>
-Signed-off-by: Qu Wenruo <wqu@suse.com>
-Link: https://lore.kernel.org/r/5a11091a4fb79de6a37bcec6c70b178467641f28.1793168898.git.wqu@suse.com
----
- fs/btrfs/raid56.c | 32 ++++++++++++++++++++------------
- 1 file changed, 20 insertions(+), 12 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 7dd937fa0c262..b24ec362909bb 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -874,7 +874,10 @@ static void rbio_endio_bio_list(struct bio *cur, blk_status_t status)
- static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
- {
-       struct bio *cur = bio_list_get(&rbio->bio_list);
--      struct bio *extra;
-+
-+      /* An RMW rbio must have RBIO_RMW_LOCKED_BIT set. */
-+      if (rbio->operation == BTRFS_RBIO_WRITE)
-+              ASSERT(test_bit(RBIO_RMW_LOCKED_BIT, &rbio->flags));
- 
-       kfree(rbio->csum_buf);
-       bitmap_free(rbio->csum_bitmap);
-@@ -888,21 +891,11 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
-        */
-       bitmap_clear(&rbio->dbitmap, 0, rbio->stripe_nsectors);
- 
--      /*
--       * At this moment, rbio->bio_list is empty, however since rbio does not
--       * always have RBIO_RMW_LOCKED_BIT set and rbio is still linked on the
--       * hash list, rbio may be merged with others so that rbio->bio_list
--       * becomes non-empty.
--       * Once unlock_stripe() is done, rbio->bio_list will not be updated any
--       * more and we can call bio_endio() on all queued bios.
--       */
-       unlock_stripe(rbio);
--      extra = bio_list_get(&rbio->bio_list);
-+      ASSERT(bio_list_empty(&rbio->bio_list));
-       free_raid_bio(rbio);
- 
-       rbio_endio_bio_list(cur, status);
--      if (extra)
--              rbio_endio_bio_list(extra, status);
- }
- 
- /*
-@@ -2464,6 +2457,21 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
-               }
-       }
- out:
-+      /*
-+       * If we hit an error early, the rbio won't get
-+       * RBIO_RMW_LOCKED_BIT bit set, and can cause unexpected
-+       * merge during rbio_orig_end_io().
-+       *
-+       * So set that flag before calling rbio_orig_end_io(), and
-+       * we have to hold the bio_list_lock, to make sure
-+       * rbio_can_merge() and merge_rbio() are seeing a stable
-+       * flag.
-+       */
-+      if (ret < 0) {
-+              spin_lock(&rbio->bio_list_lock);
-+              set_bit(RBIO_RMW_LOCKED_BIT, &rbio->flags);
-+              spin_unlock(&rbio->bio_list_lock);
-+      }
-       rbio_orig_end_io(rbio, errno_to_blk_status(ret));
- }
- 
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0001-btrfs-log-a-message-when-dropping-an-extent-due-to-I.patch b/topics/raid56-fixes/0001-btrfs-log-a-message-when-dropping-an-extent-due-to-I.patch
new file mode 100644 (file)
index 0000000..0492c36
--- /dev/null
@@ -0,0 +1,99 @@
+From 85b1734748117b2908a2af848cf804a802447818 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Fri, 5 Jul 2024 23:08:46 -0400
+Subject: [PATCH 01/10] btrfs: log a message when dropping an extent due to IO
+ error
+To: linux-btrfs@vger.kernel.org
+
+When an IO error occurs while writing a datacow file, btrfs will drop the
+extent containing the unwritten blocks.  This prevents potential leaks
+of information stored in the unwritten data blocks back to userspace, but
+it is also a data loss event that is not easily visible from userspace.
+
+The existing code does notify userspace of the error via the inode,
+and the notification can be received through fsync (for the inode) or
+syncfs (for any dirty inode on the filesystem) return values; however,
+for the common case of a process that writes to a file and exits with
+its data still in dirty cache pages, there is no process left to notify
+when the ordered writes eventually fail.
+
+In most cases the extent drop is preceded by error messages from the
+write operation, but the IOERR bit can be set for less visible or obvious
+reasons, like running out of memory, bad metadata, or as a result of
+bugs that appear in other parts of btrfs from time to time.
+
+Some of the existing error messages for writes contain only logical
+addresses, while other messages contain only disk bytenrs.  For read
+errors, only one address is necessary, as the user can look up the other
+with `btrfs ins log -o` or `btrfs ins sub/ino`, but for write errors, the
+mapping between these addresses is removed when the error is detected in
+btrfs_finish_one_ordered, so we can't derive one address from the other.
+We need both addresses for separate purposes:  the logical address to
+identify which files have missing data, and the disk bytenr to identify
+which part of the filesystem address space is failing to accept writes
+(resolvable to device sectors through the chunk tree).
+
+For now, inform the sysadmin that the data has been dropped by logging a
+message when it happens, including both the logical subvol/inode/offset
+triple and the disk bytenr, and the corresponding sizes.
+
+In the future we might want to add some stats counters for this event,
+similar to the dev stats counters, but not tied to any specific device.
+The first step is to detect and report the events at all.
+
+Other notes:
+
+Because the extent is dropped, the lost data cannot be detected by a csum
+mismatch or read failure, i.e. everything will look OK if the file is read
+or the filesystem scrubbed, but an application will notice a truncated
+file or a file with data replaced by zeros.  For datasum files, we could
+simply keep the extent as-is, allow future reads or csum verification
+to fail, and report EIO errors that way.  That is a larger and riskier
+change to btrfs behavior than simply adding some passive monitoring of
+the status quo.  This approach also has problems with csum collisions,
+it doesn't work for nodatasum+datacow files, and it takes much longer
+for the errors to be detected and reported to a sysadmin.
+
+nodatacow files don't have their extents dropped; instead, they will
+simply have garbage in the blocks where the writes failed.  In most
+use cases for nodatacow files (e.g. VM disk images or databases), the
+user will be running all writes through fsync(), O_DIRECT, or similar
+mechanisms that can observe the existing EIO return value notification
+path, so there's less need for diagnostic coverage in the kernel log
+for nodatacow files.
+
+Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+---
+ fs/btrfs/inode.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
+index abaa334714566..85ce4f2433eb4 100644
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -3389,6 +3389,22 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
+                   clear_reserved_extent &&
+                   !test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) &&
+                   !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) {
++                      /*
++                       * Notify the user that some data has been lost due
++                       * to an error, unless we were already expected to
++                       * remove the data because of truncate.
++                       *
++                       * Put both logical and physical addresses here
++                       * because we're about to remove the mapping that
++                       * would have allowed the user to translate from
++                       * one to the other.
++                       */
++                      if (ret && !truncated)
++                              btrfs_err_rl(fs_info,
++"dropping unwritten extent at root %llu ino %llu offset [%llu,%llu] disk bytenr %llu length %llu",
++                                      btrfs_root_id(inode->root), btrfs_ino(inode),
++                                      start, end, ordered_extent->disk_bytenr,
++                                      ordered_extent->disk_num_bytes);
+                       /*
+                        * Discard the range before returning it back to the
+                        * free space pool
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0002-btrfs-don-t-cache-rbio-if-an-error-is-hit.patch b/topics/raid56-fixes/0002-btrfs-don-t-cache-rbio-if-an-error-is-hit.patch
deleted file mode 100644 (file)
index 693c17c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-From ecf7603159cd81ec718af1efaeb529db1729132b Mon Sep 17 00:00:00 2001
-From: Qu Wenruo <wqu@suse.com>
-Date: Wed, 28 Oct 2026 17:00:47 +1030
-Subject: [PATCH 02/12] btrfs: don't cache rbio if an error is hit
-To: linux-btrfs@vger.kernel.org
-
-If rmw_rbio() hit an error after cache_rbio_pages() call, the rbio still
-have RBIO_CACHE_READY_BIT set, thus can be utilized for future page
-stealing.
-
-But that rbio didn't really reach the disk, thus using the pages for
-future steal can cause data inconsistency between in-memory cache and
-on-disk data.
-
-Fix the problem by clearing the RBIO_CACHE_READY_BIT on the error path
-of rmw_rbio().
-
-Fixes: 5eb30ee26fa4 ("btrfs: raid56: introduce the main entrance for RMW path")
-Assisted-by: LLM (find the bug)
-Reviewed-by: Filipe Manana <fdmanana@suse.com>
-Signed-off-by: Qu Wenruo <wqu@suse.com>
-Link: https://lore.kernel.org/r/b0d3adf5f3cc527b2ffd89c7ed93c99a0cbbdc76.1793168898.git.wqu@suse.com
----
- fs/btrfs/raid56.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index b24ec362909bb..a8a8004bb14c7 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -2471,6 +2471,9 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
-               spin_lock(&rbio->bio_list_lock);
-               set_bit(RBIO_RMW_LOCKED_BIT, &rbio->flags);
-               spin_unlock(&rbio->bio_list_lock);
-+
-+              /* Failed write, don't cache for page stealing. */
-+              clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags);
-       }
-       rbio_orig_end_io(rbio, errno_to_blk_status(ret));
- }
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0002-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch b/topics/raid56-fixes/0002-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch
new file mode 100644 (file)
index 0000000..45db27a
--- /dev/null
@@ -0,0 +1,212 @@
+From b0642b6384ab856b087762f9e6bba6ce93d93be6 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Sat, 25 Jul 2026 16:06:34 -0400
+Subject: [PATCH 02/10] btrfs: raid56: fix use-after-free of rbio in bio end_io
+ wakeups
+To: linux-btrfs@vger.kernel.org
+
+The read/write submission rounds in raid56 count in-flight bios in
+rbio->stripes_pending and wait with a bare
+wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0),
+while each bio's end_io does
+"if (atomic_dec_and_test(&stripes_pending)) wake_up(&rbio->io_wait)".
+
+Once the final decrement makes the counter visible as zero, the waiter
+can pass its condition check without consuming the wakeup -- via
+wait_event()'s fast path when all bios complete before the waiter
+arrives, or a condition recheck after an earlier wakeup -- and proceed
+to free the rbio through rbio_orig_end_io().  The end_io context is
+then still inside wake_up() operating on the freed rbio's embedded
+waitqueue lock.
+
+This shows up under sustained raid56 load in KVM guests as recurring
+"pvqspinlock: lock ... has corrupted value 0x0!" warnings from
+__pv_queued_spin_unlock_slowpath with a
+__wake_up <- raid_wait_{read,write}_end_io <- bio_endio call trace:
+paravirt spinlocks detect the unlock of the recycled lock word.  KASAN
+reports it as a slab-use-after-free in __wake_up_common or
+do_raw_spin_unlock from the same end_io handlers.  On bare metal
+without KASAN the use-after-free is silent and almost always harmless,
+which is how it has survived; it is a plausible match for
+long-standing sporadic crash reports on busy raid5 filesystems.
+
+It reproduces in about 12 seconds in a KVM guest running a KASAN
+kernel, on a degraded raid5 data / raid1 metadata filesystem on four
+2 GiB devices with one missing:
+ - 8 parallel O_DIRECT readers of 4K, 16K or 64K at random offsets in
+   existing files, so every read of a block on the missing device is a
+   reconstruction round;
+ - 2 writers rewriting small files with 4K..32K O_DIRECT writes, so
+   writes are sub-stripe read-modify-write rounds;
+ - the page cache dropped every second.
+With this patch the same load runs for 10 minutes without a warning.
+
+Convert the pair to a completion.  wait_for_completion()'s fast path
+takes the completion's own lock, so it cannot return before complete()
+has released it: the completing context is provably finished with the
+rbio before the waiter can free it.  A submitter-held bias count keeps
+one completion per submission round even when a round submits zero
+bios or every bio finishes before the submitter starts waiting; the
+scrub path only waits when finish_parity_scrub() actually began a
+round.
+
+Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+---
+ fs/btrfs/raid56.c | 54 ++++++++++++++++++++++++++++++++++++++---------
+ fs/btrfs/raid56.h | 10 ++++++++-
+ 2 files changed, 53 insertions(+), 11 deletions(-)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index a8a8004bb14c7..4453a50866b43 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -1019,7 +1019,7 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
+       }
+ 
+       bio_list_init(&rbio->bio_list);
+-      init_waitqueue_head(&rbio->io_wait);
++      init_completion(&rbio->io_done);
+       INIT_LIST_HEAD(&rbio->plug_list);
+       spin_lock_init(&rbio->bio_list_lock);
+       INIT_LIST_HEAD(&rbio->stripe_cache);
+@@ -1606,6 +1606,40 @@ static void verify_bio_data_sectors(struct btrfs_raid_bio *rbio,
+       }
+ }
+ 
++/*
++ * Begin a submission round of @nr bios whose end_io functions report through
++ * rbio_dec_io().  stripes_pending gets one extra count on behalf of the
++ * submitter, dropped by rbio_wait_io(): this guarantees exactly one
++ * completion per round even when @nr is 0 or every bio finishes before the
++ * submitter starts waiting.
++ *
++ * The completion is what makes the round safe against a use-after-free the
++ * old bare waitqueue had: once the final bio's decrement made
++ * stripes_pending visible as zero, the waiter could pass its wait_event()
++ * condition check and free the rbio while the bio's end_io context was still
++ * inside wake_up() on the rbio's embedded waitqueue lock.  With a
++ * completion, the waiter cannot return before complete() has released the
++ * completion's lock, so the completing context is finished with the rbio.
++ */
++static void rbio_begin_io(struct btrfs_raid_bio *rbio, unsigned int nr)
++{
++      reinit_completion(&rbio->io_done);
++      atomic_set(&rbio->stripes_pending, nr + 1);
++}
++
++static void rbio_dec_io(struct btrfs_raid_bio *rbio)
++{
++      if (atomic_dec_and_test(&rbio->stripes_pending))
++              complete(&rbio->io_done);
++}
++
++static void rbio_wait_io(struct btrfs_raid_bio *rbio)
++{
++      /* Drop the submitter's count from rbio_begin_io(). */
++      rbio_dec_io(rbio);
++      wait_for_completion(&rbio->io_done);
++}
++
+ static void raid_wait_read_end_io(struct bio *bio)
+ {
+       struct btrfs_raid_bio *rbio = bio->bi_private;
+@@ -1618,8 +1652,7 @@ static void raid_wait_read_end_io(struct bio *bio)
+       }
+ 
+       bio_put(bio);
+-      if (atomic_dec_and_test(&rbio->stripes_pending))
+-              wake_up(&rbio->io_wait);
++      rbio_dec_io(rbio);
+ }
+ 
+ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
+@@ -1627,7 +1660,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
+ {
+       struct bio *bio;
+ 
+-      atomic_set(&rbio->stripes_pending, bio_list_size(bio_list));
++      rbio_begin_io(rbio, bio_list_size(bio_list));
+       while ((bio = bio_list_pop(bio_list))) {
+               bio->bi_end_io = raid_wait_read_end_io;
+ 
+@@ -1640,7 +1673,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
+               submit_bio(bio);
+       }
+ 
+-      wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
++      rbio_wait_io(rbio);
+ }
+ 
+ static int alloc_rbio_data_pages(struct btrfs_raid_bio *rbio)
+@@ -2328,8 +2361,7 @@ static void raid_wait_write_end_io(struct bio *bio)
+       if (bio->bi_status)
+               rbio_update_error_bitmap(rbio, bio);
+       bio_put(bio);
+-      if (atomic_dec_and_test(&rbio->stripes_pending))
+-              wake_up(&rbio->io_wait);
++      rbio_dec_io(rbio);
+ }
+ 
+ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -2337,7 +2369,7 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+ {
+       struct bio *bio;
+ 
+-      atomic_set(&rbio->stripes_pending, bio_list_size(bio_list));
++      rbio_begin_io(rbio, bio_list_size(bio_list));
+       while ((bio = bio_list_pop(bio_list))) {
+               bio->bi_end_io = raid_wait_write_end_io;
+ 
+@@ -2444,7 +2476,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+       /* We should have at least one bio assembled. */
+       ASSERT(bio_list_size(&bio_list));
+       submit_write_bios(rbio, &bio_list);
+-      wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
++      rbio_wait_io(rbio);
+ 
+       /* We may have more errors than our tolerance during the read. */
+       for (sectornr = 0; sectornr < rbio->stripe_nsectors; sectornr++) {
+@@ -2915,7 +2947,9 @@ static void scrub_rbio(struct btrfs_raid_bio *rbio)
+        * and writeback the good content.
+        */
+       ret = finish_parity_scrub(rbio);
+-      wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
++      /* A submission round only began if finish_parity_scrub() succeeded. */
++      if (ret == 0)
++              rbio_wait_io(rbio);
+       for (sector_nr = 0; sector_nr < rbio->stripe_nsectors; sector_nr++) {
+               int found_errors;
+ 
+diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
+index 8700910b8dc99..b56f9b958d713 100644
+--- a/fs/btrfs/raid56.h
++++ b/fs/btrfs/raid56.h
+@@ -13,6 +13,7 @@
+ #include <linux/bio.h>
+ #include <linux/refcount.h>
+ #include <linux/workqueue.h>
++#include <linux/completion.h>
+ #include "volumes.h"
+ 
+ struct page;
+@@ -173,9 +174,16 @@ struct btrfs_raid_bio {
+ 
+       refcount_t refs;
+ 
++      /*
++       * In-flight bios of the current submission round, plus one bias
++       * count held by the submitter and dropped when it starts waiting.
++       * The final decrement completes io_done; a completion (unlike a
++       * bare waitqueue) guarantees the completing context is finished
++       * with the rbio before the waiter can return and free it.
++       */
+       atomic_t stripes_pending;
+ 
+-      wait_queue_head_t io_wait;
++      struct completion io_done;
+ 
+       /* Bitmap to record which horizontal stripe has data */
+       unsigned long dbitmap;
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0003-btrfs-don-t-drop-the-error-of-the-last-split-bio.patch b/topics/raid56-fixes/0003-btrfs-don-t-drop-the-error-of-the-last-split-bio.patch
new file mode 100644 (file)
index 0000000..02f6ddb
--- /dev/null
@@ -0,0 +1,81 @@
+From ad380c9ebe7095df530a61447fd8f81e4921f8bd Mon Sep 17 00:00:00 2001
+From: Josef Bacik <josef@toxicpanda.com>
+Date: Tue, 3 Nov 2026 15:05:16 +0000
+Subject: [PATCH 03/10] btrfs: don't drop the error of the last split bio
+To: linux-btrfs@vger.kernel.org
+
+When a btrfs_bio had to be split, btrfs_bio_end_io() saves the first error
+of any of its parts in the status field of the original btrfs_bio. The
+part that completes last is supposed to load it into bi_status of the
+original bio before calling the end_io handler, but that is only done if
+that last part was successful:
+
+       if (atomic_dec_and_test(&bbio->pending_ios)) {
+               /* Load split bio's error which might be set above. */
+               if (status == BLK_STS_OK)
+                       bbio->bio.bi_status = READ_ONCE(bbio->status);
+
+If the last part failed, the assumption is that bi_status was set at the
+top of the function. That is true if the last part is what is left of the
+original bio. If it is a split bio, the assignment was done to the split
+bio, which was freed right after. If the original bio has completed before
+without an error, its bi_status is BLK_STS_OK and stays like that:
+
+  original bio (tail)                 split bio (head)
+
+  btrfs_bio_end_io(orig, OK)
+    orig->bio.bi_status = OK
+    pending_ios 2 -> 1
+                                      btrfs_bio_end_io(split, IOERR)
+                                        split->bio.bi_status = IOERR
+                                        bio_put(split)
+                                        cmpxchg(&orig->status, OK, IOERR)
+                                        pending_ios 1 -> 0
+                                        orig->end_io(), bi_status is OK
+
+The end_io handler covers the whole range, so for a buffered read all the
+folios are marked uptodate, including the ones that were never filled, and
+read(2) returns their content instead of -EIO. For a write the ordered
+extent is completed as if all the data had reached the device.
+
+This can be reproduced with raid0 data on two devices, one of them slower
+than the other and with a bad block, by reading a file whose last stripe
+is on the fast device.
+
+The saved status has the first error of all the parts, or BLK_STS_OK if
+there was none, so always use it.
+
+Fixes: d48e1dea3931 ("btrfs: fix error propagation of split bios")
+CC: stable@vger.kernel.org # 6.12+
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: Filipe Manana <fdmanana@suse.com>
+Tested-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Signed-off-by: Josef Bacik <josef@toxicpanda.com>
+Link: https://lore.kernel.org/r/20261103-b4-btrfs-data-integrity-v2-1-577dc2690061@toxicpanda.com
+---
+ fs/btrfs/bio.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
+index 2c6234f6182f8..fc0b021cdefb1 100644
+--- a/fs/btrfs/bio.c
++++ b/fs/btrfs/bio.c
+@@ -127,9 +127,12 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status)
+               cmpxchg(&bbio->status, BLK_STS_OK, status);
+ 
+       if (atomic_dec_and_test(&bbio->pending_ios)) {
+-              /* Load split bio's error which might be set above. */
+-              if (status == BLK_STS_OK)
+-                      bbio->bio.bi_status = READ_ONCE(bbio->status);
++              /*
++               * Load the first error, if any. It may come from a split bio,
++               * including the one we were called for, in which case nothing
++               * stored it in the original bio yet.
++               */
++              bbio->bio.bi_status = READ_ONCE(bbio->status);
+ 
+               if (bbio_has_ordered_extent(bbio)) {
+                       struct btrfs_ordered_extent *ordered = bbio->ordered;
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0003-btrfs-log-a-message-when-dropping-an-extent-due-to-I.patch b/topics/raid56-fixes/0003-btrfs-log-a-message-when-dropping-an-extent-due-to-I.patch
deleted file mode 100644 (file)
index ade7cdb..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-From c4a57fb229aadbdacfca2bc6b2bef62557183dfc Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Fri, 5 Jul 2024 23:08:46 -0400
-Subject: [PATCH 03/12] btrfs: log a message when dropping an extent due to IO
- error
-To: linux-btrfs@vger.kernel.org
-
-When an IO error occurs while writing a datacow file, btrfs will drop the
-extent containing the unwritten blocks.  This prevents potential leaks
-of information stored in the unwritten data blocks back to userspace, but
-it is also a data loss event that is not easily visible from userspace.
-
-The existing code does notify userspace of the error via the inode,
-and the notification can be received through fsync (for the inode) or
-syncfs (for any dirty inode on the filesystem) return values; however,
-for the common case of a process that writes to a file and exits with
-its data still in dirty cache pages, there is no process left to notify
-when the ordered writes eventually fail.
-
-In most cases the extent drop is preceded by error messages from the
-write operation, but the IOERR bit can be set for less visible or obvious
-reasons, like running out of memory, bad metadata, or as a result of
-bugs that appear in other parts of btrfs from time to time.
-
-Some of the existing error messages for writes contain only logical
-addresses, while other messages contain only disk bytenrs.  For read
-errors, only one address is necessary, as the user can look up the other
-with `btrfs ins log -o` or `btrfs ins sub/ino`, but for write errors, the
-mapping between these addresses is removed when the error is detected in
-btrfs_finish_one_ordered, so we can't derive one address from the other.
-We need both addresses for separate purposes:  the logical address to
-identify which files have missing data, and the disk bytenr to identify
-which part of the filesystem address space is failing to accept writes
-(resolvable to device sectors through the chunk tree).
-
-For now, inform the sysadmin that the data has been dropped by logging a
-message when it happens, including both the logical subvol/inode/offset
-triple and the disk bytenr, and the corresponding sizes.
-
-In the future we might want to add some stats counters for this event,
-similar to the dev stats counters, but not tied to any specific device.
-The first step is to detect and report the events at all.
-
-Other notes:
-
-Because the extent is dropped, the lost data cannot be detected by a csum
-mismatch or read failure, i.e. everything will look OK if the file is read
-or the filesystem scrubbed, but an application will notice a truncated
-file or a file with data replaced by zeros.  For datasum files, we could
-simply keep the extent as-is, allow future reads or csum verification
-to fail, and report EIO errors that way.  That is a larger and riskier
-change to btrfs behavior than simply adding some passive monitoring of
-the status quo.  This approach also has problems with csum collisions,
-it doesn't work for nodatasum+datacow files, and it takes much longer
-for the errors to be detected and reported to a sysadmin.
-
-nodatacow files don't have their extents dropped; instead, they will
-simply have garbage in the blocks where the writes failed.  In most
-use cases for nodatacow files (e.g. VM disk images or databases), the
-user will be running all writes through fsync(), O_DIRECT, or similar
-mechanisms that can observe the existing EIO return value notification
-path, so there's less need for diagnostic coverage in the kernel log
-for nodatacow files.
-
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
----
- fs/btrfs/inode.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b071ed59a583f..8b95be6893f0e 100644
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -3389,6 +3389,22 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
-                   clear_reserved_extent &&
-                   !test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) &&
-                   !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) {
-+                      /*
-+                       * Notify the user that some data has been lost due
-+                       * to an error, unless we were already expected to
-+                       * remove the data because of truncate.
-+                       *
-+                       * Put both logical and physical addresses here
-+                       * because we're about to remove the mapping that
-+                       * would have allowed the user to translate from
-+                       * one to the other.
-+                       */
-+                      if (ret && !truncated)
-+                              btrfs_err_rl(fs_info,
-+"dropping unwritten extent at root %llu ino %llu offset [%llu,%llu] disk bytenr %llu length %llu",
-+                                      btrfs_root_id(inode->root), btrfs_ino(inode),
-+                                      start, end, ordered_extent->disk_bytenr,
-+                                      ordered_extent->disk_num_bytes);
-                       /*
-                        * Discard the range before returning it back to the
-                        * free space pool
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0004-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch b/topics/raid56-fixes/0004-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch
new file mode 100644 (file)
index 0000000..0e07d0d
--- /dev/null
@@ -0,0 +1,141 @@
+From fe7a2838cad5d631362cc52d27549052b35854c0 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Mon, 3 Aug 2026 03:24:38 -0400
+Subject: [PATCH 04/10] btrfs: raid56: drop cached rbios when their stripes'
+ extents are freed
+To: linux-btrfs@vger.kernel.org
+
+A cached rbio keeps an in-memory copy of its full stripe's data
+sectors so that a later sub-stripe write can steal the pages (see
+steal_rbio()) and skip the RMW read.  That is only safe while the
+cache and the disk agree.  Nothing invalidates cache entries when the
+stripe's extents are freed, so an entry can outlive the data it
+describes: the space is reallocated, a sub-stripe write to the reused
+stripe steals the stale pages, and parity is generated from the
+cache's memory of the stripe's previous life instead of from disk.
+
+If the on-disk content diverged from that memory in the meantime, the
+result is silent, latent damage.  The divergence does not require a
+second write: a device error that corrupts a column holding only
+freed data is invisible (no live extent, no csum to fail, nothing for
+scrub to check), but the stale cached copy of that column predates
+the corruption.  The poisoned write then produces parity consistent
+with the cache's memory and inconsistent with the actual on-disk
+column.  Every read of the live data still passes csum and scrub
+reports nothing, so the loss surfaces only when a device failure
+forces reconstruction -- which XORs the real on-disk garbage against
+parity that remembers different bytes, and hands back trash.
+
+This was found and proven byte-exactly on a raid5 test array: a
+stripe's parity solved uniquely as the XOR of fresh data with the
+PRE-corruption content of a free-space column -- bytes that existed
+nowhere on disk at write time and could only have come from the rbio
+cache.  The resulting single-column loss was undetectable by scrub
+and unrecoverable by reconstruction.
+
+Drop cache entries overlapping freed extents at unpin time, when the
+space returns to circulation.  The walk is gated on raid56 block
+groups, so filesystems without raid56 never touch it, and the LRU
+list is bounded (RBIO_CACHE_SIZE entries).
+
+The cost of dropping entries was measured on an instrumented stock
+kernel that marks affected entries instead of dropping them, and
+counts a reintroduced RMW full-stripe read whenever a read-skip was
+only possible because of a marked entry.  In a worst-case free-heavy
+small-file churn on a 5-device raid5 array with raid5 metadata --
+conditions chosen to flatter the cache, and it delivers, with 87% of
+sub-stripe RMWs skipping their read -- only 1% of those skips (64 of
+6430) were enabled by entries this patch drops, costing 0.04-0.12
+MB/s of extra reads against the workload's own 0.3-0.7 MB/s of
+writes.  93% of the entries the patch drops were evicted without
+ever being stolen again.
+
+---
+ fs/btrfs/extent-tree.c | 10 ++++++++++
+ fs/btrfs/raid56.c      | 37 +++++++++++++++++++++++++++++++++++++
+ fs/btrfs/raid56.h      |  1 +
+ 3 files changed, 48 insertions(+)
+
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
+index 9b0a5c6b96f3c..e9248e52d1dce 100644
+--- a/fs/btrfs/extent-tree.c
++++ b/fs/btrfs/extent-tree.c
+@@ -2868,6 +2868,16 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
+               if (return_free_space)
+                       btrfs_add_free_space(cache, start, len);
+ 
++              /*
++               * The rbio stripe cache may still remember this range's
++               * pre-free contents; a later sub-stripe write into the
++               * reused stripes would steal those pages and generate
++               * parity from them.  Drop the stale entries now that the
++               * extents are gone.
++               */
++              if (cache->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)
++                      btrfs_raid56_uncache_range(fs_info, start, len);
++
+               start += len;
+               total_unpinned += len;
+               space_info = cache->space_info;
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 4453a50866b43..5ec0ec769a0c8 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -464,6 +464,43 @@ static void remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
+       spin_unlock(&table->cache_lock);
+ }
+ 
++/*
++ * Drop cached rbios whose full stripes overlap [start, start + len).
++ *
++ * Called when extents in that range are freed.  A cached rbio holds an
++ * in-memory copy of its stripe's data sectors; once the extents are gone
++ * the space can be reallocated, and a later sub-stripe write to the same
++ * stripe would steal the cached pages (see steal_rbio()) and compute
++ * parity from the cache's memory of the stripe's previous life instead
++ * of reading the disk.  If the on-disk content diverged from that memory
++ * in the meantime -- for example a device error corrupted a column that
++ * no longer had live data, so nothing noticed -- the write produces
++ * parity that disagrees with the on-disk columns, and the stripe is
++ * latently unreconstructible: every read of the live data passes csum,
++ * scrub sees nothing wrong, and the loss only surfaces when a device
++ * failure forces reconstruction.  Freed extents' cache entries have no
++ * value to keep: drop them.
++ */
++void btrfs_raid56_uncache_range(struct btrfs_fs_info *info, u64 start, u64 len)
++{
++      struct btrfs_stripe_hash_table *table = info->stripe_hash_table;
++      struct btrfs_raid_bio *rbio;
++      struct btrfs_raid_bio *tmp;
++
++      if (!table)
++              return;
++
++      spin_lock(&table->cache_lock);
++      list_for_each_entry_safe(rbio, tmp, &table->stripe_cache, stripe_cache) {
++              const u64 rbio_start = rbio->bioc->full_stripe_logical;
++              const u64 rbio_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
++
++              if (rbio_start < start + len && start < rbio_start + rbio_len)
++                      __remove_rbio_from_cache(rbio);
++      }
++      spin_unlock(&table->cache_lock);
++}
++
+ /*
+  * remove everything in the cache
+  */
+diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
+index b56f9b958d713..be507cceb465d 100644
+--- a/fs/btrfs/raid56.h
++++ b/fs/btrfs/raid56.h
+@@ -290,5 +290,6 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+ 
+ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
+ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
++void btrfs_raid56_uncache_range(struct btrfs_fs_info *info, u64 start, u64 len);
+ 
+ #endif
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0004-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch b/topics/raid56-fixes/0004-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch
deleted file mode 100644 (file)
index 41b9e68..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-From 3056cb9be26eb4525718fa367091328e9ff9a356 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 25 Jul 2026 16:06:34 -0400
-Subject: [PATCH 04/12] btrfs: raid56: fix use-after-free of rbio in bio end_io
- wakeups
-To: linux-btrfs@vger.kernel.org
-
-The read/write submission rounds in raid56 count in-flight bios in
-rbio->stripes_pending and wait with a bare
-wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0),
-while each bio's end_io does
-"if (atomic_dec_and_test(&stripes_pending)) wake_up(&rbio->io_wait)".
-
-Once the final decrement makes the counter visible as zero, the waiter
-can pass its condition check without consuming the wakeup -- via
-wait_event()'s fast path when all bios complete before the waiter
-arrives, or a condition recheck after an earlier wakeup -- and proceed
-to free the rbio through rbio_orig_end_io().  The end_io context is
-then still inside wake_up() operating on the freed rbio's embedded
-waitqueue lock.
-
-This shows up under sustained raid56 load in KVM guests as recurring
-"pvqspinlock: lock ... has corrupted value 0x0!" warnings from
-__pv_queued_spin_unlock_slowpath with a
-__wake_up <- raid_wait_{read,write}_end_io <- bio_endio call trace:
-paravirt spinlocks detect the unlock of the recycled lock word.  KASAN
-reports it as a slab-use-after-free in __wake_up_common or
-do_raw_spin_unlock from the same end_io handlers.  On bare metal
-without KASAN the use-after-free is silent and almost always harmless,
-which is how it has survived; it is a plausible match for
-long-standing sporadic crash reports on busy raid5 filesystems.
-
-It reproduces in about 12 seconds in a KVM guest running a KASAN
-kernel, on a degraded raid5 data / raid1 metadata filesystem on four
-2 GiB devices with one missing:
- - 8 parallel O_DIRECT readers of 4K, 16K or 64K at random offsets in
-   existing files, so every read of a block on the missing device is a
-   reconstruction round;
- - 2 writers rewriting small files with 4K..32K O_DIRECT writes, so
-   writes are sub-stripe read-modify-write rounds;
- - the page cache dropped every second.
-With this patch the same load runs for 10 minutes without a warning.
-
-Convert the pair to a completion.  wait_for_completion()'s fast path
-takes the completion's own lock, so it cannot return before complete()
-has released it: the completing context is provably finished with the
-rbio before the waiter can free it.  A submitter-held bias count keeps
-one completion per submission round even when a round submits zero
-bios or every bio finishes before the submitter starts waiting; the
-scrub path only waits when finish_parity_scrub() actually began a
-round.
-
-Assisted-by: Claude:claude-fable-5
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
----
- fs/btrfs/raid56.c | 54 ++++++++++++++++++++++++++++++++++++++---------
- fs/btrfs/raid56.h | 10 ++++++++-
- 2 files changed, 53 insertions(+), 11 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index a8a8004bb14c7..4453a50866b43 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -1019,7 +1019,7 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
-       }
- 
-       bio_list_init(&rbio->bio_list);
--      init_waitqueue_head(&rbio->io_wait);
-+      init_completion(&rbio->io_done);
-       INIT_LIST_HEAD(&rbio->plug_list);
-       spin_lock_init(&rbio->bio_list_lock);
-       INIT_LIST_HEAD(&rbio->stripe_cache);
-@@ -1606,6 +1606,40 @@ static void verify_bio_data_sectors(struct btrfs_raid_bio *rbio,
-       }
- }
- 
-+/*
-+ * Begin a submission round of @nr bios whose end_io functions report through
-+ * rbio_dec_io().  stripes_pending gets one extra count on behalf of the
-+ * submitter, dropped by rbio_wait_io(): this guarantees exactly one
-+ * completion per round even when @nr is 0 or every bio finishes before the
-+ * submitter starts waiting.
-+ *
-+ * The completion is what makes the round safe against a use-after-free the
-+ * old bare waitqueue had: once the final bio's decrement made
-+ * stripes_pending visible as zero, the waiter could pass its wait_event()
-+ * condition check and free the rbio while the bio's end_io context was still
-+ * inside wake_up() on the rbio's embedded waitqueue lock.  With a
-+ * completion, the waiter cannot return before complete() has released the
-+ * completion's lock, so the completing context is finished with the rbio.
-+ */
-+static void rbio_begin_io(struct btrfs_raid_bio *rbio, unsigned int nr)
-+{
-+      reinit_completion(&rbio->io_done);
-+      atomic_set(&rbio->stripes_pending, nr + 1);
-+}
-+
-+static void rbio_dec_io(struct btrfs_raid_bio *rbio)
-+{
-+      if (atomic_dec_and_test(&rbio->stripes_pending))
-+              complete(&rbio->io_done);
-+}
-+
-+static void rbio_wait_io(struct btrfs_raid_bio *rbio)
-+{
-+      /* Drop the submitter's count from rbio_begin_io(). */
-+      rbio_dec_io(rbio);
-+      wait_for_completion(&rbio->io_done);
-+}
-+
- static void raid_wait_read_end_io(struct bio *bio)
- {
-       struct btrfs_raid_bio *rbio = bio->bi_private;
-@@ -1618,8 +1652,7 @@ static void raid_wait_read_end_io(struct bio *bio)
-       }
- 
-       bio_put(bio);
--      if (atomic_dec_and_test(&rbio->stripes_pending))
--              wake_up(&rbio->io_wait);
-+      rbio_dec_io(rbio);
- }
- 
- static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
-@@ -1627,7 +1660,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
- {
-       struct bio *bio;
- 
--      atomic_set(&rbio->stripes_pending, bio_list_size(bio_list));
-+      rbio_begin_io(rbio, bio_list_size(bio_list));
-       while ((bio = bio_list_pop(bio_list))) {
-               bio->bi_end_io = raid_wait_read_end_io;
- 
-@@ -1640,7 +1673,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
-               submit_bio(bio);
-       }
- 
--      wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
-+      rbio_wait_io(rbio);
- }
- 
- static int alloc_rbio_data_pages(struct btrfs_raid_bio *rbio)
-@@ -2328,8 +2361,7 @@ static void raid_wait_write_end_io(struct bio *bio)
-       if (bio->bi_status)
-               rbio_update_error_bitmap(rbio, bio);
-       bio_put(bio);
--      if (atomic_dec_and_test(&rbio->stripes_pending))
--              wake_up(&rbio->io_wait);
-+      rbio_dec_io(rbio);
- }
- 
- static void submit_write_bios(struct btrfs_raid_bio *rbio,
-@@ -2337,7 +2369,7 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
- {
-       struct bio *bio;
- 
--      atomic_set(&rbio->stripes_pending, bio_list_size(bio_list));
-+      rbio_begin_io(rbio, bio_list_size(bio_list));
-       while ((bio = bio_list_pop(bio_list))) {
-               bio->bi_end_io = raid_wait_write_end_io;
- 
-@@ -2444,7 +2476,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
-       /* We should have at least one bio assembled. */
-       ASSERT(bio_list_size(&bio_list));
-       submit_write_bios(rbio, &bio_list);
--      wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
-+      rbio_wait_io(rbio);
- 
-       /* We may have more errors than our tolerance during the read. */
-       for (sectornr = 0; sectornr < rbio->stripe_nsectors; sectornr++) {
-@@ -2915,7 +2947,9 @@ static void scrub_rbio(struct btrfs_raid_bio *rbio)
-        * and writeback the good content.
-        */
-       ret = finish_parity_scrub(rbio);
--      wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
-+      /* A submission round only began if finish_parity_scrub() succeeded. */
-+      if (ret == 0)
-+              rbio_wait_io(rbio);
-       for (sector_nr = 0; sector_nr < rbio->stripe_nsectors; sector_nr++) {
-               int found_errors;
- 
-diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 8700910b8dc99..b56f9b958d713 100644
---- a/fs/btrfs/raid56.h
-+++ b/fs/btrfs/raid56.h
-@@ -13,6 +13,7 @@
- #include <linux/bio.h>
- #include <linux/refcount.h>
- #include <linux/workqueue.h>
-+#include <linux/completion.h>
- #include "volumes.h"
- 
- struct page;
-@@ -173,9 +174,16 @@ struct btrfs_raid_bio {
- 
-       refcount_t refs;
- 
-+      /*
-+       * In-flight bios of the current submission round, plus one bias
-+       * count held by the submitter and dropped when it starts waiting.
-+       * The final decrement completes io_done; a completion (unlike a
-+       * bare waitqueue) guarantees the completing context is finished
-+       * with the rbio before the waiter can return and free it.
-+       */
-       atomic_t stripes_pending;
- 
--      wait_queue_head_t io_wait;
-+      struct completion io_done;
- 
-       /* Bitmap to record which horizontal stripe has data */
-       unsigned long dbitmap;
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0005-btrfs-propagate-a-split-bio-s-error-when-the-failing.patch b/topics/raid56-fixes/0005-btrfs-propagate-a-split-bio-s-error-when-the-failing.patch
deleted file mode 100644 (file)
index 6c19821..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-From 279096509d09e88990863f44eea845cc5ef898a8 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 1 Aug 2026 01:31:24 -0400
-Subject: [PATCH 05/12] btrfs: propagate a split bio's error when the failing
- split completes last
-To: linux-btrfs@vger.kernel.org
-
-btrfs_bio_end_io() saves the first error of any split bio in the original
-btrfs_bio's ->status, then loads it into ->bio.bi_status when the last
-split completes -- but only if that last completion itself succeeded:
-
-       if (atomic_dec_and_test(&bbio->pending_ios)) {
-               /* Load split bio's error which might be set above. */
-               if (status == BLK_STS_OK)
-                       bbio->bio.bi_status = READ_ONCE(bbio->status);
-
-The condition assumes that a failing final completion has already stored
-its error in the original bio at the top of the function.  That holds only
-when the bio was never split.  For a split, "bbio->bio.bi_status = status"
-is applied to the clone, which is then freed and bbio switched to the
-original; the original's bi_status keeps whatever an earlier, successful
-split left in it, and the error never reaches the caller.
-
-The ordering that loses the error is not rare.  A read that fails checksum
-verification completes only after read repair has tried every mirror,
-which takes far longer than the healthy splits of the same bio, so the
-failing split completes last essentially every time.
-
-On a degraded raid56 array the result is silent corruption.  Reads are
-split per stripe, so for any read of BTRFS_STRIPE_LEN or more, a sector
-whose reconstruction from a torn stripe fails its checksum is returned to
-userspace as zeros with no error -- while btrfs logs the checksum failure
-and increments the device corruption counter.  A 4 KiB read of the same
-sector is not split and correctly returns EIO.  Profiles that do not split
-at 64 KiB (single, dup, raid1) are unaffected, which is how this has gone
-unnoticed.
-
-Reproducer: on a raid5 filesystem, tear one stripe row's parity (leaving
-the data intact), withhold one data member of that row and mount degraded.
-Reconstructing the missing column then yields wrong bytes for that column
-while every other column still verifies.  Reads of 64 KiB or more over the
-affected range return zeros and succeed; 4 KiB reads return EIO.
-
-Load the saved status unconditionally.  It is the first error seen by any
-split, including this one, which is the value the caller wants in either
-case.
-
-Fixes: d48e1dea3931 ("btrfs: fix error propagation of split bios")
-CC: stable@vger.kernel.org # 6.6+
-Assisted-by: Claude:claude-opus-5
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
----
- fs/btrfs/bio.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
-index 2c6234f6182f8..b589cac044271 100644
---- a/fs/btrfs/bio.c
-+++ b/fs/btrfs/bio.c
-@@ -127,9 +127,14 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status)
-               cmpxchg(&bbio->status, BLK_STS_OK, status);
- 
-       if (atomic_dec_and_test(&bbio->pending_ios)) {
--              /* Load split bio's error which might be set above. */
--              if (status == BLK_STS_OK)
--                      bbio->bio.bi_status = READ_ONCE(bbio->status);
-+              /*
-+               * Load the first error recorded above.  For a split bio the
-+               * assignment at the top of this function landed on the clone,
-+               * which has already been freed, so the original's bi_status is
-+               * only correct if it is loaded here -- including when this
-+               * last completion is itself the failing one.
-+               */
-+              bbio->bio.bi_status = READ_ONCE(bbio->status);
- 
-               if (bbio_has_ordered_extent(bbio)) {
-                       struct btrfs_ordered_extent *ordered = bbio->ordered;
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0005-btrfs-raid56-verify-reconstructed-tree-blocks.patch b/topics/raid56-fixes/0005-btrfs-raid56-verify-reconstructed-tree-blocks.patch
new file mode 100644 (file)
index 0000000..cc1c994
--- /dev/null
@@ -0,0 +1,266 @@
+From fa66a56a64eb14a9dd9e0f4197f05aa35efb73ed Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Wed, 5 Aug 2026 02:59:50 -0400
+Subject: [PATCH 05/10] btrfs: raid56: verify reconstructed tree blocks
+To: linux-btrfs@vger.kernel.org
+
+Data sectors recovered from parity are checked against the csum tree
+before they are trusted: recover_vertical() calls verify_one_sector() for
+each rebuilt sector, and a mismatch fails the read.  Metadata gets none of
+that.  fill_data_csums() returns early for anything that is not a data
+block group, so csum_bitmap is NULL, and verify_one_sector() then returns
+success without looking at anything:
+
+       if (!rbio->csum_bitmap || !rbio->csum_buf)
+               return 0;
+
+So a metadata rbio reconstructs a lost column, marks it uptodate having
+verified nothing, and hands it back.  A wrong reconstruction is caught
+much later by validate_extent_buffer(), one layer up, after the block has
+already been returned and cached -- and in the raid6 case, where several
+candidate reconstructions exist, raid56 cannot tell which one is right
+because it has no way to check any of them.
+
+A tree block can be verified, just not a sector at a time: its csum lives
+in its own header and covers the whole nodesize block, so the check has to
+wait until every sector of the block has been recovered.  Do it after the
+vertical recovery loop rather than inside it.  A tree block never straddles
+a column -- nodesize and BTRFS_STRIPE_LEN are both powers of two with
+nodesize <= BTRFS_STRIPE_LEN, and full stripes are stripe-length aligned,
+so each column starts on a nodesize boundary and tree blocks tile it
+exactly.
+
+Only the blocks the caller asked for are checked.  Those are known to be
+live tree blocks; the rest of a stripe may be free space, which has no
+header and would fail every test.  For the same reason this runs only when
+rebuilding a read: recover_sectors() is also reached from the
+read-modify-write path, where the sectors actually reconstructed are the
+ones read off the surviving columns and any of them may be free space.  A
+reconstruction feeding an RMW's parity therefore stays unverified; knowing
+which ranges hold live metadata is not something this layer can do.
+
+Tested with a 3-device raid5 filesystem with raid5 metadata, 3000 files:
+each device in turn missing and corrupted recovers byte-exactly, and with
+two devices corrupted -- where reconstruction necessarily produces a wrong
+block -- raid56 now rejects it itself:
+
+  raid56: reconstructed tree block 40796160 has bytenr 8993213254959039756,
+  cannot be trusted
+
+Scrub's reads are left out: they cover whole stripes, free space
+included, and scrub verifies the sectors that hold extents itself.
+Checked here, a free slot in a rebuilt stripe failed the whole read,
+which inflated the read error counts, made a replace with -r read the
+source after all, and with nodesize equal to sectorsize left unused
+slots of a replace target unwritten.
+
+---
+ fs/btrfs/raid56.c | 185 ++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 185 insertions(+)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 5ec0ec769a0c8..81d6ec1ab1f13 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -1885,6 +1885,187 @@ static void calculate_block_csum_paddrs(struct btrfs_fs_info *fs_info,
+       btrfs_csum_final(&csum, dest);
+ }
+ 
++/*
++ * Return the memory holding a recovered sector: the bio's pages when we are
++ * rebuilding a read, the rbio's own stripe pages otherwise.
++ */
++static phys_addr_t *recovered_sector_paddrs(struct btrfs_raid_bio *rbio,
++                                          int stripe_nr, int sector_nr)
++{
++      if (rbio->operation == BTRFS_RBIO_READ_REBUILD)
++              return sector_paddrs_in_rbio(rbio, stripe_nr, sector_nr, 0);
++      return rbio_stripe_paddrs(rbio, stripe_nr, sector_nr);
++}
++
++/*
++ * Verify one reconstructed tree block.
++ *
++ * Data sectors are verified individually against the csum tree, but a tree
++ * block carries its csum in its own header, covering the whole nodesize
++ * block.  So metadata cannot be checked a sector at a time: the check has to
++ * wait until every sector of the block has been recovered, which is why this
++ * runs after the vertical recovery loop rather than inside it.
++ *
++ * A tree block never straddles a column.  nodesize and the stripe length are
++ * both powers of two with nodesize <= the stripe length, and a full stripe is
++ * stripe-length aligned, so each column begins on a nodesize boundary and
++ * tree blocks tile it exactly.
++ *
++ * @sector_nr is the first sector of the block within the column.
++ */
++static int verify_one_eb(struct btrfs_raid_bio *rbio, int stripe_nr,
++                       int sector_nr)
++{
++      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
++      const u32 sectorsize = fs_info->sectorsize;
++      const u32 sectors_per_tree = fs_info->nodesize >> fs_info->sectorsize_bits;
++      const u32 step = min(sectorsize, PAGE_SIZE);
++      const u64 logical = rbio->bioc->full_stripe_logical +
++                          (u64)stripe_nr * rbio->bioc->stripe_len +
++                          (u64)sector_nr * sectorsize;
++      u8 on_disk_csum[BTRFS_CSUM_SIZE];
++      u8 calculated_csum[BTRFS_CSUM_SIZE];
++      struct btrfs_csum_ctx csum;
++      phys_addr_t *paddrs;
++      void *kaddr;
++      u64 found_bytenr;
++      bool bad_fsid;
++
++      /*
++       * The header lives at the start of the block.  Read what we need from
++       * it before walking the rest: a block whose bytenr or fsid do not
++       * match was not reconstructed into what it claims to be, and there is
++       * no point csumming it.
++       */
++      paddrs = recovered_sector_paddrs(rbio, stripe_nr, sector_nr);
++      kaddr = kmap_local_paddr(paddrs[0]);
++      memcpy(on_disk_csum, ((struct btrfs_header *)kaddr)->csum,
++             fs_info->csum_size);
++      found_bytenr = btrfs_stack_header_bytenr((struct btrfs_header *)kaddr);
++      bad_fsid = memcmp(((struct btrfs_header *)kaddr)->fsid,
++                        fs_info->fs_devices->metadata_uuid,
++                        BTRFS_FSID_SIZE) != 0;
++      kunmap_local(kaddr);
++
++      if (unlikely(found_bytenr != logical)) {
++              btrfs_warn_rl(fs_info,
++"raid56: reconstructed tree block %llu has bytenr %llu, cannot be trusted",
++                            logical, found_bytenr);
++              return -EIO;
++      }
++      if (unlikely(bad_fsid)) {
++              btrfs_warn_rl(fs_info,
++"raid56: reconstructed tree block %llu has the wrong fsid, cannot be trusted",
++                            logical);
++              return -EIO;
++      }
++
++      btrfs_csum_init(&csum, fs_info->csum_type);
++      for (int i = 0; i < sectors_per_tree; i++) {
++              paddrs = recovered_sector_paddrs(rbio, stripe_nr, sector_nr + i);
++
++              for (int j = 0; j < rbio->sector_nsteps; j++) {
++                      kaddr = kmap_local_paddr(paddrs[j]);
++                      /* The csum field itself is not covered by the csum. */
++                      if (i == 0 && j == 0)
++                              btrfs_csum_update(&csum, kaddr + BTRFS_CSUM_SIZE,
++                                                step - BTRFS_CSUM_SIZE);
++                      else
++                              btrfs_csum_update(&csum, kaddr, step);
++                      kunmap_local(kaddr);
++              }
++      }
++      btrfs_csum_final(&csum, calculated_csum);
++
++      if (unlikely(memcmp(calculated_csum, on_disk_csum, fs_info->csum_size))) {
++              btrfs_warn_rl(fs_info,
++"raid56: reconstructed tree block %llu fails its csum, cannot be trusted",
++                            logical);
++              return -EIO;
++      }
++      return 0;
++}
++
++/*
++ * Verify every tree block this rbio was asked to read, once recovery has
++ * filled in the missing columns.
++ *
++ * Only blocks the caller actually requested are checked: a filesystem read
++ * asks for live tree blocks, whereas the rest of a stripe may be free space,
++ * which has no header to verify and would fail every test here.  Scrub reads
++ * whole stripes, free space included, and verifies the sectors that hold
++ * extents itself, so its reads are not checked here.
++ *
++ * Without this, a metadata rbio reconstructs a column and marks it uptodate
++ * having checked nothing -- verify_one_sector() returns success immediately
++ * when there is no csum_bitmap, and metadata never has one (see
++ * fill_data_csums()).  A wrong reconstruction would then be handed back to
++ * the caller, and cached, for validate_extent_buffer() to reject much later.
++ */
++static int verify_recovered_ebs(struct btrfs_raid_bio *rbio)
++{
++      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
++      const u32 sectors_per_tree = fs_info->nodesize >> fs_info->sectorsize_bits;
++
++      /*
++       * Data has its own per-sector verification.  A mixed block group has
++       * neither: its sectors get no csums (fill_data_csums() skips mixed
++       * groups) and its contents may be file data rather than tree blocks,
++       * so there is nothing here to check either.
++       */
++      if (rbio->bioc->map_type & BTRFS_BLOCK_GROUP_DATA)
++              return 0;
++
++      /*
++       * Only when rebuilding a read.  recover_sectors() is also reached from
++       * the read-modify-write path, and there the bio list covers the blocks
++       * being written -- already-verified memory -- while the sectors that
++       * were actually reconstructed are the ones read off the other columns.
++       * Those cannot be checked: any of them may be free space rather than a
++       * live tree block, and free space has no header to verify.  Knowing
++       * which ranges hold live metadata is exactly what this layer lacks,
++       * so a reconstruction feeding an RMW's parity stays unverified.
++       */
++      if (rbio->operation != BTRFS_RBIO_READ_REBUILD)
++              return 0;
++
++      /*
++       * A scrub read covers free space too, and scrub verifies what it read
++       * itself.  A READ_REBUILD rbio is never merged (rbio_can_merge()), so
++       * its one bio says whose read it is.
++       */
++      if (!bio_list_empty(&rbio->bio_list) &&
++          btrfs_bio(bio_list_peek(&rbio->bio_list))->is_scrub)
++              return 0;
++
++      for (int stripe_nr = 0; stripe_nr < rbio->nr_data; stripe_nr++) {
++              for (int sector_nr = 0;
++                   sector_nr + sectors_per_tree <= rbio->stripe_nsectors;
++                   sector_nr += sectors_per_tree) {
++                      bool requested = true;
++                      int ret;
++
++                      for (int i = 0; i < sectors_per_tree; i++) {
++                              const int index = rbio_sector_index(rbio, stripe_nr,
++                                                                  sector_nr + i);
++
++                              if (rbio->bio_paddrs[index * rbio->sector_nsteps] ==
++                                  INVALID_PADDR) {
++                                      requested = false;
++                                      break;
++                              }
++                      }
++                      if (!requested)
++                              continue;
++
++                      ret = verify_one_eb(rbio, stripe_nr, sector_nr);
++                      if (ret < 0)
++                              return ret;
++              }
++      }
++      return 0;
++}
++
+ static int verify_one_sector(struct btrfs_raid_bio *rbio,
+                            int stripe_nr, int sector_nr)
+ {
+@@ -2120,6 +2301,10 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
+                       break;
+       }
+ 
++      /* Metadata is verified per tree block, once every sector is back. */
++      if (ret == 0)
++              ret = verify_recovered_ebs(rbio);
++
+ out:
+       kfree(pointers);
+       kfree(unmap_array);
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0006-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch b/topics/raid56-fixes/0006-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch
deleted file mode 100644 (file)
index 449a1f3..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-From 01b3569be796c1ca3f9f300c0cbe6c697ff76685 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Mon, 3 Aug 2026 03:24:38 -0400
-Subject: [PATCH 06/12] btrfs: raid56: drop cached rbios when their stripes'
- extents are freed
-To: linux-btrfs@vger.kernel.org
-
-A cached rbio keeps an in-memory copy of its full stripe's data
-sectors so that a later sub-stripe write can steal the pages (see
-steal_rbio()) and skip the RMW read.  That is only safe while the
-cache and the disk agree.  Nothing invalidates cache entries when the
-stripe's extents are freed, so an entry can outlive the data it
-describes: the space is reallocated, a sub-stripe write to the reused
-stripe steals the stale pages, and parity is generated from the
-cache's memory of the stripe's previous life instead of from disk.
-
-If the on-disk content diverged from that memory in the meantime, the
-result is silent, latent damage.  The divergence does not require a
-second write: a device error that corrupts a column holding only
-freed data is invisible (no live extent, no csum to fail, nothing for
-scrub to check), but the stale cached copy of that column predates
-the corruption.  The poisoned write then produces parity consistent
-with the cache's memory and inconsistent with the actual on-disk
-column.  Every read of the live data still passes csum and scrub
-reports nothing, so the loss surfaces only when a device failure
-forces reconstruction -- which XORs the real on-disk garbage against
-parity that remembers different bytes, and hands back trash.
-
-This was found and proven byte-exactly on a raid5 test array: a
-stripe's parity solved uniquely as the XOR of fresh data with the
-PRE-corruption content of a free-space column -- bytes that existed
-nowhere on disk at write time and could only have come from the rbio
-cache.  The resulting single-column loss was undetectable by scrub
-and unrecoverable by reconstruction.
-
-Drop cache entries overlapping freed extents at unpin time, when the
-space returns to circulation.  The walk is gated on raid56 block
-groups, so filesystems without raid56 never touch it, and the LRU
-list is bounded (RBIO_CACHE_SIZE entries).
-
-The cost of dropping entries was measured on an instrumented stock
-kernel that marks affected entries instead of dropping them, and
-counts a reintroduced RMW full-stripe read whenever a read-skip was
-only possible because of a marked entry.  In a worst-case free-heavy
-small-file churn on a 5-device raid5 array with raid5 metadata --
-conditions chosen to flatter the cache, and it delivers, with 87% of
-sub-stripe RMWs skipping their read -- only 1% of those skips (64 of
-6430) were enabled by entries this patch drops, costing 0.04-0.12
-MB/s of extra reads against the workload's own 0.3-0.7 MB/s of
-writes.  93% of the entries the patch drops were evicted without
-ever being stolen again.
-
-Assisted-by: Claude:claude-fable-5
----
- fs/btrfs/extent-tree.c | 10 ++++++++++
- fs/btrfs/raid56.c      | 37 +++++++++++++++++++++++++++++++++++++
- fs/btrfs/raid56.h      |  1 +
- 3 files changed, 48 insertions(+)
-
-diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
-index 9b0a5c6b96f3c..e9248e52d1dce 100644
---- a/fs/btrfs/extent-tree.c
-+++ b/fs/btrfs/extent-tree.c
-@@ -2868,6 +2868,16 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
-               if (return_free_space)
-                       btrfs_add_free_space(cache, start, len);
- 
-+              /*
-+               * The rbio stripe cache may still remember this range's
-+               * pre-free contents; a later sub-stripe write into the
-+               * reused stripes would steal those pages and generate
-+               * parity from them.  Drop the stale entries now that the
-+               * extents are gone.
-+               */
-+              if (cache->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)
-+                      btrfs_raid56_uncache_range(fs_info, start, len);
-+
-               start += len;
-               total_unpinned += len;
-               space_info = cache->space_info;
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 4453a50866b43..5ec0ec769a0c8 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -464,6 +464,43 @@ static void remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
-       spin_unlock(&table->cache_lock);
- }
- 
-+/*
-+ * Drop cached rbios whose full stripes overlap [start, start + len).
-+ *
-+ * Called when extents in that range are freed.  A cached rbio holds an
-+ * in-memory copy of its stripe's data sectors; once the extents are gone
-+ * the space can be reallocated, and a later sub-stripe write to the same
-+ * stripe would steal the cached pages (see steal_rbio()) and compute
-+ * parity from the cache's memory of the stripe's previous life instead
-+ * of reading the disk.  If the on-disk content diverged from that memory
-+ * in the meantime -- for example a device error corrupted a column that
-+ * no longer had live data, so nothing noticed -- the write produces
-+ * parity that disagrees with the on-disk columns, and the stripe is
-+ * latently unreconstructible: every read of the live data passes csum,
-+ * scrub sees nothing wrong, and the loss only surfaces when a device
-+ * failure forces reconstruction.  Freed extents' cache entries have no
-+ * value to keep: drop them.
-+ */
-+void btrfs_raid56_uncache_range(struct btrfs_fs_info *info, u64 start, u64 len)
-+{
-+      struct btrfs_stripe_hash_table *table = info->stripe_hash_table;
-+      struct btrfs_raid_bio *rbio;
-+      struct btrfs_raid_bio *tmp;
-+
-+      if (!table)
-+              return;
-+
-+      spin_lock(&table->cache_lock);
-+      list_for_each_entry_safe(rbio, tmp, &table->stripe_cache, stripe_cache) {
-+              const u64 rbio_start = rbio->bioc->full_stripe_logical;
-+              const u64 rbio_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
-+
-+              if (rbio_start < start + len && start < rbio_start + rbio_len)
-+                      __remove_rbio_from_cache(rbio);
-+      }
-+      spin_unlock(&table->cache_lock);
-+}
-+
- /*
-  * remove everything in the cache
-  */
-diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index b56f9b958d713..be507cceb465d 100644
---- a/fs/btrfs/raid56.h
-+++ b/fs/btrfs/raid56.h
-@@ -290,5 +290,6 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
- 
- int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
- void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
-+void btrfs_raid56_uncache_range(struct btrfs_fs_info *info, u64 start, u64 len);
- 
- #endif
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0006-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch b/topics/raid56-fixes/0006-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch
new file mode 100644 (file)
index 0000000..9b4d4f4
--- /dev/null
@@ -0,0 +1,72 @@
+From b2cd9c85c248e6a127a62319e955f3a7bd40cec7 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Fri, 4 Sep 2026 22:14:19 -0400
+Subject: [PATCH 06/10] btrfs: raid56: keep a reference on a stolen cached rbio
+ until it is dropped
+To: linux-btrfs@vger.kernel.org
+
+lock_stripe_add() steals the pages of a cached rbio for the same full
+stripe, drops the rbio's hash-list reference under the bucket lock, and
+only after releasing that lock calls remove_rbio_from_cache() on it.
+Between those two steps the rbio is held by nothing but the cache
+reference, and anyone who removes it from the cache in that window --
+the cache shrink in cache_rbio(), or btrfs_raid56_uncache_range() when
+the stripe's extents are freed -- frees it.  remove_rbio_from_cache()
+then dereferences a freed rbio:
+
+  BUG: kernel NULL pointer dereference, address: 0000000000000008
+  Workqueue: btrfs-rmw rmw_rbio_work
+  RIP: 0010:__remove_rbio_from_cache+0x33/0x180
+   remove_rbio_from_cache+0x41/0x60
+   lock_stripe_add+0xfc/0x460
+   rmw_rbio_work+0x35/0x400
+
+The oops leaves the cache and bucket locks held, and every other RMW
+worker and the transaction thread soft-lock behind them.  Seen after
+8h of the device-corruption acceptance suite on 6.18, where freeing of
+extents during read errors made the uncache path frequent; the window
+exists with the plain cache shrink as well.
+
+Keep the hash-list reference across the steal and drop it after the
+cache removal, so a concurrent remover can clear the cache bit and drop
+its own reference but never free the rbio under our feet.
+
+---
+ fs/btrfs/raid56.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 81d6ec1ab1f13..44877bc3f51b7 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -756,8 +756,14 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+                   list_empty(&cur->plug_list) &&
+                   test_bit(RBIO_CACHE_BIT, &cur->flags) &&
+                   !test_bit(RBIO_RMW_LOCKED_BIT, &cur->flags)) {
++                      /*
++                       * Keep the hash-list reference: after the bucket lock
++                       * is released nothing but the cache holds cur, and a
++                       * concurrent cache removal would free it before the
++                       * remove_rbio_from_cache() below runs.  The reference
++                       * is dropped there, after the cache is done with it.
++                       */
+                       list_del_init(&cur->hash_list);
+-                      refcount_dec(&cur->refs);
+ 
+                       steal_rbio(cur, rbio);
+                       cache_drop = cur;
+@@ -805,8 +811,10 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+       list_add(&rbio->hash_list, &h->hash_list);
+ out:
+       spin_unlock(&h->lock);
+-      if (cache_drop)
++      if (cache_drop) {
+               remove_rbio_from_cache(cache_drop);
++              free_raid_bio(cache_drop);
++      }
+       if (freeit)
+               free_raid_bio(freeit);
+       return ret;
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0007-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch b/topics/raid56-fixes/0007-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch
new file mode 100644 (file)
index 0000000..30aded1
--- /dev/null
@@ -0,0 +1,63 @@
+From 5ee2db49d71535edc02572367ede40092ab9509f Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Sat, 12 Sep 2026 07:17:54 -0400
+Subject: [PATCH 07/10] btrfs: raid56: do not unhash a cached rbio that has
+ rbios plugged on it
+To: linux-btrfs@vger.kernel.org
+
+unlock_stripe() caches the finished rbio with cache_rbio() before it
+retakes the bucket and bio_list locks, and RBIO_RMW_LOCKED_BIT is still
+set at that point.  A lock_stripe_add() for the same full stripe that
+runs in that window finds a cached rbio it can neither steal (still RMW
+locked) nor merge with (cached) and plugs itself onto it, which is
+correct: unlock_stripe() then sees the plug list and hands the stripe
+lock on to the plugged rbio.
+
+But if the rbio is removed from the cache in that same window --
+btrfs_raid56_uncache_range() from the commit's unpin, or the cache's own
+shrink in cache_rbio() -- __remove_rbio_from_cache() finds an empty
+bio_list, takes the rbio off the hash list, drops the hash reference and
+hits BUG_ON(!list_empty(&rbio->plug_list)).  Seen on a degraded raid5
+under fsstress: the transaction kthread died in that BUG_ON with the
+bucket lock held and the rmw workers spun on it until the machine was
+reset.
+
+An rbio with rbios plugged on it is busy, like one with bios: leave it
+on the hash list and let unlock_stripe() hand the lock on; drop only the
+cache's reference here.
+
+---
+ fs/btrfs/raid56.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 44877bc3f51b7..390ad69a64e0a 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -431,11 +431,21 @@ static void __remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
+                * the rbio from the hash_table, and drop
+                * the corresponding ref
+                */
+-              if (bio_list_empty(&rbio->bio_list)) {
++              /*
++               * An rbio with no bios is idle only if nothing is plugged on
++               * it either.  unlock_stripe() caches the rbio before it retakes
++               * the locks, with RBIO_RMW_LOCKED_BIT still set, so a
++               * lock_stripe_add() in that window can neither steal the pages
++               * nor merge and plugs onto the cached rbio instead.  That rbio
++               * is still the stripe's lock owner and unlock_stripe() hands
++               * the lock on to the plugged one; only the cache's reference
++               * goes away here.
++               */
++              if (bio_list_empty(&rbio->bio_list) &&
++                  list_empty(&rbio->plug_list)) {
+                       if (!list_empty(&rbio->hash_list)) {
+                               list_del_init(&rbio->hash_list);
+                               refcount_dec(&rbio->refs);
+-                              ASSERT(list_empty(&rbio->plug_list));
+                       }
+               }
+       }
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0007-btrfs-raid56-verify-reconstructed-tree-blocks.patch b/topics/raid56-fixes/0007-btrfs-raid56-verify-reconstructed-tree-blocks.patch
deleted file mode 100644 (file)
index 6360bb9..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-From d603a281c880d6a7ab5c8dcd7eb2b3054a6b8f63 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Wed, 5 Aug 2026 02:59:50 -0400
-Subject: [PATCH 07/12] btrfs: raid56: verify reconstructed tree blocks
-To: linux-btrfs@vger.kernel.org
-
-Data sectors recovered from parity are checked against the csum tree
-before they are trusted: recover_vertical() calls verify_one_sector() for
-each rebuilt sector, and a mismatch fails the read.  Metadata gets none of
-that.  fill_data_csums() returns early for anything that is not a data
-block group, so csum_bitmap is NULL, and verify_one_sector() then returns
-success without looking at anything:
-
-       if (!rbio->csum_bitmap || !rbio->csum_buf)
-               return 0;
-
-So a metadata rbio reconstructs a lost column, marks it uptodate having
-verified nothing, and hands it back.  A wrong reconstruction is caught
-much later by validate_extent_buffer(), one layer up, after the block has
-already been returned and cached -- and in the raid6 case, where several
-candidate reconstructions exist, raid56 cannot tell which one is right
-because it has no way to check any of them.
-
-A tree block can be verified, just not a sector at a time: its csum lives
-in its own header and covers the whole nodesize block, so the check has to
-wait until every sector of the block has been recovered.  Do it after the
-vertical recovery loop rather than inside it.  A tree block never straddles
-a column -- nodesize and BTRFS_STRIPE_LEN are both powers of two with
-nodesize <= BTRFS_STRIPE_LEN, and full stripes are stripe-length aligned,
-so each column starts on a nodesize boundary and tree blocks tile it
-exactly.
-
-Only the blocks the caller asked for are checked.  Those are known to be
-live tree blocks; the rest of a stripe may be free space, which has no
-header and would fail every test.  For the same reason this runs only when
-rebuilding a read: recover_sectors() is also reached from the
-read-modify-write path, where the sectors actually reconstructed are the
-ones read off the surviving columns and any of them may be free space.  A
-reconstruction feeding an RMW's parity therefore stays unverified; knowing
-which ranges hold live metadata is not something this layer can do.
-
-Tested with a 3-device raid5 filesystem with raid5 metadata, 3000 files:
-each device in turn missing and corrupted recovers byte-exactly, and with
-two devices corrupted -- where reconstruction necessarily produces a wrong
-block -- raid56 now rejects it itself:
-
-  raid56: reconstructed tree block 40796160 has bytenr 8993213254959039756,
-  cannot be trusted
-
-Scrub's reads are left out: they cover whole stripes, free space
-included, and scrub verifies the sectors that hold extents itself.
-Checked here, a free slot in a rebuilt stripe failed the whole read,
-which inflated the read error counts, made a replace with -r read the
-source after all, and with nodesize equal to sectorsize left unused
-slots of a replace target unwritten.
-
-Assisted-by: Claude:claude-fable-5
----
- fs/btrfs/raid56.c | 185 ++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 185 insertions(+)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5ec0ec769a0c8..81d6ec1ab1f13 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -1885,6 +1885,187 @@ static void calculate_block_csum_paddrs(struct btrfs_fs_info *fs_info,
-       btrfs_csum_final(&csum, dest);
- }
- 
-+/*
-+ * Return the memory holding a recovered sector: the bio's pages when we are
-+ * rebuilding a read, the rbio's own stripe pages otherwise.
-+ */
-+static phys_addr_t *recovered_sector_paddrs(struct btrfs_raid_bio *rbio,
-+                                          int stripe_nr, int sector_nr)
-+{
-+      if (rbio->operation == BTRFS_RBIO_READ_REBUILD)
-+              return sector_paddrs_in_rbio(rbio, stripe_nr, sector_nr, 0);
-+      return rbio_stripe_paddrs(rbio, stripe_nr, sector_nr);
-+}
-+
-+/*
-+ * Verify one reconstructed tree block.
-+ *
-+ * Data sectors are verified individually against the csum tree, but a tree
-+ * block carries its csum in its own header, covering the whole nodesize
-+ * block.  So metadata cannot be checked a sector at a time: the check has to
-+ * wait until every sector of the block has been recovered, which is why this
-+ * runs after the vertical recovery loop rather than inside it.
-+ *
-+ * A tree block never straddles a column.  nodesize and the stripe length are
-+ * both powers of two with nodesize <= the stripe length, and a full stripe is
-+ * stripe-length aligned, so each column begins on a nodesize boundary and
-+ * tree blocks tile it exactly.
-+ *
-+ * @sector_nr is the first sector of the block within the column.
-+ */
-+static int verify_one_eb(struct btrfs_raid_bio *rbio, int stripe_nr,
-+                       int sector_nr)
-+{
-+      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
-+      const u32 sectorsize = fs_info->sectorsize;
-+      const u32 sectors_per_tree = fs_info->nodesize >> fs_info->sectorsize_bits;
-+      const u32 step = min(sectorsize, PAGE_SIZE);
-+      const u64 logical = rbio->bioc->full_stripe_logical +
-+                          (u64)stripe_nr * rbio->bioc->stripe_len +
-+                          (u64)sector_nr * sectorsize;
-+      u8 on_disk_csum[BTRFS_CSUM_SIZE];
-+      u8 calculated_csum[BTRFS_CSUM_SIZE];
-+      struct btrfs_csum_ctx csum;
-+      phys_addr_t *paddrs;
-+      void *kaddr;
-+      u64 found_bytenr;
-+      bool bad_fsid;
-+
-+      /*
-+       * The header lives at the start of the block.  Read what we need from
-+       * it before walking the rest: a block whose bytenr or fsid do not
-+       * match was not reconstructed into what it claims to be, and there is
-+       * no point csumming it.
-+       */
-+      paddrs = recovered_sector_paddrs(rbio, stripe_nr, sector_nr);
-+      kaddr = kmap_local_paddr(paddrs[0]);
-+      memcpy(on_disk_csum, ((struct btrfs_header *)kaddr)->csum,
-+             fs_info->csum_size);
-+      found_bytenr = btrfs_stack_header_bytenr((struct btrfs_header *)kaddr);
-+      bad_fsid = memcmp(((struct btrfs_header *)kaddr)->fsid,
-+                        fs_info->fs_devices->metadata_uuid,
-+                        BTRFS_FSID_SIZE) != 0;
-+      kunmap_local(kaddr);
-+
-+      if (unlikely(found_bytenr != logical)) {
-+              btrfs_warn_rl(fs_info,
-+"raid56: reconstructed tree block %llu has bytenr %llu, cannot be trusted",
-+                            logical, found_bytenr);
-+              return -EIO;
-+      }
-+      if (unlikely(bad_fsid)) {
-+              btrfs_warn_rl(fs_info,
-+"raid56: reconstructed tree block %llu has the wrong fsid, cannot be trusted",
-+                            logical);
-+              return -EIO;
-+      }
-+
-+      btrfs_csum_init(&csum, fs_info->csum_type);
-+      for (int i = 0; i < sectors_per_tree; i++) {
-+              paddrs = recovered_sector_paddrs(rbio, stripe_nr, sector_nr + i);
-+
-+              for (int j = 0; j < rbio->sector_nsteps; j++) {
-+                      kaddr = kmap_local_paddr(paddrs[j]);
-+                      /* The csum field itself is not covered by the csum. */
-+                      if (i == 0 && j == 0)
-+                              btrfs_csum_update(&csum, kaddr + BTRFS_CSUM_SIZE,
-+                                                step - BTRFS_CSUM_SIZE);
-+                      else
-+                              btrfs_csum_update(&csum, kaddr, step);
-+                      kunmap_local(kaddr);
-+              }
-+      }
-+      btrfs_csum_final(&csum, calculated_csum);
-+
-+      if (unlikely(memcmp(calculated_csum, on_disk_csum, fs_info->csum_size))) {
-+              btrfs_warn_rl(fs_info,
-+"raid56: reconstructed tree block %llu fails its csum, cannot be trusted",
-+                            logical);
-+              return -EIO;
-+      }
-+      return 0;
-+}
-+
-+/*
-+ * Verify every tree block this rbio was asked to read, once recovery has
-+ * filled in the missing columns.
-+ *
-+ * Only blocks the caller actually requested are checked: a filesystem read
-+ * asks for live tree blocks, whereas the rest of a stripe may be free space,
-+ * which has no header to verify and would fail every test here.  Scrub reads
-+ * whole stripes, free space included, and verifies the sectors that hold
-+ * extents itself, so its reads are not checked here.
-+ *
-+ * Without this, a metadata rbio reconstructs a column and marks it uptodate
-+ * having checked nothing -- verify_one_sector() returns success immediately
-+ * when there is no csum_bitmap, and metadata never has one (see
-+ * fill_data_csums()).  A wrong reconstruction would then be handed back to
-+ * the caller, and cached, for validate_extent_buffer() to reject much later.
-+ */
-+static int verify_recovered_ebs(struct btrfs_raid_bio *rbio)
-+{
-+      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
-+      const u32 sectors_per_tree = fs_info->nodesize >> fs_info->sectorsize_bits;
-+
-+      /*
-+       * Data has its own per-sector verification.  A mixed block group has
-+       * neither: its sectors get no csums (fill_data_csums() skips mixed
-+       * groups) and its contents may be file data rather than tree blocks,
-+       * so there is nothing here to check either.
-+       */
-+      if (rbio->bioc->map_type & BTRFS_BLOCK_GROUP_DATA)
-+              return 0;
-+
-+      /*
-+       * Only when rebuilding a read.  recover_sectors() is also reached from
-+       * the read-modify-write path, and there the bio list covers the blocks
-+       * being written -- already-verified memory -- while the sectors that
-+       * were actually reconstructed are the ones read off the other columns.
-+       * Those cannot be checked: any of them may be free space rather than a
-+       * live tree block, and free space has no header to verify.  Knowing
-+       * which ranges hold live metadata is exactly what this layer lacks,
-+       * so a reconstruction feeding an RMW's parity stays unverified.
-+       */
-+      if (rbio->operation != BTRFS_RBIO_READ_REBUILD)
-+              return 0;
-+
-+      /*
-+       * A scrub read covers free space too, and scrub verifies what it read
-+       * itself.  A READ_REBUILD rbio is never merged (rbio_can_merge()), so
-+       * its one bio says whose read it is.
-+       */
-+      if (!bio_list_empty(&rbio->bio_list) &&
-+          btrfs_bio(bio_list_peek(&rbio->bio_list))->is_scrub)
-+              return 0;
-+
-+      for (int stripe_nr = 0; stripe_nr < rbio->nr_data; stripe_nr++) {
-+              for (int sector_nr = 0;
-+                   sector_nr + sectors_per_tree <= rbio->stripe_nsectors;
-+                   sector_nr += sectors_per_tree) {
-+                      bool requested = true;
-+                      int ret;
-+
-+                      for (int i = 0; i < sectors_per_tree; i++) {
-+                              const int index = rbio_sector_index(rbio, stripe_nr,
-+                                                                  sector_nr + i);
-+
-+                              if (rbio->bio_paddrs[index * rbio->sector_nsteps] ==
-+                                  INVALID_PADDR) {
-+                                      requested = false;
-+                                      break;
-+                              }
-+                      }
-+                      if (!requested)
-+                              continue;
-+
-+                      ret = verify_one_eb(rbio, stripe_nr, sector_nr);
-+                      if (ret < 0)
-+                              return ret;
-+              }
-+      }
-+      return 0;
-+}
-+
- static int verify_one_sector(struct btrfs_raid_bio *rbio,
-                            int stripe_nr, int sector_nr)
- {
-@@ -2120,6 +2301,10 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
-                       break;
-       }
- 
-+      /* Metadata is verified per tree block, once every sector is back. */
-+      if (ret == 0)
-+              ret = verify_recovered_ebs(rbio);
-+
- out:
-       kfree(pointers);
-       kfree(unmap_array);
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0008-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch b/topics/raid56-fixes/0008-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch
deleted file mode 100644 (file)
index 828c913..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-From 4f6c6b2daa562025c2d9e01e76154a4a49a0498c Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Fri, 4 Sep 2026 22:14:19 -0400
-Subject: [PATCH 08/12] btrfs: raid56: keep a reference on a stolen cached rbio
- until it is dropped
-To: linux-btrfs@vger.kernel.org
-
-lock_stripe_add() steals the pages of a cached rbio for the same full
-stripe, drops the rbio's hash-list reference under the bucket lock, and
-only after releasing that lock calls remove_rbio_from_cache() on it.
-Between those two steps the rbio is held by nothing but the cache
-reference, and anyone who removes it from the cache in that window --
-the cache shrink in cache_rbio(), or btrfs_raid56_uncache_range() when
-the stripe's extents are freed -- frees it.  remove_rbio_from_cache()
-then dereferences a freed rbio:
-
-  BUG: kernel NULL pointer dereference, address: 0000000000000008
-  Workqueue: btrfs-rmw rmw_rbio_work
-  RIP: 0010:__remove_rbio_from_cache+0x33/0x180
-   remove_rbio_from_cache+0x41/0x60
-   lock_stripe_add+0xfc/0x460
-   rmw_rbio_work+0x35/0x400
-
-The oops leaves the cache and bucket locks held, and every other RMW
-worker and the transaction thread soft-lock behind them.  Seen after
-8h of the device-corruption acceptance suite on 6.18, where freeing of
-extents during read errors made the uncache path frequent; the window
-exists with the plain cache shrink as well.
-
-Keep the hash-list reference across the steal and drop it after the
-cache removal, so a concurrent remover can clear the cache bit and drop
-its own reference but never free the rbio under our feet.
-
-Assisted-by: Claude:claude-opus-4-8
----
- fs/btrfs/raid56.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 81d6ec1ab1f13..44877bc3f51b7 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -756,8 +756,14 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
-                   list_empty(&cur->plug_list) &&
-                   test_bit(RBIO_CACHE_BIT, &cur->flags) &&
-                   !test_bit(RBIO_RMW_LOCKED_BIT, &cur->flags)) {
-+                      /*
-+                       * Keep the hash-list reference: after the bucket lock
-+                       * is released nothing but the cache holds cur, and a
-+                       * concurrent cache removal would free it before the
-+                       * remove_rbio_from_cache() below runs.  The reference
-+                       * is dropped there, after the cache is done with it.
-+                       */
-                       list_del_init(&cur->hash_list);
--                      refcount_dec(&cur->refs);
- 
-                       steal_rbio(cur, rbio);
-                       cache_drop = cur;
-@@ -805,8 +811,10 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
-       list_add(&rbio->hash_list, &h->hash_list);
- out:
-       spin_unlock(&h->lock);
--      if (cache_drop)
-+      if (cache_drop) {
-               remove_rbio_from_cache(cache_drop);
-+              free_raid_bio(cache_drop);
-+      }
-       if (freeit)
-               free_raid_bio(freeit);
-       return ret;
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0008-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch b/topics/raid56-fixes/0008-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch
new file mode 100644 (file)
index 0000000..bcc159e
--- /dev/null
@@ -0,0 +1,197 @@
+From 1b805ffcffe8c738780a287e7ed786a0d78d62ba Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Tue, 20 Oct 2026 13:04:12 -0400
+Subject: [PATCH 08/10] btrfs: raid56: rebuild from Q when a sector rebuilt
+ from P fails its csum
+To: linux-btrfs@vger.kernel.org
+
+A sub-stripe write on RAID6 reads the whole full stripe and verifies its
+data sectors against their csums.  A sector that does not match is marked
+failed, and recover_vertical() rebuilds it.  With one failed sector in a
+vertical stripe it rebuilds from P, verifies the result, and fails the
+whole write with -EIO if the rebuild does not match either.
+
+P has no csum, so a stale P is not seen as a failure.  A write that failed
+on the member holding a data strip and on the member holding P, but
+completed within the profile's tolerance, leaves exactly that: the data
+strip and P stale, and only Q matching what was written.  Every later
+sub-stripe write into that full stripe then fails with -EIO.  The
+allocator hands the same free space out again, so the next write there
+fails the same way.  The same happens on a degraded filesystem when the
+member holding the data strip is missing and P is stale.
+
+Normal reads of the stale data succeed because read repair walks the
+RAID6 mirrors: mirror 2 rebuilds from P, mirror 3 also treats P as failed
+and rebuilds from Q, and each later mirror treats one more data stripe as
+failed (set_rbio_raid6_extra_error()).  Scrub repairs it too.  The RMW
+path only tries the first of these.
+
+When the one failed data sector of a RAID6 vertical stripe, rebuilt from
+P, does not verify, rebuild it again treating one more stripe as failed,
+in read repair's order: P (a rebuild from Q), then each other data stripe
+(a rebuild from P and Q, which covers a stale data sector that has no
+csum).  Use the first rebuild whose data sectors verify.  Each try writes
+its rebuild into the extra stripe's sector, so save that sector and put
+it back before the next try.
+
+Only an RMW verifies rebuilt data sectors here (rbio->csum_bitmap is only
+filled there), so read rebuild and parity scrub do not change.
+
+raid6-rmw-stale-parity-test.sh (raid56-wh-harness) makes a data strip
+and P of a full stripe holding csummed data stale, then writes into the
+rest of that stripe.  Without this patch the write fails with -EIO; with
+it the write succeeds, the new parity matches the written data, and
+every file reads back, also with members missing.  The arms with a stale
+data strip and P where the data member is missing, and with a stale
+csummed data strip plus a stale strip of a nodatasum file, fail the same
+way without the patch and pass with it.  The arms with a stale data
+strip and Q, and with two stale csummed data strips, pass either way.
+
+Fixes: 7a3150723061 ("btrfs: raid56: do data csum verification during RMW cycle")
+---
+ fs/btrfs/raid56.c | 115 ++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 95 insertions(+), 20 deletions(-)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 390ad69a64e0a..a4aeb8c385869 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -2230,6 +2230,94 @@ static void recover_vertical_step(struct btrfs_raid_bio *rbio,
+               kunmap_local(unmap_array[stripe_nr]);
+ }
+ 
++/*
++ * Rebuild the vertical stripe @sector_nr treating @faila and @failb as the
++ * failed stripes (@failb < 0 for one), then verify the rebuilt data sectors
++ * against their csums and mark them uptodate.
++ */
++static int recover_vertical_try(struct btrfs_raid_bio *rbio, int sector_nr,
++                              int faila, int failb,
++                              void **pointers, void **unmap_array)
++{
++      int ret;
++
++      for (int i = 0; i < rbio->sector_nsteps; i++)
++              recover_vertical_step(rbio, sector_nr, i, faila, failb,
++                                    pointers, unmap_array);
++      ret = verify_one_sector(rbio, faila, sector_nr);
++      if (ret < 0)
++              return ret;
++      if (failb >= 0) {
++              ret = verify_one_sector(rbio, failb, sector_nr);
++              if (ret < 0)
++                      return ret;
++      }
++
++      set_bit(rbio_sector_index(rbio, faila, sector_nr),
++              rbio->stripe_uptodate_bitmap);
++      if (failb >= 0)
++              set_bit(rbio_sector_index(rbio, failb, sector_nr),
++                      rbio->stripe_uptodate_bitmap);
++      return 0;
++}
++
++static void copy_vertical_sector(struct btrfs_raid_bio *rbio, int stripe_nr,
++                               int sector_nr, void *buf, bool to_buf)
++{
++      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
++      phys_addr_t *paddrs = recovered_sector_paddrs(rbio, stripe_nr, sector_nr);
++
++      for (int i = 0; i < rbio->sector_nsteps; i++) {
++              void *kaddr = kmap_local_paddr(paddrs[i]);
++
++              if (to_buf)
++                      memcpy(buf + i * step, kaddr, step);
++              else
++                      memcpy(kaddr, buf + i * step, step);
++              kunmap_local(kaddr);
++      }
++}
++
++/*
++ * A single failed data sector of a RAID6 vertical stripe was rebuilt from P,
++ * and the result does not match its csum.  Nothing verifies P, nor a data
++ * sector without a csum, so a stale one of those is only found here.  Like
++ * read repair (see set_rbio_raid6_extra_error()), treat one more stripe as
++ * failed and rebuild again: first P, which rebuilds from Q, then each other
++ * data stripe, which rebuilds from P and Q.
++ *
++ * Each try overwrites the extra stripe's sector with its own rebuild, so put
++ * the original back before the next one.
++ */
++static int recover_vertical_retry(struct btrfs_raid_bio *rbio, int sector_nr,
++                                int faila, void **pointers, void **unmap_array)
++{
++      void *saved;
++      int ret = -EIO;
++
++      saved = kmalloc(rbio->bioc->fs_info->sectorsize, GFP_NOFS);
++      if (!saved)
++              return -ENOMEM;
++
++      for (int extra = rbio->nr_data; extra >= 0; extra--) {
++              if (extra == faila)
++                      continue;
++
++              copy_vertical_sector(rbio, extra, sector_nr, saved, true);
++              ret = recover_vertical_try(rbio, sector_nr, min(faila, extra),
++                                         max(faila, extra), pointers,
++                                         unmap_array);
++              if (ret == 0) {
++                      set_bit(rbio_sector_index(rbio, extra, sector_nr),
++                              rbio->error_bitmap);
++                      break;
++              }
++              copy_vertical_sector(rbio, extra, sector_nr, saved, false);
++      }
++      kfree(saved);
++      return ret;
++}
++
+ /*
+  * Recover a vertical stripe specified by @sector_nr.
+  * @*pointers are the pre-allocated pointers by the caller, so we don't
+@@ -2241,7 +2329,7 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
+       int found_errors;
+       int faila;
+       int failb;
+-      int ret = 0;
++      int ret;
+ 
+       /*
+        * Now we just use bitmap to mark the horizontal stripes in
+@@ -2263,25 +2351,12 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
+       if (unlikely(found_errors > rbio->bioc->max_errors))
+               return -EIO;
+ 
+-      for (int i = 0; i < rbio->sector_nsteps; i++)
+-              recover_vertical_step(rbio, sector_nr, i, faila, failb,
+-                                          pointers, unmap_array);
+-      if (faila >= 0) {
+-              ret = verify_one_sector(rbio, faila, sector_nr);
+-              if (ret < 0)
+-                      return ret;
+-
+-              set_bit(rbio_sector_index(rbio, faila, sector_nr),
+-                      rbio->stripe_uptodate_bitmap);
+-      }
+-      if (failb >= 0) {
+-              ret = verify_one_sector(rbio, failb, sector_nr);
+-              if (ret < 0)
+-                      return ret;
+-
+-              set_bit(rbio_sector_index(rbio, failb, sector_nr),
+-                      rbio->stripe_uptodate_bitmap);
+-      }
++      ret = recover_vertical_try(rbio, sector_nr, faila, failb, pointers,
++                                 unmap_array);
++      if (ret == -EIO && found_errors == 1 &&
++          (rbio->bioc->map_type & BTRFS_BLOCK_GROUP_RAID6))
++              ret = recover_vertical_retry(rbio, sector_nr, faila, pointers,
++                                           unmap_array);
+       return ret;
+ }
+ 
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0009-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch b/topics/raid56-fixes/0009-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch
new file mode 100644 (file)
index 0000000..6bb44ea
--- /dev/null
@@ -0,0 +1,120 @@
+From ea04a5cf3d64c0a78d9dcd2f79ca0e75a1a7b4cb Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Tue, 20 Oct 2026 13:43:10 -0400
+Subject: [PATCH 09/10] btrfs: raid56: count I/O errors in the device stats
+To: linux-btrfs@vger.kernel.org
+
+raid56.c submits the reads and writes of a raid56 stripe itself, with its
+own end_io functions, so they never reach btrfs_log_dev_io_error() in
+bio.c, which counts failed bios in the device stats for every other
+profile (and for raid56 reads that map to a single device).  The raid56
+end_io functions only record the failure in the rbio's error bitmap.
+
+So a raid56 write that fails on one device within the tolerance is acked
+and leaves that device's strip stale with no trace in btrfs: write_io_errs
+stays 0 and btrfs logs nothing.  Failed read-modify-write, rebuild and
+parity scrub reads are not counted either.  It has been like this since
+raid56 was added.
+
+Export btrfs_log_dev_io_error() and call it from both raid56 end_io
+functions, for the device the bio was sent to.  The device is found by
+the bio's bdev: a write to the replace target uses the source's pages, so
+the pages do not say which device it went to.
+
+Test (raid56-wh-harness raid56-devstats-test.sh): a write failing on one
+member within tolerance (each member in turn; raid6 also each pair)
+raises write_io_errs on exactly the failing members, and a failed
+read-modify-write read raises read_io_errs on that member only; before,
+nothing was counted.  With a member absent (degraded) no counter moves,
+and during a replace onto a target that fails writes only the target is
+charged.
+
+Fixes: 53b381b3abeb ("Btrfs: RAID5 and RAID6")
+---
+ fs/btrfs/bio.c    |  2 +-
+ fs/btrfs/bio.h    |  2 ++
+ fs/btrfs/raid56.c | 22 +++++++++++++++++++++-
+ 3 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
+index fc0b021cdefb1..d51a56c1a9531 100644
+--- a/fs/btrfs/bio.c
++++ b/fs/btrfs/bio.c
+@@ -316,7 +316,7 @@ static void btrfs_check_read_bio(struct btrfs_bio *bbio, struct btrfs_device *de
+               btrfs_bio_end_io(bbio, bbio->bio.bi_status);
+ }
+ 
+-static void btrfs_log_dev_io_error(const struct bio *bio, struct btrfs_device *dev)
++void btrfs_log_dev_io_error(const struct bio *bio, struct btrfs_device *dev)
+ {
+       blk_status_t sts = bio->bi_status;
+ 
+diff --git a/fs/btrfs/bio.h b/fs/btrfs/bio.h
+index bbf362b8668bb..2451d38566d1a 100644
+--- a/fs/btrfs/bio.h
++++ b/fs/btrfs/bio.h
+@@ -13,6 +13,7 @@
+ #include "tree-checker.h"
+ 
+ struct btrfs_bio;
++struct btrfs_device;
+ struct btrfs_fs_info;
+ struct btrfs_inode;
+ 
+@@ -121,6 +122,7 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status);
+ #define REQ_BTRFS_CGROUP_PUNT                 REQ_FS_PRIVATE
+ 
+ void btrfs_submit_bbio(struct btrfs_bio *bbio, int mirror_num);
++void btrfs_log_dev_io_error(const struct bio *bio, struct btrfs_device *dev);
+ void btrfs_submit_repair_write(struct btrfs_bio *bbio, int mirror_num, bool dev_replace);
+ int btrfs_repair_bbio_failure(struct btrfs_bio *bbio, const struct bvec_iter *orig_iter,
+                             u32 length, int mirror_num);
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index a4aeb8c385869..e45e6a6ba2566 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -1695,11 +1695,29 @@ static void rbio_wait_io(struct btrfs_raid_bio *rbio)
+       wait_for_completion(&rbio->io_done);
+ }
+ 
++/*
++ * Count a failed bio in the stats of the device it went to, as bio.c does for
++ * the other profiles.  Look the device up by its bdev: a write to the replace
++ * target uses the source's pages, so the pages do not tell the device.
++ */
++static void rbio_log_dev_io_error(struct btrfs_raid_bio *rbio, struct bio *bio)
++{
++      struct btrfs_io_context *bioc = rbio->bioc;
++
++      for (int i = 0; i < bioc->num_stripes; i++) {
++              if (bioc->stripes[i].dev->bdev == bio->bi_bdev) {
++                      btrfs_log_dev_io_error(bio, bioc->stripes[i].dev);
++                      return;
++              }
++      }
++}
++
+ static void raid_wait_read_end_io(struct bio *bio)
+ {
+       struct btrfs_raid_bio *rbio = bio->bi_private;
+ 
+       if (bio->bi_status) {
++              rbio_log_dev_io_error(rbio, bio);
+               rbio_update_error_bitmap(rbio, bio);
+       } else {
+               set_bio_pages_uptodate(rbio, bio);
+@@ -2673,8 +2691,10 @@ static void raid_wait_write_end_io(struct bio *bio)
+ {
+       struct btrfs_raid_bio *rbio = bio->bi_private;
+ 
+-      if (bio->bi_status)
++      if (bio->bi_status) {
++              rbio_log_dev_io_error(rbio, bio);
+               rbio_update_error_bitmap(rbio, bio);
++      }
+       bio_put(bio);
+       rbio_dec_io(rbio);
+ }
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0009-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch b/topics/raid56-fixes/0009-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch
deleted file mode 100644 (file)
index 4b83d39..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-From 4e743a3100a732c24ec778a6693ae25400bab9d7 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 12 Sep 2026 07:17:54 -0400
-Subject: [PATCH 09/12] btrfs: raid56: do not unhash a cached rbio that has
- rbios plugged on it
-To: linux-btrfs@vger.kernel.org
-
-unlock_stripe() caches the finished rbio with cache_rbio() before it
-retakes the bucket and bio_list locks, and RBIO_RMW_LOCKED_BIT is still
-set at that point.  A lock_stripe_add() for the same full stripe that
-runs in that window finds a cached rbio it can neither steal (still RMW
-locked) nor merge with (cached) and plugs itself onto it, which is
-correct: unlock_stripe() then sees the plug list and hands the stripe
-lock on to the plugged rbio.
-
-But if the rbio is removed from the cache in that same window --
-btrfs_raid56_uncache_range() from the commit's unpin, or the cache's own
-shrink in cache_rbio() -- __remove_rbio_from_cache() finds an empty
-bio_list, takes the rbio off the hash list, drops the hash reference and
-hits BUG_ON(!list_empty(&rbio->plug_list)).  Seen on a degraded raid5
-under fsstress: the transaction kthread died in that BUG_ON with the
-bucket lock held and the rmw workers spun on it until the machine was
-reset.
-
-An rbio with rbios plugged on it is busy, like one with bios: leave it
-on the hash list and let unlock_stripe() hand the lock on; drop only the
-cache's reference here.
-
-Assisted-by: Claude:claude-opus-4-8
----
- fs/btrfs/raid56.c | 14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 44877bc3f51b7..390ad69a64e0a 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -431,11 +431,21 @@ static void __remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
-                * the rbio from the hash_table, and drop
-                * the corresponding ref
-                */
--              if (bio_list_empty(&rbio->bio_list)) {
-+              /*
-+               * An rbio with no bios is idle only if nothing is plugged on
-+               * it either.  unlock_stripe() caches the rbio before it retakes
-+               * the locks, with RBIO_RMW_LOCKED_BIT still set, so a
-+               * lock_stripe_add() in that window can neither steal the pages
-+               * nor merge and plugs onto the cached rbio instead.  That rbio
-+               * is still the stripe's lock owner and unlock_stripe() hands
-+               * the lock on to the plugged one; only the cache's reference
-+               * goes away here.
-+               */
-+              if (bio_list_empty(&rbio->bio_list) &&
-+                  list_empty(&rbio->plug_list)) {
-                       if (!list_empty(&rbio->hash_list)) {
-                               list_del_init(&rbio->hash_list);
-                               refcount_dec(&rbio->refs);
--                              ASSERT(list_empty(&rbio->plug_list));
-                       }
-               }
-       }
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0010-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch b/topics/raid56-fixes/0010-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch
deleted file mode 100644 (file)
index c393353..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-From 13a1771e7dc5195969a132513d35cd9685ee471a Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Tue, 20 Oct 2026 13:04:12 -0400
-Subject: [PATCH 10/12] btrfs: raid56: rebuild from Q when a sector rebuilt
- from P fails its csum
-To: linux-btrfs@vger.kernel.org
-
-A sub-stripe write on RAID6 reads the whole full stripe and verifies its
-data sectors against their csums.  A sector that does not match is marked
-failed, and recover_vertical() rebuilds it.  With one failed sector in a
-vertical stripe it rebuilds from P, verifies the result, and fails the
-whole write with -EIO if the rebuild does not match either.
-
-P has no csum, so a stale P is not seen as a failure.  A write that failed
-on the member holding a data strip and on the member holding P, but
-completed within the profile's tolerance, leaves exactly that: the data
-strip and P stale, and only Q matching what was written.  Every later
-sub-stripe write into that full stripe then fails with -EIO.  The
-allocator hands the same free space out again, so the next write there
-fails the same way.  The same happens on a degraded filesystem when the
-member holding the data strip is missing and P is stale.
-
-Normal reads of the stale data succeed because read repair walks the
-RAID6 mirrors: mirror 2 rebuilds from P, mirror 3 also treats P as failed
-and rebuilds from Q, and each later mirror treats one more data stripe as
-failed (set_rbio_raid6_extra_error()).  Scrub repairs it too.  The RMW
-path only tries the first of these.
-
-When the one failed data sector of a RAID6 vertical stripe, rebuilt from
-P, does not verify, rebuild it again treating one more stripe as failed,
-in read repair's order: P (a rebuild from Q), then each other data stripe
-(a rebuild from P and Q, which covers a stale data sector that has no
-csum).  Use the first rebuild whose data sectors verify.  Each try writes
-its rebuild into the extra stripe's sector, so save that sector and put
-it back before the next try.
-
-Only an RMW verifies rebuilt data sectors here (rbio->csum_bitmap is only
-filled there), so read rebuild and parity scrub do not change.
-
-raid6-rmw-stale-parity-test.sh (raid56-wh-harness) makes a data strip
-and P of a full stripe holding csummed data stale, then writes into the
-rest of that stripe.  Without this patch the write fails with -EIO; with
-it the write succeeds, the new parity matches the written data, and
-every file reads back, also with members missing.  The arms with a stale
-data strip and P where the data member is missing, and with a stale
-csummed data strip plus a stale strip of a nodatasum file, fail the same
-way without the patch and pass with it.  The arms with a stale data
-strip and Q, and with two stale csummed data strips, pass either way.
-
-Fixes: 7a3150723061 ("btrfs: raid56: do data csum verification during RMW cycle")
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/raid56.c | 115 ++++++++++++++++++++++++++++++++++++++--------
- 1 file changed, 95 insertions(+), 20 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 390ad69a64e0a..a4aeb8c385869 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -2230,6 +2230,94 @@ static void recover_vertical_step(struct btrfs_raid_bio *rbio,
-               kunmap_local(unmap_array[stripe_nr]);
- }
- 
-+/*
-+ * Rebuild the vertical stripe @sector_nr treating @faila and @failb as the
-+ * failed stripes (@failb < 0 for one), then verify the rebuilt data sectors
-+ * against their csums and mark them uptodate.
-+ */
-+static int recover_vertical_try(struct btrfs_raid_bio *rbio, int sector_nr,
-+                              int faila, int failb,
-+                              void **pointers, void **unmap_array)
-+{
-+      int ret;
-+
-+      for (int i = 0; i < rbio->sector_nsteps; i++)
-+              recover_vertical_step(rbio, sector_nr, i, faila, failb,
-+                                    pointers, unmap_array);
-+      ret = verify_one_sector(rbio, faila, sector_nr);
-+      if (ret < 0)
-+              return ret;
-+      if (failb >= 0) {
-+              ret = verify_one_sector(rbio, failb, sector_nr);
-+              if (ret < 0)
-+                      return ret;
-+      }
-+
-+      set_bit(rbio_sector_index(rbio, faila, sector_nr),
-+              rbio->stripe_uptodate_bitmap);
-+      if (failb >= 0)
-+              set_bit(rbio_sector_index(rbio, failb, sector_nr),
-+                      rbio->stripe_uptodate_bitmap);
-+      return 0;
-+}
-+
-+static void copy_vertical_sector(struct btrfs_raid_bio *rbio, int stripe_nr,
-+                               int sector_nr, void *buf, bool to_buf)
-+{
-+      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
-+      phys_addr_t *paddrs = recovered_sector_paddrs(rbio, stripe_nr, sector_nr);
-+
-+      for (int i = 0; i < rbio->sector_nsteps; i++) {
-+              void *kaddr = kmap_local_paddr(paddrs[i]);
-+
-+              if (to_buf)
-+                      memcpy(buf + i * step, kaddr, step);
-+              else
-+                      memcpy(kaddr, buf + i * step, step);
-+              kunmap_local(kaddr);
-+      }
-+}
-+
-+/*
-+ * A single failed data sector of a RAID6 vertical stripe was rebuilt from P,
-+ * and the result does not match its csum.  Nothing verifies P, nor a data
-+ * sector without a csum, so a stale one of those is only found here.  Like
-+ * read repair (see set_rbio_raid6_extra_error()), treat one more stripe as
-+ * failed and rebuild again: first P, which rebuilds from Q, then each other
-+ * data stripe, which rebuilds from P and Q.
-+ *
-+ * Each try overwrites the extra stripe's sector with its own rebuild, so put
-+ * the original back before the next one.
-+ */
-+static int recover_vertical_retry(struct btrfs_raid_bio *rbio, int sector_nr,
-+                                int faila, void **pointers, void **unmap_array)
-+{
-+      void *saved;
-+      int ret = -EIO;
-+
-+      saved = kmalloc(rbio->bioc->fs_info->sectorsize, GFP_NOFS);
-+      if (!saved)
-+              return -ENOMEM;
-+
-+      for (int extra = rbio->nr_data; extra >= 0; extra--) {
-+              if (extra == faila)
-+                      continue;
-+
-+              copy_vertical_sector(rbio, extra, sector_nr, saved, true);
-+              ret = recover_vertical_try(rbio, sector_nr, min(faila, extra),
-+                                         max(faila, extra), pointers,
-+                                         unmap_array);
-+              if (ret == 0) {
-+                      set_bit(rbio_sector_index(rbio, extra, sector_nr),
-+                              rbio->error_bitmap);
-+                      break;
-+              }
-+              copy_vertical_sector(rbio, extra, sector_nr, saved, false);
-+      }
-+      kfree(saved);
-+      return ret;
-+}
-+
- /*
-  * Recover a vertical stripe specified by @sector_nr.
-  * @*pointers are the pre-allocated pointers by the caller, so we don't
-@@ -2241,7 +2329,7 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
-       int found_errors;
-       int faila;
-       int failb;
--      int ret = 0;
-+      int ret;
- 
-       /*
-        * Now we just use bitmap to mark the horizontal stripes in
-@@ -2263,25 +2351,12 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
-       if (unlikely(found_errors > rbio->bioc->max_errors))
-               return -EIO;
- 
--      for (int i = 0; i < rbio->sector_nsteps; i++)
--              recover_vertical_step(rbio, sector_nr, i, faila, failb,
--                                          pointers, unmap_array);
--      if (faila >= 0) {
--              ret = verify_one_sector(rbio, faila, sector_nr);
--              if (ret < 0)
--                      return ret;
--
--              set_bit(rbio_sector_index(rbio, faila, sector_nr),
--                      rbio->stripe_uptodate_bitmap);
--      }
--      if (failb >= 0) {
--              ret = verify_one_sector(rbio, failb, sector_nr);
--              if (ret < 0)
--                      return ret;
--
--              set_bit(rbio_sector_index(rbio, failb, sector_nr),
--                      rbio->stripe_uptodate_bitmap);
--      }
-+      ret = recover_vertical_try(rbio, sector_nr, faila, failb, pointers,
-+                                 unmap_array);
-+      if (ret == -EIO && found_errors == 1 &&
-+          (rbio->bioc->map_type & BTRFS_BLOCK_GROUP_RAID6))
-+              ret = recover_vertical_retry(rbio, sector_nr, faila, pointers,
-+                                           unmap_array);
-       return ret;
- }
- 
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0010-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch b/topics/raid56-fixes/0010-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch
new file mode 100644 (file)
index 0000000..141a262
--- /dev/null
@@ -0,0 +1,263 @@
+From 3b022e96c7a88a5ad5c389f756b75ff8d3dcafa5 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Tue, 20 Oct 2026 15:52:51 -0400
+Subject: [PATCH 10/10] btrfs: raid56: write back the sectors a sub-stripe
+ write repaired
+To: linux-btrfs@vger.kernel.org
+
+A sub-stripe write reads the rest of its full stripe and verifies the data
+sectors that have csums.  It rebuilds the sectors that failed their csum or
+their read, and the sectors of a missing device, and computes the new P and
+Q from the result.  On RAID6 it also finds a stale P, or a stale data
+sector without a csum, by rebuilding again with one more stripe treated as
+failed.  The write phase then writes only the new data, and P and Q of the
+vertical stripes the new data covers.
+
+The repaired sectors stay stale on disk until a read repair or a scrub
+finds them, even though the new parity was computed from their rebuilt
+contents.  Until then the full stripe has one healthy member fewer than it
+seems, and one more lost device loses data that was recoverable.
+
+Write the repaired sectors back in the same write phase:
+
+- a data sector whose rebuild is verified.  It has a csum, or it has none
+  but was rebuilt from P and Q together with a data sector of the same
+  vertical stripe that has one.  The RAID6 retry finds a stale data sector
+  without a csum that way.  A lone rebuild of a sector without a csum comes
+  from parity that nothing checked, and the copy on disk may be the right
+  one, so it is left alone;
+- P or Q that failed its read or was found stale, in the vertical stripes
+  the write does not cover (the others get new P and Q anyway);
+- nothing on a missing device.  The replace target gets the same sectors as
+  its source, as with the other writes.
+
+The write-backs go out with the rest of the write.  A write-back that fails
+leaves its sector as stale as it was before the write, so it does not count
+against the write's tolerance, and the write completes as it did before.
+
+The rbio repairs before it writes anything, so a write-back never retries a
+write that the same rbio just failed.  A write that failed on a member
+within the tolerance leaves its pages in the stripe cache, and the next
+sub-stripe write into that full stripe takes them without reading, so it
+has nothing to repair either.  A write-back can still go to a sector whose
+write by an earlier rbio failed, when that rbio's pages were not cached (a
+full stripe write) or were evicted: then it fails again, or heals the
+sector.  A btrfs_debug line counts the write-backs and the failed ones.
+
+rmw-writeback-test.sh (raid56-wh-harness) puts strips of one full stripe
+back to stale contents, writes into the rest of the stripe, once with
+fsync and once with a plain write(), and reads the members back offline
+before anything else touches them.  The stale strips are, on RAID5, a data
+strip with a csum, alone or also failing its reads; on RAID6, a data strip
+with P, with Q, with a second data strip with a csum, or with a strip of a
+nodatasum file, with the write covering all rows or only some of them.
+Without this patch every repaired strip, and P outside the written rows,
+is still stale after the write in all 18 runs; with it none is, and P and
+Q match the data in every row.  With the stale member failing writes, the
+write-back fails, the write still completes and its data reads back,
+also on RAID5 when the write to P fails as well (counting the failed
+write-back against the tolerance fails that write with -EIO).  A
+nodatasum strip rebuilt from P alone after a read error is not written
+back.
+
+Fixes: 7a3150723061 ("btrfs: raid56: do data csum verification during RMW cycle")
+---
+ fs/btrfs/raid56.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 152 insertions(+)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index e45e6a6ba2566..1706ec66b05fb 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -2742,10 +2742,153 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+       return false;
+ }
+ 
++/*
++ * Return true if the rebuild of data sector @sector_nr of @stripe_nr can be
++ * trusted enough to write it back.  It can when the sector has a csum: the
++ * rebuild was verified.  Without a csum, it can only when another data sector
++ * of the same vertical stripe also failed and has a csum: the two were
++ * rebuilt together from P and Q (on RAID6 that is also how a stale sector
++ * without a csum is found, see recover_vertical_retry()), and the csum that
++ * verified one verifies the other.  A lone rebuild without a csum came from
++ * parity that nothing checked, and the copy on the disk may still be right.
++ */
++static bool rmw_repair_verified(struct btrfs_raid_bio *rbio, int stripe_nr,
++                              int sector_nr)
++{
++      if (!rbio->csum_bitmap)
++              return false;
++
++      for (int i = 0; i < rbio->nr_data; i++) {
++              const int index = rbio_sector_index(rbio, i, sector_nr);
++
++              if (!test_bit(index, rbio->csum_bitmap))
++                      continue;
++              if (i == stripe_nr || test_bit(index, rbio->error_bitmap))
++                      return true;
++      }
++      return false;
++}
++
++/*
++ * After the read phase of a sub-stripe write, return the sectors it repaired
++ * that the write phase should also write back, or NULL if there are none.
++ *
++ * recover_sectors() leaves the error bit set on every sector it rebuilt: a
++ * data sector that failed its csum or its read, every sector of a missing
++ * device, and the extra stripe that recover_vertical_retry() found stale.
++ * The rebuilt sectors are in the stripe pages and the new P and Q are
++ * generated from them, so without a write-back the disk copies stay stale
++ * until read repair or scrub finds them.
++ *
++ * Nothing is written to a missing device.  A data sector is written back only
++ * if its rebuild is verified (rmw_repair_verified()).  P and Q are generated
++ * from the data either way, so a failed or stale one is always written back.
++ *
++ * This rbio has not written anything yet, so none of these is a retry of a
++ * write that just failed here.
++ */
++static unsigned long *rmw_repaired_sectors(struct btrfs_raid_bio *rbio)
++{
++      unsigned long *repaired = NULL;
++      int total_sector_nr;
++
++      for_each_set_bit(total_sector_nr, rbio->error_bitmap, rbio->nr_sectors) {
++              const int stripe = total_sector_nr / rbio->stripe_nsectors;
++              const int sectornr = total_sector_nr % rbio->stripe_nsectors;
++
++              if (!rbio->bioc->stripes[stripe].dev->bdev)
++                      continue;
++              if (stripe < rbio->nr_data &&
++                  !rmw_repair_verified(rbio, stripe, sectornr))
++                      continue;
++
++              if (!repaired) {
++                      /* Without memory the sectors just stay stale on disk. */
++                      repaired = bitmap_zalloc(rbio->nr_sectors, GFP_NOFS);
++                      if (!repaired)
++                              return NULL;
++              }
++              set_bit(total_sector_nr, repaired);
++      }
++      return repaired;
++}
++
++/*
++ * Add write bios for the repaired sectors that the write phase does not write
++ * anyway: data sectors no bio of this rbio covers, and P/Q outside the
++ * vertical stripes being written.  The others are dropped from @repaired.
++ * The replace target gets the same sectors as its source.
++ */
++static int rmw_assemble_repair_bios(struct btrfs_raid_bio *rbio,
++                                  struct bio_list *bio_list,
++                                  unsigned long *repaired)
++{
++      int total_sector_nr;
++      int ret;
++
++      for_each_set_bit(total_sector_nr, repaired, rbio->nr_sectors) {
++              const int stripe = total_sector_nr / rbio->stripe_nsectors;
++              const int sectornr = total_sector_nr % rbio->stripe_nsectors;
++              phys_addr_t *paddrs;
++              bool written;
++
++              if (stripe < rbio->nr_data)
++                      written = sector_paddrs_in_rbio(rbio, stripe, sectornr, 1);
++              else
++                      written = test_bit(sectornr, &rbio->dbitmap);
++              if (written) {
++                      clear_bit(total_sector_nr, repaired);
++                      continue;
++              }
++
++              paddrs = rbio_stripe_paddrs(rbio, stripe, sectornr);
++              ret = rbio_add_io_paddrs(rbio, bio_list, paddrs, stripe,
++                                       sectornr, REQ_OP_WRITE);
++              if (ret)
++                      goto error;
++
++              if (likely(!rbio->bioc->replace_nr_stripes) ||
++                  stripe != rbio->bioc->replace_stripe_src)
++                      continue;
++              ret = rbio_add_io_paddrs(rbio, bio_list, paddrs,
++                                       rbio->real_stripes, sectornr,
++                                       REQ_OP_WRITE);
++              if (ret)
++                      goto error;
++      }
++      return 0;
++error:
++      bio_list_put(bio_list);
++      return -EIO;
++}
++
++/*
++ * A write-back that fails leaves the sector as stale as it was before this
++ * write, so it does not count against the tolerance of the write itself.
++ */
++static void rmw_finish_repair_bios(struct btrfs_raid_bio *rbio,
++                                 unsigned long *repaired)
++{
++      int written = 0;
++      int failed = 0;
++      int total_sector_nr;
++
++      for_each_set_bit(total_sector_nr, repaired, rbio->nr_sectors) {
++              written++;
++              if (test_and_clear_bit(total_sector_nr, rbio->error_bitmap))
++                      failed++;
++      }
++      if (written)
++              btrfs_debug_rl(rbio->bioc->fs_info,
++      "sub-stripe write for full stripe %llu wrote back %d repaired sectors, %d failed",
++                             rbio->bioc->full_stripe_logical, written, failed);
++}
++
+ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+ {
+       struct bio_list bio_list;
+       int sectornr;
++      unsigned long *repaired = NULL;
+       int ret = 0;
+ 
+       /*
+@@ -2774,6 +2917,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+               ret = rmw_read_wait_recover(rbio);
+               if (ret < 0)
+                       goto out;
++              repaired = rmw_repaired_sectors(rbio);
+       }
+ 
+       /*
+@@ -2807,11 +2951,18 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+       ret = rmw_assemble_write_bios(rbio, &bio_list);
+       if (ret < 0)
+               goto out;
++      if (repaired) {
++              ret = rmw_assemble_repair_bios(rbio, &bio_list, repaired);
++              if (ret < 0)
++                      goto out;
++      }
+ 
+       /* We should have at least one bio assembled. */
+       ASSERT(bio_list_size(&bio_list));
+       submit_write_bios(rbio, &bio_list);
+       rbio_wait_io(rbio);
++      if (repaired)
++              rmw_finish_repair_bios(rbio, repaired);
+ 
+       /* We may have more errors than our tolerance during the read. */
+       for (sectornr = 0; sectornr < rbio->stripe_nsectors; sectornr++) {
+@@ -2842,6 +2993,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+               /* Failed write, don't cache for page stealing. */
+               clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags);
+       }
++      bitmap_free(repaired);
+       rbio_orig_end_io(rbio, errno_to_blk_status(ret));
+ }
+ 
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0011-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch b/topics/raid56-fixes/0011-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch
deleted file mode 100644 (file)
index d50584f..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-From bc422dc6bdb326f04e6fe719aa9cb4f09042e60b Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Tue, 20 Oct 2026 13:43:10 -0400
-Subject: [PATCH 11/12] btrfs: raid56: count I/O errors in the device stats
-To: linux-btrfs@vger.kernel.org
-
-raid56.c submits the reads and writes of a raid56 stripe itself, with its
-own end_io functions, so they never reach btrfs_log_dev_io_error() in
-bio.c, which counts failed bios in the device stats for every other
-profile (and for raid56 reads that map to a single device).  The raid56
-end_io functions only record the failure in the rbio's error bitmap.
-
-So a raid56 write that fails on one device within the tolerance is acked
-and leaves that device's strip stale with no trace in btrfs: write_io_errs
-stays 0 and btrfs logs nothing.  Failed read-modify-write, rebuild and
-parity scrub reads are not counted either.  It has been like this since
-raid56 was added.
-
-Export btrfs_log_dev_io_error() and call it from both raid56 end_io
-functions, for the device the bio was sent to.  The device is found by
-the bio's bdev: a write to the replace target uses the source's pages, so
-the pages do not say which device it went to.
-
-Test (raid56-wh-harness raid56-devstats-test.sh): a write failing on one
-member within tolerance (each member in turn; raid6 also each pair)
-raises write_io_errs on exactly the failing members, and a failed
-read-modify-write read raises read_io_errs on that member only; before,
-nothing was counted.  With a member absent (degraded) no counter moves,
-and during a replace onto a target that fails writes only the target is
-charged.
-
-Fixes: 53b381b3abeb ("Btrfs: RAID5 and RAID6")
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/bio.c    |  2 +-
- fs/btrfs/bio.h    |  2 ++
- fs/btrfs/raid56.c | 22 +++++++++++++++++++++-
- 3 files changed, 24 insertions(+), 2 deletions(-)
-
-diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
-index b589cac044271..863043cd01117 100644
---- a/fs/btrfs/bio.c
-+++ b/fs/btrfs/bio.c
-@@ -318,7 +318,7 @@ static void btrfs_check_read_bio(struct btrfs_bio *bbio, struct btrfs_device *de
-               btrfs_bio_end_io(bbio, bbio->bio.bi_status);
- }
- 
--static void btrfs_log_dev_io_error(const struct bio *bio, struct btrfs_device *dev)
-+void btrfs_log_dev_io_error(const struct bio *bio, struct btrfs_device *dev)
- {
-       blk_status_t sts = bio->bi_status;
- 
-diff --git a/fs/btrfs/bio.h b/fs/btrfs/bio.h
-index bbf362b8668bb..2451d38566d1a 100644
---- a/fs/btrfs/bio.h
-+++ b/fs/btrfs/bio.h
-@@ -13,6 +13,7 @@
- #include "tree-checker.h"
- 
- struct btrfs_bio;
-+struct btrfs_device;
- struct btrfs_fs_info;
- struct btrfs_inode;
- 
-@@ -121,6 +122,7 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status);
- #define REQ_BTRFS_CGROUP_PUNT                 REQ_FS_PRIVATE
- 
- void btrfs_submit_bbio(struct btrfs_bio *bbio, int mirror_num);
-+void btrfs_log_dev_io_error(const struct bio *bio, struct btrfs_device *dev);
- void btrfs_submit_repair_write(struct btrfs_bio *bbio, int mirror_num, bool dev_replace);
- int btrfs_repair_bbio_failure(struct btrfs_bio *bbio, const struct bvec_iter *orig_iter,
-                             u32 length, int mirror_num);
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index a4aeb8c385869..e45e6a6ba2566 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -1695,11 +1695,29 @@ static void rbio_wait_io(struct btrfs_raid_bio *rbio)
-       wait_for_completion(&rbio->io_done);
- }
- 
-+/*
-+ * Count a failed bio in the stats of the device it went to, as bio.c does for
-+ * the other profiles.  Look the device up by its bdev: a write to the replace
-+ * target uses the source's pages, so the pages do not tell the device.
-+ */
-+static void rbio_log_dev_io_error(struct btrfs_raid_bio *rbio, struct bio *bio)
-+{
-+      struct btrfs_io_context *bioc = rbio->bioc;
-+
-+      for (int i = 0; i < bioc->num_stripes; i++) {
-+              if (bioc->stripes[i].dev->bdev == bio->bi_bdev) {
-+                      btrfs_log_dev_io_error(bio, bioc->stripes[i].dev);
-+                      return;
-+              }
-+      }
-+}
-+
- static void raid_wait_read_end_io(struct bio *bio)
- {
-       struct btrfs_raid_bio *rbio = bio->bi_private;
- 
-       if (bio->bi_status) {
-+              rbio_log_dev_io_error(rbio, bio);
-               rbio_update_error_bitmap(rbio, bio);
-       } else {
-               set_bio_pages_uptodate(rbio, bio);
-@@ -2673,8 +2691,10 @@ static void raid_wait_write_end_io(struct bio *bio)
- {
-       struct btrfs_raid_bio *rbio = bio->bi_private;
- 
--      if (bio->bi_status)
-+      if (bio->bi_status) {
-+              rbio_log_dev_io_error(rbio, bio);
-               rbio_update_error_bitmap(rbio, bio);
-+      }
-       bio_put(bio);
-       rbio_dec_io(rbio);
- }
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0012-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch b/topics/raid56-fixes/0012-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch
deleted file mode 100644 (file)
index 523e3df..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-From a4b35a2e9704dbbb331f8931774d6d433c4bffeb Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Tue, 20 Oct 2026 15:52:51 -0400
-Subject: [PATCH 12/12] btrfs: raid56: write back the sectors a sub-stripe
- write repaired
-To: linux-btrfs@vger.kernel.org
-
-A sub-stripe write reads the rest of its full stripe and verifies the data
-sectors that have csums.  It rebuilds the sectors that failed their csum or
-their read, and the sectors of a missing device, and computes the new P and
-Q from the result.  On RAID6 it also finds a stale P, or a stale data
-sector without a csum, by rebuilding again with one more stripe treated as
-failed.  The write phase then writes only the new data, and P and Q of the
-vertical stripes the new data covers.
-
-The repaired sectors stay stale on disk until a read repair or a scrub
-finds them, even though the new parity was computed from their rebuilt
-contents.  Until then the full stripe has one healthy member fewer than it
-seems, and one more lost device loses data that was recoverable.
-
-Write the repaired sectors back in the same write phase:
-
-- a data sector whose rebuild is verified.  It has a csum, or it has none
-  but was rebuilt from P and Q together with a data sector of the same
-  vertical stripe that has one.  The RAID6 retry finds a stale data sector
-  without a csum that way.  A lone rebuild of a sector without a csum comes
-  from parity that nothing checked, and the copy on disk may be the right
-  one, so it is left alone;
-- P or Q that failed its read or was found stale, in the vertical stripes
-  the write does not cover (the others get new P and Q anyway);
-- nothing on a missing device.  The replace target gets the same sectors as
-  its source, as with the other writes.
-
-The write-backs go out with the rest of the write.  A write-back that fails
-leaves its sector as stale as it was before the write, so it does not count
-against the write's tolerance, and the write completes as it did before.
-
-The rbio repairs before it writes anything, so a write-back never retries a
-write that the same rbio just failed.  A write that failed on a member
-within the tolerance leaves its pages in the stripe cache, and the next
-sub-stripe write into that full stripe takes them without reading, so it
-has nothing to repair either.  A write-back can still go to a sector whose
-write by an earlier rbio failed, when that rbio's pages were not cached (a
-full stripe write) or were evicted: then it fails again, or heals the
-sector.  A btrfs_debug line counts the write-backs and the failed ones.
-
-rmw-writeback-test.sh (raid56-wh-harness) puts strips of one full stripe
-back to stale contents, writes into the rest of the stripe, once with
-fsync and once with a plain write(), and reads the members back offline
-before anything else touches them.  The stale strips are, on RAID5, a data
-strip with a csum, alone or also failing its reads; on RAID6, a data strip
-with P, with Q, with a second data strip with a csum, or with a strip of a
-nodatasum file, with the write covering all rows or only some of them.
-Without this patch every repaired strip, and P outside the written rows,
-is still stale after the write in all 18 runs; with it none is, and P and
-Q match the data in every row.  With the stale member failing writes, the
-write-back fails, the write still completes and its data reads back,
-also on RAID5 when the write to P fails as well (counting the failed
-write-back against the tolerance fails that write with -EIO).  A
-nodatasum strip rebuilt from P alone after a read error is not written
-back.
-
-Fixes: 7a3150723061 ("btrfs: raid56: do data csum verification during RMW cycle")
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/raid56.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 152 insertions(+)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index e45e6a6ba2566..1706ec66b05fb 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -2742,10 +2742,153 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
-       return false;
- }
- 
-+/*
-+ * Return true if the rebuild of data sector @sector_nr of @stripe_nr can be
-+ * trusted enough to write it back.  It can when the sector has a csum: the
-+ * rebuild was verified.  Without a csum, it can only when another data sector
-+ * of the same vertical stripe also failed and has a csum: the two were
-+ * rebuilt together from P and Q (on RAID6 that is also how a stale sector
-+ * without a csum is found, see recover_vertical_retry()), and the csum that
-+ * verified one verifies the other.  A lone rebuild without a csum came from
-+ * parity that nothing checked, and the copy on the disk may still be right.
-+ */
-+static bool rmw_repair_verified(struct btrfs_raid_bio *rbio, int stripe_nr,
-+                              int sector_nr)
-+{
-+      if (!rbio->csum_bitmap)
-+              return false;
-+
-+      for (int i = 0; i < rbio->nr_data; i++) {
-+              const int index = rbio_sector_index(rbio, i, sector_nr);
-+
-+              if (!test_bit(index, rbio->csum_bitmap))
-+                      continue;
-+              if (i == stripe_nr || test_bit(index, rbio->error_bitmap))
-+                      return true;
-+      }
-+      return false;
-+}
-+
-+/*
-+ * After the read phase of a sub-stripe write, return the sectors it repaired
-+ * that the write phase should also write back, or NULL if there are none.
-+ *
-+ * recover_sectors() leaves the error bit set on every sector it rebuilt: a
-+ * data sector that failed its csum or its read, every sector of a missing
-+ * device, and the extra stripe that recover_vertical_retry() found stale.
-+ * The rebuilt sectors are in the stripe pages and the new P and Q are
-+ * generated from them, so without a write-back the disk copies stay stale
-+ * until read repair or scrub finds them.
-+ *
-+ * Nothing is written to a missing device.  A data sector is written back only
-+ * if its rebuild is verified (rmw_repair_verified()).  P and Q are generated
-+ * from the data either way, so a failed or stale one is always written back.
-+ *
-+ * This rbio has not written anything yet, so none of these is a retry of a
-+ * write that just failed here.
-+ */
-+static unsigned long *rmw_repaired_sectors(struct btrfs_raid_bio *rbio)
-+{
-+      unsigned long *repaired = NULL;
-+      int total_sector_nr;
-+
-+      for_each_set_bit(total_sector_nr, rbio->error_bitmap, rbio->nr_sectors) {
-+              const int stripe = total_sector_nr / rbio->stripe_nsectors;
-+              const int sectornr = total_sector_nr % rbio->stripe_nsectors;
-+
-+              if (!rbio->bioc->stripes[stripe].dev->bdev)
-+                      continue;
-+              if (stripe < rbio->nr_data &&
-+                  !rmw_repair_verified(rbio, stripe, sectornr))
-+                      continue;
-+
-+              if (!repaired) {
-+                      /* Without memory the sectors just stay stale on disk. */
-+                      repaired = bitmap_zalloc(rbio->nr_sectors, GFP_NOFS);
-+                      if (!repaired)
-+                              return NULL;
-+              }
-+              set_bit(total_sector_nr, repaired);
-+      }
-+      return repaired;
-+}
-+
-+/*
-+ * Add write bios for the repaired sectors that the write phase does not write
-+ * anyway: data sectors no bio of this rbio covers, and P/Q outside the
-+ * vertical stripes being written.  The others are dropped from @repaired.
-+ * The replace target gets the same sectors as its source.
-+ */
-+static int rmw_assemble_repair_bios(struct btrfs_raid_bio *rbio,
-+                                  struct bio_list *bio_list,
-+                                  unsigned long *repaired)
-+{
-+      int total_sector_nr;
-+      int ret;
-+
-+      for_each_set_bit(total_sector_nr, repaired, rbio->nr_sectors) {
-+              const int stripe = total_sector_nr / rbio->stripe_nsectors;
-+              const int sectornr = total_sector_nr % rbio->stripe_nsectors;
-+              phys_addr_t *paddrs;
-+              bool written;
-+
-+              if (stripe < rbio->nr_data)
-+                      written = sector_paddrs_in_rbio(rbio, stripe, sectornr, 1);
-+              else
-+                      written = test_bit(sectornr, &rbio->dbitmap);
-+              if (written) {
-+                      clear_bit(total_sector_nr, repaired);
-+                      continue;
-+              }
-+
-+              paddrs = rbio_stripe_paddrs(rbio, stripe, sectornr);
-+              ret = rbio_add_io_paddrs(rbio, bio_list, paddrs, stripe,
-+                                       sectornr, REQ_OP_WRITE);
-+              if (ret)
-+                      goto error;
-+
-+              if (likely(!rbio->bioc->replace_nr_stripes) ||
-+                  stripe != rbio->bioc->replace_stripe_src)
-+                      continue;
-+              ret = rbio_add_io_paddrs(rbio, bio_list, paddrs,
-+                                       rbio->real_stripes, sectornr,
-+                                       REQ_OP_WRITE);
-+              if (ret)
-+                      goto error;
-+      }
-+      return 0;
-+error:
-+      bio_list_put(bio_list);
-+      return -EIO;
-+}
-+
-+/*
-+ * A write-back that fails leaves the sector as stale as it was before this
-+ * write, so it does not count against the tolerance of the write itself.
-+ */
-+static void rmw_finish_repair_bios(struct btrfs_raid_bio *rbio,
-+                                 unsigned long *repaired)
-+{
-+      int written = 0;
-+      int failed = 0;
-+      int total_sector_nr;
-+
-+      for_each_set_bit(total_sector_nr, repaired, rbio->nr_sectors) {
-+              written++;
-+              if (test_and_clear_bit(total_sector_nr, rbio->error_bitmap))
-+                      failed++;
-+      }
-+      if (written)
-+              btrfs_debug_rl(rbio->bioc->fs_info,
-+      "sub-stripe write for full stripe %llu wrote back %d repaired sectors, %d failed",
-+                             rbio->bioc->full_stripe_logical, written, failed);
-+}
-+
- static void rmw_rbio(struct btrfs_raid_bio *rbio)
- {
-       struct bio_list bio_list;
-       int sectornr;
-+      unsigned long *repaired = NULL;
-       int ret = 0;
- 
-       /*
-@@ -2774,6 +2917,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
-               ret = rmw_read_wait_recover(rbio);
-               if (ret < 0)
-                       goto out;
-+              repaired = rmw_repaired_sectors(rbio);
-       }
- 
-       /*
-@@ -2807,11 +2951,18 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
-       ret = rmw_assemble_write_bios(rbio, &bio_list);
-       if (ret < 0)
-               goto out;
-+      if (repaired) {
-+              ret = rmw_assemble_repair_bios(rbio, &bio_list, repaired);
-+              if (ret < 0)
-+                      goto out;
-+      }
- 
-       /* We should have at least one bio assembled. */
-       ASSERT(bio_list_size(&bio_list));
-       submit_write_bios(rbio, &bio_list);
-       rbio_wait_io(rbio);
-+      if (repaired)
-+              rmw_finish_repair_bios(rbio, repaired);
- 
-       /* We may have more errors than our tolerance during the read. */
-       for (sectornr = 0; sectornr < rbio->stripe_nsectors; sectornr++) {
-@@ -2842,6 +2993,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
-               /* Failed write, don't cache for page stealing. */
-               clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags);
-       }
-+      bitmap_free(repaired);
-       rbio_orig_end_io(rbio, errno_to_blk_status(ret));
- }
- 
--- 
-2.47.3
-
index 78feb5ce983de11d67e6ec49c40f3dbf537ae5d6..5334775ba9dfade5dd42ba5fcee4b820584c517e 100644 (file)
@@ -1,6 +1,6 @@
-From 7ec955fbc4dd0c0ae0a87ad4f7d26a03277e9f5d Mon Sep 17 00:00:00 2001
+From 83d98c04f4708f23ff40246812a81a879839b181 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:01 -0400
+Date: Fri, 6 Nov 2026 05:48:15 -0500
 Subject: [PATCH 00/12] btrfs: raid56 scrub and device replace with unrepairable data
 To: linux-btrfs@vger.kernel.org
 
@@ -148,7 +148,6 @@ Zygo Blaxell (12):
  3 files changed, 700 insertions(+), 60 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 prerequisite-patch-id: b8b4a66a0e1de9b1976b16c26f8c5972ce30b1b8
 prerequisite-patch-id: 173b1a1df563e2792318f2be7d1f8ae885566355
 prerequisite-patch-id: b96f5525980fd5dc9349f7854e7fafc21d6b260a
index c1f8c671b6baca88c09ebd49083642e147505724..a227d8521ef426ac2f49b55d368585548a315668 100644 (file)
@@ -1,4 +1,4 @@
-From 611f3c63bf6e68e1dff48605c738cbcfeaaf29ea Mon Sep 17 00:00:00 2001
+From 2e352b4e2262bf7bf73651c4c29c757f076cc17d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 02:32:16 -0400
 Subject: [PATCH 01/12] btrfs: scrub: check raid56 parity of the rows without
@@ -35,7 +35,6 @@ the scrub should fail at all is left to a later change.
 A sector without an extent that could be neither read nor rebuilt makes
 its row bad as well: there is nothing to compute the row's parity from.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 43 ++++++++++++++++++++++++++++++++++++-------
  1 file changed, 36 insertions(+), 7 deletions(-)
index 7c122ed6864b91cac78c3a3f2ad0e095be60ddc6..ebe0da14ba74a1960d56e1669813d0133175c09d 100644 (file)
@@ -1,4 +1,4 @@
-From 31e50e6cc975d985369dd5583acde2591b449a5b Mon Sep 17 00:00:00 2001
+From 69627a3e9d9bfaacfbaa544871480ac421b51639 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 02:32:16 -0400
 Subject: [PATCH 02/12] btrfs: scrub: copy raid56 parity of unrepairable rows
@@ -28,7 +28,6 @@ The commit above does not depend on this one, but a scrub that does not
 fail on unrepaired data does: a replace that carries on past such a row
 would otherwise leave its P/Q unwritten on the target.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 68 +++++++++++++++++++++++++++++++++++++++++++++---
  1 file changed, 65 insertions(+), 3 deletions(-)
index 42c6ef8f2c4b8b6ac99c7a6aebe735f1e1a4e46f..ebe5b191ca4bfe280ab0adb3fe1ffc6f47fd4437 100644 (file)
@@ -1,4 +1,4 @@
-From 78d758e1da37e1d8a5ed6c1365f2469f0b90a0a4 Mon Sep 17 00:00:00 2001
+From 89240c5a59ac9844fb79af9e905a801e87ac6647 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 02:32:17 -0400
 Subject: [PATCH 03/12] btrfs: scrub: copy unrepaired raid56 data sectors to
@@ -33,7 +33,6 @@ copy raid56 parity of unrepairable rows to the replace target", and
 "btrfs: scrub: check raid56 parity of the rows without unrepaired data"
 does not depend on it.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 50 insertions(+)
index 34f29d1f9050c76ff6781d6fce9c99b631cf4890..cb933da8894cb423fafaee1ee8c3bdd930d2adea 100644 (file)
@@ -1,4 +1,4 @@
-From 676b778f2899780d1d45897344ab401971975679 Mon Sep 17 00:00:00 2001
+From 810de2ca25f453fc514c0e4caabb07d93b72e9f8 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 20:33:38 -0400
 Subject: [PATCH 04/12] btrfs: scrub: copy every sector of raid56 data stripes
@@ -46,7 +46,6 @@ with and without stripe_alloc.  With this change all of those sectors
 are written and only the blocks that were unrecoverable before the
 replace return -EIO.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++--
  1 file changed, 85 insertions(+), 2 deletions(-)
index 3293184a5e6e19b07a7316bbea276f5150f6e7a5..4a32e6cef0f6520eb5e4a9697f27c8a190901d71 100644 (file)
@@ -1,4 +1,4 @@
-From 79f1ea957a49d17a2b0df67f16edc724db80aaa8 Mon Sep 17 00:00:00 2001
+From e882e3ea75e2fde264352fb003b7297098cdef29 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 20:33:38 -0400
 Subject: [PATCH 05/12] btrfs: scrub: only avoid the replace source device for
@@ -48,7 +48,6 @@ many bad parity sectors verbatim to the target as replaces without -r
 over bad data and copies exactly as much bad parity as a replace
 without -r.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 17 +++++++++++++----
  1 file changed, 13 insertions(+), 4 deletions(-)
index 3f5bb2f54f3b17ff302489331ff6dcd9de71d835..2764d4a1531484840f3b6e30abb3eaab7ba7f030 100644 (file)
@@ -1,4 +1,4 @@
-From 1c237ec66b90d58a38df79c78cba01e59e401267 Mon Sep 17 00:00:00 2001
+From 2d18337429512a4584356deef9456b191422ea8a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 21:06:45 -0400
 Subject: [PATCH 06/12] btrfs: scrub: read raid56 sectors without an extent
@@ -35,7 +35,6 @@ blocks that were recoverable before the replace, and left 1000-1150
 target sectors holding rebuilt bytes that carried another device's
 damage.  With this change they lose none, like replaces without -r.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 49 insertions(+), 1 deletion(-)
index e35a7e2b9d310b33fa1880aac67b4a3c363803b4..e6aa503460317dc164d87d5cb242e23dc9043e8e 100644 (file)
@@ -1,4 +1,4 @@
-From cf3a5686fa15382a4f3c661ca473ca51d80f9623 Mon Sep 17 00:00:00 2001
+From 363b13af1eb6abbece97da39023f0c669668199b Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 3 Jul 2024 21:00:18 -0400
 Subject: [PATCH 07/12] btrfs: don't abort raid56 data scrub on first
index 8ed2d00feca37d25f57618a3dfd8a58e8a07a420..af345f817c7e40efd6e03fa20b1854612e2ca889 100644 (file)
@@ -1,4 +1,4 @@
-From 3b9f88ff5f4f9171f022f53417905aaf9e11b978 Mon Sep 17 00:00:00 2001
+From 665648e5c5d9ee4c54a2e2c274f6212a400eff1d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 21 Oct 2026 03:59:11 -0400
 Subject: [PATCH 08/12] btrfs: scrub: do not write raid56 parity in a read-only
@@ -22,7 +22,6 @@ after the scrub, and the damage is still counted.  Before: with damaged
 parity, the scrub rewrote it, and a member image changed.
 
 Fixes: 5a6ac9eacb49 ("Btrfs, raid56: support parity scrub on raid56")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/raid56.c | 8 +++++++-
  fs/btrfs/raid56.h | 6 +++++-
@@ -30,10 +29,10 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 14 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index b02c0d533342c..216012c88ad7f 100644
+index e704b31670d2b..9fe3e5ad71deb 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2494,7 +2494,8 @@ static void rmw_rbio_work_locked(struct work_struct *work)
+@@ -2505,7 +2505,8 @@ static void rmw_rbio_work_locked(struct work_struct *work)
  struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
                                struct btrfs_io_context *bioc,
                                struct btrfs_device *scrub_dev,
@@ -43,7 +42,7 @@ index b02c0d533342c..216012c88ad7f 100644
  {
        struct btrfs_fs_info *fs_info = bioc->fs_info;
        struct btrfs_raid_bio *rbio;
-@@ -2525,6 +2526,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
+@@ -2536,6 +2537,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
        ASSERT_RBIO_STRIPE(i < rbio->real_stripes, rbio, i);
  
        bitmap_copy(&rbio->dbitmap, dbitmap, stripe_nsectors);
@@ -51,7 +50,7 @@ index b02c0d533342c..216012c88ad7f 100644
        return rbio;
  }
  
-@@ -2700,6 +2702,10 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2711,6 +2713,10 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
                q_paddr = INVALID_PADDR;
        }
  
index e78ca52705a50cc8530cd3bc9826d636e3536590..b20d5dfb53c994e2179f7ca7b16a3165ddae4bd3 100644 (file)
@@ -1,4 +1,4 @@
-From b659dc5350db5bd2dcd0597bcb64b0182422278e Mon Sep 17 00:00:00 2001
+From b675cd725e399bb978af033461c21e33058e7cf6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 13:43:04 -0400
 Subject: [PATCH 09/12] btrfs: scrub: rebuild a raid6 data stripe that both P
@@ -61,7 +61,6 @@ before the parity write moves ahead of the rebuilt-data writes, and a
 running dev-replace still gets the parity copy.
 
 Fixes: 5a6ac9eacb49 ("Btrfs, raid56: support parity scrub on raid56")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/raid56.c | 229 ++++++++++++++++++++++++++++++++++++++++++----
  fs/btrfs/raid56.h |   8 ++
@@ -69,7 +68,7 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 238 insertions(+), 20 deletions(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 216012c88ad7f..13f70a4165297 100644
+index 9fe3e5ad71deb..d618c754f38ba 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -9,6 +9,7 @@
@@ -88,7 +87,7 @@ index 216012c88ad7f..13f70a4165297 100644
        bitmap_free(rbio->stripe_uptodate_bitmap);
        kfree(rbio->stripe_pages);
        kfree(rbio->bio_paddrs);
-@@ -2504,6 +2506,11 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
+@@ -2515,6 +2517,11 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
        rbio = alloc_rbio(fs_info, bioc);
        if (IS_ERR(rbio))
                return NULL;
@@ -100,7 +99,7 @@ index 216012c88ad7f..13f70a4165297 100644
        bio_list_add(&rbio->bio_list, bio);
        /*
         * This is a special bio which is used to hold the completion handler
-@@ -2573,16 +2580,13 @@ static int alloc_rbio_essential_pages(struct btrfs_raid_bio *rbio)
+@@ -2584,16 +2591,13 @@ static int alloc_rbio_essential_pages(struct btrfs_raid_bio *rbio)
        return 0;
  }
  
@@ -120,7 +119,7 @@ index 216012c88ad7f..13f70a4165297 100644
  
        ASSERT(step_nr < rbio->sector_nsteps);
  
-@@ -2602,36 +2606,166 @@ static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
+@@ -2613,36 +2617,166 @@ static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
                xor_gen(pointers[nr_data], pointers + 1, nr_data - 1, step);
        }
  
@@ -297,7 +296,7 @@ index 216012c88ad7f..13f70a4165297 100644
  }
  
  static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-@@ -2647,6 +2781,9 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2658,6 +2792,9 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
        phys_addr_t q_paddr = INVALID_PADDR;
        struct bio_list bio_list;
        bool is_replace = false;
@@ -307,7 +306,7 @@ index 216012c88ad7f..13f70a4165297 100644
        int ret;
  
        bio_list_init(&bio_list);
-@@ -2687,12 +2824,27 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2698,12 +2835,27 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
                pointers[rbio->real_stripes - 1] = kmap_local_paddr(q_paddr);
        }
  
@@ -337,7 +336,7 @@ index 216012c88ad7f..13f70a4165297 100644
  
        kunmap_local(pointers[nr_data]);
        __free_page(phys_to_page(p_paddr));
-@@ -2708,12 +2860,32 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2719,12 +2871,32 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
  
        /*
         * After a transaction abort or another filesystem error, write
@@ -372,7 +371,7 @@ index 216012c88ad7f..13f70a4165297 100644
        /*
         * time to start writing.  Make bios for everything from the
         * higher layers (the bio_list in our rbio) and our p/q.  Ignore
-@@ -2944,6 +3116,23 @@ void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio)
+@@ -2955,6 +3127,23 @@ void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio)
                start_async_work(rbio, scrub_rbio_work_locked);
  }
  
index c5341858fdb2086b18de6becc0987b36abd73e83..e1fb6bd1dba1bea8379fe7b1d417d38c99eb4bce 100644 (file)
@@ -1,4 +1,4 @@
-From 31742d9026ead87e06df4ed3028d6f209af68b8b Mon Sep 17 00:00:00 2001
+From 3bdeb4e44df0e1f4bbddddcc77383b8288b4942c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 16:15:58 -0400
 Subject: [PATCH 10/12] btrfs: scrub: count raid56 parity mismatches as
@@ -44,7 +44,6 @@ corrected_errors, and neither does a scrub after a transaction abort or
 another filesystem error, which writes nothing back
 (btrfs_can_submit_repair_write()).
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/raid56.c | 51 +++++++++++++++++++++++++++++++++++++++++++----
  fs/btrfs/raid56.h |  5 ++++-
@@ -52,10 +51,10 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 58 insertions(+), 6 deletions(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 13f70a4165297..27b189a7fbeb4 100644
+index d618c754f38ba..e3777f8af6b31 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2497,7 +2497,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
+@@ -2508,7 +2508,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
                                struct btrfs_io_context *bioc,
                                struct btrfs_device *scrub_dev,
                                unsigned long *dbitmap, int stripe_nsectors,
@@ -64,7 +63,7 @@ index 13f70a4165297..27b189a7fbeb4 100644
  {
        struct btrfs_fs_info *fs_info = bioc->fs_info;
        struct btrfs_raid_bio *rbio;
-@@ -2534,6 +2534,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
+@@ -2545,6 +2545,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
  
        bitmap_copy(&rbio->dbitmap, dbitmap, stripe_nsectors);
        rbio->scrub_readonly = readonly;
@@ -72,7 +71,7 @@ index 13f70a4165297..27b189a7fbeb4 100644
        return rbio;
  }
  
-@@ -2768,6 +2769,37 @@ static int verify_one_parity_sector(struct btrfs_raid_bio *rbio,
+@@ -2779,6 +2780,37 @@ static int verify_one_parity_sector(struct btrfs_raid_bio *rbio,
        return -1;
  }
  
@@ -110,7 +109,7 @@ index 13f70a4165297..27b189a7fbeb4 100644
  static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
  {
        struct btrfs_io_context *bioc = rbio->bioc;
-@@ -2782,6 +2814,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2793,6 +2825,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
        struct bio_list bio_list;
        bool is_replace = false;
        unsigned long read_errors = 0;
@@ -118,7 +117,7 @@ index 13f70a4165297..27b189a7fbeb4 100644
        unsigned long rebuilt = 0;
        u8 rebuilt_stripe[BITS_PER_LONG];
        int ret;
-@@ -2826,11 +2859,20 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2837,11 +2870,20 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
  
        /*
         * Rows with a read error were rebuilt by recover_scrub_rbio(): do not
@@ -142,7 +141,7 @@ index 13f70a4165297..27b189a7fbeb4 100644
  
        bitmap_clear(rbio->error_bitmap, 0, rbio->nr_sectors);
  
-@@ -2845,6 +2887,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2856,6 +2898,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
                        rebuilt_stripe[sectornr] = stripe;
                }
        }
index 2b3de817274a6ce72a493f6f53da30adb1f04f35..5150c0e168bdd7bc3cb87807248c83f96b80ae30 100644 (file)
@@ -1,4 +1,4 @@
-From 17bd70d878da91e41a87a12f8802f01e010aa203 Mon Sep 17 00:00:00 2001
+From f2007666c39f1d24fb4806bc12d38d08deb3e3aa Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 22:15:15 -0400
 Subject: [PATCH 11/12] btrfs: scrub: name the device a raid56 data sector was
@@ -26,7 +26,6 @@ every scrub order.  Before: 1 to 8 of up to 10 lines named another
 member, always the predicted stripes[0].
 
 Fixes: 0096580713ff ("btrfs: scrub: introduce error reporting functionality for scrub_stripe")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 31 +++++++------------------------
  1 file changed, 7 insertions(+), 24 deletions(-)
index 44145c43172e07df57ab094f0268afe722e758fc..483278746c0776580520e6011ae8631ef2e02da8 100644 (file)
@@ -1,4 +1,4 @@
-From 7ec955fbc4dd0c0ae0a87ad4f7d26a03277e9f5d Mon Sep 17 00:00:00 2001
+From 83d98c04f4708f23ff40246812a81a879839b181 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 22:15:16 -0400
 Subject: [PATCH 12/12] btrfs: scrub: count the raid56 data repairs made by a
@@ -51,7 +51,6 @@ neither reported nor counted then, and the read repair worker's write-back
 keeps that check next to the own-scrub test.
 
 Fixes: 1009254bf22a ("btrfs: scrub: use scrub_stripe to implement RAID56 P/Q scrub")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 107 +++++++++++++++++++++++++++++++++++++++++++++--
  1 file changed, 104 insertions(+), 3 deletions(-)
index c88972a914381752fb2d1d0c30036abfa2958869..dacbe5aef8901f701c0575c0dd3aa35b5ea1d0ec 100644 (file)
@@ -1,6 +1,6 @@
-From 76eb4edbade0c6ba280af99ef5e91f204e04d6d4 Mon Sep 17 00:00:00 2001
+From fb0dade563cf4400faf384e6478eb40305e775e3 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:05 -0400
+Date: Fri, 6 Nov 2026 05:48:17 -0500
 Subject: [PATCH 0/9] btrfs: read policies and per-device read stats (Kai Krakow's series)
 To: linux-btrfs@vger.kernel.org
 
@@ -38,7 +38,6 @@ Kai Krakow (9):
  6 files changed, 510 insertions(+), 32 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index a31a8a7e5564b41cb48a85cfbcb114f9a20d2445..aa499a533f9ca9a6140434a8f9bfabf0bbd35816 100644 (file)
@@ -1,4 +1,4 @@
-From d71e118b9173507fe36a00a13a74f7b06119d206 Mon Sep 17 00:00:00 2001
+From d2ba4d2c53282f3d54bcc364f0ada121c17ebb02 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 11 Jul 2026 00:44:51 +0200
 Subject: [PATCH 1/9] btrfs: add io read stats per device to devinfo
@@ -99,10 +99,10 @@ index 89b0a4ef4063e..da3c434cd858b 100644
        BTRFS_ATTR_PTR(devid, fsid),
        BTRFS_ATTR_PTR(devid, in_fs_metadata),
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index ce78a9441c64f..1ee88bb257ac1 100644
+index 3d4ef6725de0e..ea8461bc7d82c 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6682,6 +6682,15 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6694,6 +6694,15 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        else
                num_stripes = map->num_stripes;
  
@@ -118,7 +118,7 @@ index ce78a9441c64f..1ee88bb257ac1 100644
        switch (policy) {
        default:
                /* Shouldn't happen, just warn and use pid instead of failing */
-@@ -6717,14 +6726,29 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6729,14 +6738,29 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        for (tolerance = 0; tolerance < 2; tolerance++) {
                if (map->stripes[preferred_mirror].dev->bdev &&
                    (tolerance || map->stripes[preferred_mirror].dev != srcdev))
@@ -152,7 +152,7 @@ index ce78a9441c64f..1ee88bb257ac1 100644
         * and the io error handling code will clean up eventually
         */
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 75b1179776c80..d065cec44e547 100644
+index 891bc2432870a..281ce92af1822 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -217,6 +217,14 @@ struct btrfs_device {
index 4fbb1cc8ee543c473829481cd1c0ff007a852a0c..feef3e0f658dd2541e77449b01906cd7eead78fe 100644 (file)
@@ -1,4 +1,4 @@
-From 59bb2938019d6749f1eb2244d592bacb2d5ca6ca Mon Sep 17 00:00:00 2001
+From 73f9b169786d3abbad108db8ce63b4b6edecab65 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 13 Dec 2025 18:34:36 +0100
 Subject: [PATCH 2/9] btrfs: move read policies out of experimental
@@ -196,10 +196,10 @@ index 05498e5346c39..abc5ac356c8dc 100644
  
  #endif
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 1ee88bb257ac1..983f4d7910bc6 100644
+index ea8461bc7d82c..1d30b6a99b4d7 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -1293,7 +1293,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices,
+@@ -1295,7 +1295,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices,
        fs_devices->latest_dev = latest_dev;
        fs_devices->total_rw_bytes = 0;
        fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR;
@@ -208,7 +208,7 @@ index 1ee88bb257ac1..983f4d7910bc6 100644
        fs_devices->rr_min_contig_read = BTRFS_DEFAULT_RR_MIN_CONTIG_READ;
        fs_devices->read_devid = latest_dev->devid;
        fs_devices->read_policy = btrfs_read_policy_to_enum(btrfs_get_mod_read_policy(),
-@@ -1309,7 +1309,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices,
+@@ -1311,7 +1311,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices,
        }
  #else
        fs_devices->read_policy = BTRFS_READ_POLICY_PID;
@@ -217,7 +217,7 @@ index 1ee88bb257ac1..983f4d7910bc6 100644
  
        return 0;
  }
-@@ -6593,7 +6593,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
+@@ -6605,7 +6605,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
        return len;
  }
  
@@ -226,7 +226,7 @@ index 1ee88bb257ac1..983f4d7910bc6 100644
  static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first, int num_stripes)
  {
        for (int index = first; index < first + num_stripes; index++) {
-@@ -6661,7 +6661,7 @@ static int btrfs_read_rr(const struct btrfs_chunk_map *map, int first, int num_s
+@@ -6673,7 +6673,7 @@ static int btrfs_read_rr(const struct btrfs_chunk_map *map, int first, int num_s
        read_cycle = total_reads / min_reads_per_dev;
        return stripes[read_cycle % num_stripes].num;
  }
@@ -235,7 +235,7 @@ index 1ee88bb257ac1..983f4d7910bc6 100644
  
  static int find_live_mirror(struct btrfs_fs_info *fs_info,
                            struct btrfs_chunk_map *map, int first,
-@@ -6701,14 +6701,14 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6713,14 +6713,14 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        case BTRFS_READ_POLICY_PID:
                preferred_mirror = first + (current->pid % num_stripes);
                break;
@@ -253,7 +253,7 @@ index 1ee88bb257ac1..983f4d7910bc6 100644
  
        if (dev_replace_is_ongoing &&
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index d065cec44e547..fc9bc3f462795 100644
+index 281ce92af1822..8e888f2e0a1f3 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -334,12 +334,12 @@ enum btrfs_chunk_allocation_policy {
index eb8e96a79756d2d17b5150caaa8b729e51f00eee..e408b4c9b6595ac1f14359da3c86f320112045b1 100644 (file)
@@ -1,4 +1,4 @@
-From 336671af9065554471666f16177c5bb3ab8c94c0 Mon Sep 17 00:00:00 2001
+From 3e4fac65c6c3ffa2f56255b250abbd83c77bedcf Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Fri, 25 Apr 2025 21:46:52 +0200
 Subject: [PATCH 3/9] btrfs: add in-flight queue read policy
@@ -42,7 +42,7 @@ index 59e0d97e7ee64..c851f6c44207b 100644
  
  int btrfs_read_policy_to_enum(const char *str, s64 *value_ret)
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 983f4d7910bc6..f94e9a2f58e3b 100644
+index 1d30b6a99b4d7..e54100aae37df 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -35,6 +35,10 @@
@@ -56,7 +56,7 @@ index 983f4d7910bc6..f94e9a2f58e3b 100644
  #define BTRFS_BLOCK_GROUP_STRIPE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
                                         BTRFS_BLOCK_GROUP_RAID10 | \
                                         BTRFS_BLOCK_GROUP_RAID56_MASK)
-@@ -6594,6 +6598,50 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
+@@ -6606,6 +6610,50 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
  }
  
  #ifdef CONFIG_BTRFS_READ_POLICIES
@@ -107,7 +107,7 @@ index 983f4d7910bc6..f94e9a2f58e3b 100644
  static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first, int num_stripes)
  {
        for (int index = first; index < first + num_stripes; index++) {
-@@ -6705,6 +6753,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6717,6 +6765,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        case BTRFS_READ_POLICY_RR:
                preferred_mirror = btrfs_read_rr(map, first, num_stripes);
                break;
@@ -119,7 +119,7 @@ index 983f4d7910bc6..f94e9a2f58e3b 100644
                preferred_mirror = btrfs_read_preferred(map, first, num_stripes);
                break;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index fc9bc3f462795..e81d80273254c 100644
+index 8e888f2e0a1f3..5c514dbb23884 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -337,6 +337,8 @@ enum btrfs_read_policy {
index c6eac75618904c99ed3f60920a904b5ccc17cea9..b46630f179322e7da832b2aa18e9dc2e21579632 100644 (file)
@@ -1,4 +1,4 @@
-From e2cbe223f5f6d86fd739745b8ba86f84b582883e Mon Sep 17 00:00:00 2001
+From fa4f23204bf16cb4ea0414b777988d6798abd761 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Thu, 9 Jul 2026 12:35:14 +0200
 Subject: [PATCH 4/9] btrfs: move age io stat out of
@@ -17,10 +17,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  2 files changed, 10 insertions(+), 5 deletions(-)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index f94e9a2f58e3b..42d537ef1b67f 100644
+index e54100aae37df..cee81fabe8a56 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6730,14 +6730,17 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6742,14 +6742,17 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        else
                num_stripes = map->num_stripes;
  
@@ -40,7 +40,7 @@ index f94e9a2f58e3b..42d537ef1b67f 100644
  
        switch (policy) {
        default:
-@@ -6789,17 +6792,19 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6801,17 +6804,19 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        }
  
  out:
@@ -63,7 +63,7 @@ index f94e9a2f58e3b..42d537ef1b67f 100644
        /* we couldn't find one that doesn't fail.  Just return something
         * and the io error handling code will clean up eventually
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index e81d80273254c..5b94161023664 100644
+index 5c514dbb23884..283ca70777bc9 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -218,10 +218,10 @@ struct btrfs_device {
index d3eff54363ca07b65cfde3fa2c466cda04bb2a0e..07cca8ce38523b8027a8225d62c1553912f7bf05 100644 (file)
@@ -1,4 +1,4 @@
-From 63b6f0773c9843cb6af29e4fb0cfa240b9fd58fd Mon Sep 17 00:00:00 2001
+From c13710a35849be014e5f30f2ac1cf07e353f9465 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Thu, 9 Jul 2026 12:27:18 +0200
 Subject: [PATCH 5/9] btrfs: break queue read ties by mirror age
@@ -25,10 +25,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  1 file changed, 23 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 42d537ef1b67f..c14768795cda1 100644
+index cee81fabe8a56..dbf33e8bd3e12 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6613,28 +6613,48 @@ static unsigned int part_in_flight(struct block_device *part)
+@@ -6625,28 +6625,48 @@ static unsigned int part_in_flight(struct block_device *part)
        return inflight;
  }
  
index 77cf60f8754f21faedcfed21bba6fc86998e67e1..d3f2b85e69a1608cce6aac1db728ba67ac9a1fdf 100644 (file)
@@ -1,4 +1,4 @@
-From c5a0115e99bd21233fd97e891cb651f5e03d077e Mon Sep 17 00:00:00 2001
+From a8ef24e95145c4f15597204870eaa4268d201456 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Thu, 9 Jul 2026 13:10:10 +0200
 Subject: [PATCH 6/9] btrfs: add read latency health stats to per-device io
@@ -69,7 +69,7 @@ index c851f6c44207b..aa7cac991e684 100644
  BTRFS_ATTR(devid, read_stats, btrfs_devinfo_read_stats_show);
  #endif /* CONFIG_BTRFS_PER_DEVICE_IO_STATS */
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index c14768795cda1..d7bbe94175c2d 100644
+index dbf33e8bd3e12..372c54c212461 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -35,9 +35,12 @@
@@ -87,7 +87,7 @@ index c14768795cda1..d7bbe94175c2d 100644
  
  #define BTRFS_BLOCK_GROUP_STRIPE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
                                         BTRFS_BLOCK_GROUP_RAID10 | \
-@@ -6662,6 +6665,77 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6674,6 +6677,77 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
        return best_stripe;
  }
  
@@ -165,7 +165,7 @@ index c14768795cda1..d7bbe94175c2d 100644
  static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first, int num_stripes)
  {
        for (int index = first; index < first + num_stripes; index++) {
-@@ -6762,6 +6836,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6774,6 +6848,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        }
  #endif /* CONFIG_BTRFS_READ_POLICIES || CONFIG_BTRFS_PER_DEVICE_IO_STATS */
  
@@ -177,7 +177,7 @@ index c14768795cda1..d7bbe94175c2d 100644
        default:
                /* Shouldn't happen, just warn and use pid instead of failing */
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 5b94161023664..c06dc6b33c839 100644
+index 283ca70777bc9..d4290428d2746 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -224,6 +224,21 @@ struct btrfs_device {
index b101dd210cc398f4951c1ad8b82e23e5505c2f7c..c1e43dd0d54e98bba051a80e7ff6b949bfdcd39b 100644 (file)
@@ -1,4 +1,4 @@
-From 115e32a72555b6abce8a4ee8715fb71ce28976aa Mon Sep 17 00:00:00 2001
+From 933d763ddff40722bb4c6614d6c1ce5cae13e55c Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Wed, 8 Jul 2026 16:38:51 +0200
 Subject: [PATCH 7/9] btrfs: add queue-adaptive read policy
@@ -141,7 +141,7 @@ index aa7cac991e684..953b47cbf38ea 100644
  BTRFS_ATTR(devid, read_stats, btrfs_devinfo_read_stats_show);
  #endif /* CONFIG_BTRFS_PER_DEVICE_IO_STATS */
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index d7bbe94175c2d..245ae1ef7b363 100644
+index 372c54c212461..9fdcb16c46469 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -36,11 +36,9 @@
@@ -157,7 +157,7 @@ index d7bbe94175c2d..245ae1ef7b363 100644
  
  #define BTRFS_BLOCK_GROUP_STRIPE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
                                         BTRFS_BLOCK_GROUP_RAID10 | \
-@@ -6665,9 +6663,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6677,9 +6675,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
        return best_stripe;
  }
  
@@ -168,7 +168,7 @@ index d7bbe94175c2d..245ae1ef7b363 100644
  #define BTRFS_READ_HEALTH_RECHECK_INTERVAL    HZ
  #define BTRFS_READ_HEALTH_MIN_SAMPLE_IOS      256ULL
  
-@@ -6675,6 +6672,15 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6687,6 +6684,15 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
   * Refresh the cached windowed avg read latency for the current candidates.
   * The avg is a delta against the previous checkpoint, not a lifetime average,
   * so unrelated bulk reads can only skew the current window.
@@ -184,7 +184,7 @@ index d7bbe94175c2d..245ae1ef7b363 100644
   */
  static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
                                     int num_stripes)
-@@ -6730,11 +6736,129 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6742,11 +6748,129 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
                atomic64_set(&device->health_avg_ns, div64_u64(delta_wait, delta_ios));
                atomic64_set(&device->health_check_ios, read_ios);
                atomic64_set(&device->health_check_wait, read_wait);
@@ -316,7 +316,7 @@ index d7bbe94175c2d..245ae1ef7b363 100644
  
  static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first, int num_stripes)
  {
-@@ -6836,10 +6960,6 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6848,10 +6972,6 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        }
  #endif /* CONFIG_BTRFS_READ_POLICIES || CONFIG_BTRFS_PER_DEVICE_IO_STATS */
  
@@ -327,7 +327,7 @@ index d7bbe94175c2d..245ae1ef7b363 100644
        switch (policy) {
        default:
                /* Shouldn't happen, just warn and use pid instead of failing */
-@@ -6858,6 +6978,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6870,6 +6990,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
                preferred_mirror = btrfs_read_earliest(fs_info, map, first,
                                                       num_stripes);
                break;
@@ -339,7 +339,7 @@ index d7bbe94175c2d..245ae1ef7b363 100644
                preferred_mirror = btrfs_read_preferred(map, first, num_stripes);
                break;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index c06dc6b33c839..211b406ab3413 100644
+index d4290428d2746..4d281da89ac94 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -225,6 +225,14 @@ struct btrfs_device {
index fd231a1ae94ce2ccdc2e3fdd6d4bc46a8b908350..f53e7fd01df2a831e634c3db648481fb907e92ca 100644 (file)
@@ -1,4 +1,4 @@
-From 03489adc8d7f8a8fba8c8c48b642acdef4573c64 Mon Sep 17 00:00:00 2001
+From 8a440b21ffeb0a45c2e26e0866175fbf581e3092 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sun, 12 Jul 2026 14:15:19 +0200
 Subject: [PATCH 8/9] btrfs: scale adaptive queue guard with latency
@@ -24,10 +24,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  1 file changed, 27 insertions(+), 10 deletions(-)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 245ae1ef7b363..5cbec0f704129 100644
+index 9fdcb16c46469..52483d9988f72 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6663,7 +6663,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6675,7 +6675,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
        return best_stripe;
  }
  
@@ -37,7 +37,7 @@ index 245ae1ef7b363..5cbec0f704129 100644
  
  #define BTRFS_READ_HEALTH_RECHECK_INTERVAL    HZ
  #define BTRFS_READ_HEALTH_MIN_SAMPLE_IOS      256ULL
-@@ -6758,14 +6759,14 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6770,14 +6771,14 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
   * so it can never be stale from a different mirror pairing on a larger
   * pool. If the in-flight winner is not derived-slow, done. If it is,
   * it's only trusted when its in-flight lead over the best non-slow
@@ -60,7 +60,7 @@ index 245ae1ef7b363..5cbec0f704129 100644
   */
  static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
                                      struct btrfs_chunk_map *map, int first,
-@@ -6781,6 +6782,8 @@ static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
+@@ -6793,6 +6794,8 @@ static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
        u64 best_healthy_inflight = U64_MAX;
        u64 best_healthy_age = 0;
        int best_healthy_stripe = -1;
@@ -69,7 +69,7 @@ index 245ae1ef7b363..5cbec0f704129 100644
  
        btrfs_update_read_health(map, first, num_stripes);
  
-@@ -6848,7 +6851,21 @@ static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
+@@ -6860,7 +6863,21 @@ static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
                return best_stripe;
        if (best_healthy_stripe < 0)
                return best_stripe; /* every candidate derived-slow, no alternative */
index 4091ce225c5f07469b78e858fd04c88b0bc93ef6..fe2a5c881fabc718dcd24af4f5e2dc8cd6db655b 100644 (file)
@@ -1,4 +1,4 @@
-From 76eb4edbade0c6ba280af99ef5e91f204e04d6d4 Mon Sep 17 00:00:00 2001
+From fb0dade563cf4400faf384e6478eb40305e775e3 Mon Sep 17 00:00:00 2001
 From: Kai Krakow <kai@kaishome.de>
 Date: Sat, 18 Jul 2026 18:15:38 +0200
 Subject: [PATCH 9/9] btrfs: count unstable read health snapshots
@@ -48,10 +48,10 @@ index 953b47cbf38ea..ec077db33ee4f 100644
  BTRFS_ATTR(devid, read_stats, btrfs_devinfo_read_stats_show);
  #endif /* CONFIG_BTRFS_PER_DEVICE_IO_STATS */
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 5cbec0f704129..63b646073e423 100644
+index 52483d9988f72..ae2bf25f3130b 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6709,6 +6709,10 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6721,6 +6721,10 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
                    checked_jiffies)
                        continue;
  
@@ -62,7 +62,7 @@ index 5cbec0f704129..63b646073e423 100644
                /*
                 * ios is updated before nsecs. Bracket the wait read to reject a
                 * completion that could pair newer wait time with an older io count.
-@@ -6716,8 +6720,12 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6728,8 +6732,12 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
                read_ios_before = part_stat_read(device->bdev, ios[READ]);
                read_wait = part_stat_read(device->bdev, nsecs[READ]);
                read_ios = part_stat_read(device->bdev, ios[READ]);
@@ -77,7 +77,7 @@ index 5cbec0f704129..63b646073e423 100644
                checked_ios = atomic64_read(&device->health_check_ios);
                checked_wait = atomic64_read(&device->health_check_wait);
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 211b406ab3413..0234e95d845a0 100644
+index 4d281da89ac94..6c707e2bb73b0 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -230,6 +230,12 @@ struct btrfs_device {
index 70f87d1d069bde216891493a01d00f8f4cad78c6..bb4fc281982b6c0d239368f90ee7d0dde04b623c 100644 (file)
@@ -1,6 +1,6 @@
-From 72e09512671c6dbee47d35aad0fa6f98073fcb4e Mon Sep 17 00:00:00 2001
+From eed1056fffd707affeac38415f2abe5f8d9f8e12 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:01 -0400
+Date: Fri, 6 Nov 2026 05:48:15 -0500
 Subject: [PATCH 0/4] btrfs: read repair and scrub after a transaction abort
 To: linux-btrfs@vger.kernel.org
 
@@ -74,7 +74,6 @@ Zygo Blaxell (4):
  4 files changed, 56 insertions(+), 3 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index c370a3240e84e3745e189db4a5a14eba8d6c3cdc..154f37c223ae93f2741c6c1eea34c4a87dcf2895 100644 (file)
@@ -1,4 +1,4 @@
-From 13a9bbefab5769fb053c1cc67534ee62761840a5 Mon Sep 17 00:00:00 2001
+From c109be9feb88a61103c0d57bb50b452a30e5fa15 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 02:16:13 -0400
 Subject: [PATCH 1/4] btrfs: give the read repair bio an end_io for submit
@@ -53,7 +53,6 @@ the failed_bio, and free the repair bio.  The read then fails with -EIO.
 
 Fixes: 7609afac6775 ("btrfs: handle checksum validation and repair at the storage layer")
 Cc: stable@vger.kernel.org # 6.6+
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/bio.c | 22 +++++++++++++++++++++-
  1 file changed, 21 insertions(+), 1 deletion(-)
index 631fd82480d5f5f561ae614e54e69f00986d827f..91b15ecc8c115c5c0a4d317bdefcc52d35c3b4f9 100644 (file)
@@ -1,4 +1,4 @@
-From a4071d1bdf4f3024c37b6c213fc462bf8383c4c0 Mon Sep 17 00:00:00 2001
+From 13969538d7fcfa9fcde07a6fbbe22d39e9aa0709 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 14:31:46 -0400
 Subject: [PATCH 2/4] btrfs: look up a repair read's csums in the same root as
@@ -41,7 +41,6 @@ the read returns the file's data.
 
 Fixes: f07b855c56b1 ("btrfs: try to search for data csums in commit root")
 Cc: stable@vger.kernel.org # 6.18+
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/bio.c | 7 +++++++
  1 file changed, 7 insertions(+)
index 2b9f41932084a4c312c2075d43248452c10ea572..7843b73555d4a7d5581d2a6e973f2400e94163f7 100644 (file)
@@ -1,4 +1,4 @@
-From e3d9b5c617267b110c72f9294b3d5462697bdf0f Mon Sep 17 00:00:00 2001
+From e8210eab80ce0bad9006169433522b6438511cca Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 14:31:48 -0400
 Subject: [PATCH 3/4] btrfs: do not write back a read repair after a
@@ -38,7 +38,6 @@ corrupt copy stays as it was.
 
 Fixes: 8ceaad6cd6e7 ("btrfs: do not ASSERT() when the fs flips RO inside btrfs_repair_io_failure()")
 Fixes: 9b2839451dfc ("btrfs: introduce a new shutdown state")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/bio.c |  2 +-
  fs/btrfs/fs.h  | 13 +++++++++++++
index 75753153493cdbccc5704b339744bde6e6672f67..94081695ff19811c8aef303d0f9402449cc9d8d8 100644 (file)
@@ -1,4 +1,4 @@
-From 72e09512671c6dbee47d35aad0fa6f98073fcb4e Mon Sep 17 00:00:00 2001
+From eed1056fffd707affeac38415f2abe5f8d9f8e12 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 14:31:49 -0400
 Subject: [PATCH 4/4] btrfs: scrub: do not write back repairs after a
@@ -34,17 +34,16 @@ The parity scrub of raid56 checks the same: its parity write-back is
 skipped too, and its copy to a dev-replace target still goes out.
 
 Fixes: 54765392a1b9 ("btrfs: scrub: introduce helper to queue a stripe for scrub")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/raid56.c | 9 +++++++++
  fs/btrfs/scrub.c  | 6 +++++-
  2 files changed, 14 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 7dd937fa0c262..b02c0d533342c 100644
+index a8a8004bb14c7..e704b31670d2b 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2700,6 +2700,14 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2711,6 +2711,14 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
                q_paddr = INVALID_PADDR;
        }
  
@@ -59,7 +58,7 @@ index 7dd937fa0c262..b02c0d533342c 100644
        /*
         * time to start writing.  Make bios for everything from the
         * higher layers (the bio_list in our rbio) and our p/q.  Ignore
-@@ -2715,6 +2723,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2726,6 +2734,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
                        goto cleanup;
        }
  
index b35aa00750df95355937840fee696d05186c4da0..4db0860e308a595c4b41232bed42d0b170ce5b56 100644 (file)
@@ -1,6 +1,6 @@
-From 002da63fa0320576de844ad398efc2d2586a69df Mon Sep 17 00:00:00 2001
+From 28c07811477669dff1d815cb59e1e1b56f3baa68 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:02 -0400
+Date: Fri, 6 Nov 2026 05:48:15 -0500
 Subject: [PATCH 0/3] btrfs: block group reclaim fixes for a full filesystem
 To: linux-btrfs@vger.kernel.org
 
@@ -44,7 +44,6 @@ Zygo Blaxell (3):
  4 files changed, 124 insertions(+), 3 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 34b5af77724b06e5d2c84710b290c64d06deb0c5..862cee022b7e9bfaee656e07fe833cf2cdd56f00 100644 (file)
@@ -1,4 +1,4 @@
-From 56bbc2412451d2750d4432b24c03f191e8ee6b79 Mon Sep 17 00:00:00 2001
+From ca6a08b6b6f2e4245aed613f8294f3a32e3eeb09 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 24 Sep 2026 02:21:12 -0400
 Subject: [PATCH 1/3] btrfs: do not reclaim block groups on an errored
@@ -16,8 +16,6 @@ waits for the group's writes in flight: on a degraded raid6 whose commit
 hit ENOSPC and aborted, the reclaim worker sat in that wait for good.  The
 wait is fixed where it is; the worker has nothing to do there either way.
 
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 4 ++++
  1 file changed, 4 insertions(+)
index 6aa5aad1c99d714881b8e1bc19a80afdd8faa526..8997a8db9f58c3dfd868370cbcc9116fe73f160e 100644 (file)
@@ -1,4 +1,4 @@
-From 9e8e0abcbcb4feb8eea8cc1ae090a218739b6bc7 Mon Sep 17 00:00:00 2001
+From 631ee219a55e87f483ea49a572529ab30ef1da3d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 13:04:19 -0400
 Subject: [PATCH 2/3] btrfs: log block group reclaim at debug level
@@ -21,7 +21,6 @@ by default and can be enabled with dynamic debug:
 
 Errors are still logged with btrfs_err() as before.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
index 8eb20bb3ee41a095394aadacf16eb31c5d957252..43aa8c8e07f2833a09a0493c0f58da332f09f3dc 100644 (file)
@@ -1,4 +1,4 @@
-From 002da63fa0320576de844ad398efc2d2586a69df Mon Sep 17 00:00:00 2001
+From 28c07811477669dff1d815cb59e1e1b56f3baa68 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 04:02:52 -0400
 Subject: [PATCH 3/3] btrfs: back off block group reclaim after repeated ENOSPC
@@ -27,7 +27,6 @@ for immediate retry.
 /sys/fs/btrfs/<uuid>/allocation/<type>/reclaim_backoffs counts the
 backoffs, and the start of one is logged at debug level ("reclaim: ...").
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 94 +++++++++++++++++++++++++++++++++++++++++-
  fs/btrfs/block-group.h |  1 +
index ebacf770aa58087d0c3bc4f307caffec897ee123..9889e03d912fcdbe03b9b44ebc5a7c4064b50cf3 100644 (file)
@@ -1,6 +1,6 @@
-From 4d9e701c741188892031ed8989b6824e2ee59411 Mon Sep 17 00:00:00 2001
+From 0d75f39b65f3fa3ba0eadd5ff1dedaa2d5948c67 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:06 -0400
+Date: Fri, 6 Nov 2026 05:48:17 -0500
 Subject: [PATCH 0/2] btrfs: reflink: two fixes for copying inline extents into the page cache
 To: linux-btrfs@vger.kernel.org
 
@@ -43,7 +43,6 @@ Zygo Blaxell (2):
  1 file changed, 18 insertions(+), 2 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 2020e4b4d977eb3bd0e09969efbe9c9b1a92218b..7f663827a68dba545d022a505a7b5bafbaa58546 100644 (file)
@@ -1,4 +1,4 @@
-From cc69842d79ecb04b150b2b84c9983390b568a6f7 Mon Sep 17 00:00:00 2001
+From 8148cc56f72ab4dd003b57bdd4cc5b1401cf968f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Mon, 26 Oct 2026 15:26:35 -0400
 Subject: [PATCH 1/2] btrfs: reflink: zero the right part of the folio after
@@ -35,7 +35,6 @@ Zero the tail of the block at the block's offset in the folio, as the
 copy does.
 
 Fixes: 3115deb381e9 ("btrfs: reflink: make copy_inline_to_page() to be subpage compatible")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/reflink.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
index e284173c27500ba027849ea92f511e2c1124fe88..7fc7a52e2cdfb8efd8207b5a4f75aa52f8abe3ac 100644 (file)
@@ -1,4 +1,4 @@
-From 4d9e701c741188892031ed8989b6824e2ee59411 Mon Sep 17 00:00:00 2001
+From 0d75f39b65f3fa3ba0eadd5ff1dedaa2d5948c67 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Mon, 26 Oct 2026 15:26:36 -0400
 Subject: [PATCH 2/2] btrfs: reflink: undo delalloc if inline extent
@@ -27,7 +27,6 @@ releases the reservation, and clear the block's uptodate state so the next
 read gets it from disk.
 
 Fixes: 05a5a7621ce6 ("Btrfs: implement full reflink support for inline extents")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/reflink.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
index 0a48a4614f8c83dc3bbc61dd9fdd4066f1ce0842..64376d9a1d08ba6e14f6cf6e38b713d49a418f5f 100644 (file)
@@ -1,6 +1,6 @@
-From 1a00c361d1af739637dd7663f72bd20a7a66dcc7 Mon Sep 17 00:00:00 2001
+From 480444bfe90d6ebb487cc5533719d4ef95c34132 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:05 -0400
+Date: Fri, 6 Nov 2026 05:48:17 -0500
 Subject: [PATCH 00/10] btrfs: dev-replace error accounting, resume and failure handling, and an abort option
 To: linux-btrfs@vger.kernel.org
 
@@ -120,7 +120,6 @@ Zygo Blaxell (10):
  7 files changed, 190 insertions(+), 29 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 29b3d0cf772ba77dec65c543a194bc4a7612ebf1..17a0e1cc5201d8a2c9cbb5ace754d64cc3e2b019 100644 (file)
@@ -1,4 +1,4 @@
-From b6aab469cf1d43ba27bdedec68ac943f6e2aa84d Mon Sep 17 00:00:00 2001
+From 24fc24aefd4bc5f5743f7cbdddc67c60657e4c8f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 01:19:17 -0400
 Subject: [PATCH 01/10] btrfs: commit the canceled state when a device replace
@@ -24,16 +24,15 @@ already does when it cancels a suspended replace, so the CANCELED state
 reaches the disk.  A failure to commit is only logged: the replace has
 already failed, and its return value is the scrub error.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/dev-replace.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
 
 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
-index cdfe093e5c5c4..e28a0e6806bcd 100644
+index 3c48cc714fef2..68aaf39020a51 100644
 --- a/fs/btrfs/dev-replace.c
 +++ b/fs/btrfs/dev-replace.c
-@@ -978,6 +978,22 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
+@@ -977,6 +977,22 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                if (src_device->bdev)
                        bdev_allow_freeze(src_device->bdev);
                btrfs_rm_dev_replace_unblocked(fs_info);
index 6b5fffa1c2301134051c89c83f5e4b44a869aea5..98ae0b44587d5ef60031fbe2c758bf037447a16d 100644 (file)
@@ -1,4 +1,4 @@
-From 96b87030db6ae7e4eedbe275dd02be2d651c7a35 Mon Sep 17 00:00:00 2001
+From f391d3ff6d63ff433dfcb94679fa88a1a3eb419d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 04:07:33 -0400
 Subject: [PATCH 02/10] btrfs: scrub: do not count write errors twice, or on
@@ -20,7 +20,6 @@ Drop the extra accounting in scrub_write_endio(); the write_error_bitmap
 it maintains is unchanged.
 
 Fixes: ec1f3a207cdf3 ("btrfs: scrub: update device stats when an error is detected")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 3 ---
  1 file changed, 3 deletions(-)
index 5316847106361fde88dba7653aa67f41344dc621..a4b819a40664a7ebce280303430924870e48954d 100644 (file)
@@ -1,4 +1,4 @@
-From b5b7853cd89b39ce2145822b01402ef1ce852c81 Mon Sep 17 00:00:00 2001
+From 8a2fb848ff33317d5f00604bf727ce8cd78ecd62 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 04:07:34 -0400
 Subject: [PATCH 03/10] btrfs: dev-replace: count uncorrectable read errors
@@ -28,7 +28,6 @@ The count is taken before the check for a metadata error, which aborts
 the replace, so that the sectors of the batch that aborts it are counted
 as well.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 21 +++++++++++++++++----
  1 file changed, 17 insertions(+), 4 deletions(-)
index e64fbb3af0e1f81e6e26fe92796f0f528191aa3c..c18872ecadcf05778bb940b2dfb47b05970dec46 100644 (file)
@@ -1,4 +1,4 @@
-From ef9040540b2392e1d3e3f7d563302ead2a54f901 Mon Sep 17 00:00:00 2001
+From 13bc21e764b63c201af7ea76abea6afae622f988 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 13:58:22 -0400
 Subject: [PATCH 04/10] btrfs: dev-replace: do not warn when a resumed replace
@@ -16,16 +16,15 @@ and -EIO once write errors to the target stop the replace again.
 The failure is already logged and recorded as a canceled replace.  Drop
 the WARN_ON.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/dev-replace.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
-index e28a0e6806bcd..ee16b80d7de9b 100644
+index 68aaf39020a51..b19e6536ac327 100644
 --- a/fs/btrfs/dev-replace.c
 +++ b/fs/btrfs/dev-replace.c
-@@ -1337,8 +1337,7 @@ static int btrfs_dev_replace_kthread(void *data)
+@@ -1336,8 +1336,7 @@ static int btrfs_dev_replace_kthread(void *data)
                              dev_replace->committed_cursor_left,
                              btrfs_device_get_total_bytes(dev_replace->srcdev),
                              &dev_replace->scrub_progress, false, true);
index 961430105c2da7888231a732cf537b4637c7bc42..7af6d2bf8f020fb3666dc7d529965c53f970d77a 100644 (file)
@@ -1,4 +1,4 @@
-From adbf4100993da32d4dd535d34d0825e474368bb0 Mon Sep 17 00:00:00 2001
+From 93f0be8dc0c6a0ed49eb0f669aec105019238ff5 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 04:07:34 -0400
 Subject: [PATCH 05/10] btrfs: dev-replace: count write errors to the target
@@ -18,7 +18,6 @@ repair writes to the source device, so clear it before the replace
 writes are submitted.
 
 Fixes: e02ee89baa66c ("btrfs: scrub: switch scrub_simple_mirror() to scrub_stripe infrastructure")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
index 55b8fccd740d37f48023ec77a6d389bcc3009a9d..de0e9e332018d26c50d0e44ee619723912fa93c9 100644 (file)
@@ -1,4 +1,4 @@
-From 26025d2bbc6648b956e2a0cab9b3676adac28cf5 Mon Sep 17 00:00:00 2001
+From ba95b697f5bbd63ca50aa9cda1045c1ec8fcd34c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 29 Oct 2026 12:17:20 -0400
 Subject: [PATCH 06/10] btrfs: dev-replace: do not skip the rest of a chunk
@@ -51,7 +51,6 @@ progress and to resume the replace.  The update stays before
 btrfs_dec_block_group_ro() anyway.
 
 Fixes: 1a1a8b732c7e9 ("Btrfs: fix race setting block group back to RW mode during device replace")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/scrub.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
index 739cfd97c6ca782a67b7fc086b4ea60724a5db99..11ce8af5015084e91d27d3d40b1feeac2b9cf9bd 100644 (file)
@@ -1,4 +1,4 @@
-From 5cd2203a007a4dd165929ee550000955aead9279 Mon Sep 17 00:00:00 2001
+From cb21c83bd66c030ebf21f22fad584190c74f42fd Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 04:07:34 -0400
 Subject: [PATCH 07/10] btrfs: dev-replace: report the progress of a canceled
@@ -20,14 +20,13 @@ replace: scrub_enumerate_chunks() moves cursor_left to the end of a chunk
 only when the copy of that chunk is complete, so a replace that stops
 part way through a chunk is reported at the start of that chunk.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/dev-replace.c | 10 +++++++++-
  fs/btrfs/fs.h          |  2 ++
  2 files changed, 11 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
-index ee16b80d7de9b..a48c5daae2302 100644
+index b19e6536ac327..cf774f9114d5c 100644
 --- a/fs/btrfs/dev-replace.c
 +++ b/fs/btrfs/dev-replace.c
 @@ -65,6 +65,7 @@
@@ -38,7 +37,7 @@ index ee16b80d7de9b..a48c5daae2302 100644
  static int btrfs_dev_replace_kthread(void *data);
  
  int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
-@@ -941,6 +942,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
+@@ -940,6 +941,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
        }
  
        down_write(&dev_replace->rwsem);
@@ -48,7 +47,7 @@ index ee16b80d7de9b..a48c5daae2302 100644
        dev_replace->replace_state =
                scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED
                          : BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED;
-@@ -1084,9 +1088,11 @@ static u64 btrfs_dev_replace_progress(struct btrfs_fs_info *fs_info)
+@@ -1083,9 +1087,11 @@ static u64 btrfs_dev_replace_progress(struct btrfs_fs_info *fs_info)
  
        switch (dev_replace->replace_state) {
        case BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED:
@@ -61,7 +60,7 @@ index ee16b80d7de9b..a48c5daae2302 100644
        case BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED:
                ret = 1000;
                break;
-@@ -1170,6 +1176,8 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
+@@ -1169,6 +1175,8 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
                result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR;
                tgt_device = dev_replace->tgtdev;
                src_device = dev_replace->srcdev;
index 9023bb9e0426606d2868853dcd63d31242a6a500..44831dc84874746909640fb2f28967d6ded930ae 100644 (file)
@@ -1,4 +1,4 @@
-From 3df39f4186e993b659a4eff8853d24557404acc0 Mon Sep 17 00:00:00 2001
+From cfc2c59bdeaa14024310d30598f6bb6f76f0e74b Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 16 Oct 2026 13:02:21 -0400
 Subject: [PATCH 08/10] btrfs: dev-replace: optionally abort on uncorrectable
@@ -37,7 +37,6 @@ also reads from the source device again, as if -r was not given.
 This depends on the counting of uncorrectable read errors added by
 "btrfs: dev-replace: count uncorrectable read errors".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/dev-replace.c          | 32 ++++++++++++++++++++++++--------
  fs/btrfs/fs.h                   |  2 ++
@@ -47,7 +46,7 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 56 insertions(+), 8 deletions(-)
 
 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
-index a48c5daae2302..50c2e53c148a4 100644
+index cf774f9114d5c..c3e88f9729a66 100644
 --- a/fs/btrfs/dev-replace.c
 +++ b/fs/btrfs/dev-replace.c
 @@ -81,6 +81,7 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
@@ -78,7 +77,7 @@ index a48c5daae2302..50c2e53c148a4 100644
        dev_replace->replace_state = btrfs_dev_replace_replace_state(eb, ptr);
        dev_replace->time_started = btrfs_dev_replace_time_started(eb, ptr);
        dev_replace->time_stopped =
-@@ -422,7 +426,7 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans)
+@@ -421,7 +425,7 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans)
        else
                btrfs_set_dev_replace_src_devid(eb, ptr, (u64)-1);
        btrfs_set_dev_replace_cont_reading_from_srcdev_mode(eb, ptr,
@@ -87,7 +86,7 @@ index a48c5daae2302..50c2e53c148a4 100644
        btrfs_set_dev_replace_replace_state(eb, ptr,
                dev_replace->replace_state);
        btrfs_set_dev_replace_time_started(eb, ptr, dev_replace->time_started);
-@@ -592,7 +596,7 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev,
+@@ -591,7 +595,7 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev,
  
  static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
                const char *tgtdev_name, u64 srcdevid, const char *srcdev_name,
@@ -96,7 +95,7 @@ index a48c5daae2302..50c2e53c148a4 100644
  {
        struct btrfs_root *root = fs_info->dev_root;
        struct btrfs_trans_handle *trans;
-@@ -660,14 +664,17 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
+@@ -659,14 +663,17 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
        }
  
        dev_replace->cont_reading_from_srcdev_mode = read_src;
@@ -116,7 +115,7 @@ index a48c5daae2302..50c2e53c148a4 100644
  
        /*
         * from now on, the writes to the srcdev are all duplicated to
-@@ -750,9 +757,19 @@ static int btrfs_check_replace_dev_names(struct btrfs_ioctl_dev_replace_args *ar
+@@ -749,9 +756,19 @@ static int btrfs_check_replace_dev_names(struct btrfs_ioctl_dev_replace_args *ar
  int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
                            struct btrfs_ioctl_dev_replace_args *args)
  {
@@ -137,7 +136,7 @@ index a48c5daae2302..50c2e53c148a4 100644
        case BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS:
        case BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID:
                break;
-@@ -765,8 +782,7 @@ int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
+@@ -764,8 +781,7 @@ int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
  
        ret = btrfs_dev_replace_start(fs_info, args->start.tgtdev_name,
                                        args->start.srcdevid,
index 4f23285f501425052af4f6ab67b0cc62d6a5859a..160a91e11063b1ccb20c8554ad3500ac8036a69c 100644 (file)
@@ -1,4 +1,4 @@
-From 8536334bdfdc30f8f18c85d8867eeb414dbd3ec0 Mon Sep 17 00:00:00 2001
+From ca6bd1e590349479ccfb229fbf6de054303e1124 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 29 Oct 2026 12:17:21 -0400
 Subject: [PATCH 09/10] btrfs: mount a single device filesystem with a device
@@ -47,16 +47,15 @@ replace ended, e.g. after a crash at that point.
 
 Fixes: bc27d6f0aa0e4 ("btrfs: scan but don't register device on single device filesystem")
 Fixes: a5b8a5f9f8355 ("btrfs: support cloned-device mount capability")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/volumes.c | 32 +++++++++++++++++++++++++++++++-
  1 file changed, 31 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index ce78a9441c64f..4c3106acb295e 100644
+index 3d4ef6725de0e..456becaa77cf0 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -586,6 +586,27 @@ static int btrfs_free_stale_devices(dev_t devt, struct btrfs_device *skip_device
+@@ -588,6 +588,27 @@ static int btrfs_free_stale_devices(dev_t devt, struct btrfs_device *skip_device
        return ret;
  }
  
@@ -84,7 +83,7 @@ index ce78a9441c64f..4c3106acb295e 100644
  static struct btrfs_fs_devices *find_fsid_by_device(
                                        struct btrfs_super_block *disk_super,
                                        dev_t devt, bool *same_fsid_diff_dev)
-@@ -644,6 +665,8 @@ static struct btrfs_fs_devices *find_fsid_by_device(
+@@ -646,6 +667,8 @@ static struct btrfs_fs_devices *find_fsid_by_device(
                /* New device. */
                if (fsid_fs_devices == NULL) {
                        return NULL;
@@ -93,7 +92,7 @@ index ce78a9441c64f..4c3106acb295e 100644
                } else {
                        /* sb::fsid is already used create a new temp_fsid. */
                        *same_fsid_diff_dev = true;
-@@ -1460,8 +1483,15 @@ static bool btrfs_skip_registration(struct btrfs_super_block *disk_super,
+@@ -1462,8 +1485,15 @@ static bool btrfs_skip_registration(struct btrfs_super_block *disk_super,
                mutex_unlock(&fs_devices->device_list_mutex);
        }
  
index effd4c08691e12d54312b75b596fb8fc3e7fbf8a..10f1dac0d4a0b5e7fb5cce6b4a12d8b30d366222 100644 (file)
@@ -1,4 +1,4 @@
-From 1a00c361d1af739637dd7663f72bd20a7a66dcc7 Mon Sep 17 00:00:00 2001
+From 480444bfe90d6ebb487cc5533719d4ef95c34132 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 29 Oct 2026 17:52:59 -0400
 Subject: [PATCH 10/10] btrfs: scrub: stop scrub and device replace when the
@@ -42,7 +42,6 @@ Update the comment in __btrfs_handle_fs_error(), which says that the
 replace goes on until it completes.
 
 Fixes: 1acd6831d9877 ("Btrfs: avoid risk of a deadlock in btrfs_handle_error")
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/messages.c | 13 +++++++------
  fs/btrfs/scrub.c    | 18 ++++++++++++++++++
index 2dc6fd2cd8c0876cc598c554d1f87df2cb3ac57a..0dd5649632a055e977f525107b34591919b07c69 100644 (file)
@@ -1,6 +1,6 @@
-From 8a5168fc52bb4f4c8a63561b47b1264a7a003a04 Mon Sep 17 00:00:00 2001
+From 3865255228933287e3a8da2aaa0357822864c342 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:06 -0400
+Date: Fri, 6 Nov 2026 05:48:17 -0500
 Subject: [PATCH 0/1] btrfs: resize: allow shrinking a missing device
 To: linux-btrfs@vger.kernel.org
 
@@ -41,7 +41,6 @@ Qu Wenruo (1):
  1 file changed, 28 insertions(+), 4 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 -- 
 2.47.3
 
index 274c87efebb4772865b1452ad525d68bd4106be6..b423bf00956d87db46be3e94c50fb150690cfc07 100644 (file)
@@ -1,4 +1,4 @@
-From 8a5168fc52bb4f4c8a63561b47b1264a7a003a04 Mon Sep 17 00:00:00 2001
+From 3865255228933287e3a8da2aaa0357822864c342 Mon Sep 17 00:00:00 2001
 From: Qu Wenruo <wqu@suse.com>
 Date: Mon, 18 Nov 2019 15:05:25 +0800
 Subject: [PATCH 1/1] btrfs: resize: allow shrinking a missing device
@@ -29,7 +29,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 28 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
-index ac070c745b0eb..b7ad8289108a4 100644
+index 215e3220df7fa..09d13fbea6382 100644
 --- a/fs/btrfs/ioctl.c
 +++ b/fs/btrfs/ioctl.c
 @@ -1033,6 +1033,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
index 5b40a3f2e85da6d1aade76021beb6884d07fc72c..d164c61587c3179621515635224d0d6efd91d9b8 100644 (file)
@@ -1,7 +1,7 @@
-From 1944ff74ed890d045c8d8f7346c44c519f6a2dee Mon Sep 17 00:00:00 2001
+From 294d230e458ac952577f5edc9d25770679c636c1 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 31 Oct 2026 01:04:02 -0400
-Subject: [RFC PATCH 00/85] btrfs: close the raid56 write hole for datacow with stripe-exclusive allocation
+Date: Fri, 6 Nov 2026 05:48:15 -0500
+Subject: [RFC PATCH 00/86] btrfs: close the raid56 write hole for datacow with stripe-exclusive allocation
 To: linux-btrfs@vger.kernel.org
 
 This series closes the raid56 write hole for datacow data by changing
@@ -870,7 +870,7 @@ Open questions for review
 
 The harness, logs and test catalog are available on request.
 
-Zygo Blaxell (85):
+Zygo Blaxell (86):
   btrfs: add btrfs_claim_free_stripe_run() for stripe-exclusive
     allocation
   btrfs: add open stripe run tracking for stripe-exclusive allocation
@@ -1015,6 +1015,8 @@ Zygo Blaxell (85):
     (debug_meta part)
   btrfs: stripe_alloc: keep a stripe in the rbio cache until its run has
     written all of it (debug_meta part)
+  btrfs: stripe_alloc: drop the extract hooks of the stripe_alloc
+    properties
 
  fs/btrfs/block-group.c            | 3870 ++++++++++++++++++++++++++++-
  fs/btrfs/block-group.h            |  313 ++-
@@ -1037,7 +1039,7 @@ Zygo Blaxell (85):
  fs/btrfs/messages.c               |    3 +
  fs/btrfs/ordered-data.c           |  126 +
  fs/btrfs/ordered-data.h           |   14 +
- fs/btrfs/props.c                  |  154 ++
+ fs/btrfs/props.c                  |  140 ++
  fs/btrfs/props.h                  |    1 +
  fs/btrfs/qgroup.c                 |   12 +
  fs/btrfs/qgroup.h                 |    3 +
@@ -1059,10 +1061,9 @@ Zygo Blaxell (85):
  fs/btrfs/zoned.c                  |   10 -
  fs/btrfs/zoned.h                  |    3 -
  include/trace/events/btrfs.h      |   60 +
- 43 files changed, 10876 insertions(+), 146 deletions(-)
+ 43 files changed, 10862 insertions(+), 146 deletions(-)
 
 
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
 prerequisite-patch-id: d27f13acdb7e1fb211a9524027f3f1c8c119f80b
 prerequisite-patch-id: 3ba444b908adb7eb7dd36a0bac6a3816516935c4
 prerequisite-patch-id: 9eebec1e5af9c3767f7de46e5a2406a7d140b135
index 1d47e0611089dc9bf58ad2ba64dd5f237c4824f4..fa34fe4b1b9f6a8653c0898e266a5a99cdcd3a98 100644 (file)
@@ -1,7 +1,7 @@
-From 81d6ce66c3eec1d688dde8c89f22d519a2a9784f Mon Sep 17 00:00:00 2001
+From 91c74628bae365b6d8f5628cc974099aafd8ff56 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:26 -0400
-Subject: [RFC PATCH 01/85] btrfs: add btrfs_claim_free_stripe_run() for
+Subject: [RFC PATCH 01/86] btrfs: add btrfs_claim_free_stripe_run() for
  stripe-exclusive allocation
 To: linux-btrfs@vger.kernel.org
 
@@ -35,8 +35,6 @@ capped claims, partial-stripe exclusion, head/tail carving, block-group-
 relative geometry, bitmap entries, and non-power-of-two stripe widths.
 The raid56 stripe allocation policy will be its first non-test user.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/free-space-cache.c       | 165 +++++++++++++++++++++++
  fs/btrfs/free-space-cache.h       |   2 +
index ae20888ebbaa93960831517743f3b6a33a4141d8..6509a0d30ceb5343246ccd8edaf75ab73c08fbc2 100644 (file)
@@ -1,7 +1,7 @@
-From 54e8674b89c106739d94508eee48be798fca3d58 Mon Sep 17 00:00:00 2001
+From 00c9b45ed15d7316686132c812bc9942244ba2ff Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:26 -0400
-Subject: [RFC PATCH 02/85] btrfs: add open stripe run tracking for
+Subject: [RFC PATCH 02/86] btrfs: add open stripe run tracking for
  stripe-exclusive allocation
 To: linux-btrfs@vger.kernel.org
 
@@ -37,8 +37,6 @@ walk rely on the sequence stamp.
 Exercised by a new sanity self-test; the raid56 stripe allocation
 policy and the commit hook will be the first non-test users.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            | 343 ++++++++++++++++++++++++++++++
  fs/btrfs/block-group.h            |  26 +++
@@ -464,7 +462,7 @@ index f0bf50033d4b1..2e7d5afdaf705 100644
                                                  u64 bytenr);
  void btrfs_dec_nocow_writers(struct btrfs_block_group *bg);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index c628c5081d923..ccefc67fcbd68 100644
+index 6afcd6ca2a8a8..164cda154f66e 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -2803,6 +2803,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
index 6e07521824501e2786931c6974b7078156c0278c..f7bd417225fb6e55fde2aeb34d2af677afeab8a8 100644 (file)
@@ -1,7 +1,7 @@
-From 5c0d8a2033b534af23e2bad0e41dd8635374693d Mon Sep 17 00:00:00 2001
+From 3aed6f7719229a17fa8a2e28f1297fe44a5a1d78 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:26 -0400
-Subject: [RFC PATCH 03/85] btrfs: add the stripe_alloc allocation policy for
+Subject: [RFC PATCH 03/86] btrfs: add the stripe_alloc allocation policy for
  raid56 data
 To: linux-btrfs@vger.kernel.org
 
@@ -55,9 +55,6 @@ and a warning says when runs were left in flight.
 __btrfs_handle_fs_error() wakes the drain waiters, after the full barrier
 wake_up_var() needs when the condition is not set under a lock.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            | 268 ++++++++++++++++++++++--------
  fs/btrfs/block-group.h            |  20 ++-
index 12eb37d75ffca80dbe74fa6e4285cb72a661ddc6..8af8ef22f610197367abace1858f9a12a579547d 100644 (file)
@@ -1,7 +1,7 @@
-From a5e9eaa5277931ed08c3260641b01c767d505fa6 Mon Sep 17 00:00:00 2001
+From e4bb83290aface63b197b12c5ef9b0a8d1aa0619 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:26 -0400
-Subject: [RFC PATCH 04/85] btrfs: stripe_alloc: control the policy with a
+Subject: [RFC PATCH 04/86] btrfs: stripe_alloc: control the policy with a
  filesystem property
 To: linux-btrfs@vger.kernel.org
 
@@ -65,8 +65,6 @@ the current STRIPE_ALLOC value is carried into the context first, or a
 property change made after the context was created would be undone
 without its enable or disable work.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c |  70 ++++++++++++++++++++++++++
  fs/btrfs/block-group.h |   3 ++
@@ -172,7 +170,7 @@ index ca43f0c5c8d27..852f74b592aa0 100644
  void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg);
  void btrfs_release_data_reloc_bg(struct btrfs_fs_info *fs_info);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index ccefc67fcbd68..b1df5fd84a94f 100644
+index 164cda154f66e..dbaef84feefc3 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -47,6 +47,7 @@
index 089a5fe64d996032a0bad6c2c2f99dc035495831..0bc5a497d550992e037661829213b90d011bf1fb 100644 (file)
@@ -1,7 +1,7 @@
-From 5dd1fc6bf065a109a19c30107069f65664b96424 Mon Sep 17 00:00:00 2001
+From 46c71836e61902b340cf4367124633c173166229 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:26 -0400
-Subject: [RFC PATCH 05/85] btrfs: report stripe run data IO through the
+Subject: [RFC PATCH 05/86] btrfs: report stripe run data IO through the
  ordered extent lifecycle
 To: linux-btrfs@vger.kernel.org
 
@@ -28,8 +28,6 @@ into a window's stripes:
 - Preallocated extents never issue data IO and report at insertion;
   this also covers relocation's data inode preallocations.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c  | 51 ++++++++++++++++++++++++++++++++++++++
  fs/btrfs/block-group.h  |  4 +++
@@ -232,7 +230,7 @@ index ff330d4896d66..bc847c03470ed 100644
                              const struct extent_buffer *eb);
  int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b071ed59a583f..5803f5d95d654 100644
+index abaa334714566..3230a5f54f7e0 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -3398,7 +3398,7 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
@@ -244,7 +242,7 @@ index b071ed59a583f..5803f5d95d654 100644
                                        ordered_extent->disk_bytenr,
                                        ordered_extent->disk_num_bytes, true);
                        /*
-@@ -9198,6 +9198,17 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9195,6 +9195,17 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
                                min_size, 0, *alloc_hint, &ins, true, false);
                if (ret)
                        break;
@@ -262,7 +260,7 @@ index b071ed59a583f..5803f5d95d654 100644
  
                /*
                 * We've reserved this space, and thus converted it from
-@@ -9220,8 +9231,8 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9217,8 +9228,8 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
                btrfs_dec_block_group_reservations(fs_info, ins.objectid);
                if (IS_ERR(trans)) {
                        ret = PTR_ERR(trans);
index 8418ed39068aeb6649f1889d2170aaa4c2be7a5e..9c5457690b00669fc4f7a21975174ae994b828b0 100644 (file)
@@ -1,7 +1,7 @@
-From 90328f8ca40d0895a8e06a8885909979e47d6eee Mon Sep 17 00:00:00 2001
+From 5a34f8f8c7596f6822cc20cf229f54bb4ee0dbe5 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:26 -0400
-Subject: [RFC PATCH 06/85] btrfs: retire stripe runs at commit and gate
+Subject: [RFC PATCH 06/86] btrfs: retire stripe runs at commit and gate
  stripe_alloc
 To: linux-btrfs@vger.kernel.org
 
@@ -129,8 +129,6 @@ ran.  The cost is the zoned one: a small dedupe or clone of a large dirty
 file waits for up to max_extent_size of IO that the allocation had already
 committed to.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            | 144 +++++++++++++++++++-----------
  fs/btrfs/block-group.h            |   8 +-
@@ -439,7 +437,7 @@ index 76c0bfaf9d62a..d45cde622dd40 100644
  }
  
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 5803f5d95d654..b66dd823053f1 100644
+index 3230a5f54f7e0..e8ddf098d2d39 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1869,6 +1869,18 @@ static int can_nocow_file_extent(struct btrfs_path *path,
@@ -665,7 +663,7 @@ index 5fd65251f9b45..197db1694c1b0 100644
        /* Only partially filled stripes remain: nothing left to claim. */
        ret = btrfs_alloc_from_open_stripe(cache, sectorsize,
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index d265fac023e58..c2e9a4fd69d3b 100644
+index cd7dff5ba59b6..f25350b7e5fd6 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
 @@ -367,6 +367,7 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
@@ -708,7 +706,7 @@ index d265fac023e58..c2e9a4fd69d3b 100644
  /* wait for commit against the current transaction to become unblocked
   * when this is done, it is safe to start a new transaction, but the current
   * transaction might not be fully on disk.
-@@ -2426,6 +2452,27 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2421,6 +2447,27 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
        wait_event(cur_trans->pending_wait,
                   atomic_read(&cur_trans->pending_ordered) == 0);
  
index 1ef19b22127f4995e9a75b32f911217289d096f3..8abc8d19de86f09db4f9bb255cbbdb6212fd82cc 100644 (file)
@@ -1,7 +1,7 @@
-From 38248cd7451a2ab3525d133fa661462db65c9f4f Mon Sep 17 00:00:00 2001
+From 263e48f3a677953c4d7e9f9b0af41797fb6c6c9e Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:27 -0400
-Subject: [RFC PATCH 07/85] btrfs: account stripe_alloc trapped free space for
+Subject: [RFC PATCH 07/86] btrfs: account stripe_alloc trapped free space for
  honest statfs
 To: linux-btrfs@vger.kernel.org
 
@@ -76,9 +76,6 @@ The scan walks the group's free space tree, so the entries of an
 allocation cluster the legacy allocator set up are returned to the group
 before the scan, when arming and at the commit-time rescan.
 
-Assisted-by: Claude:claude-opus-4-8
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c       | 164 ++++++++++++++++++++++-
  fs/btrfs/block-group.h       |  19 +++
@@ -811,10 +808,10 @@ index 96d43e5ef19f5..7852bd1c1e64b 100644
        NULL,
  };
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index c2e9a4fd69d3b..4f781df772202 100644
+index f25350b7e5fd6..b3f4b186935e8 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
-@@ -2684,6 +2684,12 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2679,6 +2679,12 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
        if (unlikely(ret))
                goto scrub_continue;
  
index 28d7135015d13f1523e5f4d1118fa2fe47e21c44..ac4be434b5b180c296c046ffb76d618029755e8a 100644 (file)
@@ -1,7 +1,7 @@
-From 0e2243bd9a29d331bf39433f9651464ef445416f Mon Sep 17 00:00:00 2001
+From 5641d16585fad171cb99fd54410279a844f75a4f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:27 -0400
-Subject: [RFC PATCH 08/85] btrfs: stripe_alloc: keep an open run per size band
+Subject: [RFC PATCH 08/86] btrfs: stripe_alloc: keep an open run per size band
  to trap less
 To: linux-btrfs@vger.kernel.org
 
@@ -42,8 +42,6 @@ misfit allocation now keeps the old run open (its tail is not returned to
 the cache) and a later small allocation backfills it, so fewer stripes are
 claimed before the free space is exhausted.
 
-Assisted-by: Claude:claude-opus-4-8
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            | 146 ++++++++++++++++++++++--------
  fs/btrfs/block-group.h            |  13 ++-
index a7b9beffdcb59a475b5eb1b7fe3f1fab4cfcf4db..5b3595b89e0043892767d70bd4b83beeb1b238f0 100644 (file)
@@ -1,7 +1,7 @@
-From 38f0f97adcd4fa6d4d124e8bc7846a41b974a7db Mon Sep 17 00:00:00 2001
+From d084d3cd17b754cd68a4f2c1eb3bd76afa293339 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:27 -0400
-Subject: [RFC PATCH 09/85] btrfs: stripe_alloc: grow the frontier run instead
+Subject: [RFC PATCH 09/86] btrfs: stripe_alloc: grow the frontier run instead
  of stranding its tail
 To: linux-btrfs@vger.kernel.org
 
@@ -49,8 +49,6 @@ run and lands at the run's old tail, spanning the stripe boundary, and
 the relocation-class case doubles as a check that a claim adjacent to
 another class's run never grows it.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            | 42 +++++++++++++++++++---
  fs/btrfs/tests/free-space-tests.c | 60 +++++++++++++++++--------------
index deec78b798b33fae0b93b7460be271dac22aa8a9..796b6c03037e9ed3945b011c1421c768ba8aaf96 100644 (file)
@@ -1,7 +1,7 @@
-From 9a0221ec59bc5466fff131a68edd4fe72da935d1 Mon Sep 17 00:00:00 2001
+From 97651f55b054c50a0c57077a878b691906403647 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:29 -0400
-Subject: [RFC PATCH 10/85] btrfs: raid56: batch stripe_alloc partial writes
+Subject: [RFC PATCH 10/86] btrfs: raid56: batch stripe_alloc partial writes
  into full-stripe writes
 To: linux-btrfs@vger.kernel.org
 
@@ -94,8 +94,6 @@ that window.  Whatever is still parked at unmount or on a failed mount is
 sent down, and the park timer cancelled, before the raid56 workqueue is
 destroyed.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 292 ++++++++++++++++++++++--------------
  fs/btrfs/block-group.h      |   3 +
@@ -446,7 +444,7 @@ index b76c44f09d532..7f2df9d2fc31c 100644
  int btrfs_enable_stripe_alloc(struct btrfs_fs_info *fs_info);
  void btrfs_disable_stripe_alloc(struct btrfs_fs_info *fs_info);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index b1df5fd84a94f..28f360e84f110 100644
+index dbaef84feefc3..c16c4e8fe3cba 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -3846,6 +3846,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
@@ -457,7 +455,7 @@ index b1df5fd84a94f..28f360e84f110 100644
        btrfs_stop_all_workers(fs_info);
        btrfs_free_block_groups(fs_info);
  fail_alloc:
-@@ -4608,6 +4609,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
+@@ -4604,6 +4605,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
         * submit after we stop all workers.
         */
        invalidate_and_check_btree_folios(fs_info);
@@ -572,7 +570,7 @@ index eb6b2da628220..44122090fe4f4 100644
  }
  
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 7dd937fa0c262..71ff75c8c93ff 100644
+index a8a8004bb14c7..3aea63a986742 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -21,6 +21,7 @@
@@ -922,7 +920,7 @@ index 7dd937fa0c262..71ff75c8c93ff 100644
                        spin_unlock(&cur->bio_list_lock);
                        freeit = rbio;
                        ret = 1;
-@@ -1031,6 +1312,7 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
+@@ -1024,6 +1305,7 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
        spin_lock_init(&rbio->bio_list_lock);
        INIT_LIST_HEAD(&rbio->stripe_cache);
        INIT_LIST_HEAD(&rbio->hash_list);
@@ -930,7 +928,7 @@ index 7dd937fa0c262..71ff75c8c93ff 100644
        btrfs_get_bioc(bioc);
        rbio->bioc = bioc;
        rbio->nr_pages = num_pages;
-@@ -1721,12 +2003,15 @@ static void raid_unplug(struct blk_plug_cb *cb, bool from_schedule)
+@@ -1714,12 +1996,15 @@ static void raid_unplug(struct blk_plug_cb *cb, bool from_schedule)
                                free_raid_bio(cur);
                                continue;
                        }
@@ -947,7 +945,7 @@ index 7dd937fa0c262..71ff75c8c93ff 100644
        kfree(plug);
  }
  
-@@ -2472,8 +2757,11 @@ static void rmw_rbio_work(struct work_struct *work)
+@@ -2483,8 +2768,11 @@ static void rmw_rbio_work(struct work_struct *work)
        struct btrfs_raid_bio *rbio;
  
        rbio = container_of(work, struct btrfs_raid_bio, work);
index 03a6bab75f46a8a2188f0ac51e491c839cc68899..1181b274ac8c6ab9e2e3b538986c57f5e8459da4 100644 (file)
@@ -1,7 +1,7 @@
-From 72dcaf543ee045269a9d09cc1b25887fa6227e0d Mon Sep 17 00:00:00 2001
+From aa7183b5ec88b2f9cef35f6a12b00e7959adcef1 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:31 -0400
-Subject: [RFC PATCH 11/85] btrfs: stripe_alloc: private per-inode stripe runs
+Subject: [RFC PATCH 11/86] btrfs: stripe_alloc: private per-inode stripe runs
  for log-active inodes
 To: linux-btrfs@vger.kernel.org
 
@@ -37,8 +37,6 @@ which private runs never occupy; walk the block group's run list
 instead so every open run, slotted or private, is closed and drained
 under invariant I2 (no open run survives a transaction commit).
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 154 ++++++++++++++++++++++++++++++++++++-----
  fs/btrfs/block-group.h |  11 +++
@@ -281,7 +279,7 @@ index 7f2df9d2fc31c..6d83c79e8c02e 100644
                                  u64 num_bytes);
  void btrfs_open_stripe_write_done_run(struct btrfs_open_stripe_run *run,
 diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
-index f7aa0d1451851..a3aab18d60337 100644
+index 0782f917fcccb..7515ed6b90ba6 100644
 --- a/fs/btrfs/btrfs_inode.h
 +++ b/fs/btrfs/btrfs_inode.h
 @@ -87,6 +87,16 @@ enum {
@@ -468,7 +466,7 @@ index 2dc1fbf569cf3..89d71cec371d6 100644
  
        /*
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b66dd823053f1..3190191b41d6d 100644
+index e8ddf098d2d39..80efdd9f3014b 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1070,7 +1070,7 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,
@@ -500,7 +498,7 @@ index b66dd823053f1..3190191b41d6d 100644
  
        spin_lock_init(&ei->lock);
        ei->outstanding_extents = 0;
-@@ -9278,7 +9280,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9275,7 +9277,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
                 * sized chunks.
                 */
                cur_bytes = min(cur_bytes, last_alloc);
@@ -509,7 +507,7 @@ index b66dd823053f1..3190191b41d6d 100644
                                min_size, 0, *alloc_hint, &ins, true, false);
                if (ret)
                        break;
-@@ -10115,7 +10117,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10112,7 +10114,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
                }
        }
  
index 35b303cb3b8875d1588779bd3fed3e0f9cca0400..34c9b7d9bf7e0866cd33737fd0c5d12ce5809bec 100644 (file)
@@ -1,7 +1,7 @@
-From bc8976c3642036cfdb102312af296f4c31450d4f Mon Sep 17 00:00:00 2001
+From 3bd13f8c8d842412359afc83ed36b8a6ff169245 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:38 -0400
-Subject: [RFC PATCH 12/85] btrfs: raid56: pad sub-stripe writes to full
+Subject: [RFC PATCH 12/86] btrfs: raid56: pad sub-stripe writes to full
  stripes in open runs
 To: linux-btrfs@vger.kernel.org
 
@@ -30,8 +30,6 @@ RBIO_RMW_LOCKED_BIT is set another writer can merge into the rbio and OR
 its bits in under that lock, and a lost pad bit would leave rows out of
 the write while the cached stripe marks their zero-filled pages up to date.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 43 ++++++++++++++++++
  fs/btrfs/block-group.h |  3 ++
@@ -107,7 +105,7 @@ index 6d83c79e8c02e..981ebbd6b8149 100644
  int btrfs_enable_stripe_alloc(struct btrfs_fs_info *fs_info);
  void btrfs_disable_stripe_alloc(struct btrfs_fs_info *fs_info);
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 71ff75c8c93ff..49c1163bc1f28 100644
+index 3aea63a986742..1fc098bf87be2 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -45,6 +45,15 @@
@@ -126,7 +124,7 @@ index 71ff75c8c93ff..49c1163bc1f28 100644
  /*
   * Set when an unplug callback finished merging this rbio's submission
   * batch: the submitter has no more bios coming.  A sync rbio past this
-@@ -1688,7 +1697,12 @@ static int rmw_assemble_write_bios(struct btrfs_raid_bio *rbio,
+@@ -1681,7 +1690,12 @@ static int rmw_assemble_write_bios(struct btrfs_raid_bio *rbio,
                        continue;
  
                if (stripe < rbio->nr_data) {
@@ -140,7 +138,7 @@ index 71ff75c8c93ff..49c1163bc1f28 100644
                        if (paddrs == NULL)
                                continue;
                } else {
-@@ -2643,6 +2657,79 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -2636,6 +2650,79 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
        }
  }
  
@@ -220,7 +218,7 @@ index 71ff75c8c93ff..49c1163bc1f28 100644
  /*
   * To determine if we need to read any sector from the disk.
   * Should only be utilized in RMW path, to skip cached rbio.
-@@ -2684,8 +2771,15 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2677,8 +2764,15 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
        /*
         * Either full stripe write, or we have every data sector already
         * cached, can go to write path immediately.
index 3c912878eeacc2bc8def3bf68ec2aaefd9246161..1249f93d3f03bbbd2726d7552c743880c5479e6d 100644 (file)
@@ -1,7 +1,7 @@
-From cebc5592ab68c4ab3067f4c832a57fdea905722c Mon Sep 17 00:00:00 2001
+From 08f51801f9a1ce325cc194543944d65f761d793c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:43 -0400
-Subject: [RFC PATCH 13/85] btrfs: raid56: expose parking statistics in sysfs
+Subject: [RFC PATCH 13/86] btrfs: raid56: expose parking statistics in sysfs
 To: linux-btrfs@vger.kernel.org
 
 /sys/fs/btrfs/<uuid>/stripe_park_stats reports lifetime counters for
@@ -15,8 +15,6 @@ later reappear as rmw_reads are the batching the window failed to
 capture -- so any future retuning (or an adaptive deadline) can argue
 from measurements instead of taste.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/fs.h     | 14 ++++++++++++++
  fs/btrfs/raid56.c | 16 ++++++++++++++++
@@ -49,7 +47,7 @@ index b085e198f23da..d0198cfe1c850 100644
        struct mutex scrub_lock;
        atomic_t scrubs_running;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 49c1163bc1f28..a9fac8fc28e4f 100644
+index 1fc098bf87be2..1c524bde24a4d 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -62,6 +62,9 @@
@@ -112,7 +110,7 @@ index 49c1163bc1f28..a9fac8fc28e4f 100644
                start_async_work(rbio, rmw_rbio_work_locked);
        }
        if (rearm)
-@@ -2727,6 +2738,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2720,6 +2731,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        spin_lock(&rbio->bio_list_lock);
        bitmap_set(&rbio->dbitmap, 0, rbio->stripe_nsectors);
        spin_unlock(&rbio->bio_list_lock);
@@ -120,7 +118,7 @@ index 49c1163bc1f28..a9fac8fc28e4f 100644
        return true;
  }
  
-@@ -2780,6 +2792,10 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2773,6 +2785,10 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
         */
        if (!rbio_is_full(rbio) && !rmw_try_pad_full(rbio) &&
            need_read_stripe_sectors(rbio)) {
index dfcc641dfe5c839ed827391f07a2572d038791c0..9b4e58ba684c410c80c77f92f4a3d85b01b45416 100644 (file)
@@ -1,7 +1,7 @@
-From f1536f5012fef160581f7103b7a4f43224eea5c7 Mon Sep 17 00:00:00 2001
+From ac8d30533e5e2b20b485521e3a63711cad6c5607 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:45 -0400
-Subject: [RFC PATCH 14/85] btrfs: stripe_alloc: count open stripe run
+Subject: [RFC PATCH 14/86] btrfs: stripe_alloc: count open stripe run
  remainders against data reservations
 To: linux-btrfs@vger.kernel.org
 
@@ -27,8 +27,6 @@ only the bytes_stripe_unusable accounting): tree 'b' still lost 3.3%
 (8532 blocks) and tree 'c' 30% (62371 blocks) to silent writeback
 allocation failure as trapping compounded.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 51 +++++++++++++++++++++++++++++++++++++++++-
  fs/btrfs/block-group.h |  8 +++++++
index bf4d0f4dc0860a5e36139c8bf05dac5ad4dfbd7e..3365f6ce1564164704cc9cf562964a67d03564a4 100644 (file)
@@ -1,7 +1,7 @@
-From 406db25e00c5ace70157c961876b333ff0ff9752 Mon Sep 17 00:00:00 2001
+From b1343709a8f47bd2f20eb0768db80fc4b21191f7 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:46 -0400
-Subject: [RFC PATCH 15/85] btrfs: stripe_alloc: pessimistic data reservation
+Subject: [RFC PATCH 15/86] btrfs: stripe_alloc: pessimistic data reservation
  margin
 To: linux-btrfs@vger.kernel.org
 
@@ -82,8 +82,6 @@ allocate window is one syscall); clearing the property with dirty
 delalloc drains the counter (charges are gated on the policy,
 releases are not, and the counter clamps at zero).
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      |  6 ++++
  fs/btrfs/btrfs_inode.h      |  3 ++
@@ -119,7 +117,7 @@ index d5a1f6f2070b2..4aa943fc23100 100644
        }
  }
 diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
-index a3aab18d60337..663e925b14300 100644
+index 7515ed6b90ba6..93c256a68c242 100644
 --- a/fs/btrfs/btrfs_inode.h
 +++ b/fs/btrfs/btrfs_inode.h
 @@ -423,6 +423,8 @@ static inline bool is_data_inode(const struct btrfs_inode *inode)
@@ -572,7 +570,7 @@ index d0198cfe1c850..6c82782a8a7f5 100644
        spinlock_t swapfile_pins_lock;
        struct rb_root swapfile_pins;
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 3190191b41d6d..d27cc1155adf9 100644
+index 80efdd9f3014b..82221e32a8a67 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -5099,6 +5099,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
index 834819fa36a0134147e6ef1f884c9c048e51700b..77c81bc5852602fe3b9258267d012e5b43311f0c 100644 (file)
@@ -1,7 +1,7 @@
-From c53ebde40f2c1d2e7ff3320305c45c77e825b408 Mon Sep 17 00:00:00 2001
+From 9e70c7e8da076da5b8de44253b8dbe64ff7cb688 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:47 -0400
-Subject: [RFC PATCH 16/85] btrfs: stripe_alloc: claim fully-free stripes that
+Subject: [RFC PATCH 16/86] btrfs: stripe_alloc: claim fully-free stripes that
  span free space entries
 To: linux-btrfs@vger.kernel.org
 
@@ -54,8 +54,6 @@ head is linked back with a spare entry allocated before ctl->tree_lock is
 taken, so a failed allocation cannot lose it from the cache; without a
 spare it is added after the lock as before.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            |   1 +
  fs/btrfs/block-group.h            |  12 ++
index 55dc23ea163936da311a2d30c2298f6500d120ce..6a2ad651bce6aafa10d8bc3bafd45bcb20906049 100644 (file)
@@ -1,7 +1,7 @@
-From 59646fb2be214b885116d4fc5277664960250167 Mon Sep 17 00:00:00 2001
+From 8dfdd56cc3889c9bb9dcdcfd8ca00ac44a2645a6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:47 -0400
-Subject: [RFC PATCH 17/85] btrfs: stripe_alloc: warn when raid56 metadata is
+Subject: [RFC PATCH 17/86] btrfs: stripe_alloc: warn when raid56 metadata is
  not covered
 To: linux-btrfs@vger.kernel.org
 
@@ -19,8 +19,6 @@ warning, not an error: the data guarantee is real and worth having on
 its own, and a filesystem can be converted to raid1c3/raid1c4 metadata
 without unmounting.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 23 +++++++++++++++++++++++
  1 file changed, 23 insertions(+)
index ae2b633f4e0afc859034cb1a20086201bd4dbfb3..a5632babc0a164bdf5e3f500eb759c213c87eaa2 100644 (file)
@@ -1,7 +1,7 @@
-From 4d1558d6fa3ff13a54ef69beecb2ededd8816d3b Mon Sep 17 00:00:00 2001
+From 4e62481e9d68003cf9dd6acaed025a6df09a29e4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:48 -0400
-Subject: [RFC PATCH 18/85] btrfs: stripe_alloc: report read-modify-write of
+Subject: [RFC PATCH 18/86] btrfs: stripe_alloc: report read-modify-write of
  uncovered stripes
 To: linux-btrfs@vger.kernel.org
 
@@ -22,17 +22,15 @@ grepping dmesg, is debug code and is added in the debug subtopic.)
 Silent when stripe_alloc is off: there the whole filesystem works this
 way and the user has asked for nothing else.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/raid56.c | 25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index a9fac8fc28e4f..2b54bb70f6d2f 100644
+index 1c524bde24a4d..27cba16c34120 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2766,6 +2766,27 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+@@ -2759,6 +2759,27 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
        return false;
  }
  
@@ -60,7 +58,7 @@ index a9fac8fc28e4f..2b54bb70f6d2f 100644
  static void rmw_rbio(struct btrfs_raid_bio *rbio)
  {
        struct bio_list bio_list;
-@@ -2811,6 +2832,10 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2804,6 +2825,10 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                        goto out;
        }
  
index 61224f0620c7306de39402cf80b53b7d8eec560c..bf943330c67d834ad13acaafe1fa6cec1d57929b 100644 (file)
@@ -1,7 +1,7 @@
-From 387b1af89ded50a341b2da77ee25fa3809e10ea1 Mon Sep 17 00:00:00 2001
+From 8fbba78bdcbbebf2247086b1441a90543b3c15fa Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:50 -0400
-Subject: [RFC PATCH 19/85] btrfs: stripe_alloc: tunable park deadlines, and
+Subject: [RFC PATCH 19/86] btrfs: stripe_alloc: tunable park deadlines, and
  say why padding declined
 To: linux-btrfs@vger.kernel.org
 
@@ -34,8 +34,6 @@ remains" into a specific thing to fix.
 
 No behaviour change at the defaults.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 22 ++++++++++++++++++++--
  fs/btrfs/disk-io.c     |  2 ++
@@ -95,7 +93,7 @@ index a2e7e8667b15e..a0c4bf74a4e42 100644
        return ret;
  }
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 28f360e84f110..0b23e576ed4ed 100644
+index c16c4e8fe3cba..67776888ea3e1 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -2805,6 +2805,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
@@ -159,7 +157,7 @@ index 6c82782a8a7f5..9386ec918b530 100644
        /* Private scrub information */
        struct mutex scrub_lock;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 2b54bb70f6d2f..b92712b13294b 100644
+index 27cba16c34120..c0fa12005206f 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -67,8 +67,6 @@
@@ -215,7 +213,7 @@ index 2b54bb70f6d2f..b92712b13294b 100644
  
                                        spin_lock(&table->parked_lock);
                                        if (test_bit(RBIO_PARKED_BIT,
-@@ -2813,10 +2818,17 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2806,10 +2811,17 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
         */
        if (!rbio_is_full(rbio) && !rmw_try_pad_full(rbio) &&
            need_read_stripe_sectors(rbio)) {
index e9880c42ea61093ae0b871214f86e8b6c3bcc954..c54a28d0c6c8d74073c8a31af5d3c1fb1a7ca4c8 100644 (file)
@@ -1,7 +1,7 @@
-From b7418073639203b116bc9ee2e125879e4cab1733 Mon Sep 17 00:00:00 2001
+From bd6ea24e29f154a33046ab8fd96ec4c427350b95 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:51 -0400
-Subject: [RFC PATCH 20/85] btrfs: stripe_alloc: trace why padding declined, at
+Subject: [RFC PATCH 20/86] btrfs: stripe_alloc: trace why padding declined, at
  the moment it declined
 To: linux-btrfs@vger.kernel.org
 
@@ -22,8 +22,6 @@ refusal reason, and the run's start/end/frontier/inflight, so a trace says
 directly whether the frontier had already run past the stripe when the
 write showed up.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c       | 19 +++++++++++++++-
  fs/btrfs/block-group.h       | 23 ++++++++++++++++++-
@@ -140,10 +138,10 @@ index 9386ec918b530..1790cd2563b02 100644
        /*
         * Park deadlines, ms (sysfs); 0 disables parking for that class.  See
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index b92712b13294b..e54f73cb641f4 100644
+index c0fa12005206f..bec90a0cd5d91 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2688,20 +2688,40 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2681,20 +2681,40 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        const u64 stripe_start = rbio->bioc->full_stripe_logical;
        const u32 sectorsize = fs_info->sectorsize;
        const u64 stripe_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
@@ -188,7 +186,7 @@ index b92712b13294b..e54f73cb641f4 100644
                const int stripe_nr = i / rbio->stripe_nsectors;
                const int sectornr = i % rbio->stripe_nsectors;
                u64 logical = stripe_start + stripe_nr * BTRFS_STRIPE_LEN +
-@@ -2709,8 +2729,19 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2702,8 +2722,19 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
  
                if (rbio->bio_paddrs[i * rbio->sector_nsteps] != INVALID_PADDR)
                        continue;
index 3c265f003c99f4d08a05d15db4b2b6eaea122b58..e1988fb7593f0548c7bec41550b6f313e818bb54 100644 (file)
@@ -1,7 +1,7 @@
-From 6820ba5fd5d604cec20c20bd0d632ddc9337b2d7 Mon Sep 17 00:00:00 2001
+From f7452696e902783738a4a20ee50ba4e0da4efb5c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:52 -0400
-Subject: [RFC PATCH 21/85] btrfs: stripe_alloc: complete parked writes on
+Subject: [RFC PATCH 21/86] btrfs: stripe_alloc: complete parked writes on
  allocation coverage, not clocks
 To: linux-btrfs@vger.kernel.org
 
@@ -36,9 +36,6 @@ down the old path and counted.
 New sysfs stripe_park_stats counters: unparked_ready (parks completed by
 the coverage test) and stuck (parks forced at the cap).
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c  |  41 +++++++++++++++-
  fs/btrfs/block-group.h  |   2 +
@@ -182,7 +179,7 @@ index 44122090fe4f4..e0dccad6f22a9 100644
                                       test_bit(BTRFS_ORDERED_COMPLETE,
                                                &entry->flags),
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index e54f73cb641f4..da8abb516afb8 100644
+index bec90a0cd5d91..07d9d54de751f 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -65,6 +65,13 @@
index 4b1c547f1937f0c7525f175e1bf6199a0a3b9e84..b706418b372c56c5866e4f457fd7ea211afc4970 100644 (file)
@@ -1,7 +1,7 @@
-From ac7145c02402d97f770bed05d22d3fa320599eaf Mon Sep 17 00:00:00 2001
+From 2bbf52c0fc405c1bacba2eccb695eb6b0b210f15 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:53 -0400
-Subject: [RFC PATCH 22/85] btrfs: stripe_alloc: track per-sector liveness and
+Subject: [RFC PATCH 22/86] btrfs: stripe_alloc: track per-sector liveness and
  pad from the map
 To: linux-btrfs@vger.kernel.org
 
@@ -48,8 +48,6 @@ With padding decided by the liveness map, the LIVE and UNALLOCATED pad
 refusal reasons, which only the frontier oracle produced, go; padding now
 declines only for NO_RUN and UNCOVERED.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 262 ++++++++++++++++++++++++++++++------
  fs/btrfs/block-group.h      |  11 +-
@@ -745,10 +743,10 @@ index 2a60ab06618c8..074e1c1a1e5da 100644
   * given a cluster, put all of its extents back into the free space
   * cache.  If a block group is passed, this function will only free
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index da8abb516afb8..a9068fca6b240 100644
+index 07d9d54de751f..910c6f7794ffb 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2175,6 +2175,7 @@ void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc)
+@@ -2168,6 +2168,7 @@ void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc)
        rbio->operation = BTRFS_RBIO_WRITE;
        rbio_add_bio(rbio, bio);
  
@@ -756,7 +754,7 @@ index da8abb516afb8..a9068fca6b240 100644
        /*
         * Don't plug on full rbios, just get them out the door
         * as quickly as we can
-@@ -2757,75 +2758,78 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -2750,75 +2751,78 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
  }
  
  /*
index f458a62c5f4fbb57c9138ef78f2c7a05cbd3bb78..f926839e48660dd5825477615e52b86f2339f14e 100644 (file)
@@ -1,7 +1,7 @@
-From d8b93fda68ac47db25b073220c90b369ab09170b Mon Sep 17 00:00:00 2001
+From 3e8bbdf9b5376b1d44357109ea6c80a93081b8a9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:54 -0400
-Subject: [RFC PATCH 23/85] btrfs: stripe_alloc: count claimable whole-stripe
+Subject: [RFC PATCH 23/86] btrfs: stripe_alloc: count claimable whole-stripe
  supply directly
 To: linux-btrfs@vger.kernel.org
 
@@ -86,8 +86,6 @@ writers, writeback racing fallocate) or a trim holding an entry out could
 both "remove" the same tail and hand out the same extent.  A self-test
 claims the same tail twice.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c       |  31 ++++-
  fs/btrfs/block-group.h       |  10 ++
index bacb350a189d95d1bef972784f3f5617f5d93de0..abe983925daccb6591419cc8c641c6925ab5d021 100644 (file)
@@ -1,7 +1,7 @@
-From d5cf72426bd3a1acbbf21e2f210ac5e87cb8f7a4 Mon Sep 17 00:00:00 2001
+From 44f60282aef09621633a26ba337d93e605b94571 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:55 -0400
-Subject: [RFC PATCH 24/85] btrfs: raid56: adaptive park deadline from the
+Subject: [RFC PATCH 24/86] btrfs: raid56: adaptive park deadline from the
  parked-rbio backlog
 To: linux-btrfs@vger.kernel.org
 
@@ -38,8 +38,6 @@ so the knob can be set from measurement.  Off by default, and no data-path
 change: a shortened park still pads or reads exactly as it would have, only
 sooner.
 
-Assisted-by: Claude:claude-opus-4-8
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/fs.h     |  5 +++++
  fs/btrfs/raid56.c | 21 +++++++++++++++++++++
@@ -70,7 +68,7 @@ index bbb03936df650..89bd82093ea84 100644
        /* Private scrub information */
        struct mutex scrub_lock;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index a9068fca6b240..f27215f8a4017 100644
+index 910c6f7794ffb..bbb4308a16cfd 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -717,6 +717,7 @@ static void rbio_unpark_locked(struct btrfs_raid_bio *rbio)
index 7e28ddc2b5cb2c8285d5e2f87d2a60049f536a87..5a9f045ecbfbde6fe5f26e73f52057e326fd4293 100644 (file)
@@ -1,7 +1,7 @@
-From 961fd368e3fbfa54791cc92b36e3305cfd29ea95 Mon Sep 17 00:00:00 2001
+From 99655819fc7d9a4e0234e1e51f76e147ad75387b Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:56 -0400
-Subject: [RFC PATCH 25/85] btrfs: stripe_alloc: gate data admission on
+Subject: [RFC PATCH 25/86] btrfs: stripe_alloc: gate data admission on
  claimable whole-stripe supply
 To: linux-btrfs@vger.kernel.org
 
@@ -87,10 +87,6 @@ What the gate charges, and what it holds against:
   reservation path does not: a live device shrink must fail cleanly at
   its reservation rather than grow the data space_info).
 
-Assisted-by: Claude:claude-opus-4-8
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      |  46 ++++++-
  fs/btrfs/delalloc-space.c   |  20 ++-
@@ -436,10 +432,10 @@ index 89bd82093ea84..a069482d73257 100644
        /* Block groups and devices containing active swapfiles. */
        spinlock_t swapfile_pins_lock;
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index d27cc1155adf9..1f2a1677aa10a 100644
+index 82221e32a8a67..7f769ad8db3a3 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -9952,6 +9952,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -9949,6 +9949,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
        u64 num_bytes, ram_bytes, disk_num_bytes;
        struct btrfs_key ins;
        bool extent_reserved = false;
@@ -447,7 +443,7 @@ index d27cc1155adf9..1f2a1677aa10a 100644
        struct extent_map *em;
        ssize_t ret;
  
-@@ -10093,7 +10094,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10090,7 +10091,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
         * We don't use the higher-level delalloc space functions because our
         * num_bytes and disk_num_bytes are different.
         */
@@ -457,7 +453,7 @@ index d27cc1155adf9..1f2a1677aa10a 100644
        if (ret)
                goto out_unlock;
        ret = btrfs_qgroup_reserve_data(inode, &data_reserved, start, num_bytes);
-@@ -10121,6 +10123,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10118,6 +10120,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
  
        ret = btrfs_reserve_extent(root, inode, disk_num_bytes, disk_num_bytes,
                                   disk_num_bytes, 0, 0, &ins, true, true);
@@ -466,7 +462,7 @@ index d27cc1155adf9..1f2a1677aa10a 100644
        if (ret)
                goto out_delalloc_release;
        extent_reserved = true;
-@@ -10169,6 +10173,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10166,6 +10170,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
        if (ret < 0)
                btrfs_qgroup_free_data(inode, data_reserved, start, num_bytes, NULL);
  out_free_data_space:
index 63bf5632af1fca2e17c60233a381abd65c267dd4..4a0b0d8aa7fdd81051d6af0598272351dc0a2335 100644 (file)
@@ -1,7 +1,7 @@
-From 77979a1e01f45f2e6b9651e1c4ec9aba3388680d Mon Sep 17 00:00:00 2001
+From c21d5c6a51c2e7e314066171616c5b1cdc4acecf Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:16 -0400
-Subject: [RFC PATCH 26/85] btrfs: stripe_alloc: show per-group trapped bytes
+Subject: [RFC PATCH 26/86] btrfs: stripe_alloc: show per-group trapped bytes
  in the space info dump
 To: linux-btrfs@vger.kernel.org
 
@@ -15,8 +15,6 @@ Print stripe_unusable next to zone_unusable and leave it out of the
 available bytes.  A group whose trapped bytes have not been counted yet
 (stripe_unusable_ready not set) prints 0 and the old available figure.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/space-info.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
index 1cb52bf4625254f5dcdf43fc318ca53d402e639a..f518cd4295a6b448a332e8538e89bf9316b22c50 100644 (file)
@@ -1,7 +1,7 @@
-From ab3d1172e1ef05b4aaec29389ca173379fab47b6 Mon Sep 17 00:00:00 2001
+From 449dfd26d389c92042e6e72599917c28ca818c9d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:19 -0400
-Subject: [RFC PATCH 27/85] btrfs: stripe_alloc: count whole stripes stranded
+Subject: [RFC PATCH 27/86] btrfs: stripe_alloc: count whole stripes stranded
  behind live runs as trapped
 To: linux-btrfs@vger.kernel.org
 
@@ -53,8 +53,6 @@ until the next commit, admitting writes that writeback could not place.
 The scan does not restore the stripe_meta margin and reserve when
 stripe_alloc was disabled after it started.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 86 +++++++++++++++++++++++++++++++------
  fs/btrfs/block-group.h      | 12 ++++++
index 4d335c4c4e30496350a080b33a1946392a8699f8..947472239b0f8d40d49ccfb60851c7d6b7544707 100644 (file)
@@ -1,7 +1,7 @@
-From 42a2d55cf0d1a42daf2b0e52b1dbfea8c106ff5d Mon Sep 17 00:00:00 2001
+From a1db622df6f181b4a34b828ccadcac14a4ed7434 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:20 -0400
-Subject: [RFC PATCH 28/85] btrfs: stripe_alloc: count nocow run lifecycles and
+Subject: [RFC PATCH 28/86] btrfs: stripe_alloc: count nocow run lifecycles and
  stranded stripes in sysfs
 To: linux-btrfs@vger.kernel.org
 
@@ -25,8 +25,6 @@ burns no stripe per commit; a run whose map was retired is never taken as
 dead.  The free path only clears bits under bg->stripe_run_lock.
 nocow_run_dead_closed counts the closes.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 10 ++++++++--
  fs/btrfs/fs.h          | 11 +++++++++++
index 1d343c7fdcc311c485dab15641086e3796fc7869..d7dc36397f049e2c52defe0aa308187411d83ad6 100644 (file)
@@ -1,7 +1,7 @@
-From a970426e4778810f1fb11a61d9893f9d6867fdd3 Mon Sep 17 00:00:00 2001
+From c7a11a6c2872b3c59ae249619b6e0c797ed3556f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:25 -0400
-Subject: [RFC PATCH 29/85] btrfs: stripe_alloc: say at mount whether the
+Subject: [RFC PATCH 29/86] btrfs: stripe_alloc: say at mount whether the
  policy is on
 To: linux-btrfs@vger.kernel.org
 
@@ -29,8 +29,6 @@ needs the runtime enable worker of the write-hole checker.
 Nothing is printed when the policy is off, which keeps the common mount
 quiet and makes the absence of the line mean exactly one thing.
 
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/super.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
index 32d830709f029e53f8587ca00e1c49734ce40c46..9b72fc9065e1d46a225fedf776e6d7dbd776ea2d 100644 (file)
@@ -1,7 +1,7 @@
-From 1093cc1e885e8804cfc10e1528014a38e29c772c Mon Sep 17 00:00:00 2001
+From d1660f5c53c2e3cb9739fe7f32b0372bead413e0 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 00:57:50 -0400
-Subject: [RFC PATCH 30/85] btrfs: stripe_alloc: keep relocation's stripe runs
+Subject: [RFC PATCH 30/86] btrfs: stripe_alloc: keep relocation's stripe runs
  until relocation ends
 To: linux-btrfs@vger.kernel.org
 
@@ -35,7 +35,6 @@ runs kept and released.
 The open stripe self-test frees the runs it leaves retained, as unmount
 does.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 65 ++++++++++++++++++++++++++++++++++++++----
  fs/btrfs/fs.h          |  3 ++
index 5eac214f027f4be1a26f7c2ed36dbff553ef8a3d..a4ebb0695ba8f5784c9c51fbf1b37da187b1c581 100644 (file)
@@ -1,7 +1,7 @@
-From 3f01056e9cf437ba083971c5e9d7abb87546e572 Mon Sep 17 00:00:00 2001
+From 72003bdac03adebdff243a2808103f9ba8b42255 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 12:14:49 -0400
-Subject: [RFC PATCH 31/85] btrfs: stripe_alloc: keep a stripe in the rbio
+Subject: [RFC PATCH 31/86] btrfs: stripe_alloc: keep a stripe in the rbio
  cache until its run has written all of it
 To: linux-btrfs@vger.kernel.org
 
@@ -60,7 +60,6 @@ so nothing a truncated extent kept is zeroed.  Waiters are woken while the
 run lock is held, since the run and its group can be freed once it is
 dropped.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c  | 157 ++++++++++++++++++++++++++++++++++++++--
  fs/btrfs/block-group.h  |   6 +-
@@ -351,7 +350,7 @@ index e0dccad6f22a9..5bd8ff43f9d52 100644
  
  static bool can_finish_ordered_extent(struct btrfs_ordered_extent *ordered,
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index f27215f8a4017..4b8854370ce1b 100644
+index bbb4308a16cfd..ea237b4a346a1 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -72,6 +72,17 @@
@@ -530,7 +529,7 @@ index f27215f8a4017..4b8854370ce1b 100644
  
        spin_unlock(&table->cache_lock);
  }
-@@ -1291,6 +1398,10 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
+@@ -1294,6 +1401,10 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
        rbio->csum_buf = NULL;
        rbio->csum_bitmap = NULL;
  
index eaf126d6a706780a01183ed6a9ecdfec7449ad12..40c87d16f0cac6d3f2de151dd2cf3b3ac1fb2f0e 100644 (file)
@@ -1,7 +1,7 @@
-From 7aaa8f1b809d96dec4c7d6efc27bc42289439e50 Mon Sep 17 00:00:00 2001
+From 57145e6448f6a9da02b0452044f7927d4c0bf680 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 2 Oct 2026 02:41:44 -0400
-Subject: [RFC PATCH 32/85] btrfs: stripe_alloc: pad a stripe's allocated
+Subject: [RFC PATCH 32/86] btrfs: stripe_alloc: pad a stripe's allocated
  sectors whose write is still to come
 To: linux-btrfs@vger.kernel.org
 
@@ -32,7 +32,6 @@ keep no written map (their extents are rewritten in place for as long as
 the inode lives) and are excluded.  padded_unwritten in stripe_park_stats
 counts the pads that zeroed such sectors.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 47 +++++++++++++++++++++++++-----------------
  fs/btrfs/block-group.h |  1 +
@@ -138,10 +137,10 @@ index 58d4eb020e1f2..0abf7d9f8b661 100644
                 * Data read-modify-writes in a covered block group, parked or
                 * not; zero with allow_rmw empty.  rmw_reads counts only the
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 4b8854370ce1b..9245585a371b0 100644
+index ea237b4a346a1..da1307598f21b 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2905,7 +2905,9 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2898,7 +2898,9 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        const u32 nsectors = rbio->nr_data * rbio->stripe_nsectors;
        struct btrfs_stripe_pad_info info;
        unsigned long *dead;
@@ -151,7 +150,7 @@ index 4b8854370ce1b..9245585a371b0 100644
        bool ok = false;
        int i;
  
-@@ -2913,10 +2915,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2906,10 +2908,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                return false;
  
        dead = bitmap_zalloc(nsectors, GFP_NOFS);
@@ -168,7 +167,7 @@ index 4b8854370ce1b..9245585a371b0 100644
                trace_btrfs_stripe_pad_decline(fs_info, stripe_start,
                                               stripe_len, 0, 0, nsectors,
                                               info.run_start, info.run_end,
-@@ -2934,11 +2940,10 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2927,11 +2933,10 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                        covered++;
  
        /*
@@ -184,7 +183,7 @@ index 4b8854370ce1b..9245585a371b0 100644
         */
        for (i = 0; i < nsectors; i++) {
                if (rbio->bio_paddrs[i * rbio->sector_nsteps] != INVALID_PADDR)
-@@ -2956,10 +2961,13 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2949,10 +2954,13 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                                                       info.reason);
                        goto out;
                }
@@ -198,7 +197,7 @@ index 4b8854370ce1b..9245585a371b0 100644
        if (!ok)
                return false;
  
-@@ -2994,6 +3002,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2987,6 +2995,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        bitmap_set(&rbio->dbitmap, 0, rbio->stripe_nsectors);
        spin_unlock(&rbio->bio_list_lock);
        atomic64_inc(&fs_info->stripe_park_stats.padded);
index f3b8320c1f44b286d0ea813ddc48429131f3daed..95b6daeee8aca9d5619d6b3b1955523f8ca317a6 100644 (file)
@@ -1,7 +1,7 @@
-From 450ed7f4243375fd35744e4305ce5e50f60c1ace Mon Sep 17 00:00:00 2001
+From da01defef21f07a729ba14e509b3f4098055f495 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 4 Oct 2026 12:26:45 -0400
-Subject: [RFC PATCH 33/85] btrfs: stripe_alloc: count refused rbio pins and
+Subject: [RFC PATCH 33/86] btrfs: stripe_alloc: count refused rbio pins and
  track rbio cache high water
 To: linux-btrfs@vger.kernel.org
 
@@ -51,8 +51,6 @@ while buffered writeback needed 3-14.  Two things release pins:
 
 stripe_park_stats also has rbio_pin_swept and rbio_pin_commit_requests.
 
-Assisted-by: Claude:claude-opus-5-5
-Assisted-by: Claude:claude-fable-5
 ---
  fs/btrfs/fs.h          |  19 ++++++
  fs/btrfs/raid56.c      | 136 +++++++++++++++++++++++++++++++++++++++--
@@ -92,7 +90,7 @@ index 0abf7d9f8b661..015f492b1f5d3 100644
                atomic64_t written_not_live;
        } stripe_park_stats;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 9245585a371b0..3c702231c6f44 100644
+index da1307598f21b..7ac5d6479cf4a 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -80,8 +80,20 @@
@@ -275,7 +273,7 @@ index 9245585a371b0..3c702231c6f44 100644
        spin_lock(&rbio->bio_list_lock);
  
        /* bump our ref if we were not in the list before */
-@@ -3086,6 +3212,8 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -3079,6 +3205,8 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                 * count that should be zero.
                 */
                atomic64_inc(&fs_info->stripe_park_stats.data_rmw);
@@ -356,7 +354,7 @@ index 74eb13bf72c58..6997c81febfb2 100644
  BTRFS_ATTR(, stripe_park_stats, btrfs_stripe_park_stats_show);
  
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index 4f781df772202..6bbcf42121461 100644
+index b3f4b186935e8..c97e37951c2af 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
 @@ -23,6 +23,7 @@
@@ -367,7 +365,7 @@ index 4f781df772202..6bbcf42121461 100644
  #include "space-info.h"
  #include "fs.h"
  #include "accessors.h"
-@@ -2472,6 +2473,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2467,6 +2468,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
         * no-op when no stripe runs exist.
         */
        btrfs_retire_open_stripes(fs_info, cur_trans);
index 2f4f06e71c94b4c2b4b00c9478ab1d55cd8d8f36..666cde81c763c8c205d92ce68dac4429c914a30d 100644 (file)
@@ -1,7 +1,7 @@
-From f0c935dc1c822c96b7756632d5820b5e2ff3e3b9 Mon Sep 17 00:00:00 2001
+From c39dfd7b5e531bb483c4b6ef6c46084795188c73 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 10 Oct 2026 00:19:18 -0400
-Subject: [RFC PATCH 34/85] btrfs: stripe_alloc: skip RAID5/6 groups that are
+Subject: [RFC PATCH 34/86] btrfs: stripe_alloc: skip RAID5/6 groups that are
  mapped as RAID1/RAID1C3
 To: linux-btrfs@vger.kernel.org
 
@@ -37,7 +37,6 @@ takes away.  Groups of other profiles are not counted: a RAID5/6 write
 cannot use them.  The full-stripe widths the admission charge is taken
 over leave these groups out, as their full stripe is one sector.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 25 ++++++++++++++----
  fs/btrfs/block-group.h      | 27 ++++++++++++++++++++
@@ -399,10 +398,10 @@ index cba0232fa04a3..6cdfe66d0d305 100644
                                           remainders.  Claimed out of the free
                                           space cache but not yet allocated;
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index ce78a9441c64f..ae2d0a814d63e 100644
+index 3d4ef6725de0e..c0a75b974b8d6 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6593,6 +6593,27 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
+@@ -6605,6 +6605,27 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
        return len;
  }
  
@@ -431,10 +430,10 @@ index ce78a9441c64f..ae2d0a814d63e 100644
  static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first, int num_stripes)
  {
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 75b1179776c80..bce6134218f48 100644
+index 891bc2432870a..fd057a44447bd 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -803,6 +803,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev,
+@@ -802,6 +802,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev,
  void btrfs_free_device(struct btrfs_device *device);
  unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
                                    u64 logical);
index 059407e46aee3b35485cfe7174431f67b074a877..8f88d76c55705bbcf50a4fb5b21af3e199db02cc 100644 (file)
@@ -1,7 +1,7 @@
-From e8b09057e186e8145de34006de1d726882937c03 Mon Sep 17 00:00:00 2001
+From 857157c303f240edee21f9f6b144fa8628c2e330 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 25 Oct 2026 06:27:49 -0400
-Subject: [RFC PATCH 35/85] btrfs: stripe_alloc: do not count a writeback
+Subject: [RFC PATCH 35/86] btrfs: stripe_alloc: do not count a writeback
  ENOSPC drop's give-back as supply
 To: linux-btrfs@vger.kernel.org
 
@@ -62,7 +62,6 @@ or a new group arrive.
 The counter is in sysfs (bytes_stripe_quarantine), in the space info
 dump, and in the data writeback ENOSPC line; each drop logs the new total.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 12 +++++-
  fs/btrfs/extent-tree.c      | 13 +++++++
@@ -194,7 +193,7 @@ index 03a3d91ae04d5..d89127c24f11e 100644
  void btrfs_stripe_unmanaged_sync(struct btrfs_block_group *block_group);
  void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *block_group);
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 1f2a1677aa10a..5a36404d62d8f 100644
+index 7f769ad8db3a3..afa0ea5db0400 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1360,6 +1360,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
index 9a1129715f520d6cdffaf050c4df4ae830b90e69..c418e5eea906adf767d0553b1fb162f12b33bd21 100644 (file)
@@ -1,7 +1,7 @@
-From c5e7e44d3b410638918e88d8cc9f97918b558c48 Mon Sep 17 00:00:00 2001
+From 95957351e9567cf88b15e3a0158b266b9b950e03 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:39 -0400
-Subject: [RFC PATCH 36/85] btrfs: stripe_alloc: isolate nodatacow and
+Subject: [RFC PATCH 36/86] btrfs: stripe_alloc: isolate nodatacow and
  preallocated extents by stripe
 To: linux-btrfs@vger.kernel.org
 
@@ -25,8 +25,6 @@ are left for a private run the allocation falls back to the shared
 runs, which is safe -- an extent that lands in a shared stripe simply
 stays force-COWed when write-in-place arrives.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c |  6 ++--
  fs/btrfs/block-group.h | 10 +++++++
@@ -255,7 +253,7 @@ index 45a4a7e38d810..f650cc79b094d 100644
                  struct extent_buffer *buf, bool full_backref);
  int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 5a36404d62d8f..56e516441be7e 100644
+index afa0ea5db0400..336478ad199b4 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1072,7 +1072,7 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,
@@ -276,7 +274,7 @@ index 5a36404d62d8f..56e516441be7e 100644
        if (ret < 0) {
                *ret_alloc_size = cur_len;
                return ret;
-@@ -9293,8 +9293,9 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9290,8 +9290,9 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
                 * sized chunks.
                 */
                cur_bytes = min(cur_bytes, last_alloc);
@@ -288,7 +286,7 @@ index 5a36404d62d8f..56e516441be7e 100644
                if (ret)
                        break;
                /*
-@@ -10133,7 +10134,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10130,7 +10131,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
        }
  
        ret = btrfs_reserve_extent(root, inode, disk_num_bytes, disk_num_bytes,
index 600b01197afc9e83922f25b60ba8591feec7a8f8..bc31902f70d7cf37370213580806fce2a42b2324 100644 (file)
@@ -1,7 +1,7 @@
-From a69e33446c5071f8b1ec51725680c0c6018d6b13 Mon Sep 17 00:00:00 2001
+From 682cce8d9316608aa650220109edf31475ea6771 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:20 -0400
-Subject: [RFC PATCH 37/85] btrfs: stripe_alloc: count nocow run lifecycles and
+Subject: [RFC PATCH 37/86] btrfs: stripe_alloc: count nocow run lifecycles and
  stranded stripes in sysfs (allow_rmw part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ once "btrfs: stripe_alloc: isolate nodatacow and preallocated extents by
 stripe" is in, instead of with the rest of "btrfs: stripe_alloc: count
 nocow run lifecycles and stranded stripes in sysfs".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 2 ++
  1 file changed, 2 insertions(+)
index 63192c5b41209947e19a70862d8d0650dace69ea..e11de85ec6c5a57cfadb589bf9abc2b2fa161591 100644 (file)
@@ -1,7 +1,7 @@
-From 0d4a5956944659eaf614e92e4457eb4818133dbd Mon Sep 17 00:00:00 2001
+From 59f2a99e3339f631c6f62c0629534ad35947b668 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 12:14:49 -0400
-Subject: [RFC PATCH 38/85] btrfs: stripe_alloc: keep a stripe in the rbio
+Subject: [RFC PATCH 38/86] btrfs: stripe_alloc: keep a stripe in the rbio
  cache until its run has written all of it (allow_rmw part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,7 +13,6 @@ once "btrfs: stripe_alloc: isolate nodatacow and preallocated extents by
 stripe" is in, instead of with the rest of "btrfs: stripe_alloc: keep a
 stripe in the rbio cache until its run has written all of it".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 2 ++
  1 file changed, 2 insertions(+)
index 0d097a5c732e0c05b92c522cdac7bf329c31b5af..c098f26ea56bcfafe9a97f99a87501e1a69e9536 100644 (file)
@@ -1,7 +1,7 @@
-From 7aae3e102d63ae77c7c24d64c3d472708641092b Mon Sep 17 00:00:00 2001
+From 49d8dca3a2558a961dfec04e2cb791b1f53579b5 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 2 Oct 2026 02:41:44 -0400
-Subject: [RFC PATCH 39/85] btrfs: stripe_alloc: pad a stripe's allocated
+Subject: [RFC PATCH 39/86] btrfs: stripe_alloc: pad a stripe's allocated
  sectors whose write is still to come (allow_rmw part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,7 +13,6 @@ once "btrfs: stripe_alloc: isolate nodatacow and preallocated extents by
 stripe" is in, instead of with the rest of "btrfs: stripe_alloc: pad a
 stripe's allocated sectors whose write is still to come".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 1 +
  1 file changed, 1 insertion(+)
index 16f57db63ac120a1b63ac338b57095a0ac6ba23e..1cf6f696f0794771d539766868423c938997cca7 100644 (file)
@@ -1,7 +1,7 @@
-From 0437ebeb84516f0d77b626d5ec03d23100ca56a5 Mon Sep 17 00:00:00 2001
+From d687d8628a81c64bdb86b015f8272a4bd87275bc Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:40 -0400
-Subject: [RFC PATCH 40/85] btrfs: stripe_alloc: allow-rmw policy, and
+Subject: [RFC PATCH 40/86] btrfs: stripe_alloc: allow-rmw policy, and
  write-in-place for isolated nocow extents
 To: linux-btrfs@vger.kernel.org
 
@@ -71,8 +71,6 @@ inline backref: a data extent whose only backref is a keyed
 EXTENT_DATA_REF item (the leaf had no room to grow the item) has none, and
 counts as not owned.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 240 ++++++++++++++++++++++++++++++++++++++++-
  fs/btrfs/block-group.h |  12 +++
@@ -467,7 +465,7 @@ index 015f492b1f5d3..b23133fff440b 100644
  {
        clear_and_wake_up_bit(BTRFS_FS_UNFINISHED_DROPS, &fs_info->flags);
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 56e516441be7e..60c44c371d6bd 100644
+index 336478ad199b4..0af674f204dbc 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1888,9 +1888,19 @@ static int can_nocow_file_extent(struct btrfs_path *path,
@@ -552,7 +550,7 @@ index 334657a98fdc2..741ccacb42f84 100644
  
  int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 3c702231c6f44..1dea8aa3ef539 100644
+index 7ac5d6479cf4a..6df54ae555c9b 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -1000,8 +1000,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
index 2b8301eecdecf242327cf1df8477592694d2eaae..650164f72b2d5629c3c15c9a66b2aae5e61d451f 100644 (file)
@@ -1,7 +1,7 @@
-From cafd58d8083939417609bbb04bd6816fef59f62f Mon Sep 17 00:00:00 2001
+From c97275bdab83c1ae6c22c46b80489208154dd8da Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:50 -0400
-Subject: [RFC PATCH 41/85] btrfs: stripe_alloc: tunable park deadlines, and
+Subject: [RFC PATCH 41/86] btrfs: stripe_alloc: tunable park deadlines, and
  say why padding declined (allow_rmw part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,14 +13,12 @@ once "btrfs: stripe_alloc: allow-rmw policy, and write-in-place for
 isolated nocow extents" is in, instead of with the rest of "btrfs:
 stripe_alloc: tunable park deadlines, and say why padding declined".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/raid56.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 1dea8aa3ef539..169e1cccd73cd 100644
+index 6df54ae555c9b..f458014e85792 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -1022,7 +1022,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
index 10e32ccedfe8ea9e6c28f3b45cec516dd5907269..63b562aca168faf7b7a14001e52887d02637a49c 100644 (file)
@@ -1,7 +1,7 @@
-From ee51d53e1180106cedb240a3133381863b5ef054 Mon Sep 17 00:00:00 2001
+From 71b9db1fb04d771cba8479b664e1e5d7a727129a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:53 -0400
-Subject: [RFC PATCH 42/85] btrfs: stripe_alloc: track per-sector liveness and
+Subject: [RFC PATCH 42/86] btrfs: stripe_alloc: track per-sector liveness and
  pad from the map (allow_rmw part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ once "btrfs: stripe_alloc: allow-rmw policy, and write-in-place for
 isolated nocow extents" is in, instead of with the rest of "btrfs:
 stripe_alloc: track per-sector liveness and pad from the map".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 18 ++++++++++++------
  1 file changed, 12 insertions(+), 6 deletions(-)
index cdbdd6419ee2cd92c70493e4f208976c941d0c1c..c4813fbbb9b0eb7a64d13ca9cfde959dc0df1c2d 100644 (file)
@@ -1,7 +1,7 @@
-From 17c29738aeed56dea82bcc78e661387c315c5e27 Mon Sep 17 00:00:00 2001
+From e465e48a55b7342b8de92ccde32c6821ec9a93a6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:41 -0400
-Subject: [RFC PATCH 43/85] btrfs: stripe_alloc: persist nocow runs across
+Subject: [RFC PATCH 43/86] btrfs: stripe_alloc: persist nocow runs across
  commits and remounts
 To: linux-btrfs@vger.kernel.org
 
@@ -80,9 +80,6 @@ tree search; when that cannot answer, the extent is treated as not the
 inode's own and the write falls back to COW, which a NOWAIT write refuses
 with -EAGAIN.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            | 336 +++++++++++++++++++++++++++++-
  fs/btrfs/block-group.h            |  14 +-
@@ -816,7 +813,7 @@ index b23133fff440b..3981823c3b879 100644
                atomic64_t reloc_run_retained;
                atomic64_t reloc_run_released;
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 60c44c371d6bd..8b7fd4704349a 100644
+index 0af674f204dbc..cc1dabf910591 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1900,7 +1900,8 @@ static int can_nocow_file_extent(struct btrfs_path *path,
index fea7eca9938a351e66e272d3afc4e86df8535043..b5599547c5237b71637c557f9728a822b34d96f0 100644 (file)
@@ -1,7 +1,7 @@
-From fc70bed6ee5389cfaa680f350387c570fae0567d Mon Sep 17 00:00:00 2001
+From fb1ac0bc8a7a5c3ec104e094b0dd80f887cffa08 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:45 -0400
-Subject: [RFC PATCH 44/85] btrfs: stripe_alloc: count open stripe run
+Subject: [RFC PATCH 44/86] btrfs: stripe_alloc: count open stripe run
  remainders against data reservations (allow_rmw part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ stripe_alloc: persist nocow runs across commits and remounts" is in,
 instead of with the rest of "btrfs: stripe_alloc: count open stripe run
 remainders against data reservations".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 1 +
  1 file changed, 1 insertion(+)
index 1a96ab2494dcd4cf1b2f498ced8fd28ef7dcf957..79733c138181f8a098382cf88fe86b49acdddeaf 100644 (file)
@@ -1,7 +1,7 @@
-From d7415060a9e2c225a14c877d1d6e26568a78b984 Mon Sep 17 00:00:00 2001
+From 4e250f77964d8705199ed51f1e3148fe0225b6b6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:06 -0400
-Subject: [RFC PATCH 45/85] btrfs: stripe_alloc: hand groups full of trapped
+Subject: [RFC PATCH 45/86] btrfs: stripe_alloc: hand groups full of trapped
  free space to the reclaim worker
 To: linux-btrfs@vger.kernel.org
 
@@ -54,9 +54,6 @@ Relocation waits for in-flight allocations and writers on its own.
 The stripe_meta block group part of this change moved to
 "btrfs: stripe_meta: extend stripe reclaim to metadata block groups".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 94 +++++++++++++++++++++++++++++++++++--
  fs/btrfs/block-group.h      |  4 +-
index 55b4adfec89d073bc22ff830a1ecca5316c41797..7ef560bf0f76c528ba9b19a6cf3c9dfcc9110848 100644 (file)
@@ -1,7 +1,7 @@
-From 5597aa5fed5c31b4b3138152b8fcae6cdc20e028 Mon Sep 17 00:00:00 2001
+From 50dfc82d544d4c26e6fd40d75a509389993027da Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:19 -0400
-Subject: [RFC PATCH 46/85] btrfs: stripe_alloc: count whole stripes stranded
+Subject: [RFC PATCH 46/86] btrfs: stripe_alloc: count whole stripes stranded
  behind live runs as trapped (reclaim part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ here, once "btrfs: stripe_alloc: hand groups full of trapped free space
 to the reclaim worker" is in, instead of with the rest of "btrfs:
 stripe_alloc: count whole stripes stranded behind live runs as trapped".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/free-space-cache.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
index 56ce2e883b881e7b92d8e26410dd7f02fb3daae2..f7d57d312c3315f77eef0303790834439211068d 100644 (file)
@@ -1,7 +1,7 @@
-From 47e107d59d085279c4b94662f59a916745cce5c7 Mon Sep 17 00:00:00 2001
+From 4c21fe03a1a989245bdb2bcc7fdc33b7fde4fbf6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 29 Sep 2026 05:29:38 -0400
-Subject: [RFC PATCH 47/85] btrfs: stripe_alloc: compact mostly live groups
+Subject: [RFC PATCH 47/86] btrfs: stripe_alloc: compact mostly live groups
  instead of skipping them
 To: linux-btrfs@vger.kernel.org
 
@@ -61,7 +61,6 @@ claimable elsewhere, the most a compaction can move.
 The stripe_meta block group part of this change moved to
 "btrfs: stripe_meta: extend stripe reclaim to metadata block groups".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      |  42 +++++-
  fs/btrfs/disk-io.c          |   1 +
@@ -152,7 +151,7 @@ index 32948c0ec5b33..7a486f1301d39 100644
                btrfs_dec_block_group_ro(bg);
                btrfs_debug(fs_info, "deferring reclaim of chunk %llu", bg->start);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 0b23e576ed4ed..7a882a47829c4 100644
+index 67776888ea3e1..0d7906bea0c61 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -2806,6 +2806,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
@@ -836,10 +835,10 @@ index 325f6cb1e7167..56140f1f34c35 100644
        NULL,
  };
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index ae2d0a814d63e..c9f81b0975fe0 100644
+index c0a75b974b8d6..ea98cef92dc3d 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -3737,7 +3737,8 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
+@@ -3749,7 +3749,8 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
        return ret;
  }
  
@@ -849,7 +848,7 @@ index ae2d0a814d63e..c9f81b0975fe0 100644
  {
        struct btrfs_block_group *block_group;
        int ret;
-@@ -3764,7 +3765,7 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
+@@ -3776,7 +3777,7 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
  
        /* step one, relocate all the extents inside this chunk */
        btrfs_scrub_pause(fs_info);
@@ -858,7 +857,7 @@ index ae2d0a814d63e..c9f81b0975fe0 100644
        btrfs_scrub_continue(fs_info);
        if (ret) {
                /*
-@@ -3776,6 +3777,10 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
+@@ -3788,6 +3789,10 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
                return ret;
        }
  
@@ -869,7 +868,7 @@ index ae2d0a814d63e..c9f81b0975fe0 100644
        block_group = btrfs_lookup_block_group(fs_info, chunk_offset);
        if (!block_group)
                return -ENOENT;
-@@ -3791,6 +3796,25 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
+@@ -3803,6 +3808,25 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
        return ret;
  }
  
@@ -896,10 +895,10 @@ index ae2d0a814d63e..c9f81b0975fe0 100644
  {
        struct btrfs_root *chunk_root = fs_info->chunk_root;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index bce6134218f48..f57b73ae996bc 100644
+index fd057a44447bd..89cd915ea503e 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -787,6 +787,8 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info);
+@@ -786,6 +786,8 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info);
  int btrfs_pause_balance(struct btrfs_fs_info *fs_info);
  int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset,
                         bool verbose);
index 870008baf1a87c997b736fdf1c5d5da8061022c2..055f6ea1428a40ab22712457158b2f6477d1395a 100644 (file)
@@ -1,7 +1,7 @@
-From ce90272a1e42dbd3b8cb55d8caf659b53f2218c4 Mon Sep 17 00:00:00 2001
+From 1f926d1edc4c12784201a0d0c816a2e8aebdf62f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 00:57:50 -0400
-Subject: [RFC PATCH 48/85] btrfs: stripe_alloc: keep relocation's stripe runs
+Subject: [RFC PATCH 48/86] btrfs: stripe_alloc: keep relocation's stripe runs
  until relocation ends (reclaim part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,7 +13,6 @@ stripe_alloc: compact mostly live groups instead of skipping them" is
 in, instead of with the rest of "btrfs: stripe_alloc: keep relocation's
 stripe runs until relocation ends".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/sysfs.c | 4 ++++
  1 file changed, 4 insertions(+)
index 2ea0a6da82638a17e02c21dd78d6fe0ccb355dd8..2ba82f82f76379b661391def81a3ed173a2efabc 100644 (file)
@@ -1,7 +1,7 @@
-From 5e7bdfed533872a8dcf42c0bf0c61093e904e7d0 Mon Sep 17 00:00:00 2001
+From a74d8a8889f6062bd6270534d16c60bb3971c3bb Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 13:04:19 -0400
-Subject: [RFC PATCH 49/85] btrfs: stripe_alloc: log compaction and trapped
+Subject: [RFC PATCH 49/86] btrfs: stripe_alloc: log compaction and trapped
  bytes in the reclaim log
 To: linux-btrfs@vger.kernel.org
 
@@ -12,7 +12,6 @@ which counts reclaims in the log, could not tell automatic compaction from
 relocation, and an octopus replace stalled behind a reclaim the log did not
 explain.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
index b36562a4941538f8897165e292e8dccdaf26ebad..61d1ea1b45705fe59bfb395ae9b8cf97fc5796ce 100644 (file)
@@ -1,7 +1,7 @@
-From b2f61eea4161613ad769f238ca4e3a577933db32 Mon Sep 17 00:00:00 2001
+From 63a86ba3758d8eeef11e9488730609861f0989c1 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 14:41:37 -0400
-Subject: [RFC PATCH 50/85] btrfs: stripe_alloc: add stripe_reclaim_now to
+Subject: [RFC PATCH 50/86] btrfs: stripe_alloc: add stripe_reclaim_now to
  reclaim stripes on demand
 To: linux-btrfs@vger.kernel.org
 
@@ -69,7 +69,6 @@ btrfs check is clean.
 The stripe_meta block group part of this change moved to
 "btrfs: stripe_meta: extend stripe reclaim to metadata block groups".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 164 +++++++++++++++++++++++++++++++++++-
  fs/btrfs/block-group.h      |   7 ++
index 1679dc65aeedce919296e1780dfde020d9b8be0b..9da246283adda78ee29f19b32941d8fd882de211 100644 (file)
@@ -1,7 +1,7 @@
-From 09ecfab617ebaa1cb76f626ebe7c752342436e7f Mon Sep 17 00:00:00 2001
+From 01ac2f5d66a2cedb2a963aa277dec37f79138e03 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 04:02:52 -0400
-Subject: [RFC PATCH 51/85] btrfs: stripe_alloc: back off stripe reclaim after
+Subject: [RFC PATCH 51/86] btrfs: stripe_alloc: back off stripe reclaim after
  repeated ENOSPC
 To: linux-btrfs@vger.kernel.org
 
@@ -40,7 +40,6 @@ five relocations failed with -ENOSPC and reclaim backed off once
 (reclaim_backoffs +1), then resumed.  stripe-reclaim-test and
 stripe-reclaim-now-test pass.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      |  9 ++++++---
  fs/btrfs/free-space-cache.c | 34 +++++++++++++++++++++++++++++++++-
index 6acc29c55180ade73086a1e5f3aa32999f5bd67b..6923b03824826ffc13cfaeb59afb91aec836e6cd 100644 (file)
@@ -1,7 +1,7 @@
-From c76ecce44b21c74f5e253d032b848547a34165c8 Mon Sep 17 00:00:00 2001
+From be59354e5d64390d55076dadfa9d50a33705e205 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:31 -0400
-Subject: [RFC PATCH 52/85] btrfs: stripe_alloc: settle a logged extent's
+Subject: [RFC PATCH 52/86] btrfs: stripe_alloc: settle a logged extent's
  stripes at log commit
 To: linux-btrfs@vger.kernel.org
 
@@ -51,9 +51,6 @@ On a filesystem that has gone into error the settle wait does not sleep
 for IO: the log commit fails anyway, and the ordered extents in flight are
 only torn down at unmount.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 81 ++++++++++++++++++++++++++++++++++++++++++
  fs/btrfs/block-group.h |  2 ++
index ffa3e419b5d0845e4ef8df2956686d9f5b3b94b6..c1fc175de8b797288fadfc85feb800fc35dec0c7 100644 (file)
@@ -1,7 +1,7 @@
-From e1e8599602e0ab71282791410e7db2f0b3e9a6ac Mon Sep 17 00:00:00 2001
+From fe00cd985222e2044dbbdf7537f041c3de0b9fb4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:45 -0400
-Subject: [RFC PATCH 53/85] btrfs: stripe_alloc: count open stripe run
+Subject: [RFC PATCH 53/86] btrfs: stripe_alloc: count open stripe run
  remainders against data reservations (fsync part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ stripe_alloc: settle a logged extent's stripes at log commit" is in,
 instead of with the rest of "btrfs: stripe_alloc: count open stripe run
 remainders against data reservations".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
index e68506ebb146000c52734192a181584444086cb4..cc449958c8a8511f4715755345a442b24a1aa77b 100644 (file)
@@ -1,7 +1,7 @@
-From 480cf210e8b628cc824e3a754f3cd900cd781327 Mon Sep 17 00:00:00 2001
+From b07a15be4643a5f02ade5fa34c71b21ac5862b76 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:40 -0400
-Subject: [RFC PATCH 54/85] btrfs: stripe_alloc: allow-rmw policy, and
+Subject: [RFC PATCH 54/86] btrfs: stripe_alloc: allow-rmw policy, and
  write-in-place for isolated nocow extents (fsync part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ stripe_alloc: settle a logged extent's stripes at log commit" is in,
 instead of with the rest of "btrfs: stripe_alloc: allow-rmw policy, and
 write-in-place for isolated nocow extents".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
index 7c53b0bed97e57cd9c771e13ac9f08b40efb346e..f05c57ba7cf02f89379d9178524d1bd00b23ec1f 100644 (file)
@@ -1,7 +1,7 @@
-From 026d160272731cde3642ea1c7017802fbc51ee70 Mon Sep 17 00:00:00 2001
+From 0af3d9a23c6653f46f0354b39bc74df134d0c020 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:37 -0400
-Subject: [RFC PATCH 55/85] btrfs: stripe_alloc: carry an inode's log tail
+Subject: [RFC PATCH 55/86] btrfs: stripe_alloc: carry an inode's log tail
  forward at fsync
 To: linux-btrfs@vger.kernel.org
 
@@ -63,9 +63,6 @@ just not carried.  The carry also clears a stale EXTENT_NORESERVE (left by
 a NOCOW write) with the other delalloc bits, so the data space it reserved
 is released when the range is later written NOCOW.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
-Assisted-by: Claude:claude-opus-5
 ---
  fs/btrfs/block-group.c    |  90 ++++++++++++++++++++-
  fs/btrfs/block-group.h    |   4 +-
@@ -242,7 +239,7 @@ index 32bbbad20a817..d6b2c12c7230c 100644
  int btrfs_enable_stripe_alloc(struct btrfs_fs_info *fs_info);
  void btrfs_disable_stripe_alloc(struct btrfs_fs_info *fs_info);
 diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
-index 663e925b14300..8cb09b291597a 100644
+index 93c256a68c242..048206318a1cf 100644
 --- a/fs/btrfs/btrfs_inode.h
 +++ b/fs/btrfs/btrfs_inode.h
 @@ -140,6 +140,31 @@ enum {
@@ -589,7 +586,7 @@ index 73941a48cf4d7..1af09fbaf2bf9 100644
         * Before we acquired the inode's lock and the mmap lock, someone may
         * have dirtied more pages in the target range. We need to make sure
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 8b7fd4704349a..d183371910b3d 100644
+index cc1dabf910591..55f452b4aa4a3 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -8144,6 +8144,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
index 3697431baaf7f4cbcd9f12755d59b52a712d88c0..5f4cbe1db04bfc9414d6d283ffe35e8253ecfebc 100644 (file)
@@ -1,7 +1,7 @@
-From b4a377a8995decd762e20496278a30ecf10bf7b8 Mon Sep 17 00:00:00 2001
+From d03d936d4aa8f739960a6f041fbc6f5a7ff7caec Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:40 -0400
-Subject: [RFC PATCH 56/85] btrfs: stripe_alloc: allow-rmw policy, and
+Subject: [RFC PATCH 56/86] btrfs: stripe_alloc: allow-rmw policy, and
  write-in-place for isolated nocow extents (fsync part 2)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ stripe_alloc: carry an inode's log tail forward at fsync" is in, instead
 of with the rest of "btrfs: stripe_alloc: allow-rmw policy, and
 write-in-place for isolated nocow extents".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/defrag.c | 3 +++
  1 file changed, 3 insertions(+)
index a87d453a96578c99a5b6c6794a86e69847dbc38e..1f6075bbd071dd13b5edb28c86fad2f409d72b23 100644 (file)
@@ -1,7 +1,7 @@
-From ad5d2f9e6baf74ded8f1bb164aad9080b98aaf69 Mon Sep 17 00:00:00 2001
+From 88333ddcbb17e2719bdf7f50194a3f9438f9a864 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 6 Oct 2026 00:11:38 -0400
-Subject: [RFC PATCH 57/85] btrfs: stripe_alloc: share LOG data runs per log
+Subject: [RFC PATCH 57/86] btrfs: stripe_alloc: share LOG data runs per log
  transaction
 To: linux-btrfs@vger.kernel.org
 
@@ -66,7 +66,6 @@ and every completed write wakes the settle waiters whatever the knob says,
 so a sysfs change cannot leave an fsync waiting for a run only the commit
 it blocks would provide.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 228 +++++++++++++++++++++++++++++++++--------
  fs/btrfs/defrag.c      |   6 ++
@@ -459,7 +458,7 @@ index 9fdf94ecb5c93..b4a55cb7eeb68 100644
                carry_one_range(inode, copy->range[i].start,
                                copy->range[i].len,
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 7a882a47829c4..cb7f04ec8916f 100644
+index 0d7906bea0c61..870e8dd6b6eed 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -2805,6 +2805,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
index 702a65bad71b582cdbe1a7464cab2498a185c37e..996ea47d42aa0606cc354d862718dbab006db83e 100644 (file)
@@ -1,7 +1,7 @@
-From ef656afade0bf10d89629245f8a45c562c1e52b7 Mon Sep 17 00:00:00 2001
+From 60ee9f16b32d870f6697479787185b97b32f0119 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:27 -0400
-Subject: [RFC PATCH 58/85] btrfs: add a write-hole invariant checker to the
+Subject: [RFC PATCH 58/86] btrfs: add a write-hole invariant checker to the
  raid56 write path
 To: linux-btrfs@vger.kernel.org
 
@@ -36,9 +36,6 @@ wait); the same wait writes any delalloc tail a writeback racing the
 enable left unsubmitted.  A mount-time enable has nothing in flight.
 close_ctree() flushes the worker.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 90 ++++++++++++++++++++++++++++++++++++++++++
  fs/btrfs/block-group.h | 16 ++++++++
@@ -214,7 +211,7 @@ index d6b2c12c7230c..7f4227e488fbd 100644
                                                  u64 bytenr);
  void btrfs_dec_nocow_writers(struct btrfs_block_group *bg);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index cb7f04ec8916f..ad4046b12d011 100644
+index 870e8dd6b6eed..e5c3ebca75dd6 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -2805,6 +2805,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
@@ -225,7 +222,7 @@ index cb7f04ec8916f..ad4046b12d011 100644
        fs_info->stripe_log_data_shared = true;
        fs_info->stripe_park_timeout_ms = BTRFS_RBIO_PARK_TIMEOUT_MS;
        fs_info->stripe_compact = 10;
-@@ -4504,6 +4505,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
+@@ -4500,6 +4501,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
         */
        btrfs_run_delayed_iputs(fs_info);
  
@@ -275,10 +272,10 @@ index 54b568b419bf0..c09060496cb20 100644
        struct work_struct async_reclaim_work;
        struct work_struct async_data_reclaim_work;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 169e1cccd73cd..3f469d62d5d46 100644
+index f458014e85792..e1886e245d2f2 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3196,6 +3196,16 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -3189,6 +3189,16 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
        int sectornr;
        int ret = 0;
  
index a799111829bc6abc0ebdf64dde136bbc3fe695f0..edafd021bb49d93f25f0c92ebfc0229272c382c0 100644 (file)
@@ -1,7 +1,7 @@
-From 1fb94c6dc46ba944ff8863f08acd8156ff904eae Mon Sep 17 00:00:00 2001
+From 586833ca872bd8e8504fc4a3d14a3af7f0c99849 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:48 -0400
-Subject: [RFC PATCH 59/85] btrfs: stripe_alloc: report read-modify-write of
+Subject: [RFC PATCH 59/86] btrfs: stripe_alloc: report read-modify-write of
  uncovered stripes (debug part)
 To: linux-btrfs@vger.kernel.org
 
@@ -10,8 +10,6 @@ uncovered stripes", earlier in this series: the meta_rmw counter in
 stripe_park_stats, which goes with the series' other debug statistics.
 The warning itself is in that patch.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/fs.h     | 1 +
  fs/btrfs/raid56.c | 1 +
@@ -31,10 +29,10 @@ index c09060496cb20..10c70314e9126 100644
                /* Stripes pinned in the rbio cache (rbio_needs_pin()). */
                atomic64_t rbio_pinned;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 3f469d62d5d46..05e2952ac074a 100644
+index e1886e245d2f2..546ae059589b8 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3185,6 +3185,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3178,6 +3178,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
            !(rbio->bioc->map_type & BTRFS_BLOCK_GROUP_METADATA))
                return;
  
index 5b1f636544cd1cfa60271a956f9a89a77885d19f..3a3d5d7e58fe51a6636c9e0816d1c9838cb6d647 100644 (file)
@@ -1,7 +1,7 @@
-From 587a154b50c77423901bc29f0991dd3053fe0bf1 Mon Sep 17 00:00:00 2001
+From 0429c058a3ee097eb8dc5ac4ebc77027b726637b Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:25 -0400
-Subject: [RFC PATCH 60/85] btrfs: stripe_alloc: say at mount whether the
+Subject: [RFC PATCH 60/86] btrfs: stripe_alloc: say at mount whether the
  policy is on (debug part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ write-hole invariant checker to the raid56 write path" is in, instead of
 with the rest of "btrfs: stripe_alloc: say at mount whether the policy
 is on".
 
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
index 7867d4aad1388bda7ed5fe8c379112337e0b6a27..13bd612e4da7113397b467851ed5e2b67b05ff78 100644 (file)
@@ -1,7 +1,7 @@
-From 4496c53dc0e42c3833b3c135678720b10a79ffdd Mon Sep 17 00:00:00 2001
+From 3f162beaab34bc056ac90e9c7f79f7083c0e6f72 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:40 -0400
-Subject: [RFC PATCH 61/85] btrfs: stripe_alloc: allow-rmw policy, and
+Subject: [RFC PATCH 61/86] btrfs: stripe_alloc: allow-rmw policy, and
  write-in-place for isolated nocow extents (debug part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ add a write-hole invariant checker to the raid56 write path" is in,
 instead of with the rest of "btrfs: stripe_alloc: allow-rmw policy, and
 write-in-place for isolated nocow extents".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
index fcc521fdb12f58d9347db0dfe39efbcaaf4df03b..3e03ac7dd4ee131b3677b1b0d1fc6bcc812cc3c1 100644 (file)
@@ -1,7 +1,7 @@
-From 369c9857cc08bba5420a2a23f8db57d28900f4a4 Mon Sep 17 00:00:00 2001
+From 4877b92652be53ab750ba537f4613f67fb164e4c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 30 Sep 2026 18:07:52 -0400
-Subject: [RFC PATCH 62/85] btrfs: stripe_alloc: attribute each data
+Subject: [RFC PATCH 62/86] btrfs: stripe_alloc: attribute each data
  read-modify-write to why padding declined
 To: linux-btrfs@vger.kernel.org
 
@@ -38,7 +38,6 @@ could not do from the totals alone.
 The cost is a byte of state per rbio and a few counter increments per
 RMW, plus one block group lookup for NO_RUN RMWs.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 17 +++++++++--
  fs/btrfs/block-group.h | 17 +++++++++++
@@ -167,7 +166,7 @@ index 10c70314e9126..9d637c75ae38d 100644
                atomic64_t congestion_short;
                /* Stripes pinned in the rbio cache (rbio_needs_pin()). */
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 05e2952ac074a..91780dae429aa 100644
+index 546ae059589b8..d1142d64e2c0a 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -22,6 +22,7 @@
@@ -188,7 +187,7 @@ index 05e2952ac074a..91780dae429aa 100644
  /*
   * Set when a parked rbio carries (or merged) a REQ_SYNC bio: a waiter
   * is blocked on it, so deadlines stay authoritative and neither the
-@@ -3027,6 +3031,65 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -3020,6 +3024,65 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
        }
  }
  
@@ -254,7 +253,7 @@ index 05e2952ac074a..91780dae429aa 100644
  /*
   * Try to avoid the RMW read phase of a sub-stripe write by zero-filling the
   * uncovered data sectors.  Legal only where the stripe's run says a sector
-@@ -3049,6 +3112,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3042,6 +3105,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        bool ok = false;
        int i;
  
@@ -262,7 +261,7 @@ index 05e2952ac074a..91780dae429aa 100644
        if (!btrfs_test_opt(fs_info, STRIPE_ALLOC))
                return false;
  
-@@ -3061,6 +3125,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3054,6 +3118,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        }
        if (!btrfs_stripe_run_pad_mask(fs_info, stripe_start, stripe_len, dead,
                                       unwritten, &info)) {
@@ -270,7 +269,7 @@ index 05e2952ac074a..91780dae429aa 100644
                trace_btrfs_stripe_pad_decline(fs_info, stripe_start,
                                               stripe_len, 0, 0, nsectors,
                                               info.run_start, info.run_end,
-@@ -3089,6 +3154,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3082,6 +3147,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                if (!test_bit(i, dead)) {
                        atomic64_inc(&fs_info->stripe_park_stats.pad_decline_uncovered);
                        info.reason = BTRFS_STRIPE_PAD_UNCOVERED;
@@ -278,7 +277,7 @@ index 05e2952ac074a..91780dae429aa 100644
                        trace_btrfs_stripe_pad_decline(fs_info, stripe_start,
                                                       stripe_len, 0, covered,
                                                       nsectors,
-@@ -3109,6 +3175,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3102,6 +3168,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        if (!ok)
                return false;
  
@@ -287,7 +286,7 @@ index 05e2952ac074a..91780dae429aa 100644
        if (alloc_rbio_data_pages(rbio) < 0)
                return false;
  
-@@ -3237,6 +3305,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -3230,6 +3298,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                atomic64_inc(&fs_info->stripe_park_stats.data_rmw);
                if (!(rbio->bioc->map_type & BTRFS_BLOCK_GROUP_DATA))
                        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw_reads);
index 6e66b953fd1757655d8081ac3f21d7978ffc03bf..1d1afe3583e82301e6361a175fdb579d4a5c785e 100644 (file)
@@ -1,7 +1,7 @@
-From 1b40736d13f7ed5208eaa5fa4f31b5ee0cd2330b Mon Sep 17 00:00:00 2001
+From 92f980554a87ea36fce399fbbb8eb6d2ce6cb7be Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 30 Sep 2026 18:07:56 -0400
-Subject: [RFC PATCH 63/85] btrfs: stripe_alloc: optionally audit data
+Subject: [RFC PATCH 63/86] btrfs: stripe_alloc: optionally audit data
  read-modify-writes against the committed extent tree
 To: linux-btrfs@vger.kernel.org
 
@@ -37,7 +37,6 @@ which it is not by default.  Its counters are in
 debug/stripe_rmw_audit_stats, with data_rmw_audited so a reader can
 tell an audit that found nothing from one that never ran.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c |   2 +
  fs/btrfs/block-group.h |   2 +
@@ -106,7 +105,7 @@ index 9d637c75ae38d..69d33accd21ee 100644
         * LOG-class data runs.  Set (the default): runs are shared per
         * (subvolume, log_transid); a log commit seals the stripe holding the
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 91780dae429aa..b892e085ac07a 100644
+index d1142d64e2c0a..24f13a6871616 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -23,6 +23,7 @@
@@ -117,7 +116,7 @@ index 91780dae429aa..b892e085ac07a 100644
  
  /* set when additional merges to this rbio are not allowed */
  #define RBIO_RMW_LOCKED_BIT   1
-@@ -3036,6 +3037,13 @@ static void rbio_record_pad(struct btrfs_raid_bio *rbio,
+@@ -3029,6 +3030,13 @@ static void rbio_record_pad(struct btrfs_raid_bio *rbio,
  {
        rbio->pad_reason = info->reason;
        rbio->pad_norun = info->norun;
@@ -131,7 +130,7 @@ index 91780dae429aa..b892e085ac07a 100644
  }
  
  static_assert(BTRFS_STRIPE_PAD_NR_REASONS + 1 ==
-@@ -3043,6 +3051,320 @@ static_assert(BTRFS_STRIPE_PAD_NR_REASONS + 1 ==
+@@ -3036,6 +3044,320 @@ static_assert(BTRFS_STRIPE_PAD_NR_REASONS + 1 ==
  static_assert(BTRFS_STRIPE_NORUN_NR ==
              ARRAY_SIZE(((struct btrfs_fs_info *)0)->stripe_park_stats.data_rmw_norun));
  
@@ -452,7 +451,7 @@ index 91780dae429aa..b892e085ac07a 100644
  /*
   * Attribute a read-modify-write to why padding declined for this rbio.  With
   * allow_rmw empty, a data RMW in a stripe_alloc group is expected in two
-@@ -3088,6 +3410,8 @@ static void rbio_count_rmw_reason(struct btrfs_raid_bio *rbio)
+@@ -3081,6 +3403,8 @@ static void rbio_count_rmw_reason(struct btrfs_raid_bio *rbio)
        /* Disjoint from the frontier count, so the two can be summed. */
        if (reloc_writer && idx != BTRFS_STRIPE_PAD_UNCOVERED)
                atomic64_inc(&fs_info->stripe_park_stats.data_rmw_reloc_writer);
index 3f7d9e8da0642bd0ea8a3aa826a237cd28e983fd..effc69213242ba53f04e92345832d5f809361cf3 100644 (file)
@@ -1,7 +1,7 @@
-From 33f8c600f9ebddf923072c8eeb67f27a471ecfca Mon Sep 17 00:00:00 2001
+From 11e5a2444ce6562a9cb3efa58645731d339243b4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 4 Oct 2026 17:46:19 -0400
-Subject: [RFC PATCH 64/85] btrfs: stripe_alloc: break rbio pins and open
+Subject: [RFC PATCH 64/86] btrfs: stripe_alloc: break rbio pins and open
  stripe runs down by run class
 To: linux-btrfs@vger.kernel.org
 
@@ -19,7 +19,6 @@ class), for class cow, reloc, log, nocow and meta.
 btrfs_stripe_run_incomplete() becomes a wrapper around
 btrfs_stripe_run_incomplete_class(), which also says which run's class.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 70 ++++++++++++++++++++++++++++++++++--------
  fs/btrfs/block-group.h |  3 ++
@@ -141,7 +140,7 @@ index c6dc7c1cdf1a5..75775cb52ae8a 100644
                                 enum btrfs_stripe_run_class *class);
  u64 btrfs_stripe_run_stranded_stripes(struct btrfs_block_group *bg, u32 *freep,
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index b892e085ac07a..e1fee64396457 100644
+index 24f13a6871616..ea85d8e41e01a 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -796,22 +796,34 @@ void btrfs_rbio_unpin_stale(struct btrfs_fs_info *fs_info)
index 7a3d0b17978bf501b648fe48a0cb14ec21bfdf83..24be261ab2521243e9a659afc2661d127a1041e1 100644 (file)
@@ -1,7 +1,7 @@
-From a57dba490e9d9cc8b4703be67e5e9ed983beb924 Mon Sep 17 00:00:00 2001
+From 9431221b38c0f86e016a6fc31c226cd88334597f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 19:13:11 -0400
-Subject: [RFC PATCH 65/85] btrfs: stripe_alloc: count and log ordered extents
+Subject: [RFC PATCH 65/86] btrfs: stripe_alloc: count and log ordered extents
  that end with sectors unwritten
 To: linux-btrfs@vger.kernel.org
 
@@ -30,7 +30,6 @@ unwritten_on_end_truncated and unwritten_on_end_truncated_bytes;
 unwritten_on_end and unwritten_on_end_bytes count only the logged ones, so
 any increase there is worth a look.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c  | 27 ++++++++++++++---
  fs/btrfs/block-group.h  |  5 ++--
index ec4471f6ac89bb788552b9b8a525010a1ebfa66e..a3f8539160ef4d7d47e2f239a47b5b37cddd1a9f 100644 (file)
@@ -1,7 +1,7 @@
-From b8a1eee6f055ac803c5063beebc831789e0126ec Mon Sep 17 00:00:00 2001
+From c408bbeff9075e15022a2ecdee002da9a65d7b1e Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 25 Oct 2026 04:48:50 -0400
-Subject: [RFC PATCH 66/85] btrfs: stripe_alloc: log the space counters when
+Subject: [RFC PATCH 66/86] btrfs: stripe_alloc: log the space counters when
  data writeback hits ENOSPC
 To: linux-btrfs@vger.kernel.org
 
@@ -28,7 +28,6 @@ this call site, so it adds no lock ordering.
 The line and the walk share one rate limit, so a burst of failures cannot
 flood the log with group lines.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/extent-tree.c | 34 +++++++++++++++++++++++++++++-----
  fs/btrfs/space-info.c  | 39 +++++++++++++++++++++++++++++++++++++++
index b69d1952abae7244967e09dfaf05322a5cf079c0..7f6af2d759c218595f004461652b7bd2e9c93ff2 100644 (file)
@@ -1,7 +1,7 @@
-From fd2541deae3f19661fd8e5a03f1981574b6343b1 Mon Sep 17 00:00:00 2001
+From c1081b79df36a55c35469e6b3e3e0d15f05672ed Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 25 Oct 2026 06:27:49 -0400
-Subject: [RFC PATCH 67/85] btrfs: stripe_alloc: do not count a writeback
+Subject: [RFC PATCH 67/86] btrfs: stripe_alloc: do not count a writeback
  ENOSPC drop's give-back as supply (debug part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,7 +13,6 @@ once "btrfs: stripe_alloc: log the space counters when data writeback
 hits ENOSPC" is in, instead of with the rest of "btrfs: stripe_alloc: do
 not count a writeback ENOSPC drop's give-back as supply".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/extent-tree.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
index bfa884e5414b33dd1376cae42b02cd20b969bac8..8d738d1d6b7251cd4e30daed1304e6a53aed3e66 100644 (file)
@@ -1,7 +1,7 @@
-From 6e3a00f579397c6232636f8f734f1c18db50aef7 Mon Sep 17 00:00:00 2001
+From 6324127f015a6ecedfdc61729084f838a2b83cff Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:58 -0400
-Subject: [RFC PATCH 68/85] btrfs: stripe_meta: allocate tree blocks by whole
+Subject: [RFC PATCH 68/86] btrfs: stripe_meta: allocate tree blocks by whole
  stripes
 To: linux-btrfs@vger.kernel.org
 
@@ -85,9 +85,6 @@ retirement never releases their open runs and block group references:
 both release every open run before the block groups are freed, reporting
 any run that still counts bytes in flight.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c            | 395 ++++++++++++++++++++++++++++--
  fs/btrfs/block-group.h            |  14 ++
@@ -707,7 +704,7 @@ index fd604631b9ca8..d78ae83bd00d0 100644
        spin_unlock(&block_rsv->lock);
        spin_unlock(&sinfo->lock);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index ad4046b12d011..a7339ea5b0028 100644
+index e5c3ebca75dd6..a54c687aee50a 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -3853,6 +3853,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
@@ -718,7 +715,7 @@ index ad4046b12d011..a7339ea5b0028 100644
        btrfs_free_block_groups(fs_info);
  fail_alloc:
        btrfs_mapping_tree_free(fs_info);
-@@ -4625,6 +4626,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
+@@ -4621,6 +4622,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
         * accounting appear to be wrong because there's pending reserved bytes,
         * so make sure we do the block group cleanup afterwards.
         */
@@ -942,10 +939,10 @@ index eaed680e362dc..362e31f8be3d5 100644
  
        nstripes = stripe_unusable_nstripes(bg);
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index e1fee64396457..c2ba1f3e7a25c 100644
+index ea85d8e41e01a..2d60d202201ab 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3581,6 +3581,8 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+@@ -3574,6 +3574,8 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
  static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
  {
        struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
@@ -954,7 +951,7 @@ index e1fee64396457..c2ba1f3e7a25c 100644
  
        if (!btrfs_test_opt(fs_info, STRIPE_ALLOC))
                return;
-@@ -3590,6 +3592,21 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3583,6 +3585,21 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
                return;
  
        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw);
@@ -1008,7 +1005,7 @@ index 5da244e148321..10fd9d6b344b3 100644
        return ret;
  }
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index 6bbcf42121461..aa251b32b1dcf 100644
+index c97e37951c2af..b217566a6c9ba 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
 @@ -23,6 +23,7 @@
@@ -1033,7 +1030,7 @@ index 6bbcf42121461..aa251b32b1dcf 100644
        ret2 = btrfs_wait_extents(fs_info, dirty_pages);
  
        if (ret)
-@@ -2664,6 +2672,16 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2659,6 +2667,16 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                goto scrub_continue;
        }
  
index 461d37ac83fe95535526d915954e98f691cb1dab..a5c5e4b345d3f4d473f7350899f0ae91f947aab5 100644 (file)
@@ -1,7 +1,7 @@
-From aa8b778a51434b49ca822ad7c66f8e0e5eeb2bef Mon Sep 17 00:00:00 2001
+From 9c56fb1e257e76510e957a6b667bdecd01a9650d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 12:14:49 -0400
-Subject: [RFC PATCH 69/85] btrfs: stripe_alloc: keep a stripe in the rbio
+Subject: [RFC PATCH 69/86] btrfs: stripe_alloc: keep a stripe in the rbio
  cache until its run has written all of it (stripe_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,7 +13,6 @@ stripe_meta: allocate tree blocks by whole stripes" is in, instead of
 with the rest of "btrfs: stripe_alloc: keep a stripe in the rbio cache
 until its run has written all of it".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 1 +
  1 file changed, 1 insertion(+)
index 7b442563c98fb853904f4b6860baf7ebe039c382..bc6e9bb556943654b5bea3c3d576e3811f00471d 100644 (file)
@@ -1,7 +1,7 @@
-From 9e00bb532a627618364cd9b43a1c833dbd3d0da9 Mon Sep 17 00:00:00 2001
+From edd54a44ead7e5cf1c54d68bb572fa83d08a312f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 10 Oct 2026 00:19:18 -0400
-Subject: [RFC PATCH 70/85] btrfs: stripe_alloc: skip RAID5/6 groups that are
+Subject: [RFC PATCH 70/86] btrfs: stripe_alloc: skip RAID5/6 groups that are
  mapped as RAID1/RAID1C3 (stripe_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,7 +13,6 @@ allocate tree blocks by whole stripes" is in, instead of with the rest
 of "btrfs: stripe_alloc: skip RAID5/6 groups that are mapped as
 RAID1/RAID1C3".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/extent-tree.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
index 4e4032cf7a26defbd267ddf431bc3f6e21c28d02..a8953b86acd8fe056b4a3565af1b479e25be258d 100644 (file)
@@ -1,7 +1,7 @@
-From f338d88054a75420a22b7013958b392a3103a579 Mon Sep 17 00:00:00 2001
+From d9ee4a59d2396e04fdff11ceab00f8518f4cbc2d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 16:47:05 -0400
-Subject: [RFC PATCH 71/85] btrfs: stripe_meta: extend stripe reclaim to
+Subject: [RFC PATCH 71/86] btrfs: stripe_meta: extend stripe reclaim to
  metadata block groups
 To: linux-btrfs@vger.kernel.org
 
@@ -34,7 +34,6 @@ Extend each reclaim mechanism to stripe_meta block groups:
 
 The comments that name the groups reclaim handles now name both.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c      | 26 +++++++++++++++-----------
  fs/btrfs/free-space-cache.c |  2 +-
@@ -228,10 +227,10 @@ index 1812ba343ca14..60bf7da1790b4 100644
   * start forces that group.  See btrfs_stripe_reclaim_now().
   */
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index c9f81b0975fe0..9f689c4c9d7f8 100644
+index ea98cef92dc3d..6c2a9e391dae7 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -3802,7 +3802,7 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
+@@ -3814,7 +3814,7 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
  }
  
  /*
index b1642572883c34d96fed1dea924ec9aa7d08e558..40196b1a4b1a2656e601f33eaf753bb4fe88ca33 100644 (file)
@@ -1,7 +1,7 @@
-From 5caf207efa50dc5d51f7e0a120f22301e3329f2c Mon Sep 17 00:00:00 2001
+From 938f111753c327badb8b7755c40c5c527fd291ec Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:12 -0400
-Subject: [RFC PATCH 72/85] btrfs: stripe_meta: hold back whole stripes so tree
+Subject: [RFC PATCH 72/86] btrfs: stripe_meta: hold back whole stripes so tree
  blocks always land and trapped groups can be reclaimed
 To: linux-btrfs@vger.kernel.org
 
@@ -94,9 +94,6 @@ transaction before arming the write-hole check, since tree blocks the
 legacy allocator placed in it are written by that commit into partly used
 stripes.  That one commit's exposure is inherent.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
-Assisted-by: Claude:claude-fable-5-1
 ---
  fs/btrfs/block-group.c      | 98 ++++++++++++++++++++++++++++++++++---
  fs/btrfs/disk-io.c          |  7 ++-
@@ -277,7 +274,7 @@ index cd6fe47d6b0f4..73c7b5575c39d 100644
        }
  
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index a7339ea5b0028..d4b6de361fb3c 100644
+index a54c687aee50a..593f94f9c42de 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -3148,17 +3148,22 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
index 7a93e7010a578ba9684f73a1bf3dd77be35423a3..29628c8dc4cf7448de3fb88644e98b9b4d8b920a 100644 (file)
@@ -1,7 +1,7 @@
-From 1c27225353cf83f9b418f297ce1f028332aec02d Mon Sep 17 00:00:00 2001
+From bfbfb1226c79d44594119db0f4b66d4377d27709 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:19 -0400
-Subject: [RFC PATCH 73/85] btrfs: stripe_alloc: count whole stripes stranded
+Subject: [RFC PATCH 73/86] btrfs: stripe_alloc: count whole stripes stranded
  behind live runs as trapped (stripe_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -14,8 +14,6 @@ stripes so tree blocks always land and trapped groups can be reclaimed"
 is in, instead of with the rest of "btrfs: stripe_alloc: count whole
 stripes stranded behind live runs as trapped".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/space-info.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
index c32c27fda6af39b374ad17d07dc0930c0d40df37..85cd7abc2da1c5c728e71b460afdad3a80f065f4 100644 (file)
@@ -1,7 +1,7 @@
-From 11c8a7cfaaf14db5bbb2009c829b7848197f6073 Mon Sep 17 00:00:00 2001
+From 4dc2b5434dc5670dbe67d0799ed435e1d926ff38 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 25 Oct 2026 06:27:49 -0400
-Subject: [RFC PATCH 74/85] btrfs: stripe_alloc: do not count a writeback
+Subject: [RFC PATCH 74/86] btrfs: stripe_alloc: do not count a writeback
  ENOSPC drop's give-back as supply (stripe_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -14,7 +14,6 @@ stripes so tree blocks always land and trapped groups can be reclaimed"
 is in, instead of with the rest of "btrfs: stripe_alloc: do not count a
 writeback ENOSPC drop's give-back as supply".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/space-info.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
index b9bc298b87f38562489373112ec25084bb1bc236..b44a64c4af44ab15033997b51056fae5dc61ed7b 100644 (file)
@@ -1,7 +1,7 @@
-From dbd6acf9aefead735973a3e9b9f70ad05488289b Mon Sep 17 00:00:00 2001
+From 4aebc7adc2abe26338ad70da8523e2a78d5faeaa Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 20 Sep 2026 01:33:09 -0400
-Subject: [RFC PATCH 75/85] btrfs: stripe_meta: cover raid56 system chunks
+Subject: [RFC PATCH 75/86] btrfs: stripe_meta: cover raid56 system chunks
 To: linux-btrfs@vger.kernel.org
 
 The chunk tree lives in system chunks, which carry no METADATA bit, so the
@@ -36,8 +36,6 @@ very allocation could find no stripe to land in.
 The "does not cover raid56 system chunks" warning has nothing left to
 warn about and goes.
 
-Assisted-by: Claude:claude-fable-5-1
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 76 +++++++++++++++++++++++-------------------
  fs/btrfs/extent-tree.c | 23 ++++++-------
@@ -222,10 +220,10 @@ index 8fce8a5568222..51d06531a15ae 100644
               (bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK) &&
               !test_bit(BLOCK_GROUP_FLAG_RAID56_MIRRORED, &bg->runtime_flags);
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index c2ba1f3e7a25c..1afccd067b8a9 100644
+index 2d60d202201ab..d9c1dddda6aa2 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3593,12 +3593,11 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3586,12 +3586,11 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
  
        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw);
        /*
index c64a459a39c47a381fecc550957716df2732b667..100f26529d5036a5c30f9c593589096bb1552da1 100644 (file)
@@ -1,7 +1,7 @@
-From 370ac4e55a9ea07cc456c2c1c135419bbf020b7c Mon Sep 17 00:00:00 2001
+From fcec7b1f4c096d708ede6e6f0560e51ec54f8a82 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 10 Oct 2026 00:19:18 -0400
-Subject: [RFC PATCH 76/85] btrfs: stripe_alloc: skip RAID5/6 groups that are
+Subject: [RFC PATCH 76/86] btrfs: stripe_alloc: skip RAID5/6 groups that are
  mapped as RAID1/RAID1C3 (stripe_meta part 2)
 To: linux-btrfs@vger.kernel.org
 
@@ -12,7 +12,6 @@ series: they are applied here, once "btrfs: stripe_meta: cover raid56
 system chunks" is in, instead of with the rest of "btrfs: stripe_alloc:
 skip RAID5/6 groups that are mapped as RAID1/RAID1C3".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/extent-tree.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
index b0ed81836038d03d27c7f69e78583af563490f76..67df9bcfede7bc05adcf142f54a2af7bb4d99f19 100644 (file)
@@ -1,7 +1,7 @@
-From 94620d2830c64ef9b046fec2180d7e5807226a7f Mon Sep 17 00:00:00 2001
+From 30a6372518d70d023dc844a8363d559870d11366 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 4 Oct 2026 23:16:03 -0400
-Subject: [RFC PATCH 77/85] btrfs: stripe_alloc: give each log commit its own
+Subject: [RFC PATCH 77/86] btrfs: stripe_alloc: give each log commit its own
  metadata stripe run
 To: linux-btrfs@vger.kernel.org
 
@@ -69,8 +69,6 @@ hung commit where it happens rather than as later symptoms.  After 60
 seconds they warn once and dump the group's runs (every run class) and
 keep waiting.  Only a filesystem error ends them.
 
-Assisted-by: Claude:claude-opus-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/block-group.c | 240 ++++++++++++++++++++++++++++++++++++-----
  fs/btrfs/block-group.h |  23 ++++
@@ -468,7 +466,7 @@ index b1cbc08ce058d..605e040421e45 100644
                                      struct btrfs_inode *inode,
                                      enum btrfs_stripe_run_class class,
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index d4b6de361fb3c..322daea247db4 100644
+index 593f94f9c42de..8eb61d7c08845 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -2806,6 +2806,11 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
index 44649193ee0c247a68cf8cdd652208a4cad56ee3..bbbeed6a5badfd56c5e87554c74a05ae0ffe964e 100644 (file)
@@ -1,7 +1,7 @@
-From 0d3c2f28add6021e5c01082d66129e49e828b6bd Mon Sep 17 00:00:00 2001
+From 5fa12d371d598711448219bc1f51ae1a64a59071 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 6 Oct 2026 00:11:38 -0400
-Subject: [RFC PATCH 78/85] btrfs: stripe_alloc: share LOG data runs per log
+Subject: [RFC PATCH 78/86] btrfs: stripe_alloc: share LOG data runs per log
  transaction (stripe_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,14 +13,13 @@ stripe_alloc: give each log commit its own metadata stripe run" is in,
 instead of with the rest of "btrfs: stripe_alloc: share LOG data runs
 per log transaction".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/disk-io.c |  5 +++--
  fs/btrfs/sysfs.c   | 16 ++++++++++++++--
  2 files changed, 17 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 322daea247db4..27faf262898f7 100644
+index 8eb61d7c08845..a91fc9e510ba2 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -2807,8 +2807,9 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
index 4893c56abc8c1774f391727509d882cde8c65def..e8d0d0dee7ceabcc4695004efbecb974b6274954 100644 (file)
@@ -1,7 +1,7 @@
-From 4a7162b0186b5c8ba3f17157c595750d9ea0d43b Mon Sep 17 00:00:00 2001
+From 3503c569a88848171f7cb71ce813480571483b79 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 19:13:11 -0400
-Subject: [RFC PATCH 79/85] btrfs: stripe_alloc: count and log ordered extents
+Subject: [RFC PATCH 79/86] btrfs: stripe_alloc: count and log ordered extents
  that end with sectors unwritten (debug_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -17,7 +17,6 @@ sectors unwritten".
 They append the unwritten_on_end counters to the stripe_run_stats list
 after the log seal counters, which that patch adds to it.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/sysfs.c | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
index 20677161be23ff6dc98be7ceb3b944fbe307aa3b..00806a4240d9c8f72f5356564a0612cbf3672617 100644 (file)
@@ -1,7 +1,7 @@
-From f7823fb8ab4d325a71cd00fb2d68f9b909d51aca Mon Sep 17 00:00:00 2001
+From 707fe91a973591b6fd0fda9835579e34b72bf5d3 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:49 -0400
-Subject: [RFC PATCH 80/85] btrfs: raid56: say whether a metadata
+Subject: [RFC PATCH 80/86] btrfs: raid56: say whether a metadata
  read-modify-write is a write hole
 To: linux-btrfs@vger.kernel.org
 
@@ -60,8 +60,6 @@ tree block of the same stripe would queue a rebuild behind that lock, so
 it does not block: commit_root_sem is taken with a trylock and the search
 uses path->nowait.  A block not in memory is counted as meta_rmw_unknown.
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/fs.h     |  14 +++
  fs/btrfs/raid56.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++
@@ -94,10 +92,10 @@ index 9e639f1788cb1..3fbe632d14a2d 100644
                /* Stripes pinned in the rbio cache (rbio_needs_pin()). */
                atomic64_t rbio_pinned;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 1afccd067b8a9..b3fdffa6c1418 100644
+index d9c1dddda6aa2..42c3251de77e5 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3573,6 +3573,219 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+@@ -3566,6 +3566,219 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
        return false;
  }
  
@@ -317,7 +315,7 @@ index 1afccd067b8a9..b3fdffa6c1418 100644
  /*
   * Count and audit a metadata or system read-modify-write
   * (audit_uncovered_rmw()), and warn if it lands in a raid56 group that
-@@ -3592,6 +3805,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3585,6 +3798,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
                return;
  
        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw);
index aff002acc4a18d57ed2b135395f6aee6fb17bbd7..970edca56c07538b2b485c73a71cf6a0c036eec8 100644 (file)
@@ -1,7 +1,7 @@
-From 00221b3dedbc3abae5c2ebc91a652c8a06aac067 Mon Sep 17 00:00:00 2001
+From 012fa07665108a367d81cb925e22517923672122 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:50 -0400
-Subject: [RFC PATCH 81/85] btrfs: stripe_alloc: tunable park deadlines, and
+Subject: [RFC PATCH 81/86] btrfs: stripe_alloc: tunable park deadlines, and
  say why padding declined (debug_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ raid56: say whether a metadata read-modify-write is a write hole" is in,
 instead of with the rest of "btrfs: stripe_alloc: tunable park
 deadlines, and say why padding declined".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/sysfs.c | 8 ++++++++
  1 file changed, 8 insertions(+)
index ec2345192a69f91aa3416538ee5a64dea747ad81..39487898c99b851df6753c0cb9f6e3e6af9ea0c8 100644 (file)
@@ -1,7 +1,7 @@
-From b1c2f116b1f03bf020ea758261f07a89fc4712ab Mon Sep 17 00:00:00 2001
+From 51404c85145db5076d18209f9e2ee6d400e0ca78 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:51 -0400
-Subject: [RFC PATCH 82/85] btrfs: stripe_alloc: trace why padding declined, at
+Subject: [RFC PATCH 82/86] btrfs: stripe_alloc: trace why padding declined, at
  the moment it declined (debug_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ raid56: say whether a metadata read-modify-write is a write hole" is in,
 instead of with the rest of "btrfs: stripe_alloc: trace why padding
 declined, at the moment it declined".
 
-Assisted-by: Claude:claude-fable-5
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/sysfs.c | 2 ++
  1 file changed, 2 insertions(+)
index fe0b23fb6f49d84b5867d7add9c0bd0693579782..2394dca127929f60da4990a83aecd76ffea15c6c 100644 (file)
@@ -1,7 +1,7 @@
-From 8c1af409d04fb26378e23b6a5045ed85b488a890 Mon Sep 17 00:00:00 2001
+From 9fc871e8ec173756d47d6e347872999e3e8eb3d6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 30 Sep 2026 18:07:52 -0400
-Subject: [RFC PATCH 83/85] btrfs: stripe_alloc: attribute each data
+Subject: [RFC PATCH 83/86] btrfs: stripe_alloc: attribute each data
  read-modify-write to why padding declined (debug_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -16,7 +16,6 @@ each data read-modify-write to why padding declined".
 It also drops the pad_decline_live and pad_decline_unallocated counters:
 these hunks remove their last readers.
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/fs.h    |  9 +--------
  fs/btrfs/sysfs.c | 28 ++++++++++++++++++++++++----
index c67378949310a0636bc9fba4545543dbe5b92721..72f23a880391ceaf8623a6cda1d0889dfe42d514 100644 (file)
@@ -1,7 +1,7 @@
-From e63b3c7abf59fc929a99c3ca00ff3ea8be776366 Mon Sep 17 00:00:00 2001
+From c04e21622d6428d9d3665a10b7ef961d87581e79 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:55 -0400
-Subject: [RFC PATCH 84/85] btrfs: raid56: adaptive park deadline from the
+Subject: [RFC PATCH 84/86] btrfs: raid56: adaptive park deadline from the
  parked-rbio backlog (debug_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,8 +13,6 @@ whether a metadata read-modify-write is a write hole" is in, instead of
 with the rest of "btrfs: raid56: adaptive park deadline from the
 parked-rbio backlog".
 
-Assisted-by: Claude:claude-opus-4-8
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/sysfs.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
index 8116a5b50b2191aef1fb0ad161a15d6ad696a515..1e7090c4e2ada74d9eb9c1d9899619b044fae79c 100644 (file)
@@ -1,7 +1,7 @@
-From 1944ff74ed890d045c8d8f7346c44c519f6a2dee Mon Sep 17 00:00:00 2001
+From 1ad774c8163bd5e040f4e6900194207e2ea1b392 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 12:14:49 -0400
-Subject: [RFC PATCH 85/85] btrfs: stripe_alloc: keep a stripe in the rbio
+Subject: [RFC PATCH 85/86] btrfs: stripe_alloc: keep a stripe in the rbio
  cache until its run has written all of it (debug_meta part)
 To: linux-btrfs@vger.kernel.org
 
@@ -13,7 +13,6 @@ hole", which comes after it in this series: they are applied here, once
 hole" is in, instead of with the rest of "btrfs: stripe_alloc: keep a
 stripe in the rbio cache until its run has written all of it".
 
-Assisted-by: Claude:claude-opus-5-5
 ---
  fs/btrfs/sysfs.c | 4 ++++
  1 file changed, 4 insertions(+)
diff --git a/topics/stripe-alloc/0086-btrfs-stripe_alloc-drop-the-extract-hooks-of-the-str.patch b/topics/stripe-alloc/0086-btrfs-stripe_alloc-drop-the-extract-hooks-of-the-str.patch
new file mode 100644 (file)
index 0000000..d95d123
--- /dev/null
@@ -0,0 +1,115 @@
+From 294d230e458ac952577f5edc9d25770679c636c1 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Wed, 4 Nov 2026 15:07:35 -0500
+Subject: [RFC PATCH 86/86] btrfs: stripe_alloc: drop the extract hooks of the
+ stripe_alloc properties
+To: linux-btrfs@vger.kernel.org
+
+The stripe_alloc and stripe_alloc_allow_rmw property handlers are not
+inheritable.  The only caller of a handler's extract hook is
+btrfs_inode_inherit_props(), and it skips handlers that are not
+inheritable before it calls the hook, so prop_stripe_alloc_extract() and
+prop_stripe_rmw_extract() were dead code that only returned NULL.
+Remove them and leave .extract unset in both handlers.  This also keeps
+the stripe_alloc handlers independent of the extract() prototype.
+
+Also move prop_compression_extract() up, next to
+prop_compression_ignore(): the stripe_alloc handler functions were
+added between the two, splitting the compression property's hooks.  Now
+they follow the compression hooks, just before the handler table.
+
+No functional change.
+
+---
+ fs/btrfs/props.c | 42 ++++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 28 deletions(-)
+
+diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
+index 741ccacb42f84..01f8c8a23d556 100644
+--- a/fs/btrfs/props.c
++++ b/fs/btrfs/props.c
+@@ -418,6 +418,20 @@ static bool prop_compression_ignore(const struct btrfs_inode *inode)
+       return false;
+ }
+ 
++static const char *prop_compression_extract(const struct btrfs_inode *inode)
++{
++      switch (inode->prop_compress) {
++      case BTRFS_COMPRESS_ZLIB:
++      case BTRFS_COMPRESS_LZO:
++      case BTRFS_COMPRESS_ZSTD:
++              return btrfs_compress_type2str(inode->prop_compress);
++      default:
++              break;
++      }
++
++      return NULL;
++}
++
+ /*
+  * The "stripe_alloc" property is filesystem-wide policy: stripe-exclusive
+  * (raid56 write hole safe) data allocation.  It lives on the top-level
+@@ -463,12 +477,6 @@ static int prop_stripe_alloc_apply(struct btrfs_inode *inode,
+       return btrfs_enable_stripe_alloc(fs_info);
+ }
+ 
+-static const char *prop_stripe_alloc_extract(const struct btrfs_inode *inode)
+-{
+-      /* Not inheritable; nothing regenerates the value from inode state. */
+-      return NULL;
+-}
+-
+ static int prop_stripe_rmw_validate(const struct btrfs_inode *inode,
+                                         const char *value, size_t len)
+ {
+@@ -497,31 +505,11 @@ static int prop_stripe_rmw_apply(struct btrfs_inode *inode,
+       return 0;
+ }
+ 
+-static const char *prop_stripe_rmw_extract(const struct btrfs_inode *inode)
+-{
+-      /* Not inheritable; nothing regenerates the value from inode state. */
+-      return NULL;
+-}
+-
+ static bool prop_stripe_alloc_ignore(const struct btrfs_inode *inode)
+ {
+       return false;
+ }
+ 
+-static const char *prop_compression_extract(const struct btrfs_inode *inode)
+-{
+-      switch (inode->prop_compress) {
+-      case BTRFS_COMPRESS_ZLIB:
+-      case BTRFS_COMPRESS_LZO:
+-      case BTRFS_COMPRESS_ZSTD:
+-              return btrfs_compress_type2str(inode->prop_compress);
+-      default:
+-              break;
+-      }
+-
+-      return NULL;
+-}
+-
+ static struct prop_handler prop_handlers[] = {
+       {
+               .xattr_name = XATTR_BTRFS_PREFIX "compression",
+@@ -535,7 +523,6 @@ static struct prop_handler prop_handlers[] = {
+               .xattr_name = XATTR_BTRFS_PREFIX "stripe_alloc",
+               .validate = prop_stripe_alloc_validate,
+               .apply = prop_stripe_alloc_apply,
+-              .extract = prop_stripe_alloc_extract,
+               .ignore = prop_stripe_alloc_ignore,
+               .inheritable = 0
+       },
+@@ -543,7 +530,6 @@ static struct prop_handler prop_handlers[] = {
+               .xattr_name = XATTR_BTRFS_PREFIX "stripe_alloc_allow_rmw",
+               .validate = prop_stripe_rmw_validate,
+               .apply = prop_stripe_rmw_apply,
+-              .extract = prop_stripe_rmw_extract,
+               .ignore = prop_stripe_alloc_ignore,
+               .inheritable = 0
+       },
+-- 
+2.47.3
+