]> git.hungrycats.org Git - linux/commitdiff
Re-export onto the rebased misc-next lane (base 99bc6552614f)
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 25 Oct 2026 07:16:15 +0000 (03:16 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 25 Oct 2026 07:16:15 +0000 (03:16 -0400)
misc-next was rebased onto btrfs/for-next 0713fa6a4356 plus the marker
commit. The new lane tips are testing e8519e93c9a2 and zb64 315863b5a610.
Every series is re-exported against that base.

- raid56-scrub-replace is 0/12. Filipe Manana's -EIO fix (ec0795c045c3)
  is in the base now. The cover drops the paragraph about it and
  renumbers its patch references; TESTING.md gets a numbering note.
- README: the base, the testing and zb64 tips, every branch tip, and the
  scrub-replace row. The "git am --skip Filipe's patch" note is dropped.
- stripe-alloc cover: the base hash in its prerequisites section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B6wxsJn1aY7PwnhgXdz6Ec

234 files changed:
README.md
fixups/post-merge.patch
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-usage-90-balance-resume-heuristic-.patch
topics/balance-resume/0003-btrfs-keep-the-usage-90-resume-heuristic-for-balance.patch
topics/compress-fixes/0000-cover-letter.patch
topics/compress-fixes/0001-btrfs-fix-nodatacow-vs-compression-inode-flag-confli.patch
topics/compress-fixes/0002-btrfs-do-not-leave-COMPRESS-on-an-inode-that-gets-NO.patch
topics/compress-fixes/0003-btrfs-allow-NODATACOW-NOCOMPRESS.patch
topics/compress-fixes/0004-btrfs-props-add-per-inode-compression-level-support.patch
topics/compress-fixes/0005-btrfs-props-validate-compression-property-values-str.patch
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-stats/0000-cover-letter.patch
topics/dev-stats/0001-btrfs-write-dirty-device-stats-when-no-transaction-i.patch
topics/dm-stripfault/0000-cover-letter.patch
topics/dm-stripfault/0001-dm-add-the-stripfault-target-a-raid56-read-modify-wr.patch
topics/dm-stripfault/0002-DO-NOT-UPSTREAM-btrfs-sysfs-force_fs_error-to-raise-.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-log-a-message-when-dropping-an-extent-due-to-I.patch
topics/raid56-fixes/0002-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch
topics/raid56-fixes/0003-btrfs-propagate-a-split-bio-s-error-when-the-failing.patch
topics/raid56-fixes/0004-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch
topics/raid56-fixes/0005-btrfs-raid56-verify-reconstructed-tree-blocks.patch
topics/raid56-fixes/0006-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch
topics/raid56-fixes/0007-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch
topics/raid56-fixes/0008-btrfs-raid56-do-not-let-a-failed-write-leave-its-pag.patch
topics/raid56-fixes/0009-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch
topics/raid56-fixes/0010-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch
topics/raid56-fixes/0011-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch
topics/raid56-fixes/0012-DO-NOT-UPSTREAM-btrfs-raid56-debug-knob-for-the-rbio.patch
topics/raid56-scrub-replace/0000-cover-letter.patch
topics/raid56-scrub-replace/0001-btrfs-scrub-check-raid56-parity-of-the-rows-without-.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0001-btrfs-scrub-fix-lost-error-return-value-when-scrubbi.patch [deleted file]
topics/raid56-scrub-replace/0002-btrfs-scrub-check-raid56-parity-of-the-rows-without-.patch [deleted file]
topics/raid56-scrub-replace/0002-btrfs-scrub-copy-raid56-parity-of-unrepairable-rows-.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0003-btrfs-scrub-copy-raid56-parity-of-unrepairable-rows-.patch [deleted file]
topics/raid56-scrub-replace/0003-btrfs-scrub-copy-unrepaired-raid56-data-sectors-to-t.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0004-btrfs-scrub-copy-every-sector-of-raid56-data-stripes.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0004-btrfs-scrub-copy-unrepaired-raid56-data-sectors-to-t.patch [deleted file]
topics/raid56-scrub-replace/0005-btrfs-scrub-copy-every-sector-of-raid56-data-stripes.patch [deleted file]
topics/raid56-scrub-replace/0005-btrfs-scrub-only-avoid-the-replace-source-device-for.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0006-btrfs-scrub-only-avoid-the-replace-source-device-for.patch [deleted file]
topics/raid56-scrub-replace/0006-btrfs-scrub-read-raid56-sectors-without-an-extent-fr.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0007-btrfs-don-t-abort-raid56-data-scrub-on-first-uncorre.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0007-btrfs-scrub-read-raid56-sectors-without-an-extent-fr.patch [deleted file]
topics/raid56-scrub-replace/0008-btrfs-don-t-abort-raid56-data-scrub-on-first-uncorre.patch [deleted file]
topics/raid56-scrub-replace/0008-btrfs-scrub-do-not-write-raid56-parity-in-a-read-onl.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0009-btrfs-scrub-do-not-write-raid56-parity-in-a-read-onl.patch [deleted file]
topics/raid56-scrub-replace/0009-btrfs-scrub-rebuild-a-raid6-data-stripe-that-both-P-.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0010-btrfs-scrub-count-raid56-parity-mismatches-as-corrup.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0010-btrfs-scrub-rebuild-a-raid6-data-stripe-that-both-P-.patch [deleted file]
topics/raid56-scrub-replace/0011-btrfs-scrub-count-raid56-parity-mismatches-as-corrup.patch [deleted file]
topics/raid56-scrub-replace/0011-btrfs-scrub-name-the-device-a-raid56-data-sector-was.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0012-btrfs-scrub-count-the-raid56-data-repairs-made-by-a-.patch [new file with mode: 0644]
topics/raid56-scrub-replace/0012-btrfs-scrub-name-the-device-a-raid56-data-sector-was.patch [deleted file]
topics/raid56-scrub-replace/0013-btrfs-scrub-count-the-raid56-data-repairs-made-by-a-.patch [deleted file]
topics/raid56-scrub-replace/TESTING.md
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/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-report-the-progress-of-a-canceled-.patch
topics/replace-fixes/0007-btrfs-dev-replace-optionally-abort-on-uncorrectable-.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-add-a-write-hole-invariant-checker-to-the-raid.patch
topics/stripe-alloc/0008-btrfs-account-stripe_alloc-trapped-free-space-for-ho.patch
topics/stripe-alloc/0009-btrfs-stripe_alloc-keep-an-open-run-per-size-band-to.patch
topics/stripe-alloc/0010-btrfs-stripe_alloc-grow-the-frontier-run-instead-of-.patch
topics/stripe-alloc/0011-btrfs-raid56-batch-stripe_alloc-partial-writes-into-.patch
topics/stripe-alloc/0012-btrfs-stripe_alloc-never-claim-stripes-covered-by-a-.patch
topics/stripe-alloc/0013-btrfs-stripe_alloc-settle-a-logged-extent-s-stripes-.patch
topics/stripe-alloc/0014-btrfs-stripe_alloc-private-per-inode-stripe-runs-for.patch
topics/stripe-alloc/0015-btrfs-stripe_alloc-carry-an-inode-s-log-tail-forward.patch
topics/stripe-alloc/0016-btrfs-stripe_alloc-kick-parked-rbios-before-the-fast.patch
topics/stripe-alloc/0017-btrfs-raid56-pad-sub-stripe-writes-to-full-stripes-i.patch
topics/stripe-alloc/0018-btrfs-stripe_alloc-isolate-nodatacow-and-preallocate.patch
topics/stripe-alloc/0019-btrfs-stripe_alloc-allow-rmw-policy-and-write-in-pla.patch
topics/stripe-alloc/0020-btrfs-stripe_alloc-persist-nocow-runs-across-commits.patch
topics/stripe-alloc/0021-btrfs-raid56-do-not-park-sync-writes-into-nocow-runs.patch
topics/stripe-alloc/0022-btrfs-raid56-expose-parking-statistics-in-sysfs.patch
topics/stripe-alloc/0023-btrfs-raid56-skip-parking-for-sync-rbios-finished-by.patch
topics/stripe-alloc/0024-btrfs-stripe_alloc-count-open-stripe-run-remainders-.patch
topics/stripe-alloc/0025-btrfs-stripe_alloc-pessimistic-data-reservation-marg.patch
topics/stripe-alloc/0026-btrfs-stripe_alloc-claim-fully-free-stripes-that-spa.patch
topics/stripe-alloc/0027-btrfs-stripe_alloc-warn-when-raid56-metadata-is-not-.patch
topics/stripe-alloc/0028-btrfs-stripe_alloc-report-read-modify-write-of-uncov.patch
topics/stripe-alloc/0029-btrfs-raid56-say-whether-a-metadata-read-modify-writ.patch
topics/stripe-alloc/0030-btrfs-stripe_alloc-tunable-park-deadlines-and-say-wh.patch
topics/stripe-alloc/0031-btrfs-stripe_alloc-trace-why-padding-declined-at-the.patch
topics/stripe-alloc/0032-btrfs-stripe_alloc-complete-parked-writes-on-allocat.patch
topics/stripe-alloc/0033-btrfs-stripe_alloc-track-per-sector-liveness-and-pad.patch
topics/stripe-alloc/0034-btrfs-stripe_alloc-count-claimable-whole-stripe-supp.patch
topics/stripe-alloc/0035-btrfs-raid56-adaptive-park-deadline-from-the-parked-.patch
topics/stripe-alloc/0036-btrfs-stripe_alloc-gate-data-admission-on-claimable-.patch
topics/stripe-alloc/0037-btrfs-stripe_alloc-cache-a-failed-stripe-run-scan-pe.patch
topics/stripe-alloc/0038-btrfs-stripe_meta-allocate-tree-blocks-by-whole-stri.patch
topics/stripe-alloc/0039-btrfs-stripe_alloc-drain-the-legacy-allocator-s-writ.patch
topics/stripe-alloc/0040-btrfs-stripe_alloc-keep-the-admitted-bytes-placeable.patch
topics/stripe-alloc/0041-btrfs-stripe_alloc-never-let-relocation-wait-on-the-.patch
topics/stripe-alloc/0042-btrfs-stripe_alloc-give-a-queued-stripe-group-a-chun.patch
topics/stripe-alloc/0043-btrfs-stripe_alloc-charge-relocation-a-margin-per-re.patch
topics/stripe-alloc/0044-btrfs-stripe_alloc-keep-the-relocation-group-s-strip.patch
topics/stripe-alloc/0045-btrfs-stripe_alloc-let-a-data-write-fall-back-to-the.patch
topics/stripe-alloc/0046-btrfs-stripe_alloc-hand-groups-full-of-trapped-free-.patch
topics/stripe-alloc/0047-btrfs-stripe_alloc-relocate-a-queued-stripe-group-ev.patch
topics/stripe-alloc/0048-btrfs-stripe_meta-maintain-trapped-free-space-for-me.patch
topics/stripe-alloc/0049-btrfs-stripe_meta-back-the-global-reserve-with-usabl.patch
topics/stripe-alloc/0050-btrfs-stripe_meta-hold-back-whole-stripes-so-tree-bl.patch
topics/stripe-alloc/0051-btrfs-stripe_meta-do-not-steal-from-the-global-reser.patch
topics/stripe-alloc/0052-btrfs-stripe_meta-let-the-transaction-machinery-s-ow.patch
topics/stripe-alloc/0053-btrfs-stripe_meta-let-a-group-go-read-only-for-reloc.patch
topics/stripe-alloc/0054-btrfs-stripe_alloc-show-per-group-trapped-bytes-in-t.patch
topics/stripe-alloc/0055-btrfs-stripe_alloc-tell-a-dead-tree-block-from-a-liv.patch
topics/stripe-alloc/0056-btrfs-stripe_alloc-do-not-read-an-inline-backref-off.patch
topics/stripe-alloc/0057-btrfs-stripe_alloc-count-whole-stripes-stranded-behi.patch
topics/stripe-alloc/0058-btrfs-stripe_alloc-give-nocow-extents-a-private-run-.patch
topics/stripe-alloc/0059-btrfs-stripe_alloc-count-nocow-run-lifecycles-and-st.patch
topics/stripe-alloc/0060-btrfs-stripe_alloc-hold-a-stripe-of-margin-across-a-.patch
topics/stripe-alloc/0061-btrfs-stripe_meta-carry-raid56-metadata-groups-throu.patch
topics/stripe-alloc/0062-btrfs-stripe_alloc-return-a-group-s-allocation-clust.patch
topics/stripe-alloc/0063-btrfs-stripe_alloc-release-open-stripe-runs-when-a-m.patch
topics/stripe-alloc/0064-btrfs-stripe_alloc-say-at-mount-whether-the-policy-i.patch
topics/stripe-alloc/0065-btrfs-stripe_meta-cover-raid56-system-chunks.patch
topics/stripe-alloc/0066-btrfs-stripe_alloc-close-dead-nocow-stripe-runs-at-c.patch
topics/stripe-alloc/0067-btrfs-stripe_alloc-do-not-round-a-full-stripe-with-p.patch
topics/stripe-alloc/0068-btrfs-stripe_alloc-do-not-wait-for-stripe-runs-to-dr.patch
topics/stripe-alloc/0069-btrfs-stripe_alloc-end-the-commit-time-and-log-drain.patch
topics/stripe-alloc/0070-btrfs-stripe_alloc-compact-mostly-live-groups-instea.patch
topics/stripe-alloc/0071-btrfs-stripe_alloc-attribute-each-data-read-modify-w.patch
topics/stripe-alloc/0072-btrfs-stripe_alloc-optionally-audit-data-read-modify.patch
topics/stripe-alloc/0073-btrfs-stripe_alloc-keep-relocation-s-stripe-runs-unt.patch
topics/stripe-alloc/0074-btrfs-stripe_alloc-let-relocation-allocate-a-data-ch.patch
topics/stripe-alloc/0075-btrfs-stripe_alloc-keep-a-stripe-in-the-rbio-cache-u.patch
topics/stripe-alloc/0076-btrfs-stripe_alloc-pad-a-stripe-s-allocated-sectors-.patch
topics/stripe-alloc/0077-btrfs-stripe_alloc-apply-the-property-before-tree-lo.patch
topics/stripe-alloc/0078-btrfs-stripe_alloc-count-refused-rbio-pins-and-track.patch
topics/stripe-alloc/0079-btrfs-stripe_alloc-sweep-stale-rbio-pins-and-commit-.patch
topics/stripe-alloc/0080-btrfs-stripe_alloc-break-rbio-pins-and-open-stripe-r.patch
topics/stripe-alloc/0081-btrfs-stripe_alloc-give-each-log-commit-its-own-meta.patch
topics/stripe-alloc/0082-btrfs-stripe_alloc-don-t-make-a-parked-rbio-wait-for.patch
topics/stripe-alloc/0083-btrfs-stripe_alloc-share-LOG-data-runs-per-log-trans.patch
topics/stripe-alloc/0084-btrfs-stripe_alloc-let-relocation-allocate-as-many-d.patch
topics/stripe-alloc/0085-btrfs-stripe_alloc-key-private-stripe-runs-by-subvol.patch
topics/stripe-alloc/0086-btrfs-stripe_alloc-do-not-treat-an-allocation-error-.patch
topics/stripe-alloc/0087-btrfs-stripe_alloc-mark-an-ended-ordered-extent-s-se.patch
topics/stripe-alloc/0088-btrfs-stripe_alloc-read-the-shared-LOG-run-mode-once.patch
topics/stripe-alloc/0089-btrfs-stripe_alloc-remove-only-the-set-bits-of-a-bit.patch
topics/stripe-alloc/0090-btrfs-stripe_alloc-claim-a-stripe-tail-in-one-free-s.patch
topics/stripe-alloc/0091-btrfs-stripe_alloc-keep-the-stripe-totals-consistent.patch
topics/stripe-alloc/0092-btrfs-stripe_alloc-do-not-delete-an-unused-block-gro.patch
topics/stripe-alloc/0093-btrfs-stripe_meta-commit-before-waiting-for-metadata.patch
topics/stripe-alloc/0094-btrfs-raid56-do-not-read-tree-blocks-under-the-strip.patch
topics/stripe-alloc/0095-btrfs-raid56-stop-the-park-timer-before-destroying-t.patch
topics/stripe-alloc/0096-btrfs-stripe_alloc-order-the-filesystem-error-before.patch
topics/stripe-alloc/0097-btrfs-raid56-set-a-padded-rbio-s-data-bitmap-under-b.patch
topics/stripe-alloc/0098-btrfs-stripe_alloc-forget-the-failed-claim-verdict-w.patch
topics/stripe-alloc/0099-btrfs-stripe_alloc-do-not-let-a-remount-revert-the-s.patch
topics/stripe-alloc/0100-btrfs-stripe_alloc-do-not-block-a-NOWAIT-write-in-th.patch
topics/stripe-alloc/0101-btrfs-stripe_alloc-keep-the-head-of-a-claimed-free-s.patch
topics/stripe-alloc/0102-btrfs-stripe_meta-check-the-block-group-lookup-when-.patch
topics/stripe-alloc/0103-btrfs-stripe_alloc-remove-the-unused-stripe_rmw_opt-.patch
topics/stripe-alloc/0104-btrfs-stripe_alloc-correct-and-trim-the-block-group-.patch
topics/stripe-alloc/0105-btrfs-stripe_alloc-correct-and-trim-the-comments-out.patch
topics/stripe-alloc/0106-btrfs-stripe_meta-keep-waiting-for-metadata-runs-tha.patch
topics/stripe-alloc/0107-btrfs-stripe_alloc-remove-pad-refusal-reasons-that-n.patch
topics/stripe-alloc/0108-btrfs-stripe_alloc-count-and-log-ordered-extents-tha.patch
topics/stripe-alloc/0109-btrfs-stripe_alloc-skip-RAID5-6-groups-that-are-mapp.patch
topics/stripe-alloc/0110-btrfs-stripe_alloc-count-single-data-stripe-groups-f.patch
topics/stripe-alloc/0111-btrfs-stripe_alloc-account-claimable-stripes-while-a.patch
topics/stripe-alloc/0112-btrfs-stripe_alloc-do-not-miss-bitmap-free-space-whe.patch
topics/stripe-alloc/0113-btrfs-log-block-group-reclaim-at-debug-level.patch
topics/stripe-alloc/0114-btrfs-stripe_alloc-add-stripe_reclaim_now-to-reclaim.patch
topics/stripe-alloc/0115-btrfs-stripe_alloc-back-off-block-group-reclaim-afte.patch
topics/stripe-alloc/0116-btrfs-stripe_alloc-let-queued-exclusive-operations-i.patch

index 4d5f0b4da075cacf70f34437e0d3e2d490b5ee32..cd1c8a7ed4947e497b4775d43a4d43040b6c54a0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,9 +7,9 @@ upstream at all (see the table).
 
 | | |
 |---|---|
-| base of every series | `0c48d26d46bd` ("btrfs: stop reading free space inodes from the commit root"), the misc-next lane base (`misc-next/testing^1`) |
-| integration branch | `misc-next/testing` `3b6557663e94` (octopus of all 20 topics) |
-| lane head | `zygo-misc-next-zb64` `03fd98a3ff17`; its own commits on top of `testing` (kernel configs, `covers/`) are not exported |
+| base of every series | `99bc6552614f` ("btrfs: === misc-next on b-for-next ==="): btrfs/for-next `0713fa6a4356` plus a marker commit, the misc-next lane base (`misc-next/testing^1`, rebased 2026-10-25) |
+| integration branch | `misc-next/testing` `e8519e93c9a2` (octopus of all 20 topics) |
+| lane head | `zygo-misc-next-zb64` `315863b5a610`; its own commits on top of `testing` (kernel configs, `covers/`) are not exported |
 
 The base is not a published commit: the lane rebuilds it from
 btrfs/for-next plus David Sterba's queue.  It lives in the
@@ -59,32 +59,32 @@ the integration recipe below uses.
 
 | directory | patches | branch tip | authors | cover letter | notes |
 |---|---|---|---|---|---|
-| `logical-ino-costs` | 3 | `fe67a58f7f48` | Zygo, Kai Krakow | from misc-next `covers/`, updated: 0/3 and a paragraph on patch 3 | patch 3 is Kai's, already posted by him |
-| `balance-resume` | 3 | `4f577b679051` | Zygo | from misc-next `covers/`, current | patch 3 optional, offered for rejection |
-| `compress-fixes` | 5 | `babe6f1c006d` | Zygo | from misc-next `covers/`, current | |
-| `deadlock-fixes` | 3 | `68c1f77b3885` | Zygo | new | |
-| `dedupe-fixes` | 1 | `13e8d4c620f7` | Zygo | new, 0/1 (drafted 2026-10-18) | |
-| `delalloc-fixes` | 1 | `7c23eb7ad5c9` | Zygo | from misc-next `covers/`, rewritten 2026-10-19 for 0/1 | patch 1 (delalloc leak) dropped 2026-10-19: fixed upstream by 095be159f3eb; 6.18 keeps it |
-| `dev-extent-defrag` | 1 | `40c2fffa8348` | Zygo | new, 0/1 (drafted 2026-10-18) | |
-| `prealloc-size` | 1 | `93d225865ab2` | Zygo | new, 0/1 (drafted 2026-10-18) | |
-| `raid56-fixes` | 12 | `f7e693d10be2` | Zygo | new; replaces `covers/raid56-rbio-fixes.txt` (2 of these patches) | **patch 12 is DO-NOT-UPSTREAM** (rbio cache size debug knob) |
-| `raid56-scrub-replace` | 13 | `9970d7e44abf` | Filipe Manana, Zygo | new | patch 1 is Filipe's, already in btrfs/for-next (`ec0795c045c3`) |
-| `stripe-alloc` | 116 | `a23064467620` | Zygo | rewritten 2026-10-22 by subtopic (rebuild planned, REORDER-PLAN.md) | RFC; subtopic 6 (debug) not for merging; stripe_meta may be dropped (STRIPE-META-CLAIMS.md) |
-| `low-space` | 3 | `4f26c7c44896` | Zygo | from misc-next `covers/`, patch 3 paragraph added 2026-10-22 | reserve off by default; patch 3 fixes an upstream relocation abort (FLUSH_LIMIT merge refill) |
-| `dedupe-mtime` | 1 | `288d851bbbc2` | Ivan Kozik | new, 0/1 (drafted 2026-10-18) | Ivan's patch |
-| `dm-stripfault` | 2 | `9ab63d7ab0fa` | Zygo | new | **test fixtures, NOT for merge** (no `To:`) |
-| `allocator-hints` | 12 | `43c53b3f02db` | Kai Krakow, KeinNiemand, Zygo | new | Kai's series plus follow-ups; the authors' postings are authoritative |
-| `read-policies` | 9 | `18680c6045be` | Kai Krakow | new | Kai's series; his postings are authoritative |
-| `replace-fixes` | 7 | `43c8a1e60a5a` | Zygo | new | patch 7 has a btrfs-progs counterpart (`topics/replace-abort-uncorrectable`) |
-| `dev-stats` | 1 | `55ade1cf195c` | Zygo | new, 0/1 (2026-10-21) | behaviour change, offered for rejection; independent of every other series |
-| `resize-missing` | 1 | `8763f9e2126d` | Qu Wenruo, rewritten by Zygo | new, 0/1 (2026-10-21) | Qu's 2019 patch reworked: grow checks now return, absolute sizes checked; Zygo's Signed-off-by to be added before sending |
-| `read-repair-fixes` | 4 | `035bd2f8c1e3` | Zygo | new 2026-10-22; 0/4 | read repair and scrub after an abort: NULL end_io (v6.3+), same csum root, no repair writes after abort; Cc stable on 1-2 only (the abort-write rule is under revision upstream); raid56 left as upstream |
+| `logical-ino-costs` | 3 | `f792976ba697` | Zygo, Kai Krakow | from misc-next `covers/`, updated: 0/3 and a paragraph on patch 3 | patch 3 is Kai's, already posted by him |
+| `balance-resume` | 3 | `6094381703cd` | Zygo | from misc-next `covers/`, current | patch 3 optional, offered for rejection |
+| `compress-fixes` | 5 | `9cf6495173d4` | Zygo | from misc-next `covers/`, current | |
+| `deadlock-fixes` | 3 | `78c0c9e6a02b` | Zygo | new | |
+| `dedupe-fixes` | 1 | `8e47d471e8a3` | Zygo | new, 0/1 (drafted 2026-10-18) | |
+| `delalloc-fixes` | 1 | `a49a18e6a3c7` | Zygo | from misc-next `covers/`, rewritten 2026-10-19 for 0/1 | patch 1 (delalloc leak) dropped 2026-10-19: fixed upstream by 095be159f3eb; 6.18 keeps it |
+| `dev-extent-defrag` | 1 | `34a8e85757bb` | Zygo | new, 0/1 (drafted 2026-10-18) | |
+| `prealloc-size` | 1 | `a69ecf626add` | Zygo | new, 0/1 (drafted 2026-10-18) | |
+| `raid56-fixes` | 12 | `796097dafc94` | Zygo | new; replaces `covers/raid56-rbio-fixes.txt` (2 of these patches) | **patch 12 is DO-NOT-UPSTREAM** (rbio cache size debug knob) |
+| `raid56-scrub-replace` | 12 | `b7b4005cacc4` | Zygo | new; 0/12 since 2026-10-25 | Filipe's -EIO fix (`ec0795c045c3`) is in the base now and was dropped from the series |
+| `stripe-alloc` | 116 | `bc8cd9cac405` | Zygo | rewritten 2026-10-22 by subtopic (rebuild planned, REORDER-PLAN.md) | RFC; subtopic 6 (debug) not for merging; stripe_meta may be dropped (STRIPE-META-CLAIMS.md) |
+| `low-space` | 3 | `087669d83341` | Zygo | from misc-next `covers/`, patch 3 paragraph added 2026-10-22 | reserve off by default; patch 3 fixes an upstream relocation abort (FLUSH_LIMIT merge refill) |
+| `dedupe-mtime` | 1 | `dcacae4b4bd8` | Ivan Kozik | new, 0/1 (drafted 2026-10-18) | Ivan's patch |
+| `dm-stripfault` | 2 | `0d13e1572fe7` | Zygo | new | **test fixtures, NOT for merge** (no `To:`) |
+| `allocator-hints` | 12 | `6944c7760536` | Kai Krakow, KeinNiemand, Zygo | new | Kai's series plus follow-ups; the authors' postings are authoritative |
+| `read-policies` | 9 | `ccf8a6c6d49b` | Kai Krakow | new | Kai's series; his postings are authoritative |
+| `replace-fixes` | 7 | `1c2676130104` | Zygo | new | patch 7 has a btrfs-progs counterpart (`topics/replace-abort-uncorrectable`) |
+| `dev-stats` | 1 | `a5160f442538` | Zygo | new, 0/1 (2026-10-21) | behaviour change, offered for rejection; independent of every other series |
+| `resize-missing` | 1 | `2d41f2a9495d` | Qu Wenruo, rewritten by Zygo | new, 0/1 (2026-10-21) | Qu's 2019 patch reworked: grow checks now return, absolute sizes checked; Zygo's Signed-off-by to be added before sending |
+| `read-repair-fixes` | 4 | `df4629dcf9ad` | Zygo | new 2026-10-22; 0/4 | read repair and scrub after an abort: NULL end_io (v6.3+), same csum root, no repair writes after abort; Cc stable on 1-2 only (the abort-write rule is under revision upstream); raid56 left as upstream |
 
 ## Applying one series
 
 ```sh
 cd ~/share/linux                  # any clone that has the base commit
-git checkout -b up/raid56-scrub-replace 0c48d26d46bd
+git checkout -b up/raid56-scrub-replace 99bc6552614f
 git am $(ls ~/share/linux-upstream/topics/raid56-scrub-replace/*.patch | grep -v 0000-cover-letter)
 ```
 
@@ -92,8 +92,6 @@ git am $(ls ~/share/linux-upstream/topics/raid56-scrub-replace/*.patch | grep -v
 On a base that already contains a patch of the series, `git am` stops
 at that patch; `git am --skip` drops it.  Expected cases:
 
-- `raid56-scrub-replace` patch 1 (Filipe's -EIO fix), once btrfs/for-next
-  is in the base;
 - `logical-ino-costs` patch 3 and the `allocator-hints` /
   `read-policies` patches, if Kai's postings are merged first.
 
@@ -109,7 +107,7 @@ fixup:
 ```sh
 cd ~/share/linux
 P=~/share/linux-upstream
-B=0c48d26d46bd
+B=99bc6552614f
 ORDER="logical-ino-costs balance-resume compress-fixes deadlock-fixes dedupe-fixes
        delalloc-fixes dev-extent-defrag prealloc-size raid56-fixes raid56-scrub-replace
        stripe-alloc low-space dedupe-mtime dm-stripfault allocator-hints read-policies
@@ -135,7 +133,7 @@ plain `git am`, because the later series conflict.  Merging separate
 branches is the supported way.
 
 Verified on the export: the patches of every directory, applied in order
-to `0c48d26d46bd`, give that branch's tree exactly.  Merging all 20 in
+to `99bc6552614f`, give that branch's tree exactly.  Merging all 20 in
 the order above with `-X ours` and applying `fixups/post-merge.patch`
 gives the tree of `misc-next/testing` exactly.  The verification used
 git 2.47.
@@ -205,5 +203,5 @@ The fixup adds 640 lines and removes 16, in 10 files.
 - `balance-resume` patch 3 is offered for rejection, as its cover letter
   says.
 - Re-export with `scripts/export.sh` after any lane change.  The
-  directories reflect the lane at `misc-next/testing` `3b6557663e94`.
+  directories reflect the lane at `misc-next/testing` `e8519e93c9a2`.
   Commit the result with the misc-next SHAs that the script prints.
index 5cb1a49ade0cd487d68f783f7638782995aeff10..6fdf918ee05a02a9e3ce343cf71e4484fc8b580e 100644 (file)
@@ -37,7 +37,7 @@ index f097f9631a8574a5792c90cb72f82a012674879c..2f24b9e5dac6425e75e7dfeb4445c0f9
        bool "Btrfs experimental features"
        depends on BTRFS_FS
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 59f668359df7b6ccbb85dd632eee6858250a2993..e0862c13efafaed76b7c5aa606dd94179ac80500 100644
+index 681fd72ab9277ea30b95cb93999bb720f5e21230..f031f0329814ac9b13bdfae893275548f0e64ff1 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -3511,6 +3511,8 @@ void btrfs_retire_open_stripes(struct btrfs_fs_info *fs_info,
@@ -62,7 +62,7 @@ index 59f668359df7b6ccbb85dd632eee6858250a2993..e0862c13efafaed76b7c5aa606dd9417
                                }
                                unit = max(unit, bg->full_stripe_len);
                        }
-@@ -4826,6 +4834,13 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -4828,6 +4836,13 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                 */
                if (sinfo_used - trapped + num_bytes <= sinfo->total_bytes)
                        ret = 0;
@@ -76,7 +76,7 @@ index 59f668359df7b6ccbb85dd632eee6858250a2993..e0862c13efafaed76b7c5aa606dd9417
  
                /*
                 * The stripe_alloc gate admitted writers against whole
-@@ -7198,7 +7213,15 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
+@@ -7201,7 +7216,15 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
        mutex_unlock(&fs_info->ro_block_group_mutex);
  
        btrfs_end_transaction(trans);
@@ -93,7 +93,7 @@ index 59f668359df7b6ccbb85dd632eee6858250a2993..e0862c13efafaed76b7c5aa606dd9417
                btrfs_bg_unblock_nocow(cache);
        return ret;
  }
-@@ -7226,6 +7249,7 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
+@@ -7229,6 +7252,7 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
                sinfo->bytes_readonly -= btrfs_block_group_available_space(cache);
                list_del_init(&cache->ro_list);
                became_rw = true;
@@ -101,7 +101,7 @@ index 59f668359df7b6ccbb85dd632eee6858250a2993..e0862c13efafaed76b7c5aa606dd9417
        }
        spin_unlock(&cache->lock);
        spin_unlock(&sinfo->lock);
-@@ -8833,6 +8857,30 @@ static bool reloc_reserve_wanted(struct btrfs_fs_info *fs_info,
+@@ -8836,6 +8860,30 @@ static bool reloc_reserve_wanted(struct btrfs_fs_info *fs_info,
        return READ_ONCE(sinfo->reloc_reserve);
  }
  
@@ -175,10 +175,10 @@ index cd3073cc60fe361602e0a154f1e7085dd76a4cc2..cfc0d9a2169a4448eb13ce64128db7ad
        ret = find_free_extent(root, ins, &ffe_ctl);
        if (!ret && !is_data) {
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index bcf8dbc7fdf8dc3455b08855149f351046850b1c..c10f75587c2310196a13faf797c868d294cc276d 100644
+index 7cd95d273947a8d3b909ee5b12e1cb3fe5e57fa0..1aa93286f75b929e2a15ea07618778289f670c6f 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -991,13 +991,15 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
+@@ -995,13 +995,15 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
  {
        struct btrfs_stripe_hash_table *table;
        const unsigned int limit = rbio_cache_limit(rbio->bioc->fs_info);
@@ -196,7 +196,7 @@ index bcf8dbc7fdf8dc3455b08855149f351046850b1c..c10f75587c2310196a13faf797c868d2
        table = rbio->bioc->fs_info->stripe_hash_table;
  
        spin_lock(&table->cache_lock);
-@@ -1020,18 +1022,8 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
+@@ -1024,18 +1026,8 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
  
        spin_unlock(&rbio->bio_list_lock);
  
@@ -217,7 +217,7 @@ index bcf8dbc7fdf8dc3455b08855149f351046850b1c..c10f75587c2310196a13faf797c868d2
  
        spin_unlock(&table->cache_lock);
  }
-@@ -4032,6 +4024,258 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+@@ -4049,6 +4041,258 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
        return false;
  }
  
@@ -237,7 +237,7 @@ index bcf8dbc7fdf8dc3455b08855149f351046850b1c..c10f75587c2310196a13faf797c868d2
 +      const int stripe_nr = i / rbio->stripe_nsectors;
 +      const int sectornr = i % rbio->stripe_nsectors;
 +      const u64 logical = rbio->bioc->full_stripe_logical +
-+                          (u64)stripe_nr * BTRFS_STRIPE_LEN +
++                          (u64)stripe_nr * rbio->bioc->stripe_len +
 +                          (u64)sectornr * fs_info->sectorsize;
 +      const phys_addr_t *paddrs = from_bio ? rbio->bio_paddrs
 +                                           : rbio->stripe_paddrs;
@@ -409,7 +409,7 @@ index bcf8dbc7fdf8dc3455b08855149f351046850b1c..c10f75587c2310196a13faf797c868d2
 +                      const int stripe_nr = i / rbio->stripe_nsectors;
 +                      const int sectornr = i % rbio->stripe_nsectors;
 +                      const u64 logical = rbio->bioc->full_stripe_logical +
-+                              (u64)stripe_nr * BTRFS_STRIPE_LEN +
++                              (u64)stripe_nr * rbio->bioc->stripe_len +
 +                              (u64)sectornr * fs_info->sectorsize;
 +                      u64 refs;
 +                      u64 egen;
@@ -477,10 +477,10 @@ index bcf8dbc7fdf8dc3455b08855149f351046850b1c..c10f75587c2310196a13faf797c868d2
   * 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
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index d71c5c5f4b2ed8f930cb1c2991f98fbafba35261..cfcd9bce4652f861774763844076ef755cc70475 100644
+index 28241c31faa28bb6e68b1fe309e0901c280b986d..a00ef6881ce51e57c4305d5154583ddc580678f3 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -334,5 +334,11 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
+@@ -329,5 +329,11 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
  void btrfs_set_rbio_cache_size(struct btrfs_fs_info *info, unsigned int size);
  #endif
  void btrfs_raid56_uncache_range(struct btrfs_fs_info *info, u64 start, u64 len);
@@ -493,10 +493,10 @@ index d71c5c5f4b2ed8f930cb1c2991f98fbafba35261..cfcd9bce4652f861774763844076ef75
  
  #endif
 diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 34998749fc548fc6f3a730a1064d60fa1b4cf931..82ab5fbf983e2e58e2e8cd43924d5614a0a857cf 100644
+index 5801b68037a08e36a68939353ccd01d5767de4ed..4cd4f5a58dd3a71bc241410e67d111597e863400 100644
 --- a/fs/btrfs/scrub.c
 +++ b/fs/btrfs/scrub.c
-@@ -1289,7 +1289,8 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
+@@ -1297,7 +1297,8 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
        bitmap_andnot(&repaired, &errors.init_error_bitmap, &error,
                      stripe->nr_sectors);
        if (!sctx->readonly && !bitmap_empty(&repaired, stripe->nr_sectors) &&
@@ -507,10 +507,10 @@ index 34998749fc548fc6f3a730a1064d60fa1b4cf931..82ab5fbf983e2e58e2e8cd43924d5614
                        btrfs_repair_one_zone(fs_info, sctx->stripes[0].bg->start);
                } else {
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 72c6b4c4c2772ec75bf3e0645aed5d8546da4576..08ecac160dfc0e4e9734c1fc72528ecc3e08d854 100644
+index c0273a10a97035d85e5cb1d3de4823787aead125..9f1809b9a598fbd15405e4b1e177d3c9af30b4cd 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -696,6 +696,7 @@ bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
+@@ -694,6 +694,7 @@ bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
         */
        if (reloc)
                used -= min(used, space_info->bytes_stripe_reserve);
@@ -518,7 +518,7 @@ index 72c6b4c4c2772ec75bf3e0645aed5d8546da4576..08ecac160dfc0e4e9734c1fc72528ecc
  
        return check_can_overcommit(space_info, used, bytes, flush);
  }
-@@ -774,6 +775,12 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
+@@ -772,6 +773,12 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
                } else {
                        /* ...and that group is out of reach for everyone else */
                        supply -= min(supply, dedicated);
@@ -531,7 +531,7 @@ index 72c6b4c4c2772ec75bf3e0645aed5d8546da4576..08ecac160dfc0e4e9734c1fc72528ecc
                        /*
                         * An allocation that opens a run claims
                         * round_up(bytes, unit).  A delalloc write's margin
-@@ -824,6 +831,7 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
+@@ -822,6 +829,7 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
                tused = used;
                if (ticket->reloc)
                        tused -= min(tused, space_info->bytes_stripe_reserve);
@@ -539,7 +539,7 @@ index 72c6b4c4c2772ec75bf3e0645aed5d8546da4576..08ecac160dfc0e4e9734c1fc72528ecc
  
                /* Check and see if our ticket can be satisfied now. */
                if ((tused + ticket->bytes <= space_info->total_bytes ||
-@@ -2143,7 +2151,6 @@ static int __reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2141,7 +2149,6 @@ static int __reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
                space_info->reclaim_size += ticket.bytes;
                init_waitqueue_head(&ticket.wait);
                spin_lock_init(&ticket.lock);
@@ -548,7 +548,7 @@ index 72c6b4c4c2772ec75bf3e0645aed5d8546da4576..08ecac160dfc0e4e9734c1fc72528ecc
                ticket.reloc = reloc;
                ticket.mount_cleanup =
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 0ee5b52a8296bea97ab82afd153dbd9cd69777d0..af2eb0c3f9a17207fbb20a0a9b83cd3106f5d297 100644
+index 63dd1dc79bef527c3daa470b29b84f535f96c0ca..88141644027aa0f87e08512f64b88cd328a14e97 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -382,7 +382,7 @@ static inline u64 btrfs_space_info_used(const struct btrfs_space_info *s_info,
@@ -561,7 +561,7 @@ index 0ee5b52a8296bea97ab82afd153dbd9cd69777d0..af2eb0c3f9a17207fbb20a0a9b83cd31
                s_info->bytes_stripe_margin +
                s_info->bytes_stripe_reserve +
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 9aaa51a6734bb814620155960de1be76019ed7a8..161ee904e12c2dc442438ccea295332c3baa2bad 100644
+index 6c16cc96ff1fea35fe02dffbb0186ce574635744..5edefae1dd1c850306250226c6d4bcfe395f9a80 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -616,6 +616,8 @@ BTRFS_ATTR(debug_mount, stripe_rmw_audit_stats,
@@ -581,7 +581,7 @@ index 9aaa51a6734bb814620155960de1be76019ed7a8..161ee904e12c2dc442438ccea295332c
  SPACE_INFO_ATTR(disk_used);
  SPACE_INFO_ATTR(disk_total);
  SPACE_INFO_ATTR(reclaim_count);
-@@ -2650,6 +2653,61 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
+@@ -2651,6 +2654,61 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
  BTRFS_ATTR_RW(devid, type, btrfs_devinfo_type_show, btrfs_devinfo_type_store);
  #endif /* CONFIG_BTRFS_ALLOCATOR_HINTS */
  
@@ -644,10 +644,10 @@ index 9aaa51a6734bb814620155960de1be76019ed7a8..161ee904e12c2dc442438ccea295332c
   * Information about one device.
   *
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index b538d4790ef64047e214132263cd4d37eb910a85..816f5522baf27fa701127da27b5e7a5b53c5119e 100644
+index babe6ad81716978f45a6f8f3b65fc745ee18dfe7..a966de1270bcb32580d5365bca1b3887a16207b9 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6924,7 +6924,293 @@ bool btrfs_chunk_raid56_mirrored(struct btrfs_fs_info *fs_info, u64 logical)
+@@ -6937,7 +6937,293 @@ bool btrfs_chunk_raid56_mirrored(struct btrfs_fs_info *fs_info, u64 logical)
        return ret;
  }
  
index 51c7463c94c43f46c61bd7a0451356c24dc9caa4..d5ef37fc3c4163be1eacfadc6d13f7699b420004 100644 (file)
@@ -1,6 +1,6 @@
-From 43c53b3f02db3c3bcc55714bfe5b06eb56276353 Mon Sep 17 00:00:00 2001
+From 6944c77605368854e644f8c961ad38ffb741d873 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 22:46:13 -0400
+Date: Sun, 25 Oct 2026 03:13:46 -0400
 Subject: [PATCH 00/12] btrfs: allocator hints (Kai Krakow's series, as carried on misc-next)
 To: linux-btrfs@vger.kernel.org
 
@@ -77,7 +77,7 @@ Zygo Blaxell (4):
  8 files changed, 490 insertions(+), 20 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 9f4fd5173d8b94073e1433fac120568834adbfe9..75e366c043198a826adffdaa3bf5ec0b1357e264 100644 (file)
@@ -1,4 +1,4 @@
-From 8f3082a7ebefed571d0f36d0194073feaff58660 Mon Sep 17 00:00:00 2001
+From 047b7c947d423dd8f3246d42d2aa48862b1a9ab8 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 c62d39779230308b7592103173024ad4828139d5..16ecd4cd663d3e041750b604114f77387626cbe6 100644 (file)
@@ -1,4 +1,4 @@
-From 8e7507febeb58ab020164fbdcf7e1d06b8da0621 Mon Sep 17 00:00:00 2001
+From 3a82701b991baee17492c8fdb1911cef9d9a5344 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 3d84c12d0b59867e4372eeb2b7dc7d17af70299e..9ca62fdddc3a09a18eca9610a7c92f8dc53f42a1 100644 (file)
@@ -1,4 +1,4 @@
-From 96eca7bce271925186716b49248f5ac700d2d459 Mon Sep 17 00:00:00 2001
+From 894ba25b5c1bb9bcbafd5ed149503d86f04da31b 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
@@ -12,10 +12,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  1 file changed, 15 insertions(+)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..697238beadd0c 100644
+index 89b0a4ef4063e..6a68149318d84 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
-@@ -1983,6 +1983,18 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
+@@ -1984,6 +1984,18 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
  }
  BTRFS_ATTR(devid, error_stats, btrfs_devinfo_error_stats_show);
  
@@ -34,7 +34,7 @@ index 3ac1fa608d3b5..697238beadd0c 100644
  /*
   * Information about one device.
   *
-@@ -1996,6 +2008,9 @@ static struct attribute *devid_attrs[] = {
+@@ -1997,6 +2009,9 @@ static struct attribute *devid_attrs[] = {
        BTRFS_ATTR_PTR(devid, replace_target),
        BTRFS_ATTR_PTR(devid, scrub_speed_max),
        BTRFS_ATTR_PTR(devid, writeable),
index d1036f9cb58d2287dbcadd45e09c472caae165c0..482ac5251c05528984e0964ab5154d61a936eb25 100644 (file)
@@ -1,4 +1,4 @@
-From d7878068817b71bf6ed1dab1e4a17b853d139b9e Mon Sep 17 00:00:00 2001
+From 5c78cc5b6dfa6fca8616e11d75c9c71df39c7ba3 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
@@ -38,10 +38,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  1 file changed, 79 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 697238beadd0c..ef03b81215d58 100644
+index 6a68149318d84..a3ccfe3dbcafc 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
-@@ -1984,6 +1984,22 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
+@@ -1985,6 +1985,22 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
  BTRFS_ATTR(devid, error_stats, btrfs_devinfo_error_stats_show);
  
  #ifdef CONFIG_BTRFS_ALLOCATOR_HINTS
@@ -64,7 +64,7 @@ index 697238beadd0c..ef03b81215d58 100644
  static ssize_t btrfs_devinfo_type_show(struct kobject *kobj,
                                       struct kobj_attribute *a, char *buf)
  {
-@@ -1992,7 +2008,69 @@ static ssize_t btrfs_devinfo_type_show(struct kobject *kobj,
+@@ -1993,7 +2009,69 @@ static ssize_t btrfs_devinfo_type_show(struct kobject *kobj,
  
        return scnprintf(buf, PAGE_SIZE, "0x%016llx\n", device->type);
  }
index 63e4ab3fe2b4a3f5afc9e6f32852dbe9e8bf4ccb..0dc9d2902638dc8a57bb2ec1f2a9f2587968930f 100644 (file)
@@ -1,4 +1,4 @@
-From b35e5a63150a6c0dce37745f655ad149043a5ef7 Mon Sep 17 00:00:00 2001
+From 957cad32902b12696afc0b263d70050cd204aa83 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 d3e6a9b429dd9..fdeb073b5c275 100644
+index ce78a9441c64f..7af7af717c9ba 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 d3e6a9b429dd9..fdeb073b5c275 100644
  const char *btrfs_bg_type_to_raid_name(u64 flags)
  {
        const int index = btrfs_bg_flags_to_raid_index(flags);
-@@ -5571,13 +5586,20 @@ static int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info,
+@@ -5576,13 +5591,20 @@ static int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info,
  }
  
  /*
@@ -118,7 +118,7 @@ index d3e6a9b429dd9..fdeb073b5c275 100644
        if (di_a->max_avail > di_b->max_avail)
                return -1;
        if (di_a->max_avail < di_b->max_avail)
-@@ -5947,16 +5969,97 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -5953,16 +5975,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,10 +217,10 @@ index d3e6a9b429dd9..fdeb073b5c275 100644
  }
  
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 6eddda2392215..3c64aa598971c 100644
+index 75b1179776c80..3cd7d94554151 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -602,6 +602,9 @@ struct btrfs_device_info {
+@@ -603,6 +603,9 @@ struct btrfs_device_info {
        u64 dev_offset;
        u64 max_avail;
        u64 total_avail;
index bad52266621dffde1a6bd68e070c476a94635d5d..9b4d52625b2729e6cda832d2736a7bb65ea2c83a 100644 (file)
@@ -1,4 +1,4 @@
-From 93213d412a41300db32e3fd57fb090bbbbe73fc4 Mon Sep 17 00:00:00 2001
+From d7add7cf6edfa308343ea12cb95ccabaf7305e2b 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
@@ -38,10 +38,10 @@ index e2b0e1cc28d0e..2326ae14c10a7 100644
          If unsure, say N.
  
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index ef03b81215d58..0a787e96bc147 100644
+index a3ccfe3dbcafc..931fd4b5a6559 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
-@@ -1994,6 +1994,7 @@ static bool btrfs_dev_allocation_hint_valid(u64 type)
+@@ -1995,6 +1995,7 @@ static bool btrfs_dev_allocation_hint_valid(u64 type)
        case BTRFS_DEV_ALLOCATION_PREFERRED_METADATA:
        case BTRFS_DEV_ALLOCATION_METADATA_ONLY:
        case BTRFS_DEV_ALLOCATION_DATA_ONLY:
@@ -50,7 +50,7 @@ index ef03b81215d58..0a787e96bc147 100644
        default:
                return false;
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index fdeb073b5c275..44acb1b301981 100644
+index 7af7af717c9ba..c1fc62270289d 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 fdeb073b5c275..44acb1b301981 100644
        /* the other values are set to 0 */
  };
  #endif /* CONFIG_BTRFS_ALLOCATOR_HINTS */
-@@ -6006,7 +6007,10 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6012,7 +6013,10 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                         * sort also by hint (metadata hint
                         * higher priority)
                         */
index a4c15ff828ddf2affd24df58945d5ec4dfd11703..9e5c81456f0d1a28f771aa4b33f719c9d84785dd 100644 (file)
@@ -1,4 +1,4 @@
-From 0c7225f7aabe7a207e0f4d0abf5fad55d7f33daf Mon Sep 17 00:00:00 2001
+From b54d25e97ca7ae0cdd1706c872ee9035e430a6f2 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
@@ -47,10 +47,10 @@ index 2326ae14c10a7..e14cddb83c8a3 100644
          If unsure, say N.
  
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 0a787e96bc147..19102dafcd4c1 100644
+index 931fd4b5a6559..16912c8f4f9e6 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
-@@ -1995,6 +1995,7 @@ static bool btrfs_dev_allocation_hint_valid(u64 type)
+@@ -1996,6 +1996,7 @@ static bool btrfs_dev_allocation_hint_valid(u64 type)
        case BTRFS_DEV_ALLOCATION_METADATA_ONLY:
        case BTRFS_DEV_ALLOCATION_DATA_ONLY:
        case BTRFS_DEV_ALLOCATION_PREFERRED_NONE:
@@ -59,7 +59,7 @@ index 0a787e96bc147..19102dafcd4c1 100644
        default:
                return false;
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 44acb1b301981..862a296bd0453 100644
+index c1fc62270289d..00ecf2b1b30f4 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 44acb1b301981..862a296bd0453 100644
        [BTRFS_DEV_ALLOCATION_DATA_ONLY] = -1,
        [BTRFS_DEV_ALLOCATION_PREFERRED_DATA] = 0,
        [BTRFS_DEV_ALLOCATION_PREFERRED_METADATA] = 1,
-@@ -5988,6 +5989,11 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -5994,6 +5995,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 44acb1b301981..862a296bd0453 100644
                        /*
                         * if a data chunk must be allocated,
                         * sort also by hint (data disk
-@@ -6002,6 +6008,11 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6008,6 +6014,11 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                         */
                        if (BTRFS_DEV_ALLOCATION_DATA_ONLY == hint)
                                continue;
index 83dc6b24fb63e57f3b0518ca7d73200a8fc9913e..6fee311e50bed8a99672aa5380baef31921bbf86 100644 (file)
@@ -1,4 +1,4 @@
-From 0cd6b6146d3a4273b9c79f22b5a5d46c2e7dfeda Mon Sep 17 00:00:00 2001
+From 2763c25f8752709a108b4d07a5a8f734c5596ca8 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 862a296bd0453..a1ea8450109e3 100644
+index 00ecf2b1b30f4..eba473441b55a 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6058,6 +6058,19 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6064,6 +6064,19 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                        break;
        }
  
index e9e1692dec65459844017e896109f038733b747d..6af6207b5d6eae9b5f60eb29c31dec373da20e6b 100644 (file)
@@ -1,4 +1,4 @@
-From 486e2ee2648429c8d668073de4ac1598d1a4cf77 Mon Sep 17 00:00:00 2001
+From 1920847e6f57ae71dc0b18ab63fa9bbf147512bd 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
@@ -26,10 +26,10 @@ Assisted-by: Claude:claude-opus-5-5
  2 files changed, 21 insertions(+), 25 deletions(-)
 
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 3c64aa598971c..60b941876da64 100644
+index 3cd7d94554151..ae48bcec15a94 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -597,6 +597,27 @@ struct btrfs_io_context {
+@@ -598,6 +598,27 @@ struct btrfs_io_context {
        struct btrfs_io_stripe stripes[];
  };
  
index d2e8d549172e1ff8f8b631eee8125180db01e975..4faa4238ad7381546b11eec2efc3376a8ad27bf0 100644 (file)
@@ -1,4 +1,4 @@
-From c6e048eb9c855be6d381b2a3c5aa6273d684c02e Mon Sep 17 00:00:00 2001
+From 51fc372ce6d49e87326aaa266d695d8b5b9db0aa 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
@@ -72,7 +72,7 @@ index cdfe093e5c5c4..ac0e3e99ac653 100644
        memcpy(uuid_tmp, tgt_device->uuid, sizeof(uuid_tmp));
        memcpy(tgt_device->uuid, src_device->uuid, sizeof(tgt_device->uuid));
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 19102dafcd4c1..9dcbc02ff1204 100644
+index 16912c8f4f9e6..6457b74d67f93 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -19,6 +19,7 @@
@@ -83,7 +83,7 @@ index 19102dafcd4c1..9dcbc02ff1204 100644
  #include "space-info.h"
  #include "block-group.h"
  #include "qgroup.h"
-@@ -2020,6 +2021,7 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
+@@ -2021,6 +2022,7 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
        struct btrfs_device *device;
        int ret;
        struct btrfs_trans_handle *trans;
@@ -91,7 +91,7 @@ index 19102dafcd4c1..9dcbc02ff1204 100644
  
        u64 type, prev_type;
  
-@@ -2048,6 +2050,21 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
+@@ -2049,6 +2051,21 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
        if (!btrfs_dev_allocation_hint_valid(type))
                return -EINVAL;
  
@@ -113,7 +113,7 @@ index 19102dafcd4c1..9dcbc02ff1204 100644
        trans = btrfs_start_transaction(root, 1);
        if (IS_ERR(trans))
                return PTR_ERR(trans);
-@@ -2057,6 +2074,17 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
+@@ -2058,6 +2075,17 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
  
        ret = btrfs_update_device(trans, device);
  
index 58056b137072232e39d2e31c256e39b15783cf4f..8617de83e6c5a2f020c408f600c65576cf32deaa 100644 (file)
@@ -1,4 +1,4 @@
-From ed65ad6368ce76486e756248deafd5ec748f8f76 Mon Sep 17 00:00:00 2001
+From de1ee879d7873f5224ea97fa5066a8392cc30b9a 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
@@ -88,7 +88,7 @@ index ac0e3e99ac653..8c6f156524332 100644
        memcpy(uuid_tmp, tgt_device->uuid, sizeof(uuid_tmp));
        memcpy(tgt_device->uuid, src_device->uuid, sizeof(tgt_device->uuid));
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 9dcbc02ff1204..edb0ca4fb9d2b 100644
+index 6457b74d67f93..8a48b6895a9ae 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -19,7 +19,6 @@
@@ -99,7 +99,7 @@ index 9dcbc02ff1204..edb0ca4fb9d2b 100644
  #include "space-info.h"
  #include "block-group.h"
  #include "qgroup.h"
-@@ -2017,31 +2016,22 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
+@@ -2018,31 +2017,22 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
                                        const char *buf, size_t len)
  {
        struct btrfs_fs_info *fs_info;
@@ -136,7 +136,7 @@ index 9dcbc02ff1204..edb0ca4fb9d2b 100644
        ret = kstrtou64(buf, 0, &type);
        if (ret < 0)
                return -EINVAL;
-@@ -2050,55 +2040,39 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
+@@ -2051,55 +2041,39 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
        if (!btrfs_dev_allocation_hint_valid(type))
                return -EINVAL;
  
@@ -218,10 +218,10 @@ index 9dcbc02ff1204..edb0ca4fb9d2b 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 7431a06f168da..5c41eb54545e4 100644
+index d265fac023e58..39d2718256019 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
-@@ -2301,6 +2301,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2285,6 +2285,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                        goto lockdep_trans_commit_start_release;
        }
  
@@ -232,10 +232,10 @@ index 7431a06f168da..5c41eb54545e4 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 a1ea8450109e3..f9753dd1b3714 100644
+index eba473441b55a..ebc7be7858aa2 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -8676,6 +8676,61 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
+@@ -8730,6 +8730,61 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
        return ret;
  }
  
@@ -298,7 +298,7 @@ index a1ea8450109e3..f9753dd1b3714 100644
  {
        btrfs_dev_stat_inc(dev, index);
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 60b941876da64..c16508aca0cd0 100644
+index ae48bcec15a94..f4dd7fd5e4d97 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -110,6 +110,8 @@ static_assert(BTRFS_RAID_RAID1C4 == 8);
@@ -310,7 +310,7 @@ index 60b941876da64..c16508aca0cd0 100644
  
  /* Special value encoding failure to write primary super block. */
  #define BTRFS_SUPER_PRIMARY_WRITE_ERROR               (INT_MAX / 2)
-@@ -816,6 +818,11 @@ int btrfs_init_devices_late(struct btrfs_fs_info *fs_info);
+@@ -820,6 +822,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 44864d3031bc5c560f78e23fc3e6a618226988bf..d122790afcf8c3c360c193f1608bf1c4861a63ee 100644 (file)
@@ -1,4 +1,4 @@
-From 43c53b3f02db3c3bcc55714bfe5b06eb56276353 Mon Sep 17 00:00:00 2001
+From 6944c77605368854e644f8c961ad38ffb741d873 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
@@ -68,10 +68,10 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 181 insertions(+), 91 deletions(-)
 
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 82d4ac418a2de..5d0d0917b00ef 100644
+index d5a84fa97462c..4165ace1cedd3 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -464,7 +464,8 @@ static u64 calc_available_free_space(const struct btrfs_space_info *space_info,
+@@ -461,7 +461,8 @@ static u64 calc_available_free_space(const struct btrfs_space_info *space_info,
        else
                profile = btrfs_metadata_alloc_profile(fs_info);
  
@@ -82,10 +82,10 @@ index 82d4ac418a2de..5d0d0917b00ef 100644
                avail = atomic64_read(&fs_info->free_chunk_space);
  
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index acb704b20c2be..ed5c7a1e29a95 100644
+index b424cc836bd4a..74d2468914d31 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
-@@ -1642,6 +1642,10 @@ static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
+@@ -1644,6 +1644,10 @@ static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
                if (i >= nr_devices)
                        break;
  
@@ -97,10 +97,10 @@ index acb704b20c2be..ed5c7a1e29a95 100644
  
                /* align with stripe_len */
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index edb0ca4fb9d2b..2e2d0c7ed4ba4 100644
+index 8a48b6895a9ae..f744ebea1a8c4 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
-@@ -2066,6 +2066,8 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
+@@ -2067,6 +2067,8 @@ static ssize_t btrfs_devinfo_type_store(struct kobject *kobj,
        }
        WRITE_ONCE(device->type, type);
        set_bit(BTRFS_DEV_STATE_TYPE_DIRTY, &device->dev_state);
@@ -110,7 +110,7 @@ index edb0ca4fb9d2b..2e2d0c7ed4ba4 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 f9753dd1b3714..a2dc5754e9b88 100644
+index ebc7be7858aa2..1c2981104646e 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] = {
@@ -215,7 +215,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
  
  const char *btrfs_bg_type_to_raid_name(u64 flags)
  {
-@@ -5629,7 +5723,7 @@ static int btrfs_cmp_device_info(const void *a, const void *b)
+@@ -5634,7 +5728,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,
@@ -224,7 +224,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
                               u64 *allocated)
  {
        const struct btrfs_raid_attr *raid_attr = &btrfs_raid_array[type];
-@@ -5649,6 +5743,13 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
+@@ -5654,6 +5748,13 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
                    test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state))
                        continue;
  
@@ -238,7 +238,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
                if (device->total_bytes > device->bytes_used +
                                device->per_profile_allocated)
                        avail = device->total_bytes - device->bytes_used -
-@@ -5683,6 +5784,16 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
+@@ -5688,6 +5789,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);
@@ -255,7 +255,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
        ndevs = rounddown(ndevs, raid_attr->devs_increment);
        if (ndevs < raid_attr->devs_min)
                return -ENOSPC;
-@@ -5705,7 +5816,7 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
+@@ -5710,7 +5821,7 @@ static int alloc_virtual_chunk(struct btrfs_fs_info *fs_info,
  }
  
  static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
@@ -264,7 +264,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
                                  u64 *result_ret)
  {
        struct btrfs_device_info *devices_info = NULL;
-@@ -5733,7 +5844,8 @@ static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
+@@ -5738,7 +5849,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;
  
@@ -274,7 +274,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
                result += allocated;
  
  out:
-@@ -5744,10 +5856,19 @@ static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
+@@ -5749,10 +5861,19 @@ static int calc_one_profile_avail(struct btrfs_fs_info *fs_info,
        return 0;
  }
  
@@ -296,7 +296,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
        int ret;
  
        /*
-@@ -5757,21 +5878,33 @@ void btrfs_update_per_profile_avail(struct btrfs_fs_info *fs_info)
+@@ -5762,21 +5883,33 @@ void btrfs_update_per_profile_avail(struct btrfs_fs_info *fs_info)
        if (btrfs_is_zoned(fs_info))
                goto error;
  
@@ -338,7 +338,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
        spin_unlock(&fs_info->fs_devices->per_profile_lock);
  }
  
-@@ -5973,56 +6106,9 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -5979,56 +6112,9 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
                devices_info[ndevs].dev = device;
  
  #ifdef CONFIG_BTRFS_ALLOCATOR_HINTS
@@ -398,7 +398,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
  #endif /* CONFIG_BTRFS_ALLOCATOR_HINTS */
  
                ++ndevs;
-@@ -6048,28 +6134,8 @@ static int gather_device_info(struct btrfs_fs_devices *fs_devices,
+@@ -6054,28 +6140,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
         */
@@ -430,7 +430,7 @@ index f9753dd1b3714..a2dc5754e9b88 100644
        BUG_ON(ndevs > ctl->ndevs);
        ctl->ndevs = ndevs;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index c16508aca0cd0..5d7127b406a22 100644
+index f4dd7fd5e4d97..3fd0200e8ec73 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -337,6 +337,13 @@ enum btrfs_read_policy {
@@ -464,7 +464,7 @@ index c16508aca0cd0..5d7127b406a22 100644
        spinlock_t per_profile_lock;
  };
  
-@@ -944,18 +953,26 @@ const char *btrfs_bg_type_to_raid_name(u64 flags);
+@@ -948,18 +957,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 4850b6433015c5cd3d460718a371b1f77952837f..7db52bd2384ab7d64894c5ff27ec438fccd24ae9 100644 (file)
@@ -1,6 +1,6 @@
-From 4f577b67905133549460b60640c9c61ab0b9e85a Mon Sep 17 00:00:00 2001
+From 6094381703cd582ed0a4c84e2d28954696b2c616 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 17 Oct 2026 22:32:14 -0400
+Date: Sun, 25 Oct 2026 03:13:33 -0400
 Subject: [PATCH 0/3] btrfs: balance resume selects what the original request selected
 To: linux-btrfs@vger.kernel.org
 
@@ -115,7 +115,7 @@ Zygo Blaxell (3):
  2 files changed, 85 insertions(+), 13 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index a2ba537b623bc80bec1e32b1d20cd62ca461eb73..048206d8ebbc17b140c946bbdccc7526649ff6d9 100644 (file)
@@ -1,4 +1,4 @@
-From 936c55b685b4b8c3c868c3b0583263d2eeda1999 Mon Sep 17 00:00:00 2001
+From a9847e16418f7b9b1a8f3c91d629fc6426a12132 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
@@ -24,10 +24,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 8 insertions(+)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index d3e6a9b429dd9..d22c41bbb1056 100644
+index ce78a9441c64f..2ed57bc7a9905 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -4739,6 +4739,14 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
+@@ -4744,6 +4744,14 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
                }
        }
  error:
index 05334c8e771ff95b758d0ac5790f6c9020fcc003..aa2862e6cafda2b1a2c4e5ed185ee9f24d61936e 100644 (file)
@@ -1,4 +1,4 @@
-From ed06b587874e04ced16aebde918ebbdc08cbe874 Mon Sep 17 00:00:00 2001
+From fb89bec9e7b30c381f7d85b4ced60e5d5a21912e 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
@@ -77,7 +77,7 @@ index 2dd167c32d612..a42aa4de2bcc6 100644
        /* Cancellation requests for chunk relocation */
        atomic_t reloc_cancel_req;
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index d22c41bbb1056..17cbbaca44373 100644
+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)
@@ -89,7 +89,7 @@ index d22c41bbb1056..17cbbaca44373 100644
  }
  
  static noinline int find_next_devid(struct btrfs_fs_info *fs_info,
-@@ -4047,10 +4047,7 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
+@@ -4052,10 +4052,7 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
        return ret;
  }
  
@@ -101,7 +101,7 @@ index d22c41bbb1056..17cbbaca44373 100644
  static void update_balance_args(struct btrfs_balance_control *bctl)
  {
        /*
-@@ -4062,34 +4059,58 @@ 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;
@@ -184,7 +184,7 @@ index d22c41bbb1056..17cbbaca44373 100644
  /*
   * Clear the balance status in fs_info and delete the balance item from disk.
   */
-@@ -4106,6 +4127,7 @@ static void reset_balance_state(struct btrfs_fs_info *fs_info)
+@@ -4111,6 +4132,7 @@ static void reset_balance_state(struct btrfs_fs_info *fs_info)
  
        kfree(bctl);
        ret = del_balance_item(fs_info);
@@ -192,7 +192,7 @@ index d22c41bbb1056..17cbbaca44373 100644
        if (ret)
                btrfs_handle_fs_error(fs_info, ret, NULL);
  }
-@@ -5071,6 +5093,9 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
+@@ -5076,6 +5098,9 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
                                btrfs_bg_type_to_raid_name(data_target));
        }
  
@@ -202,7 +202,7 @@ index d22c41bbb1056..17cbbaca44373 100644
        ret = insert_balance_item(fs_info, bctl);
        if (ret && ret != -EEXIST)
                goto out;
-@@ -5081,6 +5106,8 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
+@@ -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);
@@ -211,7 +211,7 @@ index d22c41bbb1056..17cbbaca44373 100644
        } else {
                BUG_ON(ret != -EEXIST);
                spin_lock(&fs_info->balance_lock);
-@@ -5238,6 +5265,8 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
+@@ -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);
  
index 4c69e3d1e0778b96d9acd307023502f037e9da78..76008c9174bb15508a65b5e667712e4f173bf0a3 100644 (file)
@@ -1,4 +1,4 @@
-From 4f577b67905133549460b60640c9c61ab0b9e85a Mon Sep 17 00:00:00 2001
+From 6094381703cd582ed0a4c84e2d28954696b2c616 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
@@ -34,10 +34,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 29 insertions(+)
 
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 17cbbaca44373..2023f1bd85398 100644
+index 1996ebaeadc76..09fcc5d981d8a 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -4059,6 +4059,35 @@ static void update_balance_args(struct btrfs_balance_control *bctl)
+@@ -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;
index fb4f2f0474be34e55e9e8425ddf8b476a74e5f3f..7f7599b2cf08b23e4d9bec78c6db724b14fa6fe4 100644 (file)
@@ -1,6 +1,6 @@
-From babe6f1c006d470c162d26f1a981bbd0ae08dac6 Mon Sep 17 00:00:00 2001
+From 9cf6495173d43a69008af6544c73cde1b59feb4d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 21:21:16 -0400
+Date: Sun, 25 Oct 2026 03:13:34 -0400
 Subject: [PATCH 0/5] btrfs: fix and simplify inode flag vs compression interactions
 To: linux-btrfs@vger.kernel.org
 
@@ -83,7 +83,7 @@ Zygo Blaxell (5):
  5 files changed, 184 insertions(+), 28 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 09dab92cf9e94ac7091938d63189ee9ee8e2b0f6..babcba3b66de0436e7cdd97acc1aaa7bef87cd47 100644 (file)
@@ -1,4 +1,4 @@
-From 910b4110dddb076fafefa4eb930142a12d0cbccd Mon Sep 17 00:00:00 2001
+From cb00a6bf8255738f737545f961f141e9257e6fe9 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
@@ -59,7 +59,7 @@ Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
  1 file changed, 45 insertions(+), 15 deletions(-)
 
 diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
-index dec015e6bd29a..61c3da2722d3e 100644
+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)
index 6bde73f32094ac24450813eec749843555ab73d1..8003ce9abf6709450a7e8cb00926f455c491b4bd 100644 (file)
@@ -1,4 +1,4 @@
-From eb4a602a2afad08530f538a6f24351c96eb9cb10 Mon Sep 17 00:00:00 2001
+From a7879c4a2fe1ee8092e0f2613915c1ca9d64e2a1 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
@@ -32,10 +32,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 7c6f6dbfa7798..812ebd78e6562 100644
+index b071ed59a583f..ea4a2fb26e4d1 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -6553,6 +6553,8 @@ static void btrfs_inherit_iflags(struct btrfs_inode *inode, struct btrfs_inode *
+@@ -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;
@@ -44,7 +44,7 @@ index 7c6f6dbfa7798..812ebd78e6562 100644
        }
  
        btrfs_sync_inode_flags_to_i_flags(inode);
-@@ -6658,9 +6660,12 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
+@@ -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;
index 8b889dd7ab89a912eb3c3ee38f270bfbdebc6f78..108db7e87b0c2fff343d25ef6921691c8d6d5500 100644 (file)
@@ -1,4 +1,4 @@
-From af12234a0e957931c4af7723abf662701fead684 Mon Sep 17 00:00:00 2001
+From d1eafd0809350d1ee9c00b3f9e2097dcc74a2046 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
@@ -35,7 +35,7 @@ Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
  2 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
-index 61c3da2722d3e..26c54ccf42f5f 100644
+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,
index 07af242218e0d64a779f0b66cff3eb82b95f8413..a8902ff95e15597851335c775dfc8ced03300046 100644 (file)
@@ -1,4 +1,4 @@
-From a5683abc6a30bcb28effbbed88f2498e727c67dd Mon Sep 17 00:00:00 2001
+From b009cddd89352180eb1b7b44222fdbea25960cfb 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
@@ -75,7 +75,7 @@ index f7aa0d1451851..a9ccdd0a1f693 100644
         * 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 812ebd78e6562..165e4556ed067 100644
+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)
@@ -97,7 +97,7 @@ index 812ebd78e6562..165e4556ed067 100644
                /*
                 * 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 26c54ccf42f5f..8c1411297feb8 100644
+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,
index 7783c0bd2fe80ceadcd0d4f91a95112d455e1284..dcd378dcbef14a25a4498d493c255ca5c7173b7d 100644 (file)
@@ -1,4 +1,4 @@
-From babe6f1c006d470c162d26f1a981bbd0ae08dac6 Mon Sep 17 00:00:00 2001
+From 9cf6495173d43a69008af6544c73cde1b59feb4d 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
index 2e443e6b72c4b6fb94dd759dbe7250b4de8b97bf..2bcc9e13becf45449cbf5b5980f5a12396f081b4 100644 (file)
@@ -1,6 +1,6 @@
-From 68c1f77b3885b37222f141302379bc4eb43b0fd6 Mon Sep 17 00:00:00 2001
+From 78c0c9e6a02b2aa9c27f19ecb73e0dc952d9caf9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 17 Oct 2026 22:32:14 -0400
+Date: Sun, 25 Oct 2026 03:13:35 -0400
 Subject: [PATCH 0/3] btrfs: deadlocks between reflink, relocation and space reservation
 To: linux-btrfs@vger.kernel.org
 
@@ -52,7 +52,7 @@ Zygo Blaxell (3):
  2 files changed, 218 insertions(+), 118 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 8d29594c25bfd67e98272edf0e90fc0c02ef814f..19035e407b40cce07a17c9be1355af2902ee8bb2 100644 (file)
@@ -1,4 +1,4 @@
-From 2ca7cbd636565d7bc56e522f1b7a9147f2b1867a Mon Sep 17 00:00:00 2001
+From f61edbb1fa430fdb64311a5fd1c808414280329e 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
index 76aebffdb8ccca3c9d189f8caf5441b2935d41c4..4763ccb80c0e53198ac1072fdf00414320461614 100644 (file)
@@ -1,4 +1,4 @@
-From 2fd67b564a0aaae379014138030a2582b52c337f Mon Sep 17 00:00:00 2001
+From 97724c6881f7b5b79ac8bbb159a85e29aad5e3eb 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
index 14d5d8f1b4c143f2bc2a5e5b8ca316e1fba827fb..ff3fd71a21dae5d90a5acfd5ef6899349f95fda6 100644 (file)
@@ -1,4 +1,4 @@
-From 68c1f77b3885b37222f141302379bc4eb43b0fd6 Mon Sep 17 00:00:00 2001
+From 78c0c9e6a02b2aa9c27f19ecb73e0dc952d9caf9 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
index deb0b7b16b1c2d40d6838388aa7cfc4cdecb4faa..abe85073b9fd3f72b857a599b233c8b5b640f9f1 100644 (file)
@@ -1,6 +1,6 @@
-From 13e8d4c620f7d2544fc84dfc415787285687b533 Mon Sep 17 00:00:00 2001
+From 8e47d471e8a3a403a2cf9aebd061fc8ca404ae5c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 04:20:31 -0400
+Date: Sun, 25 Oct 2026 03:13:35 -0400
 Subject: [PATCH 0/1] btrfs: one dedupe request, one extent reference
 To: linux-btrfs@vger.kernel.org
 
@@ -39,7 +39,7 @@ Zygo Blaxell (1):
  1 file changed, 2 insertions(+), 19 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index c768a7b3a0821c7a2fb647bd1067621d789a090b..d0960a92d4cbe11e12f3ef1e412a35f88465a04a 100644 (file)
@@ -1,4 +1,4 @@
-From 13e8d4c620f7d2544fc84dfc415787285687b533 Mon Sep 17 00:00:00 2001
+From 8e47d471e8a3a403a2cf9aebd061fc8ca404ae5c 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 508e0f5972f6854f1db4442345a82a091f9c4f01..dd6f6e513a33ce273a3344c2e5f82de1ffe00b6c 100644 (file)
@@ -1,6 +1,6 @@
-From 288d851bbbc26377ebe77e3816d65061ad323c65 Mon Sep 17 00:00:00 2001
+From dcacae4b4bd8f6257ab9d7656a0c3e176b360f07 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 04:20:31 -0400
+Date: Sun, 25 Oct 2026 03:13:45 -0400
 Subject: [PATCH 0/1] btrfs: keep mtime and ctime when a dedupe ends in a hole
 To: linux-btrfs@vger.kernel.org
 
@@ -41,7 +41,7 @@ Ivan Kozik (1):
  5 files changed, 13 insertions(+), 13 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 920e955a8caa9dd47d7940aa51763ad8c7367669..1b31dec222b634818c63d8de768edd24774caf34 100644 (file)
@@ -1,4 +1,4 @@
-From 288d851bbbc26377ebe77e3816d65061ad323c65 Mon Sep 17 00:00:00 2001
+From dcacae4b4bd8f6257ab9d7656a0c3e176b360f07 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 7c6f6dbfa7798..8a9975aed0202 100644
+index b071ed59a583f..ee7543aef34e0 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -9137,7 +9137,6 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent(
+@@ -9135,7 +9135,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 7c6f6dbfa7798..8a9975aed0202 100644
        extent_info.qgroup_reserved = qgroup_released;
        extent_info.insertions = 0;
  
-@@ -9148,7 +9147,7 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent(
+@@ -9146,7 +9145,7 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent(
        }
  
        ret = btrfs_replace_file_extents(inode, path, file_offset,
index 6d94a9949cad4568a0a59913097df2e794526869..142e195acec6ffe6ade80711f86e055d4cd21f1f 100644 (file)
@@ -1,6 +1,6 @@
-From 7c23eb7ad5c98b24bb04e21ebba206bcd00b48ef Mon Sep 17 00:00:00 2001
+From a49a18e6a3c7818f1de0871feb20199b5a6ef5e4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 21:21:17 -0400
+Date: Sun, 25 Oct 2026 03:13:36 -0400
 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,7 @@ Zygo Blaxell (1):
  5 files changed, 102 insertions(+), 5 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 0ea7206c0ada9bd12633698730c71cb383558669..3b314a38be7e071800eba873857f47888221e019 100644 (file)
@@ -1,4 +1,4 @@
-From 7c23eb7ad5c98b24bb04e21ebba206bcd00b48ef Mon Sep 17 00:00:00 2001
+From a49a18e6a3c7818f1de0871feb20199b5a6ef5e4 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
@@ -41,10 +41,10 @@ Assisted-by: Claude:claude-opus-4-8
  5 files changed, 102 insertions(+), 5 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index b23a543bb3823..4174d632e1a21 100644
+index 027830a53f7dc..bfa3f494332de 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -3114,6 +3114,53 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
+@@ -3117,6 +3117,53 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
   *                    ensure we still have some free space after marking this
   *                    block group RO.
   */
@@ -98,7 +98,7 @@ index b23a543bb3823..4174d632e1a21 100644
  int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
                             bool do_chunk_alloc)
  {
-@@ -3143,6 +3190,14 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
+@@ -3146,6 +3193,14 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
                return ret;
        }
  
@@ -113,7 +113,7 @@ index b23a543bb3823..4174d632e1a21 100644
        do {
                trans = btrfs_join_transaction(root);
                if (IS_ERR(trans))
-@@ -3230,6 +3285,8 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
+@@ -3233,6 +3288,8 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
        mutex_unlock(&fs_info->ro_block_group_mutex);
  
        btrfs_end_transaction(trans);
@@ -122,7 +122,7 @@ index b23a543bb3823..4174d632e1a21 100644
        return ret;
  }
  
-@@ -3242,6 +3299,7 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
+@@ -3245,6 +3302,7 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
        spin_lock(&sinfo->lock);
        spin_lock(&cache->lock);
        if (!--cache->ro) {
@@ -219,10 +219,10 @@ 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 7c6f6dbfa7798..1b10f5b10616b 100644
+index b071ed59a583f..aaf8b04623bd1 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -7372,10 +7372,20 @@ static bool btrfs_extent_readonly(struct btrfs_fs_info *fs_info, u64 bytenr)
+@@ -7370,10 +7370,20 @@ static bool btrfs_extent_readonly(struct btrfs_fs_info *fs_info, u64 bytenr)
        bool readonly = false;
  
        block_group = btrfs_lookup_block_group(fs_info, bytenr);
index b21b42ef5ea016c61d3f28c8ab64dea6e9e4d8ea..f73faa9e5512aee8d39c8ec94724d8b4629dce07 100644 (file)
@@ -1,6 +1,6 @@
-From 40c2fffa8348196148b5b8ca9805ac407d142242 Mon Sep 17 00:00:00 2001
+From 34a8e85757bbf8650972770b14d8682f4844a1f4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 04:20:31 -0400
+Date: Sun, 25 Oct 2026 03:13:37 -0400
 Subject: [PATCH 0/1] btrfs: allow setting the system chunk size through sysfs
 To: linux-btrfs@vger.kernel.org
 
@@ -45,7 +45,7 @@ Zygo Blaxell (1):
  1 file changed, 13 insertions(+), 9 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index ed220a08c9ec62ca4de501082f9187a6815f1c64..8bfd168fdf0b6969f331872dd0a899fca65dc1bb 100644 (file)
@@ -1,4 +1,4 @@
-From 40c2fffa8348196148b5b8ca9805ac407d142242 Mon Sep 17 00:00:00 2001
+From 34a8e85757bbf8650972770b14d8682f4844a1f4 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
@@ -53,7 +53,7 @@ Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
  1 file changed, 13 insertions(+), 9 deletions(-)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..19b8c61cd34de 100644
+index 89b0a4ef4063e..108534dbc4577 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -647,8 +647,8 @@ static ssize_t btrfs_chunk_size_show(struct kobject *kobj,
index 39fc9b08e00b70f8abbac794e06eeae9f0daab0e..f5a08e9e632176bc87c37ff2e46e599814d5d517 100644 (file)
@@ -1,6 +1,6 @@
-From 55ade1cf195c58e80606d630120f5434f66b3a36 Mon Sep 17 00:00:00 2001
+From a5160f442538f1967dd37da26efe20d1b22e2622 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Wed, 21 Oct 2026 00:59:50 -0400
+Date: Sun, 25 Oct 2026 03:13:48 -0400
 Subject: [PATCH 0/1] btrfs: persist device stats counted without a transaction
 To: linux-btrfs@vger.kernel.org
 
@@ -40,7 +40,7 @@ Zygo Blaxell (1):
  6 files changed, 82 insertions(+), 13 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 6fecbc2aaca1d7a14cb796c1a107959f96c36798..5e80af00f030433f25eb807e3bf730b9681e89a5 100644 (file)
@@ -1,4 +1,4 @@
-From 55ade1cf195c58e80606d630120f5434f66b3a36 Mon Sep 17 00:00:00 2001
+From a5160f442538f1967dd37da26efe20d1b22e2622 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
@@ -67,7 +67,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 c45cda4290d5a..2bd33cbcb8b0e 100644
+index c628c5081d923..0955228f81201 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -1559,6 +1559,12 @@ static int transaction_kthread(void *arg)
@@ -83,7 +83,7 @@ index c45cda4290d5a..2bd33cbcb8b0e 100644
                        goto sleep;
                }
  
-@@ -4250,6 +4256,8 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
+@@ -4270,6 +4276,8 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
  
  int btrfs_commit_super(struct btrfs_fs_info *fs_info)
  {
@@ -92,7 +92,7 @@ index c45cda4290d5a..2bd33cbcb8b0e 100644
        mutex_lock(&fs_info->cleaner_mutex);
        btrfs_run_delayed_iputs(fs_info);
        mutex_unlock(&fs_info->cleaner_mutex);
-@@ -4259,7 +4267,11 @@ int btrfs_commit_super(struct btrfs_fs_info *fs_info)
+@@ -4279,7 +4287,11 @@ int btrfs_commit_super(struct btrfs_fs_info *fs_info)
        down_write(&fs_info->cleanup_work_sem);
        up_write(&fs_info->cleanup_work_sem);
  
@@ -106,7 +106,7 @@ index c45cda4290d5a..2bd33cbcb8b0e 100644
  
  static void warn_about_uncommitted_trans(struct btrfs_fs_info *fs_info)
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index acb704b20c2be..a21a88935cbb3 100644
+index b424cc836bd4a..587eee55d10fd 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
 @@ -1364,6 +1364,15 @@ static int btrfs_remount_ro(struct btrfs_fs_info *fs_info)
@@ -126,10 +126,10 @@ index acb704b20c2be..a21a88935cbb3 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 7431a06f168da..e48d014a0ad80 100644
+index d265fac023e58..0f5c5a9e1e36c 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
-@@ -2095,6 +2095,41 @@ int btrfs_commit_current_transaction(struct btrfs_root *root)
+@@ -2079,6 +2079,41 @@ int btrfs_commit_current_transaction(struct btrfs_root *root)
        return btrfs_commit_transaction(trans);
  }
  
@@ -184,10 +184,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 d3e6a9b429dd9..e8a511e814833 100644
+index ce78a9441c64f..e69f444a46622 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -8474,6 +8474,28 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
+@@ -8528,6 +8528,28 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
        return ret;
  }
  
@@ -216,7 +216,7 @@ index d3e6a9b429dd9..e8a511e814833 100644
  /*
   * called from commit_transaction. Writes all changed device stats to disk.
   */
-@@ -8484,7 +8506,6 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
+@@ -8538,7 +8560,6 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
        struct btrfs_device *device;
        int stats_cnt;
        int ret = 0;
@@ -224,7 +224,7 @@ index d3e6a9b429dd9..e8a511e814833 100644
  
        /*
         * Do an initial pass using RCU to see if we need to update any dev
-@@ -8502,17 +8523,7 @@ int btrfs_run_dev_stats(struct btrfs_trans_handle *trans)
+@@ -8556,17 +8577,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 +244,10 @@ index d3e6a9b429dd9..e8a511e814833 100644
  
        mutex_lock(&fs_devices->device_list_mutex);
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 6eddda2392215..00f5d54ae9742 100644
+index 75b1179776c80..969826cc4fe1b 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -791,6 +791,7 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
+@@ -795,6 +795,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 9b92ba5ee12de0f6d438040106ace8a5f6df5000..c675695eac9d1dd540d6b74ac0235e351560c438 100644 (file)
@@ -1,6 +1,6 @@
-From 9ab63d7ab0fa67d43583f20d672cbc28f0da9383 Mon Sep 17 00:00:00 2001
+From 0d13e1572fe71fd33e5cdb4d0eaa1111bbe9d179 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 17 Oct 2026 22:32:18 -0400
+Date: Sun, 25 Oct 2026 03:13:46 -0400
 Subject: [PATCH 0/2] test fixtures: dm-stripfault target and a forced filesystem error (NOT for merge)
 
 Test fixtures carried on the lane for the raid56 tests; NOT for
@@ -30,7 +30,7 @@ Zygo Blaxell (2):
  create mode 100644 drivers/md/dm-stripfault.c
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 3623c8dda26cc9828625d9eabad40d7d6fdaaff9..59ba32c028bdbeec181daa6f51c5a55edab323e3 100644 (file)
@@ -1,4 +1,4 @@
-From 94444f914d77923c79eef989db4f323396441610 Mon Sep 17 00:00:00 2001
+From 25e8c47ff024baacc813cf2981a3ebc1a8718762 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 2 Oct 2026 01:08:32 -0400
 Subject: [PATCH 1/2] dm: add the stripfault target, a raid56 read-modify-write
index 3100adbf9075c0f4a9c2a583fa50359de6509e97..d5ac0bfc4860b1fe0143f89c39eaa6b6cd5f9d38 100644 (file)
@@ -1,4 +1,4 @@
-From 9ab63d7ab0fa67d43583f20d672cbc28f0da9383 Mon Sep 17 00:00:00 2001
+From 0d13e1572fe71fd33e5cdb4d0eaa1111bbe9d179 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 24 Sep 2026 17:27:53 -0400
 Subject: [PATCH 2/2] DO-NOT-UPSTREAM: btrfs: sysfs force_fs_error, to raise a
@@ -27,7 +27,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 61 insertions(+)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..a50aedf117f6d 100644
+index 89b0a4ef4063e..bae3351f9559e 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1124,6 +1124,64 @@ static ssize_t quota_override_store(struct kobject *kobj,
index 561d115d58e3b927669b6176c0076814c09f7451..cabaa806c8fc929fc7231051e664ae2a4c4fde58 100644 (file)
@@ -1,6 +1,6 @@
-From fe67a58f7f48c0c26db3aac1bac44966e7ac7828 Mon Sep 17 00:00:00 2001
+From f792976ba69796c4dc0c890bf9c2c72faa500c38 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 17 Oct 2026 22:32:13 -0400
+Date: Sun, 25 Oct 2026 03:13:32 -0400
 Subject: [PATCH 0/3] btrfs: reducing LOGICAL_INO costs
 To: linux-btrfs@vger.kernel.org
 
@@ -70,7 +70,7 @@ Zygo Blaxell (2):
  4 files changed, 127 insertions(+), 21 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 504580f53f0159615bd37cac8e4a9d1e226ae453..efe2c5200be4551e2954008ff7a2d72cb237ee9d 100644 (file)
@@ -1,4 +1,4 @@
-From b82b5eec72387346fec67957cfc5f091efd62dd7 Mon Sep 17 00:00:00 2001
+From f39e3249acc05e0ae076b074fbf46db3ca1699d9 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
@@ -168,10 +168,10 @@ index a0fb90b7a9ed1..760175b689952 100644
                 * We are searching for normal backref but bytenr of this leaf
                 * matches shared data backref, OR
 diff --git a/fs/btrfs/fiemap.c b/fs/btrfs/fiemap.c
-index 7a2a971800993..31f3d56631101 100644
+index 817171028413c..02fb813ffb98f 100644
 --- a/fs/btrfs/fiemap.c
 +++ b/fs/btrfs/fiemap.c
-@@ -428,6 +428,31 @@ static int fiemap_search_slot(struct btrfs_inode *inode, struct btrfs_path *path
+@@ -429,6 +429,31 @@ static int fiemap_search_slot(struct btrfs_inode *inode, struct btrfs_path *path
        return 0;
  }
  
@@ -203,7 +203,7 @@ index 7a2a971800993..31f3d56631101 100644
  /*
   * Process a range which is a hole or a prealloc extent in the inode's subvolume
   * btree. If @disk_bytenr is 0, we are dealing with a hole, otherwise a prealloc
-@@ -483,10 +508,10 @@ static int fiemap_process_hole(struct btrfs_inode *inode,
+@@ -484,10 +509,10 @@ static int fiemap_process_hole(struct btrfs_inode *inode,
  
                if (prealloc_len > 0) {
                        if (!checked_extent_shared && fieinfo->fi_extents_max) {
@@ -218,7 +218,7 @@ index 7a2a971800993..31f3d56631101 100644
                                if (ret < 0)
                                        return ret;
                                else if (ret > 0)
-@@ -532,10 +557,10 @@ static int fiemap_process_hole(struct btrfs_inode *inode,
+@@ -533,10 +558,10 @@ static int fiemap_process_hole(struct btrfs_inode *inode,
                }
  
                if (!checked_extent_shared && fieinfo->fi_extents_max) {
@@ -233,7 +233,7 @@ index 7a2a971800993..31f3d56631101 100644
                        if (ret < 0)
                                return ret;
                        else if (ret > 0)
-@@ -768,10 +793,10 @@ static int extent_fiemap(struct btrfs_inode *inode,
+@@ -769,10 +794,10 @@ static int extent_fiemap(struct btrfs_inode *inode,
                } else {
                        /* We have a regular extent. */
                        if (fieinfo->fi_extents_max) {
@@ -249,10 +249,10 @@ index 7a2a971800993..31f3d56631101 100644
                                        goto out_unlock;
                                else if (ret > 0)
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 7c6f6dbfa7798..10aa34d4db85a 100644
+index b071ed59a583f..2886e24a20514 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -10436,7 +10436,20 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
+@@ -10434,7 +10434,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 90e8fb6ff6bc630892539d5be908b721beb97536..88ee4337185d78af741dd468cc11e7c481b0cdb5 100644 (file)
@@ -1,4 +1,4 @@
-From cef86d336e3834e393827965e7ae4d096835e168 Mon Sep 17 00:00:00 2001
+From fc805e8fbd3f23a8a358b28f9d5a695d5cf14e2b 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,7 @@ 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[1m]
+Assisted-by: Claude:claude-opus-5
 ---
  fs/btrfs/delayed-ref.c | 49 ++++++++++++++++++++++++++++++++++++------
  1 file changed, 42 insertions(+), 7 deletions(-)
index 8fb28d058e98224b926e0d4b83ab292c5d73fb01..b044a029e4989b2a4116c96a31e919ac28a36d16 100644 (file)
@@ -1,4 +1,4 @@
-From fe67a58f7f48c0c26db3aac1bac44966e7ac7828 Mon Sep 17 00:00:00 2001
+From f792976ba69796c4dc0c890bf9c2c72faa500c38 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 6eca19ebe21848df4d8592bbe41220446471dfe3..7e83b05fc32a5f2e2cc387b8652c419929a8d54d 100644 (file)
@@ -1,6 +1,6 @@
-From 4f26c7c448962f551ae85038d4ca3971d109ec9b Mon Sep 17 00:00:00 2001
+From 087669d83341b0e044a253146b2f633bc4f63534 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 05:12:25 -0400
+Date: Sun, 25 Oct 2026 03:13:45 -0400
 Subject: [PATCH 0/3] btrfs: keep room to relocate on a full filesystem
 To: linux-btrfs@vger.kernel.org
 
@@ -129,7 +129,7 @@ Zygo Blaxell (3):
  12 files changed, 614 insertions(+), 10 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index e841b363b222da86311cbec8469e2731ef3d44e0..16056d5e78b75b860d664759f771a1e7c32cf147 100644 (file)
@@ -1,4 +1,4 @@
-From bd9f6c46fa79374ba55701eec56a461cc663e23a Mon Sep 17 00:00:00 2001
+From ff1a34bdfe8c76ac3624306f3882321c90fc0e5e 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
@@ -21,10 +21,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index b23a543bb3823..17d4f23de1e66 100644
+index 027830a53f7dc..b0adf7aded255 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -2062,8 +2062,8 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -2064,8 +2064,8 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        }
        if (ret) {
                btrfs_dec_block_group_ro(bg);
index e931e8c486affe5566775455a62ce64249b80064..8826bdcf796b5a757a62ff40130fabdcea847e8c 100644 (file)
@@ -1,4 +1,4 @@
-From 57034df182f0238f0420d4b958e4f3d0b06f7959 Mon Sep 17 00:00:00 2001
+From 8ddf0ef4313d7d243c2323d679e443184c8c4510 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
@@ -113,10 +113,10 @@ Assisted-by: Claude:claude-opus-5-5
  12 files changed, 602 insertions(+), 7 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 17d4f23de1e66..882215de55683 100644
+index b0adf7aded255..f9c506b8c80d0 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -1422,6 +1422,18 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -1424,6 +1424,18 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                goto out;
        }
  
@@ -135,7 +135,7 @@ index 17d4f23de1e66..882215de55683 100644
        num_bytes = btrfs_block_group_available_space(cache);
  
        /*
-@@ -1439,6 +1451,13 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -1441,6 +1453,13 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                 */
                if (sinfo_used + num_bytes <= sinfo->total_bytes)
                        ret = 0;
@@ -149,7 +149,7 @@ index 17d4f23de1e66..882215de55683 100644
        } else {
                /*
                 * We overcommit metadata, so we need to do the
-@@ -1448,6 +1467,8 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -1450,6 +1469,8 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                 */
                if (btrfs_can_overcommit(sinfo, num_bytes, BTRFS_RESERVE_NO_FLUSH))
                        ret = 0;
@@ -158,7 +158,7 @@ index 17d4f23de1e66..882215de55683 100644
        }
  
        if (!ret) {
-@@ -1462,6 +1483,8 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -1464,6 +1485,8 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                list_add_tail(&cache->ro_list, &sinfo->ro_bgs);
        }
  out:
@@ -167,7 +167,7 @@ index 17d4f23de1e66..882215de55683 100644
        spin_unlock(&cache->lock);
        spin_unlock(&sinfo->lock);
        if (ret == -ENOSPC && btrfs_test_opt(cache->fs_info, ENOSPC_DEBUG)) {
-@@ -1649,7 +1672,9 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
+@@ -1651,7 +1674,9 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
                    ((block_group->flags & BTRFS_BLOCK_GROUP_SYSTEM) &&
                     space_info->total_bytes - block_group->length <
                     system_space_target(space_info)) ||
@@ -178,7 +178,7 @@ index 17d4f23de1e66..882215de55683 100644
                        /*
                         * We want to bail if we made new allocations or have
                         * outstanding allocations in this block group.  We do
-@@ -3253,6 +3278,7 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
+@@ -3256,6 +3281,7 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
                }
                sinfo->bytes_readonly -= btrfs_block_group_available_space(cache);
                list_del_init(&cache->ro_list);
@@ -186,7 +186,7 @@ index 17d4f23de1e66..882215de55683 100644
        }
        spin_unlock(&cache->lock);
        spin_unlock(&sinfo->lock);
-@@ -3669,6 +3695,7 @@ int btrfs_add_reserved_bytes(struct btrfs_block_group *cache,
+@@ -3672,6 +3698,7 @@ int btrfs_add_reserved_bytes(struct btrfs_block_group *cache,
        }
  
        cache->reserved += num_bytes;
@@ -194,7 +194,7 @@ index 17d4f23de1e66..882215de55683 100644
        if (delalloc)
                cache->delalloc_bytes += num_bytes;
  
-@@ -3717,6 +3744,8 @@ void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, u64 num_bytes,
+@@ -3720,6 +3747,8 @@ void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, u64 num_bytes,
        spin_lock(&cache->lock);
        bg_ro = cache->ro;
        cache->reserved -= num_bytes;
@@ -203,7 +203,7 @@ index 17d4f23de1e66..882215de55683 100644
        btrfs_maybe_reset_size_class(cache);
        if (is_delalloc)
                cache->delalloc_bytes -= num_bytes;
-@@ -4681,3 +4710,334 @@ int btrfs_populate_fully_remapped_bgs_list(struct btrfs_fs_info *fs_info)
+@@ -4684,3 +4713,334 @@ int btrfs_populate_fully_remapped_bgs_list(struct btrfs_fs_info *fs_info)
  
        return 0;
  }
@@ -587,7 +587,7 @@ index d567ed822e55d..ab7bcb7e82294 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 c45cda4290d5a..3d105a2973a3f 100644
+index c628c5081d923..c8254d91f9e91 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -1519,6 +1519,9 @@ static int cleaner_kthread(void *arg)
@@ -600,7 +600,7 @@ index c45cda4290d5a..3d105a2973a3f 100644
                /*
                 * Reclaim block groups in the reclaim_bgs list after we deleted
                 * all unused block_groups. This possibly gives us some more free
-@@ -3132,6 +3135,9 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
+@@ -3152,6 +3155,9 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
        }
        up_read(&fs_info->cleanup_work_sem);
  
@@ -760,7 +760,7 @@ index b2ac5b836b217..179bac3a2dccd 100644
  out_put_rc:
        put_reloc_control(rc);
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 82d4ac418a2de..eb4a89ab68262 100644
+index d5a84fa97462c..18dedf106ae53 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
 @@ -186,11 +186,25 @@ struct reserve_ticket {
@@ -801,7 +801,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
        space_info->clamp = 1;
        btrfs_update_space_info_chunk_size(space_info, calc_chunk_size(info, flags));
        space_info->subgroup_id = BTRFS_SUB_GROUP_PRIMARY;
-@@ -401,6 +420,13 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
+@@ -400,6 +419,13 @@ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group)
        btrfs_space_info_update_bytes_zone_unusable(space_info, block_group->zone_unusable);
        if (block_group->length > 0)
                space_info->full = false;
@@ -815,7 +815,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
        btrfs_try_granting_tickets(space_info);
        spin_unlock(&space_info->lock);
  
-@@ -550,7 +576,9 @@ bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
+@@ -547,7 +573,9 @@ bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
        if (space_info->flags & BTRFS_BLOCK_GROUP_DATA)
                return false;
  
@@ -826,7 +826,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
  
        return check_can_overcommit(space_info, used, bytes, flush);
  }
-@@ -600,13 +628,15 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
+@@ -597,13 +625,15 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
        while (!list_empty(head)) {
                struct reserve_ticket *ticket;
                u64 used_after;
@@ -844,7 +844,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
                        btrfs_space_info_update_bytes_may_use(space_info, ticket->bytes);
                        remove_ticket(space_info, ticket, 0);
                        space_info->tickets_id++;
-@@ -1795,6 +1825,7 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -1792,6 +1822,7 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
        u64 used;
        int ret = -ENOSPC;
        bool pending_tickets;
@@ -852,7 +852,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
  
        ASSERT(orig_bytes, "orig_bytes=%llu", orig_bytes);
        /*
-@@ -1816,7 +1847,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -1813,7 +1844,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
                async_work = &fs_info->async_reclaim_work;
  
        spin_lock(&space_info->lock);
@@ -862,7 +862,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
  
        /*
         * We don't want NO_FLUSH allocations to jump everybody, they can
-@@ -1866,6 +1898,7 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -1863,6 +1895,7 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
                space_info->reclaim_size += ticket.bytes;
                init_waitqueue_head(&ticket.wait);
                spin_lock_init(&ticket.lock);
@@ -870,7 +870,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
                ticket.steal = can_steal(flush);
                if (trace_btrfs_reserve_ticket_enabled())
                        start_ns = ktime_get_ns();
-@@ -1997,6 +2030,32 @@ __cold void btrfs_dump_space_info_for_trans_abort(struct btrfs_fs_info *fs_info)
+@@ -1994,6 +2027,32 @@ __cold void btrfs_dump_space_info_for_trans_abort(struct btrfs_fs_info *fs_info)
        dump_global_block_rsv(fs_info);
  }
  
@@ -904,7 +904,7 @@ index 82d4ac418a2de..eb4a89ab68262 100644
   * Account the unused space of all the readonly block group in the space_info.
   * takes mirrors into account.
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index d0130c8ba3dda..759547d4938f7 100644
+index 0456b0d2d1b4a..08ee1111085de 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -148,6 +148,8 @@ struct btrfs_space_info {
@@ -946,7 +946,7 @@ index d0130c8ba3dda..759547d4938f7 100644
                (may_use_included ? s_info->bytes_may_use : 0);
  }
  
-@@ -308,6 +324,7 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
+@@ -307,6 +323,7 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
                                 u64 orig_bytes,
                                 enum btrfs_reserve_flush_enum flush);
  void btrfs_try_granting_tickets(struct btrfs_space_info *space_info);
@@ -955,10 +955,10 @@ index d0130c8ba3dda..759547d4938f7 100644
                          enum btrfs_reserve_flush_enum flush);
  
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index acb704b20c2be..79b370625d757 100644
+index b424cc836bd4a..829cd78d04dfd 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
-@@ -1727,6 +1727,8 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
+@@ -1729,6 +1729,8 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
                        total_free_data += found->disk_total - found->disk_used;
                        total_free_data -=
                                btrfs_account_ro_block_groups_free_space(found);
@@ -968,7 +968,7 @@ index acb704b20c2be..79b370625d757 100644
                        for (i = 0; i < BTRFS_NR_RAID_TYPES; i++) {
                                if (!list_empty(&found->block_groups[i]))
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..8a3816019ba98 100644
+index 89b0a4ef4063e..4a94ab172a27a 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -788,6 +788,7 @@ SPACE_INFO_ATTR(bytes_reserved);
@@ -1041,10 +1041,10 @@ index 3ac1fa608d3b5..8a3816019ba98 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 d3e6a9b429dd9..b46e3d94eae63 100644
+index ce78a9441c64f..f78f83bfe9f47 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -3718,8 +3718,16 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
+@@ -3723,8 +3723,16 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
                                   bg->start);
        }
  
@@ -1061,7 +1061,7 @@ index d3e6a9b429dd9..b46e3d94eae63 100644
                ret = PTR_ERR(trans);
                btrfs_handle_fs_error(root->fs_info, ret, NULL);
                return ret;
-@@ -3728,6 +3736,10 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
+@@ -3733,6 +3741,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);
@@ -1072,7 +1072,7 @@ index d3e6a9b429dd9..b46e3d94eae63 100644
  
        return ret;
  }
-@@ -4322,6 +4334,25 @@ static int should_balance_chunk(struct extent_buffer *leaf, struct btrfs_chunk *
+@@ -4327,6 +4339,25 @@ static int should_balance_chunk(struct extent_buffer *leaf, struct btrfs_chunk *
                return false;
        }
  
index 7e1cf7a6786b449511f95641a17208080b8ff2f7..ad3692d8e2c73c6de0d901f9e245e5d7817c2349 100644 (file)
@@ -1,4 +1,4 @@
-From 4f26c7c448962f551ae85038d4ca3971d109ec9b Mon Sep 17 00:00:00 2001
+From 087669d83341b0e044a253146b2f633bc4f63534 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
index a1a689d11afd60650fdcdc68d7a20a9c855d0a00..398c8cae7601316da1692b124db948475ed04723 100644 (file)
@@ -1,6 +1,6 @@
-From 93d225865ab25105a48bf80f6c29a800b806a85b Mon Sep 17 00:00:00 2001
+From a69ecf626addcaa2c0d02bb8fefb6d964ead28a6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sun, 18 Oct 2026 04:20:31 -0400
+Date: Sun, 25 Oct 2026 03:13:37 -0400
 Subject: [PATCH 0/1] btrfs: limit preallocated extents to 128 MiB
 To: linux-btrfs@vger.kernel.org
 
@@ -28,7 +28,7 @@ Zygo Blaxell (1):
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 3e4069c0dbe82df13a78dca0df70b91c61ac0838..70b47e30a5f72dd4550c6c705c0c6a626e017664 100644 (file)
@@ -1,4 +1,4 @@
-From 93d225865ab25105a48bf80f6c29a800b806a85b Mon Sep 17 00:00:00 2001
+From a69ecf626addcaa2c0d02bb8fefb6d964ead28a6 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 7c6f6dbfa7798..ed46720d7c944 100644
+index b071ed59a583f..0202108393361 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -9187,7 +9187,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9185,7 +9185,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
        u64 end = start + num_bytes - 1;
  
        while (num_bytes > 0) {
index 73e16305ee1285799c54337bddccc1a7f72b1fd2..d9c15d7140c6e9d72849dbf576febf2ae739cc89 100644 (file)
@@ -1,6 +1,6 @@
-From f7e693d10be20b7f83d5ba52569425bc68c36807 Mon Sep 17 00:00:00 2001
+From 796097dafc9486af8ee93c8e073d5ca1de5cfc14 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 21:41:29 -0400
+Date: Sun, 25 Oct 2026 03:13:37 -0400
 Subject: [PATCH 00/12] btrfs: raid56: rbio lifetime and cache fixes, error reporting
 To: linux-btrfs@vger.kernel.org
 
@@ -127,7 +127,7 @@ Zygo Blaxell (12):
  8 files changed, 677 insertions(+), 43 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 70ebbcf4aad2fde7e3fc58a64485519d133a4a70..65dbf6c31731629b04b8e231185572dc518fdb71 100644 (file)
@@ -1,4 +1,4 @@
-From 06db5c045ee4d05f55678163dc984793966b09af Mon Sep 17 00:00:00 2001
+From 2390ec646753c7827a2398c9b50da8a5c5813beb 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/12] btrfs: log a message when dropping an extent due to IO
@@ -68,10 +68,10 @@ Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
  1 file changed, 16 insertions(+)
 
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 7c6f6dbfa7798..ad1528fce5f94 100644
+index b071ed59a583f..8b95be6893f0e 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -3391,6 +3391,22 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
+@@ -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)) {
index f5cbcb9572779aaf54e5d70a92188d9012f6bf1f..2c8a748ce80ab669be3581b20aab2e360e1c0c3a 100644 (file)
@@ -1,4 +1,4 @@
-From dec088fcc6e6b83401e437af76e1beac9f403bd1 Mon Sep 17 00:00:00 2001
+From 5605ea80dd3424b27a98a7621722b76866c62f64 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/12] btrfs: raid56: fix use-after-free of rbio in bio end_io
@@ -58,10 +58,10 @@ Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
  2 files changed, 53 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5ec31299f1c30..04e998e99599e 100644
+index 59aad807f98ab..a0a1bae60c1ae 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -1095,7 +1095,7 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
+@@ -1101,7 +1101,7 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
        }
  
        bio_list_init(&rbio->bio_list);
@@ -70,7 +70,7 @@ index 5ec31299f1c30..04e998e99599e 100644
        INIT_LIST_HEAD(&rbio->plug_list);
        spin_lock_init(&rbio->bio_list_lock);
        INIT_LIST_HEAD(&rbio->stripe_cache);
-@@ -1676,6 +1676,40 @@ static void verify_bio_data_sectors(struct btrfs_raid_bio *rbio,
+@@ -1689,6 +1689,40 @@ static void verify_bio_data_sectors(struct btrfs_raid_bio *rbio,
        }
  }
  
@@ -111,7 +111,7 @@ index 5ec31299f1c30..04e998e99599e 100644
  static void raid_wait_read_end_io(struct bio *bio)
  {
        struct btrfs_raid_bio *rbio = bio->bi_private;
-@@ -1688,8 +1722,7 @@ static void raid_wait_read_end_io(struct bio *bio)
+@@ -1701,8 +1735,7 @@ static void raid_wait_read_end_io(struct bio *bio)
        }
  
        bio_put(bio);
@@ -121,7 +121,7 @@ index 5ec31299f1c30..04e998e99599e 100644
  }
  
  static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
-@@ -1697,7 +1730,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
+@@ -1710,7 +1743,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
  {
        struct bio *bio;
  
@@ -130,7 +130,7 @@ index 5ec31299f1c30..04e998e99599e 100644
        while ((bio = bio_list_pop(bio_list))) {
                bio->bi_end_io = raid_wait_read_end_io;
  
-@@ -1710,7 +1743,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
+@@ -1723,7 +1756,7 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
                submit_bio(bio);
        }
  
@@ -139,7 +139,7 @@ index 5ec31299f1c30..04e998e99599e 100644
  }
  
  static int alloc_rbio_data_pages(struct btrfs_raid_bio *rbio)
-@@ -2399,8 +2432,7 @@ static void raid_wait_write_end_io(struct bio *bio)
+@@ -2416,8 +2449,7 @@ static void raid_wait_write_end_io(struct bio *bio)
        if (bio->bi_status)
                rbio_update_error_bitmap(rbio, bio);
        bio_put(bio);
@@ -149,7 +149,7 @@ index 5ec31299f1c30..04e998e99599e 100644
  }
  
  static void submit_write_bios(struct btrfs_raid_bio *rbio,
-@@ -2408,7 +2440,7 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -2425,7 +2457,7 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
  {
        struct bio *bio;
  
@@ -158,7 +158,7 @@ index 5ec31299f1c30..04e998e99599e 100644
        while ((bio = bio_list_pop(bio_list))) {
                bio->bi_end_io = raid_wait_write_end_io;
  
-@@ -2514,7 +2546,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2531,7 +2563,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);
@@ -167,7 +167,7 @@ index 5ec31299f1c30..04e998e99599e 100644
  
        /* We may have more errors than our tolerance during the read. */
        for (sectornr = 0; sectornr < rbio->stripe_nsectors; sectornr++) {
-@@ -2974,7 +3006,9 @@ static void scrub_rbio(struct btrfs_raid_bio *rbio)
+@@ -2984,7 +3016,9 @@ static void scrub_rbio(struct btrfs_raid_bio *rbio)
         * and writeback the good content.
         */
        ret = finish_parity_scrub(rbio);
@@ -179,7 +179,7 @@ index 5ec31299f1c30..04e998e99599e 100644
                int found_errors;
  
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 8542648199f1a..47f8e85db2949 100644
+index 8700910b8dc99..b56f9b958d713 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
 @@ -13,6 +13,7 @@
@@ -190,7 +190,7 @@ index 8542648199f1a..47f8e85db2949 100644
  #include "volumes.h"
  
  struct page;
-@@ -178,9 +179,16 @@ struct btrfs_raid_bio {
+@@ -173,9 +174,16 @@ struct btrfs_raid_bio {
  
        refcount_t refs;
  
index f21f4de00cd882fdbb44b7817c927662cd3ad4b5..1f0555cf0d6f9b8a7b98849824506db810c5c229 100644 (file)
@@ -1,4 +1,4 @@
-From c4ca7d88372eb775e03b9fb0ae3e080d171256c1 Mon Sep 17 00:00:00 2001
+From 9ea7e7a0b451d6f1a49a9aa4c4f43519dd98dcd7 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 03/12] btrfs: propagate a split bio's error when the failing
index f15d946bd6116e53e4c95c87d243a0b51d64a6fe..0faf9f3623d2c4c832262ae48a41e42ff396cb36 100644 (file)
@@ -1,4 +1,4 @@
-From c05f4a996dc3d9f233e27e191e3bc8d1f92492bb Mon Sep 17 00:00:00 2001
+From 8b657c64c5b9b11a1552b998c6589de8ff02ea74 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/12] btrfs: raid56: drop cached rbios when their stripes'
@@ -79,10 +79,10 @@ index 9b0a5c6b96f3c..e9248e52d1dce 100644
                total_unpinned += len;
                space_info = cache->space_info;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 04e998e99599e..8c57b1f4318e0 100644
+index a0a1bae60c1ae..69ce17bc7f0af 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -535,6 +535,43 @@ static void remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
+@@ -539,6 +539,43 @@ static void remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
        spin_unlock(&table->cache_lock);
  }
  
@@ -115,7 +115,7 @@ index 04e998e99599e..8c57b1f4318e0 100644
 +      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 << BTRFS_STRIPE_LEN_SHIFT;
++              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);
@@ -127,10 +127,10 @@ index 04e998e99599e..8c57b1f4318e0 100644
   * remove everything in the cache
   */
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 47f8e85db2949..c7c4b0db61f4c 100644
+index b56f9b958d713..be507cceb465d 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -295,5 +295,6 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+@@ -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);
index 49a6166c09e34110de0918a2544d74326ce06180..67478c2109a7e3f0fded6a0b7e669d8ba1a4fa1a 100644 (file)
@@ -1,4 +1,4 @@
-From 0fe89be282ee3d71b69555adab49dd43729aad45 Mon Sep 17 00:00:00 2001
+From 92f5a085fe10893c3980e9d17734341d85d4efb9 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/12] btrfs: raid56: verify reconstructed tree blocks
@@ -53,10 +53,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 174 insertions(+)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 8c57b1f4318e0..d3c9bd7a7a718 100644
+index 69ce17bc7f0af..13e5a0244fdb3 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -1954,6 +1954,176 @@ static void calculate_block_csum_paddrs(struct btrfs_fs_info *fs_info,
+@@ -1971,6 +1971,176 @@ static void calculate_block_csum_paddrs(struct btrfs_fs_info *fs_info,
        btrfs_csum_final(&csum, dest);
  }
  
@@ -81,8 +81,8 @@ index 8c57b1f4318e0..d3c9bd7a7a718 100644
 + * 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 BTRFS_STRIPE_LEN are
-+ * both powers of two with nodesize <= BTRFS_STRIPE_LEN, and a full stripe is
++ * 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.
 + *
@@ -96,7 +96,7 @@ index 8c57b1f4318e0..d3c9bd7a7a718 100644
 +      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 * BTRFS_STRIPE_LEN +
++                          (u64)stripe_nr * rbio->bioc->stripe_len +
 +                          (u64)sector_nr * sectorsize;
 +      u8 on_disk_csum[BTRFS_CSUM_SIZE];
 +      u8 calculated_csum[BTRFS_CSUM_SIZE];
@@ -233,7 +233,7 @@ index 8c57b1f4318e0..d3c9bd7a7a718 100644
  static int verify_one_sector(struct btrfs_raid_bio *rbio,
                             int stripe_nr, int sector_nr)
  {
-@@ -2189,6 +2359,10 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
+@@ -2206,6 +2376,10 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
                        break;
        }
  
index a09a6be2df94d2f47eda2db1d0934f18cf7d6279..76409492b5bc6882fbe1a174f04a97f2e3873eef 100644 (file)
@@ -1,4 +1,4 @@
-From b2c793a1845e5928abc500c6719aebf14e543c05 Mon Sep 17 00:00:00 2001
+From 4d6253c5eec47d8b006c6952cad73ea354d2d577 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/12] btrfs: raid56: keep a reference on a stolen cached rbio
@@ -37,10 +37,10 @@ Assisted-by: Claude:claude-opus-4-8
  1 file changed, 10 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index d3c9bd7a7a718..40ab59b1f0e2a 100644
+index 13e5a0244fdb3..cb4d6d7afe396 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -826,8 +826,14 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+@@ -831,8 +831,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)) {
@@ -56,7 +56,7 @@ index d3c9bd7a7a718..40ab59b1f0e2a 100644
  
                        steal_rbio(cur, rbio);
                        cache_drop = cur;
-@@ -875,8 +881,10 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+@@ -880,8 +886,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);
index 4cdae225aad8a3b8a53729ea41cc423566590d78..9526948f34cb37db1fe0da5c166fe7592fbbb382 100644 (file)
@@ -1,4 +1,4 @@
-From 3a80dae0c04b17fa72ef154d058a763334da4438 Mon Sep 17 00:00:00 2001
+From 91863d542ab16d679351dde0560bb5e987459f3d 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/12] btrfs: raid56: do not unhash a cached rbio that has
@@ -32,10 +32,10 @@ Assisted-by: Claude:claude-opus-4-8
  1 file changed, 12 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 40ab59b1f0e2a..1cec4589be7ba 100644
+index cb4d6d7afe396..6ff4eeca37fbc 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -502,11 +502,21 @@ static void __remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
+@@ -506,11 +506,21 @@ static void __remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
                 * the rbio from the hash_table, and drop
                 * the corresponding ref
                 */
@@ -55,7 +55,7 @@ index 40ab59b1f0e2a..1cec4589be7ba 100644
                        if (!list_empty(&rbio->hash_list)) {
                                list_del_init(&rbio->hash_list);
                                refcount_dec(&rbio->refs);
--                              BUG_ON(!list_empty(&rbio->plug_list));
+-                              ASSERT(list_empty(&rbio->plug_list));
                        }
                }
        }
index ac61edb88d167375e529868e4a72af2c0f905c78..a92b9d4202b5fc5ac6ecce9eea7c4e02e140e531 100644 (file)
@@ -1,4 +1,4 @@
-From 773140d8d8973b91099623dedb025073a34b0974 Mon Sep 17 00:00:00 2001
+From 68a1dc1bf316ba1a62c82b8d4656ccfb932623d8 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 01:19:22 -0400
 Subject: [PATCH 08/12] btrfs: raid56: do not let a failed write leave its
@@ -55,10 +55,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 12 insertions(+)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 1cec4589be7ba..616beef40d8c0 100644
+index 6ff4eeca37fbc..1d9917330e912 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -1013,6 +1013,18 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
+@@ -1018,6 +1018,18 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
         */
        bitmap_clear(&rbio->dbitmap, 0, rbio->stripe_nsectors);
  
index 192091f7433f48f4ab93127019bcc7beaad18f14..b703ffbd308eb4d01c4ccaa106d832d210308acb 100644 (file)
@@ -1,4 +1,4 @@
-From d507eefdb5832348bc728b963f3d7c8898ffb0a4 Mon Sep 17 00:00:00 2001
+From f55474d2c5c8a84ee73003e6ea52ada8fd0152be 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 09/12] btrfs: raid56: rebuild from Q when a sector rebuilt
@@ -54,10 +54,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 95 insertions(+), 20 deletions(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 616beef40d8c0..c4bea99e0b411 100644
+index 1d9917330e912..0a84eab7db224 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2300,6 +2300,94 @@ static void recover_vertical_step(struct btrfs_raid_bio *rbio,
+@@ -2317,6 +2317,94 @@ static void recover_vertical_step(struct btrfs_raid_bio *rbio,
                kunmap_local(unmap_array[stripe_nr]);
  }
  
@@ -152,7 +152,7 @@ index 616beef40d8c0..c4bea99e0b411 100644
  /*
   * Recover a vertical stripe specified by @sector_nr.
   * @*pointers are the pre-allocated pointers by the caller, so we don't
-@@ -2311,7 +2399,7 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
+@@ -2328,7 +2416,7 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
        int found_errors;
        int faila;
        int failb;
@@ -161,7 +161,7 @@ index 616beef40d8c0..c4bea99e0b411 100644
  
        /*
         * Now we just use bitmap to mark the horizontal stripes in
-@@ -2333,25 +2421,12 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
+@@ -2350,25 +2438,12 @@ static int recover_vertical(struct btrfs_raid_bio *rbio, int sector_nr,
        if (unlikely(found_errors > rbio->bioc->max_errors))
                return -EIO;
  
index 8131a08a0f500af955f9a420524d57d956adf1f7..aa00f9f5760d1320c2f26f0f141aba9c12fd32ae 100644 (file)
@@ -1,4 +1,4 @@
-From 6dfdbfdffe7d7f18f1112740a6e3a9baa06dbb93 Mon Sep 17 00:00:00 2001
+From 200a23a21458376d5d670e46e7a2c8a3a4b34201 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 10/12] btrfs: raid56: count I/O errors in the device stats
@@ -71,10 +71,10 @@ index bbf362b8668bb..2451d38566d1a 100644
  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 c4bea99e0b411..232cc91584ea2 100644
+index 0a84eab7db224..673c579147b15 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -1777,11 +1777,29 @@ static void rbio_wait_io(struct btrfs_raid_bio *rbio)
+@@ -1790,11 +1790,29 @@ static void rbio_wait_io(struct btrfs_raid_bio *rbio)
        wait_for_completion(&rbio->io_done);
  }
  
@@ -104,7 +104,7 @@ index c4bea99e0b411..232cc91584ea2 100644
                rbio_update_error_bitmap(rbio, bio);
        } else {
                set_bio_pages_uptodate(rbio, bio);
-@@ -2745,8 +2763,10 @@ static void raid_wait_write_end_io(struct bio *bio)
+@@ -2762,8 +2780,10 @@ static void raid_wait_write_end_io(struct bio *bio)
  {
        struct btrfs_raid_bio *rbio = bio->bi_private;
  
index ce8b4997e7e6c80a9f9dc6a9d5c039f656a01e61..664c751d5f25c0b7a8373b5a1baad80d83e00386 100644 (file)
@@ -1,4 +1,4 @@
-From 95d142c556b58d28b69c8c9aa579470eddce6d19 Mon Sep 17 00:00:00 2001
+From 4f9f89c3d420ce96b9e541f22aebbeaa469a2ceb 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 11/12] btrfs: raid56: write back the sectors a sub-stripe
@@ -67,10 +67,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 152 insertions(+)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 232cc91584ea2..5732c2d8ea359 100644
+index 673c579147b15..0b10204b70a50 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2813,10 +2813,153 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+@@ -2830,10 +2830,153 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
        return false;
  }
  
@@ -224,7 +224,7 @@ index 232cc91584ea2..5732c2d8ea359 100644
        int ret = 0;
  
        /*
-@@ -2845,6 +2988,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2862,6 +3005,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                ret = rmw_read_wait_recover(rbio);
                if (ret < 0)
                        goto out;
@@ -232,7 +232,7 @@ index 232cc91584ea2..5732c2d8ea359 100644
        }
  
        /*
-@@ -2878,11 +3022,18 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2895,11 +3039,18 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
        ret = rmw_assemble_write_bios(rbio, &bio_list);
        if (ret < 0)
                goto out;
@@ -251,7 +251,7 @@ index 232cc91584ea2..5732c2d8ea359 100644
  
        /* We may have more errors than our tolerance during the read. */
        for (sectornr = 0; sectornr < rbio->stripe_nsectors; sectornr++) {
-@@ -2895,6 +3046,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2912,6 +3063,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                }
        }
  out:
index 200b2324bd99cf0c7d3d4f47ea97bcff8cd11017..f84dd74d3308886528e7170a96a06e129f2ce9e2 100644 (file)
@@ -1,4 +1,4 @@
-From f7e693d10be20b7f83d5ba52569425bc68c36807 Mon Sep 17 00:00:00 2001
+From 796097dafc9486af8ee93c8e073d5ca1de5cfc14 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 03:54:55 -0400
 Subject: [PATCH 12/12] DO-NOT-UPSTREAM: btrfs: raid56: debug knob for the rbio
@@ -39,7 +39,7 @@ index 2dd167c32d612..326a54601289c 100644
        /*
         * This protects the ordered operations list only while we are
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5732c2d8ea359..c44e447b7c4a5 100644
+index 0b10204b70a50..5ea3efebfa6c8 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -198,6 +198,9 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info)
@@ -52,7 +52,7 @@ index 5732c2d8ea359..c44e447b7c4a5 100644
        if (info->stripe_hash_table)
                return 0;
  
-@@ -601,6 +604,23 @@ static void btrfs_clear_rbio_cache(struct btrfs_fs_info *info)
+@@ -605,6 +608,23 @@ static void btrfs_clear_rbio_cache(struct btrfs_fs_info *info)
        spin_unlock(&table->cache_lock);
  }
  
@@ -76,7 +76,7 @@ index 5732c2d8ea359..c44e447b7c4a5 100644
  /*
   * remove all cached entries and free the hash table
   * used by unmount
-@@ -625,12 +645,25 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
+@@ -629,12 +649,25 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
   * If the size of the rbio cache is too big, we
   * prune an item.
   */
@@ -102,7 +102,7 @@ index 5732c2d8ea359..c44e447b7c4a5 100644
  
        table = rbio->bioc->fs_info->stripe_hash_table;
  
-@@ -650,15 +683,17 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
+@@ -654,15 +687,17 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
  
        spin_unlock(&rbio->bio_list_lock);
  
@@ -124,10 +124,10 @@ index 5732c2d8ea359..c44e447b7c4a5 100644
  
        spin_unlock(&table->cache_lock);
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index c7c4b0db61f4c..8d28e2a77c62b 100644
+index be507cceb465d..0a25e41a00132 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -295,6 +295,9 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+@@ -290,6 +290,9 @@ 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);
@@ -138,7 +138,7 @@ index c7c4b0db61f4c..8d28e2a77c62b 100644
  
  #endif
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..78688c36f8b02 100644
+index 89b0a4ef4063e..c208300634ebc 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -25,6 +25,7 @@
index 247baa885a06d3553e087e3c82e5408e566e2b53..61c7d4317ed4e92e735f641986e0ebcd75196be6 100644 (file)
@@ -1,7 +1,7 @@
-From 9970d7e44abf0e5a7c67c93228908af5a0303f86 Mon Sep 17 00:00:00 2001
+From b7b4005cacc44b50375cbb55d550f35eed1662f6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Wed, 21 Oct 2026 07:09:39 -0400
-Subject: [PATCH 00/13] btrfs: raid56 scrub and device replace with unrepairable data
+Date: Sun, 25 Oct 2026 03:13:39 -0400
+Subject: [PATCH 00/12] btrfs: raid56 scrub and device replace with unrepairable data
 To: linux-btrfs@vger.kernel.org
 
 RAID5/6 scrub and device replace handle uncorrectable data differently
@@ -11,26 +11,26 @@ like the other profiles: an uncorrectable sector is counted and logged,
 the scrub or replace moves on, and the rows of a full stripe that can
 still be verified are verified and copied.
 
-Patch 1 is Filipe Manana's "btrfs: scrub: fix lost error return value
-when scrubbing raid56 parity stripe" (in for-next), included unchanged
-so the series applies; it drops out when the base contains it.
+The series applies on top of Filipe Manana's "btrfs: scrub: fix lost
+error return value when scrubbing raid56 parity stripe" (ec0795c045c3
+in for-next), which this base contains.
 
-Patch 2 checks P/Q per row.  When a data stripe has unrepaired sectors,
+Patch 1 checks P/Q per row.  When a data stripe has unrepaired sectors,
 scrub_raid56_parity_stripe() skipped the parity check for the whole full
 stripe, so P/Q of the other rows was never verified, and on dev-replace
 the replaced device's P/Q strip was never written to the target.  Now
 only the rows with unrepaired sectors are left out.  A full stripe with
 unrepaired data still fails the scrub with -EIO at this point.
 
-Patch 3 copies the original P/Q of the unrepairable rows to the replace
+Patch 2 copies the original P/Q of the unrepairable rows to the replace
 target, so a transient read failure during the replace does not make
 those rows unrecoverable from the new device.
 
-Patch 4 copies the unrepaired data sectors to the target verbatim.  On
+Patch 3 copies the unrepaired data sectors to the target verbatim.  On
 raid56 the replaced strip is an input to every later rebuild of its row,
 so leaving it unwritten damages other devices' sectors too.
 
-Patch 5 copies every sector of the raid56 data stripes to the target,
+Patch 4 copies every sector of the raid56 data stripes to the target,
 including sectors that hold no extent (deleted data, never-written
 space) in full stripes that have live data, and data stripes with no
 extent at all in such full stripes.  Replace copied only extents, so
@@ -39,33 +39,33 @@ rebuilds of other devices' sectors in those rows failed their csum:
 replacing any raid56 device, healthy or not, lost blocks that were
 recoverable before (667-1599 per replace in the test below).
 
-Patch 6 makes "replace -r" avoid only the source device's own stripes.
+Patch 5 makes "replace -r" avoid only the source device's own stripes.
 The avoid mode was applied to every stripe read, including the other
 devices' data stripes read by the parity scrub, which were then rebuilt
 from P and used, unverified, to recompute parity.
 
-Patch 7 reads the no-extent sectors from the source when -r is given
+Patch 6 reads the no-extent sectors from the source when -r is given
 and the source is present.  Their rebuild cannot be verified (no csum)
 and carries the damage of any other bad strip in the row; with patches
 5-6 alone, -r replaces lost 682-878 blocks.  It is separate so it can
 be dropped if reading the source here is not wanted.
 
-Patch 8 stops raid56 scrub from failing on the first full stripe with
+Patch 7 stops raid56 scrub from failing on the first full stripe with
 an uncorrectable sector.  -EIO there ended the scrub of every device
 holding P or Q for that stripe, and since parity rotates, a few bad
 stripes stopped most of the array's scrub, leaving later errors
 uncounted and correctable ones unrepaired.  It comes last so there is
 no point in the series where replace carries on past a bad row without
-patches 2-3 writing its parity.
+patches 1-2 writing its parity.
 
-Patch 9 makes a read-only scrub (-r) of raid56 parity write nothing.
+Patch 8 makes a read-only scrub (-r) of raid56 parity write nothing.
 finish_parity_scrub() never checked sctx->readonly, so a read-only
 scrub rewrote P/Q that disagreed with the data, on a read-only mount
 too.  The mismatches are still verified and counted.  It comes before
-patch 10 so that no point in the series rebuilds data in a read-only
+patch 9 so that no point in the series rebuilds data in a read-only
 scrub.  Fixes: 5a6ac9eacb49.
 
-Patch 10 lets raid56 parity scrub repair a raid6 data strip that has
+Patch 9 lets raid56 parity scrub repair a raid6 data strip that has
 no csum.  When the scrubbed P and Q both disagree with the data in a
 way that locates a single data strip (dQ = g^z dP for every differing
 byte), scrub rebuilds that strip from P and Q and writes it back
@@ -75,21 +75,21 @@ within tolerance.  Only the scrub of P rebuilds, so the parallel scrub
 of Q does not repeat it.  RAID5 has no such redundancy and keeps
 today's behaviour.  Fixes: 5a6ac9eacb49.
 
-Patch 11 counts parity mismatches found by raid56 parity scrub as
-corruption errors: in the device stats of the data member patch 10
+Patch 10 counts parity mismatches found by raid56 parity scrub as
+corruption errors: in the device stats of the data member patch 9
 rebuilt, otherwise of the scrubbed parity member, and in the scrub's
 corrected count.  They were rewritten silently before.  On RAID5, and
-on a RAID6 row patch 10 cannot locate, a mismatch may equally be
+on a RAID6 row patch 9 cannot locate, a mismatch may equally be
 undetectable corruption in a data strip without csums; it is charged to
 the parity member because there is no better information.
 
-Patch 12 names the right device in raid56 scrub error messages.  The
+Patch 11 names the right device in raid56 scrub error messages.  The
 "fixed up error / checksum error ... on dev X" lines mapped the sector
 with a non-READ op, which on raid56 returns the full-stripe write map,
 so they named the device of the full stripe's first data strip: damage
 on one device was reported on most of them.  Fixes: 0096580713ff.
 
-Patch 13 counts the data repairs a raid56 parity scrub makes.  The
+Patch 12 counts the data repairs a raid56 parity scrub makes.  The
 parity scrub of the P/Q holder reads and repairs the full stripe's data
 strips without reporting them, so a damaged sector it reached before
 the data device's own scrub was repaired and counted nowhere: a raid6
@@ -108,10 +108,6 @@ no-extent sector of a row with live data is left unwritten on the
 target, and no data lands at the wrong place, on misc-next and 6.18,
 under KASAN.
 
-Filipe Manana (1):
-  btrfs: scrub: fix lost error return value when scrubbing raid56 parity
-    stripe
-
 Zygo Blaxell (12):
   btrfs: scrub: check raid56 parity of the rows without unrepaired data
   btrfs: scrub: copy raid56 parity of unrepairable rows to the replace
@@ -133,11 +129,11 @@ Zygo Blaxell (12):
 
  fs/btrfs/raid56.c | 234 +++++++++++++++++++++++--
  fs/btrfs/raid56.h |   9 +-
- fs/btrfs/scrub.c  | 433 +++++++++++++++++++++++++++++++++++++++++-----
- 3 files changed, 617 insertions(+), 59 deletions(-)
+ fs/btrfs/scrub.c  | 434 +++++++++++++++++++++++++++++++++++++++++-----
+ 3 files changed, 618 insertions(+), 59 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
diff --git a/topics/raid56-scrub-replace/0001-btrfs-scrub-check-raid56-parity-of-the-rows-without-.patch b/topics/raid56-scrub-replace/0001-btrfs-scrub-check-raid56-parity-of-the-rows-without-.patch
new file mode 100644 (file)
index 0000000..4e241fe
--- /dev/null
@@ -0,0 +1,105 @@
+From 3a63fbd085fcf4b7844e7c4bb8f6c12bfabc35cc 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
+ unrepaired data
+To: linux-btrfs@vger.kernel.org
+
+When a data stripe of a full stripe has unrepaired sectors,
+scrub_raid56_parity_stripe() skips the P/Q check for the whole full
+stripe.  Parity is per row (the same sector of every strip), so only the
+rows that contain an unrepaired data sector need to be left alone.
+Skipping the whole full stripe has two costs:
+
+ - on scrub, P/Q of the other rows is never verified or repaired;
+
+ - on dev-replace, the parity scrub is the only path that writes the
+   replaced device's P/Q strip to the target (finish_parity_scrub()
+   duplicates its writes when the strip being scrubbed is on the replace
+   source).  Skipping it leaves that strip unwritten on the target, so
+   the good data strips of the full stripe can no longer be rebuilt from
+   the new device.
+
+Collect the rows with unrepaired data sectors from all data stripes,
+leave them out of the bitmap passed to the parity scrub, and check and
+regenerate P/Q for the remaining rows.  The bad rows keep their existing
+P/Q on scrub, and on dev-replace nothing is written to the target for
+them.  That is the rule the other profiles already follow when they copy
+a data stripe with uncorrectable sectors to the replace target
+(flush_scrub_stripes() writes only the good sectors).
+
+A full stripe with unrepaired data sectors still fails the scrub of the
+device with -EIO, now after its good rows have been checked.  Whether
+the scrub should fail at all is left to a later change.
+
+Assisted-by: Claude:claude-opus-5-5
+---
+ fs/btrfs/scrub.c | 33 ++++++++++++++++++++++++++-------
+ 1 file changed, 26 insertions(+), 7 deletions(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 98362c91bce43..73d200304271d 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -2156,6 +2156,8 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+       const u32 stripe_len = map->stripe_len;
+       const int data_stripes = nr_data_stripes(map);
+       unsigned long extent_bitmap = 0;
++      unsigned long bad_rows = 0;
++      const u32 nr_sectors = map->stripe_len >> fs_info->sectorsize_bits;
+       int ret;
+ 
+       ASSERT(sctx->raid56_data_stripes);
+@@ -2243,9 +2245,9 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+       ASSERT(!btrfs_is_zoned(sctx->fs_info));
+ 
+       /*
+-       * Now all data stripes are properly verified. Check if we have any
+-       * unrepaired, if so abort immediately or we could further corrupt the
+-       * P/Q stripes.
++       * Now all data stripes are properly verified.  Collect the rows that
++       * still have unrepaired sectors: P/Q computed from them would be wrong,
++       * so those rows are left out of the P/Q check below.
+        *
+        * During the loop, also populate extent_bitmap.
+        */
+@@ -2268,15 +2270,32 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+ "scrub: unrepaired sectors detected, full stripe %llu data stripe %u errors %*pbl",
+                                 full_stripe_start, i, stripe->nr_sectors,
+                                 &error);
+-                      return -EIO;
++                      bitmap_or(&bad_rows, &bad_rows, &error,
++                                stripe->nr_sectors);
+               }
+               bitmap_or(&extent_bitmap, &extent_bitmap, &has_extent,
+                         stripe->nr_sectors);
+       }
+ 
+-      /* Now we can check and regenerate the P/Q stripe. */
+-      return scrub_raid56_cached_parity(sctx, scrub_dev, map, full_stripe_start,
+-                                        &extent_bitmap);
++      /*
++       * Parity is per row.  Leave the existing P/Q of the bad rows alone
++       * (and, during dev-replace, write nothing for them to the target, as
++       * for the bad sectors of the other profiles), but check and regenerate
++       * the rest.
++       */
++      bitmap_andnot(&extent_bitmap, &extent_bitmap, &bad_rows, nr_sectors);
++      if (!bitmap_empty(&extent_bitmap, nr_sectors)) {
++              /* Now we can check and regenerate the P/Q stripe. */
++              ret = scrub_raid56_cached_parity(sctx, scrub_dev, map,
++                                               full_stripe_start, &extent_bitmap);
++              if (ret)
++                      return ret;
++      }
++
++      /* The unrepaired data sectors still fail the scrub. */
++      if (!bitmap_empty(&bad_rows, nr_sectors))
++              return -EIO;
++      return 0;
+ }
+ 
+ /*
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0001-btrfs-scrub-fix-lost-error-return-value-when-scrubbi.patch b/topics/raid56-scrub-replace/0001-btrfs-scrub-fix-lost-error-return-value-when-scrubbi.patch
deleted file mode 100644 (file)
index 9ae4278..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-From 84fa71315be6366bf0d836536c7c7f50560aa1f5 Mon Sep 17 00:00:00 2001
-From: Filipe Manana <fdmanana@suse.com>
-Date: Thu, 15 Oct 2026 18:45:45 +0100
-Subject: [PATCH 01/13] btrfs: scrub: fix lost error return value when
- scrubbing raid56 parity stripe
-To: linux-btrfs@vger.kernel.org
-
-If we find errors we are returning the value of 'ret', which has a value
-of 0 from some previous function call that succeeded, instead of returning
-an -EIO error. Fix this by returning -EIO instead of 'ret'.
-
-Fixes: fab0c0f03cfd ("btrfs: introduce BTRFS_PATH_AUTO_RELEASE() helper")
-Reviewed-by: Qu Wenruo <wqu@suse.com>
-Signed-off-by: Filipe Manana <fdmanana@suse.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
----
- fs/btrfs/scrub.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 479c0e037015a..ba2e27cc53519 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -2250,7 +2250,7 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
- "scrub: unrepaired sectors detected, full stripe %llu data stripe %u errors %*pbl",
-                                 full_stripe_start, i, stripe->nr_sectors,
-                                 &error);
--                      return ret;
-+                      return -EIO;
-               }
-               bitmap_or(&extent_bitmap, &extent_bitmap, &has_extent,
-                         stripe->nr_sectors);
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0002-btrfs-scrub-check-raid56-parity-of-the-rows-without-.patch b/topics/raid56-scrub-replace/0002-btrfs-scrub-check-raid56-parity-of-the-rows-without-.patch
deleted file mode 100644 (file)
index f07e50d..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-From fdce5181605d8fc3d78a4852e5a04d310c35a521 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/13] btrfs: scrub: check raid56 parity of the rows without
- unrepaired data
-To: linux-btrfs@vger.kernel.org
-
-When a data stripe of a full stripe has unrepaired sectors,
-scrub_raid56_parity_stripe() skips the P/Q check for the whole full
-stripe.  Parity is per row (the same sector of every strip), so only the
-rows that contain an unrepaired data sector need to be left alone.
-Skipping the whole full stripe has two costs:
-
- - on scrub, P/Q of the other rows is never verified or repaired;
-
- - on dev-replace, the parity scrub is the only path that writes the
-   replaced device's P/Q strip to the target (finish_parity_scrub()
-   duplicates its writes when the strip being scrubbed is on the replace
-   source).  Skipping it leaves that strip unwritten on the target, so
-   the good data strips of the full stripe can no longer be rebuilt from
-   the new device.
-
-Collect the rows with unrepaired data sectors from all data stripes,
-leave them out of the bitmap passed to the parity scrub, and check and
-regenerate P/Q for the remaining rows.  The bad rows keep their existing
-P/Q on scrub, and on dev-replace nothing is written to the target for
-them.  That is the rule the other profiles already follow when they copy
-a data stripe with uncorrectable sectors to the replace target
-(flush_scrub_stripes() writes only the good sectors).
-
-A full stripe with unrepaired data sectors still fails the scrub of the
-device with -EIO, now after its good rows have been checked.  Whether
-the scrub should fail at all is left to a later change.
-
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/scrub.c | 33 ++++++++++++++++++++++++++-------
- 1 file changed, 26 insertions(+), 7 deletions(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index ba2e27cc53519..8083ad640b2c1 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -2139,6 +2139,8 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
-       bool all_empty = true;
-       const int data_stripes = nr_data_stripes(map);
-       unsigned long extent_bitmap = 0;
-+      unsigned long bad_rows = 0;
-+      const u32 nr_sectors = BTRFS_STRIPE_LEN >> fs_info->sectorsize_bits;
-       int ret;
- 
-       ASSERT(sctx->raid56_data_stripes);
-@@ -2225,9 +2227,9 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
-       ASSERT(!btrfs_is_zoned(sctx->fs_info));
- 
-       /*
--       * Now all data stripes are properly verified. Check if we have any
--       * unrepaired, if so abort immediately or we could further corrupt the
--       * P/Q stripes.
-+       * Now all data stripes are properly verified.  Collect the rows that
-+       * still have unrepaired sectors: P/Q computed from them would be wrong,
-+       * so those rows are left out of the P/Q check below.
-        *
-        * During the loop, also populate extent_bitmap.
-        */
-@@ -2250,15 +2252,32 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
- "scrub: unrepaired sectors detected, full stripe %llu data stripe %u errors %*pbl",
-                                 full_stripe_start, i, stripe->nr_sectors,
-                                 &error);
--                      return -EIO;
-+                      bitmap_or(&bad_rows, &bad_rows, &error,
-+                                stripe->nr_sectors);
-               }
-               bitmap_or(&extent_bitmap, &extent_bitmap, &has_extent,
-                         stripe->nr_sectors);
-       }
- 
--      /* Now we can check and regenerate the P/Q stripe. */
--      return scrub_raid56_cached_parity(sctx, scrub_dev, map, full_stripe_start,
--                                        &extent_bitmap);
-+      /*
-+       * Parity is per row.  Leave the existing P/Q of the bad rows alone
-+       * (and, during dev-replace, write nothing for them to the target, as
-+       * for the bad sectors of the other profiles), but check and regenerate
-+       * the rest.
-+       */
-+      bitmap_andnot(&extent_bitmap, &extent_bitmap, &bad_rows, nr_sectors);
-+      if (!bitmap_empty(&extent_bitmap, nr_sectors)) {
-+              /* Now we can check and regenerate the P/Q stripe. */
-+              ret = scrub_raid56_cached_parity(sctx, scrub_dev, map,
-+                                               full_stripe_start, &extent_bitmap);
-+              if (ret)
-+                      return ret;
-+      }
-+
-+      /* The unrepaired data sectors still fail the scrub. */
-+      if (!bitmap_empty(&bad_rows, nr_sectors))
-+              return -EIO;
-+      return 0;
- }
- 
- /*
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0002-btrfs-scrub-copy-raid56-parity-of-unrepairable-rows-.patch b/topics/raid56-scrub-replace/0002-btrfs-scrub-copy-raid56-parity-of-unrepairable-rows-.patch
new file mode 100644 (file)
index 0000000..e35e62f
--- /dev/null
@@ -0,0 +1,126 @@
+From dbd38ff999b5f6be70fee9c3b537c4f16219e03a 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
+ to the replace target
+To: linux-btrfs@vger.kernel.org
+
+"btrfs: scrub: check raid56 parity of the rows without unrepaired data"
+leaves the rows of a full stripe that contain unrepaired data out of the
+parity scrub, so during dev-replace the target gets nothing for those
+rows of the replaced device's P/Q strip.
+
+A row is unrepairable when more of its strips failed than P/Q can
+rebuild, but the failure is not always permanent: a read error during
+the replace can be transient.  On the source, such a row is still
+covered by its original P/Q, so if the data turns out to be readable
+later the row can be recovered.  On the target, with nothing written for
+those P/Q sectors, that hope is gone.
+
+When replacing, copy the original P/Q sectors of those rows from the
+source device to the target, so the target's P/Q for those rows matches
+the source's and the rows stay as recoverable from the new device as
+they were from the old one.  The copy is best effort: if the source
+sectors cannot be read or the target write fails, log it and carry on,
+leaving those rows unwritten as before.
+
+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(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 73d200304271d..8e4febe466dbc 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -2142,6 +2142,65 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
+       return ret;
+ }
+ 
++/*
++ * Dev-replace: copy the original P/Q sectors of the rows that the parity scrub
++ * leaves out (@bad_rows: rows with unrepaired data) from the source device to
++ * the replace target, so the target's P/Q for those rows matches the source's.
++ * Best effort: a failed copy is logged and the replace goes on.
++ */
++static void scrub_raid56_copy_parity_rows(struct scrub_ctx *sctx,
++                                        struct btrfs_device *scrub_dev,
++                                        struct btrfs_block_group *bg,
++                                        struct btrfs_chunk_map *map,
++                                        u64 full_stripe_start,
++                                        unsigned long bad_rows)
++{
++      struct btrfs_fs_info *fs_info = sctx->fs_info;
++      struct btrfs_device *tgtdev = sctx->wr_tgtdev;
++      const u32 nr_sectors = map->stripe_len >> fs_info->sectorsize_bits;
++      const int data_stripes = nr_data_stripes(map);
++      unsigned int start, end;
++      u64 physical;
++      int rot;
++      int i;
++      void *buf;
++
++      if (!tgtdev || !tgtdev->bdev || !scrub_dev->bdev)
++              return;
++      for (i = 0; i < map->num_stripes; i++)
++              if (map->stripes[i].dev == scrub_dev)
++                      break;
++      if (WARN_ON_ONCE(i == map->num_stripes))
++              return;
++      rot = div_u64(full_stripe_start - bg->start, data_stripes) >>
++            map->stripe_shift;
++      physical = map->stripes[i].physical +
++                 btrfs_stripe_nr_to_offset(rot, map->stripe_len);
++
++      buf = kmalloc(BTRFS_STRIPE_LEN, GFP_NOFS);
++      if (!buf)
++              return;
++      btrfs_bio_counter_inc_blocked(fs_info);
++      for_each_set_bitrange(start, end, &bad_rows, nr_sectors) {
++              const u64 pos = physical +
++                              ((u64)start << fs_info->sectorsize_bits);
++              const u32 len = (end - start) << fs_info->sectorsize_bits;
++              int ret;
++
++              ret = bdev_rw_virt(scrub_dev->bdev, pos >> SECTOR_SHIFT, buf,
++                                 len, REQ_OP_READ);
++              if (!ret)
++                      ret = bdev_rw_virt(tgtdev->bdev, pos >> SECTOR_SHIFT,
++                                         buf, len, REQ_OP_WRITE);
++              if (ret)
++                      btrfs_warn_rl(fs_info,
++"scrub: failed to copy parity of full stripe %llu sectors %u-%u to the replace target: %d",
++                                    full_stripe_start, start, end - 1, ret);
++      }
++      btrfs_bio_counter_dec(fs_info);
++      kfree(buf);
++}
++
+ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+                                     struct btrfs_device *scrub_dev,
+                                     struct btrfs_block_group *bg,
+@@ -2277,11 +2336,14 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+                         stripe->nr_sectors);
+       }
+ 
++      if (sctx->is_dev_replace && !bitmap_empty(&bad_rows, nr_sectors))
++              scrub_raid56_copy_parity_rows(sctx, scrub_dev, bg, map,
++                                            full_stripe_start, bad_rows);
++
+       /*
+        * Parity is per row.  Leave the existing P/Q of the bad rows alone
+-       * (and, during dev-replace, write nothing for them to the target, as
+-       * for the bad sectors of the other profiles), but check and regenerate
+-       * the rest.
++       * (during dev-replace it is copied to the target as it is, above), but
++       * check and regenerate the rest.
+        */
+       bitmap_andnot(&extent_bitmap, &extent_bitmap, &bad_rows, nr_sectors);
+       if (!bitmap_empty(&extent_bitmap, nr_sectors)) {
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0003-btrfs-scrub-copy-raid56-parity-of-unrepairable-rows-.patch b/topics/raid56-scrub-replace/0003-btrfs-scrub-copy-raid56-parity-of-unrepairable-rows-.patch
deleted file mode 100644 (file)
index 5f91ce3..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-From e47bef121de9dabf61d7044fb5adf5b0aabad031 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 03/13] btrfs: scrub: copy raid56 parity of unrepairable rows
- to the replace target
-To: linux-btrfs@vger.kernel.org
-
-"btrfs: scrub: check raid56 parity of the rows without unrepaired data"
-leaves the rows of a full stripe that contain unrepaired data out of the
-parity scrub, so during dev-replace the target gets nothing for those
-rows of the replaced device's P/Q strip.
-
-A row is unrepairable when more of its strips failed than P/Q can
-rebuild, but the failure is not always permanent: a read error during
-the replace can be transient.  On the source, such a row is still
-covered by its original P/Q, so if the data turns out to be readable
-later the row can be recovered.  On the target, with nothing written for
-those P/Q sectors, that hope is gone.
-
-When replacing, copy the original P/Q sectors of those rows from the
-source device to the target, so the target's P/Q for those rows matches
-the source's and the rows stay as recoverable from the new device as
-they were from the old one.  The copy is best effort: if the source
-sectors cannot be read or the target write fails, log it and carry on,
-leaving those rows unwritten as before.
-
-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 | 67 +++++++++++++++++++++++++++++++++++++++++++++---
- 1 file changed, 64 insertions(+), 3 deletions(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 8083ad640b2c1..9cfa426b40ff9 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -2126,6 +2126,64 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
-       return ret;
- }
- 
-+/*
-+ * Dev-replace: copy the original P/Q sectors of the rows that the parity scrub
-+ * leaves out (@bad_rows: rows with unrepaired data) from the source device to
-+ * the replace target, so the target's P/Q for those rows matches the source's.
-+ * Best effort: a failed copy is logged and the replace goes on.
-+ */
-+static void scrub_raid56_copy_parity_rows(struct scrub_ctx *sctx,
-+                                        struct btrfs_device *scrub_dev,
-+                                        struct btrfs_block_group *bg,
-+                                        struct btrfs_chunk_map *map,
-+                                        u64 full_stripe_start,
-+                                        unsigned long bad_rows)
-+{
-+      struct btrfs_fs_info *fs_info = sctx->fs_info;
-+      struct btrfs_device *tgtdev = sctx->wr_tgtdev;
-+      const u32 nr_sectors = BTRFS_STRIPE_LEN >> fs_info->sectorsize_bits;
-+      const int data_stripes = nr_data_stripes(map);
-+      unsigned int start, end;
-+      u64 physical;
-+      int rot;
-+      int i;
-+      void *buf;
-+
-+      if (!tgtdev || !tgtdev->bdev || !scrub_dev->bdev)
-+              return;
-+      for (i = 0; i < map->num_stripes; i++)
-+              if (map->stripes[i].dev == scrub_dev)
-+                      break;
-+      if (WARN_ON_ONCE(i == map->num_stripes))
-+              return;
-+      rot = div_u64(full_stripe_start - bg->start, data_stripes) >>
-+            BTRFS_STRIPE_LEN_SHIFT;
-+      physical = map->stripes[i].physical + btrfs_stripe_nr_to_offset(rot);
-+
-+      buf = kmalloc(BTRFS_STRIPE_LEN, GFP_NOFS);
-+      if (!buf)
-+              return;
-+      btrfs_bio_counter_inc_blocked(fs_info);
-+      for_each_set_bitrange(start, end, &bad_rows, nr_sectors) {
-+              const u64 pos = physical +
-+                              ((u64)start << fs_info->sectorsize_bits);
-+              const u32 len = (end - start) << fs_info->sectorsize_bits;
-+              int ret;
-+
-+              ret = bdev_rw_virt(scrub_dev->bdev, pos >> SECTOR_SHIFT, buf,
-+                                 len, REQ_OP_READ);
-+              if (!ret)
-+                      ret = bdev_rw_virt(tgtdev->bdev, pos >> SECTOR_SHIFT,
-+                                         buf, len, REQ_OP_WRITE);
-+              if (ret)
-+                      btrfs_warn_rl(fs_info,
-+"scrub: failed to copy parity of full stripe %llu sectors %u-%u to the replace target: %d",
-+                                    full_stripe_start, start, end - 1, ret);
-+      }
-+      btrfs_bio_counter_dec(fs_info);
-+      kfree(buf);
-+}
-+
- static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
-                                     struct btrfs_device *scrub_dev,
-                                     struct btrfs_block_group *bg,
-@@ -2259,11 +2317,14 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
-                         stripe->nr_sectors);
-       }
- 
-+      if (sctx->is_dev_replace && !bitmap_empty(&bad_rows, nr_sectors))
-+              scrub_raid56_copy_parity_rows(sctx, scrub_dev, bg, map,
-+                                            full_stripe_start, bad_rows);
-+
-       /*
-        * Parity is per row.  Leave the existing P/Q of the bad rows alone
--       * (and, during dev-replace, write nothing for them to the target, as
--       * for the bad sectors of the other profiles), but check and regenerate
--       * the rest.
-+       * (during dev-replace it is copied to the target as it is, above), but
-+       * check and regenerate the rest.
-        */
-       bitmap_andnot(&extent_bitmap, &extent_bitmap, &bad_rows, nr_sectors);
-       if (!bitmap_empty(&extent_bitmap, nr_sectors)) {
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0003-btrfs-scrub-copy-unrepaired-raid56-data-sectors-to-t.patch b/topics/raid56-scrub-replace/0003-btrfs-scrub-copy-unrepaired-raid56-data-sectors-to-t.patch
new file mode 100644 (file)
index 0000000..8d6a3a8
--- /dev/null
@@ -0,0 +1,111 @@
+From e00230459d26e6365c353de0083231d53a82b7da 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
+ the replace target
+To: linux-btrfs@vger.kernel.org
+
+When dev-replace copies a data stripe, it writes only the sectors that
+were read or repaired successfully (flush_scrub_stripes()); sectors that
+could not be repaired are left unwritten on the target.  For mirrored
+profiles that loses nothing: the sector was bad on every copy anyway,
+and the csum keeps reporting it.
+
+RAID56 is different.  The replaced device's data strip is an input to
+every later rebuild of the other strips in its rows: when another device
+of the row fails, its sector is reconstructed from P/Q and the remaining
+data strips, including this one.  An unwritten target sector turns those
+rebuilds into garbage, where the source's sector, even with a bad csum,
+kept the row as consistent as it was.  And as with the parity rows, the
+failure may have been a transient read error, in which case the
+source's bytes are the right data.
+
+For RAID56 block groups only, write the unrepaired data sectors to the
+target verbatim, as they are on the source.  The scrub buffer holds the
+last failed reconstruction attempt for them, not the source's bytes, so
+they are read again from the source.  The copy is best effort: on a read
+or write error it is logged and the replace carries on.  This
+deliberately differs from the good-sectors-only rule of the other
+profiles, for the reason above.
+
+This is an optional improvement: it does not depend on "btrfs: scrub:
+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(+)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 8e4febe466dbc..4e815980c08b5 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -1938,6 +1938,54 @@ static void submit_initial_group_read(struct scrub_ctx *sctx,
+       blk_finish_plug(&plug);
+ }
+ 
++/*
++ * Dev-replace on RAID56: give the replace target the source's bytes for the
++ * data sectors of @stripe that could not be repaired (@bad), instead of
++ * leaving them unwritten as the other profiles do.  A RAID56 data strip is an
++ * input to every rebuild of the other strips in its rows, so an unwritten
++ * target sector would make those rebuilds read garbage.  The stripe buffer
++ * holds the last failed reconstruction attempt for these sectors, not the
++ * source's bytes, so read them again.  Best effort: a failed copy is logged
++ * and the replace goes on.
++ */
++static void scrub_raid56_copy_bad_sectors(struct scrub_ctx *sctx,
++                                        struct scrub_stripe *stripe,
++                                        unsigned long bad)
++{
++      struct btrfs_fs_info *fs_info = sctx->fs_info;
++      struct btrfs_device *tgtdev = sctx->wr_tgtdev;
++      unsigned int start, end;
++      void *buf;
++
++      if (!(stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK) ||
++          bitmap_empty(&bad, stripe->nr_sectors))
++              return;
++      if (!tgtdev || !tgtdev->bdev || !stripe->dev->bdev)
++              return;
++      buf = kmalloc(BTRFS_STRIPE_LEN, GFP_NOFS);
++      if (!buf)
++              return;
++      btrfs_bio_counter_inc_blocked(fs_info);
++      for_each_set_bitrange(start, end, &bad, stripe->nr_sectors) {
++              const u64 off = (u64)start << fs_info->sectorsize_bits;
++              const u64 pos = stripe->physical + off;
++              const u32 len = (end - start) << fs_info->sectorsize_bits;
++              int ret;
++
++              ret = bdev_rw_virt(stripe->dev->bdev, pos >> SECTOR_SHIFT, buf,
++                                 len, REQ_OP_READ);
++              if (!ret)
++                      ret = bdev_rw_virt(tgtdev->bdev, pos >> SECTOR_SHIFT,
++                                         buf, len, REQ_OP_WRITE);
++              if (ret)
++                      btrfs_warn_rl(fs_info,
++"scrub: failed to copy unrepaired sectors at logical %llu to the replace target: %d",
++                                    stripe->logical + off, ret);
++      }
++      btrfs_bio_counter_dec(fs_info);
++      kfree(buf);
++}
++
+ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+ {
+       struct btrfs_fs_info *fs_info = sctx->fs_info;
+@@ -1989,6 +2037,8 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+                       error = scrub_bitmap_read_error(stripe);
+                       bitmap_andnot(&good, &has_extent, &error, stripe->nr_sectors);
+                       scrub_write_sectors(sctx, stripe, good, true);
++                      scrub_raid56_copy_bad_sectors(sctx, stripe,
++                                                    error & has_extent);
+               }
+       }
+ 
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0004-btrfs-scrub-copy-every-sector-of-raid56-data-stripes.patch b/topics/raid56-scrub-replace/0004-btrfs-scrub-copy-every-sector-of-raid56-data-stripes.patch
new file mode 100644 (file)
index 0000000..013c150
--- /dev/null
@@ -0,0 +1,182 @@
+From dcef108c87c970b53ef041811305692649deaac6 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
+ to the replace target
+To: linux-btrfs@vger.kernel.org
+
+Dev-replace copies a data stripe of the source device by writing the
+sectors that hold an extent (flush_scrub_stripes()), and it only visits
+the data stripes that hold at least one extent: queue_scrub_stripe()
+skips the others.  For mirrored profiles that is all that matters.
+
+For RAID56 it is not.  P/Q of a row is computed over every data strip of
+the row, whether or not the strip's sector holds an extent (deleted data,
+never written space, zeroed padding), and every later rebuild of another
+data strip in the row reads the replaced device's sector as an input.
+If the target never got that sector, it holds whatever was there before
+the replace, the rebuild produces wrong bytes, the csum check fails and
+the read returns -EIO.  So replacing any raid56 device, healthy or not,
+silently turns recoverable damage on another device into lost data, and
+leaves the affected rows without redundancy until a full scrub rewrites
+their parity.
+
+For RAID56 block groups, also write the sectors of the data stripe that
+hold no extent and were read without error, and queue the data stripes
+without any extent when another data stripe of their full stripe holds
+one.  The bytes written are the ones the scrub read: the source's
+on-disk bytes, which keep the row as consistent with its P/Q as it was
+on the source even if other strips of the row are bad; or, when the
+source is missing or the user asked to avoid reading it (-r), the
+stripe rebuilt from the other strips.  A rebuilt sector is consistent
+with P/Q by construction, but if another strip of the row is bad at the
+time, the rebuild carries that damage and the bad sector can no longer
+be recovered; that is the price of not reading the source.  Full
+stripes without any extent are still skipped: a later write to one
+computes P/Q from what is on disk at that time.
+
+Measured with a test that fills a 5-device raid5 (raid1 metadata) with
+partially filled full stripes, corrupts two devices in different rows
+and then replaces one of them, or a healthy device, without reading
+anything first: each replace left 5400-6700 of these sectors unwritten
+on the target, and 1028-1237 blocks that were recoverable before the
+replace returned -EIO after it (667-1302 when some rows were also
+damaged on both devices), on both a misc-next and a 6.18 based tree,
+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(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 4e815980c08b5..f064acbd7a8ef 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -1325,8 +1325,13 @@ static void scrub_write_sectors(struct scrub_ctx *sctx, struct scrub_stripe *str
+       int sector_nr;
+ 
+       for_each_set_bit(sector_nr, &write_bitmap, stripe->nr_sectors) {
+-              /* We should only writeback sectors covered by an extent. */
+-              ASSERT(scrub_bitmap_test_bit_has_extent(stripe, sector_nr));
++              /*
++               * We should only writeback sectors covered by an extent, except
++               * for RAID56 dev-replace, see flush_scrub_stripes().
++               */
++              ASSERT(scrub_bitmap_test_bit_has_extent(stripe, sector_nr) ||
++                     (dev_replace &&
++                      (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)));
+ 
+               /* Cannot merge with previous sector, submit the current one. */
+               if (bbio && sector_nr && !test_bit(sector_nr - 1, &write_bitmap)) {
+@@ -1986,6 +1991,30 @@ static void scrub_raid56_copy_bad_sectors(struct scrub_ctx *sctx,
+       kfree(buf);
+ }
+ 
++/*
++ * Dev-replace on RAID56: the sectors of @stripe without an extent are inputs
++ * to the P/Q of their rows too, and the other data stripes of those rows rely
++ * on that P/Q.  The replace target must hold the same bytes, or a later
++ * rebuild of another stripe from the target would be wrong.
++ *
++ * Return those sectors whose content in the stripe buffer can be copied: read
++ * from the source device, or rebuilt from the other stripes if the source is
++ * missing, is to be avoided, or failed to read.
++ */
++static unsigned long scrub_raid56_unused_sectors(struct scrub_stripe *stripe)
++{
++      struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
++      const unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits;
++      const unsigned long has_extent = scrub_bitmap_read_has_extent(stripe);
++      const unsigned long io_error = scrub_bitmap_read_io_error(stripe);
++      unsigned long unused = 0;
++
++      bitmap_set(&unused, 0, nr_sectors);
++      bitmap_andnot(&unused, &unused, &has_extent, nr_sectors);
++      bitmap_andnot(&unused, &unused, &io_error, nr_sectors);
++      return unused;
++}
++
+ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+ {
+       struct btrfs_fs_info *fs_info = sctx->fs_info;
+@@ -2036,6 +2065,8 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+                       has_extent = scrub_bitmap_read_has_extent(stripe);
+                       error = scrub_bitmap_read_error(stripe);
+                       bitmap_andnot(&good, &has_extent, &error, stripe->nr_sectors);
++                      if (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)
++                              good |= scrub_raid56_unused_sectors(stripe);
+                       scrub_write_sectors(sctx, stripe, good, true);
+                       scrub_raid56_copy_bad_sectors(sctx, stripe,
+                                                     error & has_extent);
+@@ -2062,6 +2093,54 @@ static void raid56_scrub_wait_endio(struct bio *bio)
+       complete(bio->bi_private);
+ }
+ 
++/*
++ * Dev-replace on RAID56: set up @stripe, a data stripe of the source device
++ * that has no extent, to be copied to the target anyway if another data stripe
++ * of its full stripe has one, see scrub_raid56_unused_sectors().
++ *
++ * Return 0 if @stripe is set up, >0 if there is nothing to copy, <0 on error.
++ */
++static int scrub_raid56_fill_unused_stripe(struct scrub_ctx *sctx,
++                                         struct btrfs_block_group *bg,
++                                         struct btrfs_device *dev, u64 physical,
++                                         int mirror_num, u64 logical,
++                                         u32 length, struct scrub_stripe *stripe)
++{
++      struct btrfs_fs_info *fs_info = bg->fs_info;
++      struct btrfs_root *extent_root = btrfs_extent_root(fs_info, bg->start);
++      BTRFS_PATH_AUTO_RELEASE(path);
++      u64 full_stripe_start;
++      int ret;
++
++      if (!sctx->is_dev_replace ||
++          !(bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK))
++              return 1;
++      /* RAID56 data stripes are queued one whole stripe at a time. */
++      if (WARN_ON_ONCE(!IS_ALIGNED(logical - bg->start, stripe->stripe_len) ||
++                       length != stripe->stripe_len))
++              return 1;
++
++      full_stripe_start = bg->start +
++                          div_u64(logical - bg->start, bg->full_stripe_len) *
++                          bg->full_stripe_len;
++      path.search_commit_root = true;
++      path.skip_locking = true;
++      ret = find_first_extent_item(extent_root, &path, full_stripe_start,
++                                   bg->full_stripe_len);
++      if (ret)
++              return ret;
++
++      stripe->logical = logical;
++      stripe->physical = physical;
++      stripe->dev = dev;
++      stripe->bg = bg;
++      stripe->mirror_num = mirror_num;
++      /* No extent here, nothing to report. */
++      set_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state);
++      set_bit(SCRUB_STRIPE_FLAG_INITIALIZED, &stripe->state);
++      return 0;
++}
++
+ static int queue_scrub_stripe(struct scrub_ctx *sctx, struct btrfs_block_group *bg,
+                             struct btrfs_device *dev, int mirror_num,
+                             u64 logical, u32 length, u64 physical,
+@@ -2084,6 +2163,10 @@ static int queue_scrub_stripe(struct scrub_ctx *sctx, struct btrfs_block_group *
+       ret = scrub_find_fill_first_stripe(bg, &sctx->extent_path,
+                                          &sctx->csum_path, dev, physical,
+                                          mirror_num, logical, length, stripe);
++      if (ret > 0)
++              ret = scrub_raid56_fill_unused_stripe(sctx, bg, dev, physical,
++                                                    mirror_num, logical,
++                                                    length, stripe);
+       /* Either >0 as no more extents or <0 for error. */
+       if (ret)
+               return ret;
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0004-btrfs-scrub-copy-unrepaired-raid56-data-sectors-to-t.patch b/topics/raid56-scrub-replace/0004-btrfs-scrub-copy-unrepaired-raid56-data-sectors-to-t.patch
deleted file mode 100644 (file)
index a6002ce..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-From a2f3c61ffd00b724c66a9a3e7b28af23bcaee0e4 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 04/13] btrfs: scrub: copy unrepaired raid56 data sectors to
- the replace target
-To: linux-btrfs@vger.kernel.org
-
-When dev-replace copies a data stripe, it writes only the sectors that
-were read or repaired successfully (flush_scrub_stripes()); sectors that
-could not be repaired are left unwritten on the target.  For mirrored
-profiles that loses nothing: the sector was bad on every copy anyway,
-and the csum keeps reporting it.
-
-RAID56 is different.  The replaced device's data strip is an input to
-every later rebuild of the other strips in its rows: when another device
-of the row fails, its sector is reconstructed from P/Q and the remaining
-data strips, including this one.  An unwritten target sector turns those
-rebuilds into garbage, where the source's sector, even with a bad csum,
-kept the row as consistent as it was.  And as with the parity rows, the
-failure may have been a transient read error, in which case the
-source's bytes are the right data.
-
-For RAID56 block groups only, write the unrepaired data sectors to the
-target verbatim, as they are on the source.  The scrub buffer holds the
-last failed reconstruction attempt for them, not the source's bytes, so
-they are read again from the source.  The copy is best effort: on a read
-or write error it is logged and the replace carries on.  This
-deliberately differs from the good-sectors-only rule of the other
-profiles, for the reason above.
-
-This is an optional improvement: it does not depend on "btrfs: scrub:
-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(+)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 9cfa426b40ff9..938e9b3d0ebd4 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -1922,6 +1922,54 @@ static void submit_initial_group_read(struct scrub_ctx *sctx,
-       blk_finish_plug(&plug);
- }
- 
-+/*
-+ * Dev-replace on RAID56: give the replace target the source's bytes for the
-+ * data sectors of @stripe that could not be repaired (@bad), instead of
-+ * leaving them unwritten as the other profiles do.  A RAID56 data strip is an
-+ * input to every rebuild of the other strips in its rows, so an unwritten
-+ * target sector would make those rebuilds read garbage.  The stripe buffer
-+ * holds the last failed reconstruction attempt for these sectors, not the
-+ * source's bytes, so read them again.  Best effort: a failed copy is logged
-+ * and the replace goes on.
-+ */
-+static void scrub_raid56_copy_bad_sectors(struct scrub_ctx *sctx,
-+                                        struct scrub_stripe *stripe,
-+                                        unsigned long bad)
-+{
-+      struct btrfs_fs_info *fs_info = sctx->fs_info;
-+      struct btrfs_device *tgtdev = sctx->wr_tgtdev;
-+      unsigned int start, end;
-+      void *buf;
-+
-+      if (!(stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK) ||
-+          bitmap_empty(&bad, stripe->nr_sectors))
-+              return;
-+      if (!tgtdev || !tgtdev->bdev || !stripe->dev->bdev)
-+              return;
-+      buf = kmalloc(BTRFS_STRIPE_LEN, GFP_NOFS);
-+      if (!buf)
-+              return;
-+      btrfs_bio_counter_inc_blocked(fs_info);
-+      for_each_set_bitrange(start, end, &bad, stripe->nr_sectors) {
-+              const u64 off = (u64)start << fs_info->sectorsize_bits;
-+              const u64 pos = stripe->physical + off;
-+              const u32 len = (end - start) << fs_info->sectorsize_bits;
-+              int ret;
-+
-+              ret = bdev_rw_virt(stripe->dev->bdev, pos >> SECTOR_SHIFT, buf,
-+                                 len, REQ_OP_READ);
-+              if (!ret)
-+                      ret = bdev_rw_virt(tgtdev->bdev, pos >> SECTOR_SHIFT,
-+                                         buf, len, REQ_OP_WRITE);
-+              if (ret)
-+                      btrfs_warn_rl(fs_info,
-+"scrub: failed to copy unrepaired sectors at logical %llu to the replace target: %d",
-+                                    stripe->logical + off, ret);
-+      }
-+      btrfs_bio_counter_dec(fs_info);
-+      kfree(buf);
-+}
-+
- static int flush_scrub_stripes(struct scrub_ctx *sctx)
- {
-       struct btrfs_fs_info *fs_info = sctx->fs_info;
-@@ -1973,6 +2021,8 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
-                       error = scrub_bitmap_read_error(stripe);
-                       bitmap_andnot(&good, &has_extent, &error, stripe->nr_sectors);
-                       scrub_write_sectors(sctx, stripe, good, true);
-+                      scrub_raid56_copy_bad_sectors(sctx, stripe,
-+                                                    error & has_extent);
-               }
-       }
- 
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0005-btrfs-scrub-copy-every-sector-of-raid56-data-stripes.patch b/topics/raid56-scrub-replace/0005-btrfs-scrub-copy-every-sector-of-raid56-data-stripes.patch
deleted file mode 100644 (file)
index 92e897c..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-From 8a2a9c58e862444eb6dedaf3198c3241f525e031 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/13] btrfs: scrub: copy every sector of raid56 data stripes
- to the replace target
-To: linux-btrfs@vger.kernel.org
-
-Dev-replace copies a data stripe of the source device by writing the
-sectors that hold an extent (flush_scrub_stripes()), and it only visits
-the data stripes that hold at least one extent: queue_scrub_stripe()
-skips the others.  For mirrored profiles that is all that matters.
-
-For RAID56 it is not.  P/Q of a row is computed over every data strip of
-the row, whether or not the strip's sector holds an extent (deleted data,
-never written space, zeroed padding), and every later rebuild of another
-data strip in the row reads the replaced device's sector as an input.
-If the target never got that sector, it holds whatever was there before
-the replace, the rebuild produces wrong bytes, the csum check fails and
-the read returns -EIO.  So replacing any raid56 device, healthy or not,
-silently turns recoverable damage on another device into lost data, and
-leaves the affected rows without redundancy until a full scrub rewrites
-their parity.
-
-For RAID56 block groups, also write the sectors of the data stripe that
-hold no extent and were read without error, and queue the data stripes
-without any extent when another data stripe of their full stripe holds
-one.  The bytes written are the ones the scrub read: the source's
-on-disk bytes, which keep the row as consistent with its P/Q as it was
-on the source even if other strips of the row are bad; or, when the
-source is missing or the user asked to avoid reading it (-r), the
-stripe rebuilt from the other strips.  A rebuilt sector is consistent
-with P/Q by construction, but if another strip of the row is bad at the
-time, the rebuild carries that damage and the bad sector can no longer
-be recovered; that is the price of not reading the source.  Full
-stripes without any extent are still skipped: a later write to one
-computes P/Q from what is on disk at that time.
-
-Measured with a test that fills a 5-device raid5 (raid1 metadata) with
-partially filled full stripes, corrupts two devices in different rows
-and then replaces one of them, or a healthy device, without reading
-anything first: each replace left 5400-6700 of these sectors unwritten
-on the target, and 1028-1237 blocks that were recoverable before the
-replace returned -EIO after it (667-1302 when some rows were also
-damaged on both devices), on both a misc-next and a 6.18 based tree,
-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(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 938e9b3d0ebd4..fbef0eec7f41d 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -1317,8 +1317,13 @@ static void scrub_write_sectors(struct scrub_ctx *sctx, struct scrub_stripe *str
-       int sector_nr;
- 
-       for_each_set_bit(sector_nr, &write_bitmap, stripe->nr_sectors) {
--              /* We should only writeback sectors covered by an extent. */
--              ASSERT(scrub_bitmap_test_bit_has_extent(stripe, sector_nr));
-+              /*
-+               * We should only writeback sectors covered by an extent, except
-+               * for RAID56 dev-replace, see flush_scrub_stripes().
-+               */
-+              ASSERT(scrub_bitmap_test_bit_has_extent(stripe, sector_nr) ||
-+                     (dev_replace &&
-+                      (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)));
- 
-               /* Cannot merge with previous sector, submit the current one. */
-               if (bbio && sector_nr && !test_bit(sector_nr - 1, &write_bitmap)) {
-@@ -1970,6 +1975,30 @@ static void scrub_raid56_copy_bad_sectors(struct scrub_ctx *sctx,
-       kfree(buf);
- }
- 
-+/*
-+ * Dev-replace on RAID56: the sectors of @stripe without an extent are inputs
-+ * to the P/Q of their rows too, and the other data stripes of those rows rely
-+ * on that P/Q.  The replace target must hold the same bytes, or a later
-+ * rebuild of another stripe from the target would be wrong.
-+ *
-+ * Return those sectors whose content in the stripe buffer can be copied: read
-+ * from the source device, or rebuilt from the other stripes if the source is
-+ * missing, is to be avoided, or failed to read.
-+ */
-+static unsigned long scrub_raid56_unused_sectors(struct scrub_stripe *stripe)
-+{
-+      struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
-+      const unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits;
-+      const unsigned long has_extent = scrub_bitmap_read_has_extent(stripe);
-+      const unsigned long io_error = scrub_bitmap_read_io_error(stripe);
-+      unsigned long unused = 0;
-+
-+      bitmap_set(&unused, 0, nr_sectors);
-+      bitmap_andnot(&unused, &unused, &has_extent, nr_sectors);
-+      bitmap_andnot(&unused, &unused, &io_error, nr_sectors);
-+      return unused;
-+}
-+
- static int flush_scrub_stripes(struct scrub_ctx *sctx)
- {
-       struct btrfs_fs_info *fs_info = sctx->fs_info;
-@@ -2020,6 +2049,8 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
-                       has_extent = scrub_bitmap_read_has_extent(stripe);
-                       error = scrub_bitmap_read_error(stripe);
-                       bitmap_andnot(&good, &has_extent, &error, stripe->nr_sectors);
-+                      if (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)
-+                              good |= scrub_raid56_unused_sectors(stripe);
-                       scrub_write_sectors(sctx, stripe, good, true);
-                       scrub_raid56_copy_bad_sectors(sctx, stripe,
-                                                     error & has_extent);
-@@ -2046,6 +2077,54 @@ static void raid56_scrub_wait_endio(struct bio *bio)
-       complete(bio->bi_private);
- }
- 
-+/*
-+ * Dev-replace on RAID56: set up @stripe, a data stripe of the source device
-+ * that has no extent, to be copied to the target anyway if another data stripe
-+ * of its full stripe has one, see scrub_raid56_unused_sectors().
-+ *
-+ * Return 0 if @stripe is set up, >0 if there is nothing to copy, <0 on error.
-+ */
-+static int scrub_raid56_fill_unused_stripe(struct scrub_ctx *sctx,
-+                                         struct btrfs_block_group *bg,
-+                                         struct btrfs_device *dev, u64 physical,
-+                                         int mirror_num, u64 logical,
-+                                         u32 length, struct scrub_stripe *stripe)
-+{
-+      struct btrfs_fs_info *fs_info = bg->fs_info;
-+      struct btrfs_root *extent_root = btrfs_extent_root(fs_info, bg->start);
-+      BTRFS_PATH_AUTO_RELEASE(path);
-+      u64 full_stripe_start;
-+      int ret;
-+
-+      if (!sctx->is_dev_replace ||
-+          !(bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK))
-+              return 1;
-+      /* RAID56 data stripes are queued one whole stripe at a time. */
-+      if (WARN_ON_ONCE(!IS_ALIGNED(logical - bg->start, BTRFS_STRIPE_LEN) ||
-+                       length != BTRFS_STRIPE_LEN))
-+              return 1;
-+
-+      full_stripe_start = bg->start +
-+                          div_u64(logical - bg->start, bg->full_stripe_len) *
-+                          bg->full_stripe_len;
-+      path.search_commit_root = true;
-+      path.skip_locking = true;
-+      ret = find_first_extent_item(extent_root, &path, full_stripe_start,
-+                                   bg->full_stripe_len);
-+      if (ret)
-+              return ret;
-+
-+      stripe->logical = logical;
-+      stripe->physical = physical;
-+      stripe->dev = dev;
-+      stripe->bg = bg;
-+      stripe->mirror_num = mirror_num;
-+      /* No extent here, nothing to report. */
-+      set_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state);
-+      set_bit(SCRUB_STRIPE_FLAG_INITIALIZED, &stripe->state);
-+      return 0;
-+}
-+
- static int queue_scrub_stripe(struct scrub_ctx *sctx, struct btrfs_block_group *bg,
-                             struct btrfs_device *dev, int mirror_num,
-                             u64 logical, u32 length, u64 physical,
-@@ -2068,6 +2147,10 @@ static int queue_scrub_stripe(struct scrub_ctx *sctx, struct btrfs_block_group *
-       ret = scrub_find_fill_first_stripe(bg, &sctx->extent_path,
-                                          &sctx->csum_path, dev, physical,
-                                          mirror_num, logical, length, stripe);
-+      if (ret > 0)
-+              ret = scrub_raid56_fill_unused_stripe(sctx, bg, dev, physical,
-+                                                    mirror_num, logical,
-+                                                    length, stripe);
-       /* Either >0 as no more extents or <0 for error. */
-       if (ret)
-               return ret;
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0005-btrfs-scrub-only-avoid-the-replace-source-device-for.patch b/topics/raid56-scrub-replace/0005-btrfs-scrub-only-avoid-the-replace-source-device-for.patch
new file mode 100644 (file)
index 0000000..8bc10b3
--- /dev/null
@@ -0,0 +1,88 @@
+From c9a6389239a4e644ea9e2eda4be889f9050196f2 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
+ its own stripes
+To: linux-btrfs@vger.kernel.org
+
+With cont_reading_from_srcdev_mode AVOID (btrfs replace start -r),
+scrub_submit_initial_read() reads a stripe through the next mirror
+instead of directly.  In the data path that is right: the stripes there
+are on the source device.  But the RAID56 parity scrub
+(scrub_raid56_parity_stripe(), which runs when the source holds P or Q
+of a full stripe) reads the data stripes of all the other devices
+through the same function, and for RAID56 the next mirror of a data
+stripe is a rebuild of it from P/Q and the other data stripes, which
+reads the source's P, the device the user asked to avoid.
+
+The rebuilt bytes are verified only where the stripe has an extent with
+a csum.  Everywhere else the scrub buffer keeps them, and
+scrub_raid56_cached_parity() hands them to the parity rbio as the data,
+so finish_parity_scrub() does not check P/Q against the data on disk:
+
+ - where a sector without an extent was rebuilt from P, the recomputed
+   P equals the on-disk P by construction, so bad P passes the check and
+   is duplicated to the replace target as it is;
+
+ - where another data stripe's sector is bad, the rebuilt sectors carry
+   that damage, the recomputed P (P ^ bad ^ good) differs from the
+   on-disk P and is written to the source and the target, baking the bad
+   data into parity: the bad sector, recoverable before the replace, is
+   lost.
+
+Apply the AVOID mode only to the stripes on the source device.  A
+missing device is still read through the next mirror, whichever device
+it is.
+
+The parity scrub has read the other devices' data stripes this way since
+1009254bf22a ("btrfs: scrub: use scrub_stripe to implement RAID56 P/Q
+scrub"), and has used the scrub buffers as the parity rbio's data since
+94ead93e6375 ("btrfs: scrub: use recovered data stripes as cache to
+avoid unnecessary read").
+
+In the test described in "btrfs: scrub: copy every sector of raid56 data
+stripes to the replace target", replaces with -r recomputed 184-362
+parity sectors over another device's bad data and copied about twice as
+many bad parity sectors verbatim to the target as replaces without -r
+(1453-1600 instead of 623-712).  With this change -r recomputes none
+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(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index f064acbd7a8ef..c547379692ac5 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -1886,12 +1886,21 @@ static void scrub_submit_initial_read(struct scrub_ctx *sctx,
+       atomic_inc(&stripe->pending_io);
+ 
+       /*
+-       * For dev-replace, either user asks to avoid the source dev, or
+-       * the device is missing, we try the next mirror instead.
++       * For dev-replace, either user asks to avoid the source dev and this
++       * stripe is on it, or the device is missing, we try the next mirror
++       * instead.
++       *
++       * The RAID56 parity scrub reads the data stripes of the other devices
++       * here too.  Those must be read directly: for RAID56 the next mirror
++       * is a rebuild from the parity that is about to be checked, and the
++       * data sectors without an extent are not verified, so a rebuild would
++       * make the check pass on bad parity, or write parity computed from
++       * another stripe's bad data.
+        */
+       if (sctx->is_dev_replace &&
+-          (fs_info->dev_replace.cont_reading_from_srcdev_mode ==
+-           BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID ||
++          ((fs_info->dev_replace.cont_reading_from_srcdev_mode ==
++            BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID &&
++            stripe->dev == fs_info->dev_replace.srcdev) ||
+            !stripe->dev->bdev)) {
+               int num_copies = btrfs_num_copies(fs_info, stripe->bg->start,
+                                                 stripe->bg->length);
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0006-btrfs-scrub-only-avoid-the-replace-source-device-for.patch b/topics/raid56-scrub-replace/0006-btrfs-scrub-only-avoid-the-replace-source-device-for.patch
deleted file mode 100644 (file)
index bbed28c..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-From 979b9e694a567841b7acdb09358c7e056f0325ac 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 06/13] btrfs: scrub: only avoid the replace source device for
- its own stripes
-To: linux-btrfs@vger.kernel.org
-
-With cont_reading_from_srcdev_mode AVOID (btrfs replace start -r),
-scrub_submit_initial_read() reads a stripe through the next mirror
-instead of directly.  In the data path that is right: the stripes there
-are on the source device.  But the RAID56 parity scrub
-(scrub_raid56_parity_stripe(), which runs when the source holds P or Q
-of a full stripe) reads the data stripes of all the other devices
-through the same function, and for RAID56 the next mirror of a data
-stripe is a rebuild of it from P/Q and the other data stripes, which
-reads the source's P, the device the user asked to avoid.
-
-The rebuilt bytes are verified only where the stripe has an extent with
-a csum.  Everywhere else the scrub buffer keeps them, and
-scrub_raid56_cached_parity() hands them to the parity rbio as the data,
-so finish_parity_scrub() does not check P/Q against the data on disk:
-
- - where a sector without an extent was rebuilt from P, the recomputed
-   P equals the on-disk P by construction, so bad P passes the check and
-   is duplicated to the replace target as it is;
-
- - where another data stripe's sector is bad, the rebuilt sectors carry
-   that damage, the recomputed P (P ^ bad ^ good) differs from the
-   on-disk P and is written to the source and the target, baking the bad
-   data into parity: the bad sector, recoverable before the replace, is
-   lost.
-
-Apply the AVOID mode only to the stripes on the source device.  A
-missing device is still read through the next mirror, whichever device
-it is.
-
-The parity scrub has read the other devices' data stripes this way since
-1009254bf22a ("btrfs: scrub: use scrub_stripe to implement RAID56 P/Q
-scrub"), and has used the scrub buffers as the parity rbio's data since
-94ead93e6375 ("btrfs: scrub: use recovered data stripes as cache to
-avoid unnecessary read").
-
-In the test described in "btrfs: scrub: copy every sector of raid56 data
-stripes to the replace target", replaces with -r recomputed 184-362
-parity sectors over another device's bad data and copied about twice as
-many bad parity sectors verbatim to the target as replaces without -r
-(1453-1600 instead of 623-712).  With this change -r recomputes none
-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(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index fbef0eec7f41d..6d6de0c55beb6 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -1871,12 +1871,21 @@ static void scrub_submit_initial_read(struct scrub_ctx *sctx,
-       atomic_inc(&stripe->pending_io);
- 
-       /*
--       * For dev-replace, either user asks to avoid the source dev, or
--       * the device is missing, we try the next mirror instead.
-+       * For dev-replace, either user asks to avoid the source dev and this
-+       * stripe is on it, or the device is missing, we try the next mirror
-+       * instead.
-+       *
-+       * The RAID56 parity scrub reads the data stripes of the other devices
-+       * here too.  Those must be read directly: for RAID56 the next mirror
-+       * is a rebuild from the parity that is about to be checked, and the
-+       * data sectors without an extent are not verified, so a rebuild would
-+       * make the check pass on bad parity, or write parity computed from
-+       * another stripe's bad data.
-        */
-       if (sctx->is_dev_replace &&
--          (fs_info->dev_replace.cont_reading_from_srcdev_mode ==
--           BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID ||
-+          ((fs_info->dev_replace.cont_reading_from_srcdev_mode ==
-+            BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID &&
-+            stripe->dev == fs_info->dev_replace.srcdev) ||
-            !stripe->dev->bdev)) {
-               int num_copies = btrfs_num_copies(fs_info, stripe->bg->start,
-                                                 stripe->bg->length);
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0006-btrfs-scrub-read-raid56-sectors-without-an-extent-fr.patch b/topics/raid56-scrub-replace/0006-btrfs-scrub-read-raid56-sectors-without-an-extent-fr.patch
new file mode 100644 (file)
index 0000000..1fdcf58
--- /dev/null
@@ -0,0 +1,114 @@
+From 7105ab505bd11a8cd4f75957efee33652ea27cc7 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
+ from the replace source
+To: linux-btrfs@vger.kernel.org
+
+With -r (cont_reading_from_srcdev_mode AVOID), dev-replace reads the
+data stripes of the source device through the next mirror, which for
+RAID56 is a rebuild from the other stripes of the row.  Where the stripe
+has an extent, the rebuilt bytes are checked against the csum, and if
+they are wrong the repair reads the source after all.  "btrfs: scrub:
+copy every sector of raid56 data stripes to the replace target" also
+copies the sectors without an extent, and nothing checks their rebuild:
+if another stripe of the row is bad at that sector, the rebuild carries
+the damage, the target's sector no longer matches what P/Q was computed
+over, and the other device's bad sector, recoverable before the replace,
+is lost.
+
+Read those sectors from the source when it is present, which keeps every
+row exactly as recoverable as it was on the source, and keep the rebuilt
+bytes only where that read fails or the source is missing.  This reads
+the source for sectors that hold no data although the user asked to
+avoid it, but -r is documented as reading the source only when no other
+zero-defect mirror exists, and the rebuild of a sector without a csum
+cannot be shown to be one.
+
+It is a separate change so it can be dropped if reading the source here
+is not wanted; without it, a replace with -r can lose blocks that were
+recoverable before it.
+
+In the test described in "btrfs: scrub: copy every sector of raid56 data
+stripes to the replace target", replaces with -r lost 682-878
+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(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index c547379692ac5..9fe5c83c8273a 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -2024,6 +2024,49 @@ static unsigned long scrub_raid56_unused_sectors(struct scrub_stripe *stripe)
+       return unused;
+ }
+ 
++/*
++ * Dev-replace on RAID56 avoiding the source device (-r): the stripe buffer
++ * holds the source's data stripe rebuilt from the other stripes.  Where the
++ * stripe has an extent the rebuild is verified and replaced by the source's
++ * bytes if wrong, but nothing can verify it where there is no extent, and if
++ * another stripe of the row is bad there, the rebuild carries that damage:
++ * copied to the target, it would make the bad sector unrecoverable.  The
++ * source's bytes keep the row as recoverable as it was, so read the sectors
++ * without an extent from the source after all, and keep the rebuilt bytes
++ * only where that read fails.
++ */
++static void scrub_raid56_read_unused_from_srcdev(struct scrub_stripe *stripe)
++{
++      struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
++      const unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits;
++      unsigned long unused = 0;
++      unsigned long has_extent = scrub_bitmap_read_has_extent(stripe);
++      unsigned int start, end;
++      void *buf;
++
++      bitmap_set(&unused, 0, nr_sectors);
++      bitmap_andnot(&unused, &unused, &has_extent, nr_sectors);
++      if (bitmap_empty(&unused, nr_sectors))
++              return;
++      buf = kmalloc(BTRFS_STRIPE_LEN, GFP_NOFS);
++      if (!buf)
++              return;
++      btrfs_bio_counter_inc_blocked(fs_info);
++      for_each_set_bitrange(start, end, &unused, nr_sectors) {
++              const u32 off = start << fs_info->sectorsize_bits;
++              const u32 len = (end - start) << fs_info->sectorsize_bits;
++
++              if (bdev_rw_virt(stripe->dev->bdev,
++                               (stripe->physical + off) >> SECTOR_SHIFT, buf,
++                               len, REQ_OP_READ))
++                      continue;
++              memcpy(stripe->buffer + off, buf, len);
++              scrub_bitmap_clear_io_error(stripe, start, end - start);
++      }
++      btrfs_bio_counter_dec(fs_info);
++      kfree(buf);
++}
++
+ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+ {
+       struct btrfs_fs_info *fs_info = sctx->fs_info;
+@@ -2074,8 +2117,13 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+                       has_extent = scrub_bitmap_read_has_extent(stripe);
+                       error = scrub_bitmap_read_error(stripe);
+                       bitmap_andnot(&good, &has_extent, &error, stripe->nr_sectors);
+-                      if (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)
++                      if (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK) {
++                              if (fs_info->dev_replace.cont_reading_from_srcdev_mode ==
++                                  BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID &&
++                                  stripe->dev->bdev)
++                                      scrub_raid56_read_unused_from_srcdev(stripe);
+                               good |= scrub_raid56_unused_sectors(stripe);
++                      }
+                       scrub_write_sectors(sctx, stripe, good, true);
+                       scrub_raid56_copy_bad_sectors(sctx, stripe,
+                                                     error & has_extent);
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0007-btrfs-don-t-abort-raid56-data-scrub-on-first-uncorre.patch b/topics/raid56-scrub-replace/0007-btrfs-don-t-abort-raid56-data-scrub-on-first-uncorre.patch
new file mode 100644 (file)
index 0000000..860ce5a
--- /dev/null
@@ -0,0 +1,88 @@
+From 9ed90b2065e4fbdc968ccb96244178ef22c461b8 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
+ uncorrectable sector
+To: linux-btrfs@vger.kernel.org
+
+In commit 1009254bf22a ("btrfs: scrub: use scrub_stripe to implement
+RAID56 P/Q scrub") a new function scrub_raid56_parity_stripe() was
+introduced to recalculate the parity stripe after correcting any
+correctable errors.  When it detected unrepaired sectors in a data
+stripe, it returned -EIO, which propagated up the stack through
+scrub_stripe, scrub_chunk, and scrub_enumerate_chunks, where an error
+makes the scrub of that device break out of its loop early and return
+the error to userspace.  Every device holding P or Q for an affected
+full stripe stops there, and parity rotates, so a few bad full stripes
+stop the scrub of most of the array.
+
+That was a regression:  uncorrectable data blocks are one of the
+expected possible events that occur during a scrub, so scrub should
+continue until it has counted and reported all of the uncorrectable
+stripes in the filesystem.  Perhaps more importantly, scrub should fix
+up any correctable errors that might exist in other stripes beyond the
+first uncorrectable stripe.  No other profile does this: their scrubs
+count uncorrectable sectors, report them and carry on, returning 0.
+Errors from this function are only appropriate when scrub cannot do its
+job at all:  unable to read csums, unable to map an extent's data
+blocks, or out of memory.
+
+Since commit fab0c0f03cfd ("btrfs: introduce BTRFS_PATH_AUTO_RELEASE()
+helper") the bug had changed shape:  ret no longer held -EIO at that
+point but the leftover return value of the last
+scrub_find_fill_first_stripe() call, 0 or 1.  1 made scrub_stripe()
+silently stop scrubbing the rest of the block group on that device, and
+0 let the scrub continue only by accident, until "btrfs: scrub: fix lost
+error return value when scrubbing raid56 parity stripe" restored the
+-EIO.
+
+scrub_raid56_parity_stripe() has successfully completed its task once it
+has performed its data correction and verification steps and checked P/Q
+of the rows without unrepaired sectors.  Return 0 at that point,
+regardless of the outcome of the verification.  P/Q of the rows with
+unrepaired sectors is still not regenerated, so no garbage is written
+back to the devices, and during dev-replace their original P/Q is copied
+to the target ("btrfs: scrub: copy raid56 parity of unrepairable rows to
+the replace target"), so a replace that now carries on past them does
+not lose their redundancy.  The unrepaired sectors are logged, and
+counted in the scrub statistics (and, since v6.16, the device stats)
+when their own data device is scrubbed; they are not reported through
+the return code of the scrub ioctl.
+
+Fixes: 1009254bf22a ("btrfs: scrub: use scrub_stripe to implement RAID56 P/Q scrub")
+Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+---
+ fs/btrfs/scrub.c | 16 +++++-----------
+ 1 file changed, 5 insertions(+), 11 deletions(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 9fe5c83c8273a..89067b08106d2 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -2536,18 +2536,12 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+        * check and regenerate the rest.
+        */
+       bitmap_andnot(&extent_bitmap, &extent_bitmap, &bad_rows, nr_sectors);
+-      if (!bitmap_empty(&extent_bitmap, nr_sectors)) {
+-              /* Now we can check and regenerate the P/Q stripe. */
+-              ret = scrub_raid56_cached_parity(sctx, scrub_dev, map,
+-                                               full_stripe_start, &extent_bitmap);
+-              if (ret)
+-                      return ret;
+-      }
++      if (bitmap_empty(&extent_bitmap, nr_sectors))
++              return 0;
+ 
+-      /* The unrepaired data sectors still fail the scrub. */
+-      if (!bitmap_empty(&bad_rows, nr_sectors))
+-              return -EIO;
+-      return 0;
++      /* Now we can check and regenerate the P/Q stripe. */
++      return scrub_raid56_cached_parity(sctx, scrub_dev, map, full_stripe_start,
++                                        &extent_bitmap);
+ }
+ 
+ /*
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0007-btrfs-scrub-read-raid56-sectors-without-an-extent-fr.patch b/topics/raid56-scrub-replace/0007-btrfs-scrub-read-raid56-sectors-without-an-extent-fr.patch
deleted file mode 100644 (file)
index f3c8563..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-From 31a9785c46bf8c3c7c66b1c0dc40b42511ce5923 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 07/13] btrfs: scrub: read raid56 sectors without an extent
- from the replace source
-To: linux-btrfs@vger.kernel.org
-
-With -r (cont_reading_from_srcdev_mode AVOID), dev-replace reads the
-data stripes of the source device through the next mirror, which for
-RAID56 is a rebuild from the other stripes of the row.  Where the stripe
-has an extent, the rebuilt bytes are checked against the csum, and if
-they are wrong the repair reads the source after all.  "btrfs: scrub:
-copy every sector of raid56 data stripes to the replace target" also
-copies the sectors without an extent, and nothing checks their rebuild:
-if another stripe of the row is bad at that sector, the rebuild carries
-the damage, the target's sector no longer matches what P/Q was computed
-over, and the other device's bad sector, recoverable before the replace,
-is lost.
-
-Read those sectors from the source when it is present, which keeps every
-row exactly as recoverable as it was on the source, and keep the rebuilt
-bytes only where that read fails or the source is missing.  This reads
-the source for sectors that hold no data although the user asked to
-avoid it, but -r is documented as reading the source only when no other
-zero-defect mirror exists, and the rebuild of a sector without a csum
-cannot be shown to be one.
-
-It is a separate change so it can be dropped if reading the source here
-is not wanted; without it, a replace with -r can lose blocks that were
-recoverable before it.
-
-In the test described in "btrfs: scrub: copy every sector of raid56 data
-stripes to the replace target", replaces with -r lost 682-878
-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(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 6d6de0c55beb6..200fc471748df 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -2008,6 +2008,49 @@ static unsigned long scrub_raid56_unused_sectors(struct scrub_stripe *stripe)
-       return unused;
- }
- 
-+/*
-+ * Dev-replace on RAID56 avoiding the source device (-r): the stripe buffer
-+ * holds the source's data stripe rebuilt from the other stripes.  Where the
-+ * stripe has an extent the rebuild is verified and replaced by the source's
-+ * bytes if wrong, but nothing can verify it where there is no extent, and if
-+ * another stripe of the row is bad there, the rebuild carries that damage:
-+ * copied to the target, it would make the bad sector unrecoverable.  The
-+ * source's bytes keep the row as recoverable as it was, so read the sectors
-+ * without an extent from the source after all, and keep the rebuilt bytes
-+ * only where that read fails.
-+ */
-+static void scrub_raid56_read_unused_from_srcdev(struct scrub_stripe *stripe)
-+{
-+      struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
-+      const unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits;
-+      unsigned long unused = 0;
-+      unsigned long has_extent = scrub_bitmap_read_has_extent(stripe);
-+      unsigned int start, end;
-+      void *buf;
-+
-+      bitmap_set(&unused, 0, nr_sectors);
-+      bitmap_andnot(&unused, &unused, &has_extent, nr_sectors);
-+      if (bitmap_empty(&unused, nr_sectors))
-+              return;
-+      buf = kmalloc(BTRFS_STRIPE_LEN, GFP_NOFS);
-+      if (!buf)
-+              return;
-+      btrfs_bio_counter_inc_blocked(fs_info);
-+      for_each_set_bitrange(start, end, &unused, nr_sectors) {
-+              const u32 off = start << fs_info->sectorsize_bits;
-+              const u32 len = (end - start) << fs_info->sectorsize_bits;
-+
-+              if (bdev_rw_virt(stripe->dev->bdev,
-+                               (stripe->physical + off) >> SECTOR_SHIFT, buf,
-+                               len, REQ_OP_READ))
-+                      continue;
-+              memcpy(stripe->buffer + off, buf, len);
-+              scrub_bitmap_clear_io_error(stripe, start, end - start);
-+      }
-+      btrfs_bio_counter_dec(fs_info);
-+      kfree(buf);
-+}
-+
- static int flush_scrub_stripes(struct scrub_ctx *sctx)
- {
-       struct btrfs_fs_info *fs_info = sctx->fs_info;
-@@ -2058,8 +2101,13 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
-                       has_extent = scrub_bitmap_read_has_extent(stripe);
-                       error = scrub_bitmap_read_error(stripe);
-                       bitmap_andnot(&good, &has_extent, &error, stripe->nr_sectors);
--                      if (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK)
-+                      if (stripe->bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK) {
-+                              if (fs_info->dev_replace.cont_reading_from_srcdev_mode ==
-+                                  BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID &&
-+                                  stripe->dev->bdev)
-+                                      scrub_raid56_read_unused_from_srcdev(stripe);
-                               good |= scrub_raid56_unused_sectors(stripe);
-+                      }
-                       scrub_write_sectors(sctx, stripe, good, true);
-                       scrub_raid56_copy_bad_sectors(sctx, stripe,
-                                                     error & has_extent);
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0008-btrfs-don-t-abort-raid56-data-scrub-on-first-uncorre.patch b/topics/raid56-scrub-replace/0008-btrfs-don-t-abort-raid56-data-scrub-on-first-uncorre.patch
deleted file mode 100644 (file)
index 7745778..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-From 336c48ef59723ac8e1d01abf1e9076a369d685ef 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 08/13] btrfs: don't abort raid56 data scrub on first
- uncorrectable sector
-To: linux-btrfs@vger.kernel.org
-
-In commit 1009254bf22a ("btrfs: scrub: use scrub_stripe to implement
-RAID56 P/Q scrub") a new function scrub_raid56_parity_stripe() was
-introduced to recalculate the parity stripe after correcting any
-correctable errors.  When it detected unrepaired sectors in a data
-stripe, it returned -EIO, which propagated up the stack through
-scrub_stripe, scrub_chunk, and scrub_enumerate_chunks, where an error
-makes the scrub of that device break out of its loop early and return
-the error to userspace.  Every device holding P or Q for an affected
-full stripe stops there, and parity rotates, so a few bad full stripes
-stop the scrub of most of the array.
-
-That was a regression:  uncorrectable data blocks are one of the
-expected possible events that occur during a scrub, so scrub should
-continue until it has counted and reported all of the uncorrectable
-stripes in the filesystem.  Perhaps more importantly, scrub should fix
-up any correctable errors that might exist in other stripes beyond the
-first uncorrectable stripe.  No other profile does this: their scrubs
-count uncorrectable sectors, report them and carry on, returning 0.
-Errors from this function are only appropriate when scrub cannot do its
-job at all:  unable to read csums, unable to map an extent's data
-blocks, or out of memory.
-
-Since commit fab0c0f03cfd ("btrfs: introduce BTRFS_PATH_AUTO_RELEASE()
-helper") the bug had changed shape:  ret no longer held -EIO at that
-point but the leftover return value of the last
-scrub_find_fill_first_stripe() call, 0 or 1.  1 made scrub_stripe()
-silently stop scrubbing the rest of the block group on that device, and
-0 let the scrub continue only by accident, until "btrfs: scrub: fix lost
-error return value when scrubbing raid56 parity stripe" restored the
--EIO.
-
-scrub_raid56_parity_stripe() has successfully completed its task once it
-has performed its data correction and verification steps and checked P/Q
-of the rows without unrepaired sectors.  Return 0 at that point,
-regardless of the outcome of the verification.  P/Q of the rows with
-unrepaired sectors is still not regenerated, so no garbage is written
-back to the devices, and during dev-replace their original P/Q is copied
-to the target ("btrfs: scrub: copy raid56 parity of unrepairable rows to
-the replace target"), so a replace that now carries on past them does
-not lose their redundancy.  The unrepaired sectors are logged, and
-counted in the scrub statistics (and, since v6.16, the device stats)
-when their own data device is scrubbed; they are not reported through
-the return code of the scrub ioctl.
-
-Fixes: 1009254bf22a ("btrfs: scrub: use scrub_stripe to implement RAID56 P/Q scrub")
-Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
----
- fs/btrfs/scrub.c | 16 +++++-----------
- 1 file changed, 5 insertions(+), 11 deletions(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 200fc471748df..02c015d9f09e4 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -2517,18 +2517,12 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
-        * check and regenerate the rest.
-        */
-       bitmap_andnot(&extent_bitmap, &extent_bitmap, &bad_rows, nr_sectors);
--      if (!bitmap_empty(&extent_bitmap, nr_sectors)) {
--              /* Now we can check and regenerate the P/Q stripe. */
--              ret = scrub_raid56_cached_parity(sctx, scrub_dev, map,
--                                               full_stripe_start, &extent_bitmap);
--              if (ret)
--                      return ret;
--      }
-+      if (bitmap_empty(&extent_bitmap, nr_sectors))
-+              return 0;
- 
--      /* The unrepaired data sectors still fail the scrub. */
--      if (!bitmap_empty(&bad_rows, nr_sectors))
--              return -EIO;
--      return 0;
-+      /* Now we can check and regenerate the P/Q stripe. */
-+      return scrub_raid56_cached_parity(sctx, scrub_dev, map, full_stripe_start,
-+                                        &extent_bitmap);
- }
- 
- /*
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0008-btrfs-scrub-do-not-write-raid56-parity-in-a-read-onl.patch b/topics/raid56-scrub-replace/0008-btrfs-scrub-do-not-write-raid56-parity-in-a-read-onl.patch
new file mode 100644 (file)
index 0000000..1682e82
--- /dev/null
@@ -0,0 +1,105 @@
+From 86ab0366dc0e9d21fe74fde137cd51d87ddc0e4a 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
+ scrub
+To: linux-btrfs@vger.kernel.org
+
+A read-only scrub (btrfs scrub start -r) must not write to the devices.
+The data stripes honour that: their repairs are only written back when
+the scrub is not read-only.  The raid56 parity scrub never looks at it:
+finish_parity_scrub() rewrites every P or Q sector that does not match
+the data, whatever the scrub's mode.  So a read-only scrub of a raid56
+filesystem with stale or damaged parity rewrites it.
+
+Tell the parity scrub rbio whether the scrub is read-only, and in that
+case stop after the check, before any write is built.
+
+Test (raid56-wh-harness scrub-blame-test.sh SB_RO=1: read-only mount,
+scrub -r): with 8 damaged data sectors (every order) or 8 damaged parity
+sectors on one raid5/raid6 member, every member image is byte-identical
+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 +++++-
+ fs/btrfs/scrub.c  | 3 ++-
+ 3 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 59aad807f98ab..58f4e05561e6f 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -2574,7 +2574,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,
+-                              unsigned long *dbitmap, int stripe_nsectors)
++                              unsigned long *dbitmap, int stripe_nsectors,
++                              bool readonly)
+ {
+       struct btrfs_fs_info *fs_info = bioc->fs_info;
+       struct btrfs_raid_bio *rbio;
+@@ -2605,6 +2606,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);
++      rbio->scrub_readonly = readonly;
+       return rbio;
+ }
+ 
+@@ -2780,6 +2782,10 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+               q_paddr = INVALID_PADDR;
+       }
+ 
++      /* A read-only scrub only checks: submit no write. */
++      if (rbio->scrub_readonly)
++              goto submit_write;
++
+       /*
+        * time to start writing.  Make bios for everything from the
+        * higher layers (the bio_list in our rbio) and our p/q.  Ignore
+diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
+index 8700910b8dc99..d213ddcb102dc 100644
+--- a/fs/btrfs/raid56.h
++++ b/fs/btrfs/raid56.h
+@@ -165,6 +165,9 @@ struct btrfs_raid_bio {
+       /* Stripe number that we're scrubbing  */
+       u8 scrubp;
+ 
++      /* Parity scrub of a read-only scrub: check, but write nothing. */
++      bool scrub_readonly;
++
+       /*
+        * Size of all the bios in the bio_list.  This helps us decide if the
+        * rbio maps to a full stripe or not.
+@@ -274,7 +277,8 @@ void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc);
+ 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);
++                              unsigned long *dbitmap, int stripe_nsectors,
++                              bool readonly);
+ void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio);
+ 
+ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 89067b08106d2..e1544cf597957 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -2310,7 +2310,8 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
+       /* For RAID56 write there must be an @bioc allocated. */
+       ASSERT(bioc);
+       rbio = raid56_parity_alloc_scrub_rbio(&bio, bioc, scrub_dev, extent_bitmap,
+-                              map->stripe_len >> fs_info->sectorsize_bits);
++                              map->stripe_len >> fs_info->sectorsize_bits,
++                              sctx->readonly);
+       btrfs_put_bioc(bioc);
+       if (!rbio) {
+               ret = -ENOMEM;
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0009-btrfs-scrub-do-not-write-raid56-parity-in-a-read-onl.patch b/topics/raid56-scrub-replace/0009-btrfs-scrub-do-not-write-raid56-parity-in-a-read-onl.patch
deleted file mode 100644 (file)
index 59500b0..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-From d67280810713477185cf1dae7e72d5fe91300be1 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 09/13] btrfs: scrub: do not write raid56 parity in a read-only
- scrub
-To: linux-btrfs@vger.kernel.org
-
-A read-only scrub (btrfs scrub start -r) must not write to the devices.
-The data stripes honour that: their repairs are only written back when
-the scrub is not read-only.  The raid56 parity scrub never looks at it:
-finish_parity_scrub() rewrites every P or Q sector that does not match
-the data, whatever the scrub's mode.  So a read-only scrub of a raid56
-filesystem with stale or damaged parity rewrites it.
-
-Tell the parity scrub rbio whether the scrub is read-only, and in that
-case stop after the check, before any write is built.
-
-Test (raid56-wh-harness scrub-blame-test.sh SB_RO=1: read-only mount,
-scrub -r): with 8 damaged data sectors (every order) or 8 damaged parity
-sectors on one raid5/raid6 member, every member image is byte-identical
-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 +++++-
- fs/btrfs/scrub.c  | 3 ++-
- 3 files changed, 14 insertions(+), 3 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5ec31299f1c30..637be11a1ab4a 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -2557,7 +2557,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,
--                              unsigned long *dbitmap, int stripe_nsectors)
-+                              unsigned long *dbitmap, int stripe_nsectors,
-+                              bool readonly)
- {
-       struct btrfs_fs_info *fs_info = bioc->fs_info;
-       struct btrfs_raid_bio *rbio;
-@@ -2588,6 +2589,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);
-+      rbio->scrub_readonly = readonly;
-       return rbio;
- }
- 
-@@ -2770,6 +2772,10 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-               q_paddr = INVALID_PADDR;
-       }
- 
-+      /* A read-only scrub only checks: submit no write. */
-+      if (rbio->scrub_readonly)
-+              goto submit_write;
-+
-       /*
-        * time to start writing.  Make bios for everything from the
-        * higher layers (the bio_list in our rbio) and our p/q.  Ignore
-diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 8542648199f1a..1f68218598072 100644
---- a/fs/btrfs/raid56.h
-+++ b/fs/btrfs/raid56.h
-@@ -170,6 +170,9 @@ struct btrfs_raid_bio {
-       /* Stripe number that we're scrubbing  */
-       u8 scrubp;
- 
-+      /* Parity scrub of a read-only scrub: check, but write nothing. */
-+      bool scrub_readonly;
-+
-       /*
-        * Size of all the bios in the bio_list.  This helps us decide if the
-        * rbio maps to a full stripe or not.
-@@ -279,7 +282,8 @@ void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc);
- 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);
-+                              unsigned long *dbitmap, int stripe_nsectors,
-+                              bool readonly);
- void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio);
- 
- void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 02c015d9f09e4..690c8c9d76b5d 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -2294,7 +2294,8 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
-       /* For RAID56 write there must be an @bioc allocated. */
-       ASSERT(bioc);
-       rbio = raid56_parity_alloc_scrub_rbio(&bio, bioc, scrub_dev, extent_bitmap,
--                              BTRFS_STRIPE_LEN >> fs_info->sectorsize_bits);
-+                              BTRFS_STRIPE_LEN >> fs_info->sectorsize_bits,
-+                              sctx->readonly);
-       btrfs_put_bioc(bioc);
-       if (!rbio) {
-               ret = -ENOMEM;
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0009-btrfs-scrub-rebuild-a-raid6-data-stripe-that-both-P-.patch b/topics/raid56-scrub-replace/0009-btrfs-scrub-rebuild-a-raid6-data-stripe-that-both-P-.patch
new file mode 100644 (file)
index 0000000..d688eef
--- /dev/null
@@ -0,0 +1,328 @@
+From dc2880d0871aa4c790df4a326b0cd904dd039168 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
+ and Q disagree with
+To: linux-btrfs@vger.kernel.org
+
+Scrub checks raid56 parity against the data stripes as they read.  Data
+without checksums (nodatasum and nodatacow files) cannot be verified, so
+it is taken as it reads, and when the parity being scrubbed differs,
+finish_parity_scrub() rewrites it from that data.
+
+That is wrong when the data is what is stale.  A write that fails on one
+device but succeeds within the profile's tolerance is acked and leaves
+that device's strip with its old contents, while P and Q were written
+from the new data.  With the device missing, the new data still rebuilds
+from parity.  Scrub then rewrites P and Q from the stale strip, and from
+then on the acked data is gone: with that device missing it rebuilds to
+the old contents.
+
+On RAID6, P and Q together locate one bad stripe without a checksum: if
+data stripe z is off by e, P is off by e and Q by g^z * e, in every
+byte.  When both differ from the data in that pattern, rebuild data
+stripe z and write it back instead of rewriting the parity.  Two parity
+strips that are stale independently do not fit that pattern by chance
+over a whole sector.  Any other difference (P or Q alone, or no single
+z) keeps the parity rewrite.  The P and Q devices are scrubbed in
+parallel, each from its own read of the data, so only the scrub of P
+rebuilds; the scrub of Q leaves such a row alone (Q is right).  A torn
+write that reached one data stripe but neither P nor Q fits the pattern
+too; the rebuild returns that stripe to its old contents, as valid for
+an unacked write as the new ones.  Rows with a read error were rebuilt
+by recover_scrub_rbio() from the parity that is not being scrubbed, and
+are left alone.  In a read-only scrub nothing is written (previous
+patch).
+
+RAID5 has a single parity, so it cannot tell a stale data strip from
+stale parity, and is unchanged.
+
+Test (raid56-wh-harness nodatasum-scrub-repair-test.sh): nodatasum files
+on a 5-device raid6, each file written with one member failing writes
+during its writeback (each member in turn; within tolerance, so acked),
+then scrub, then every file read with no member, each member and each
+pair missing.  Before: scrub kept the 6 stale data strips and rewrote P
+and Q from them; 64 of 80 reads were wrong afterwards, 20 of them correct
+before the scrub.  After: the stale strips are rebuilt, P and Q match the
+data, and 80 of 80 reads are correct, with and without stripe_alloc.  Two
+stale strips per row (two members failing) cannot be located and still
+get their parity rewritten, as before.
+
+Fixes: 5a6ac9eacb49 ("Btrfs, raid56: support parity scrub on raid56")
+Assisted-by: Claude:claude-opus-5-5
+---
+ fs/btrfs/raid56.c | 195 +++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 177 insertions(+), 18 deletions(-)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 58f4e05561e6f..730fbd5225c1e 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -9,6 +9,7 @@
+ #include <linux/slab.h>
+ #include <linux/blkdev.h>
+ #include <linux/raid/pq.h>
++#include <linux/raid/pq_tables.h>
+ #include <linux/hash.h>
+ #include <linux/list_sort.h>
+ #include <linux/raid/xor.h>
+@@ -2653,16 +2654,13 @@ static int alloc_rbio_essential_pages(struct btrfs_raid_bio *rbio)
+       return 0;
+ }
+ 
+-/* Return true if the content of the step matches the calculated one. */
+-static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
+-                                 void *pointers[], unsigned int sector_nr,
+-                                 unsigned int step_nr)
++/* Calculate P (and Q) of one step into the temporary pages in @pointers. */
++static void gen_one_parity_step(struct btrfs_raid_bio *rbio, void *pointers[],
++                              unsigned int sector_nr, unsigned int step_nr)
+ {
+       const unsigned int nr_data = rbio->nr_data;
+       const bool has_qstripe = (rbio->real_stripes - rbio->nr_data == 2);
+       const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
+-      void *parity;
+-      bool ret = false;
+ 
+       ASSERT(step_nr < rbio->sector_nsteps);
+ 
+@@ -2682,36 +2680,159 @@ static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
+               xor_gen(pointers[nr_data], pointers + 1, nr_data - 1, step);
+       }
+ 
++      for (int stripe = nr_data - 1; stripe >= 0; stripe--)
++              kunmap_local(pointers[stripe]);
++}
++
++/*
++ * Return true if the content of the step matches the calculated one.  If not
++ * and @repair is set, replace it with the calculated one.
++ */
++static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
++                                 void *pointers[], unsigned int sector_nr,
++                                 unsigned int step_nr, bool repair)
++{
++      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
++      void *parity;
++      bool ret = false;
++
++      gen_one_parity_step(rbio, pointers, sector_nr, step_nr);
++
+       /* Check scrubbing parity and repair it. */
+       parity = kmap_local_paddr(rbio_stripe_paddr(rbio, rbio->scrubp, sector_nr, step_nr));
+-      if (memcmp(parity, pointers[rbio->scrubp], step) != 0)
+-              memcpy(parity, pointers[rbio->scrubp], step);
+-      else
++      if (memcmp(parity, pointers[rbio->scrubp], step) != 0) {
++              if (repair)
++                      memcpy(parity, pointers[rbio->scrubp], step);
++      } else {
+               ret = true;
++      }
+       kunmap_local(parity);
+-
+-      for (int stripe = nr_data - 1; stripe >= 0; stripe--)
+-              kunmap_local(pointers[stripe]);
+       return ret;
+ }
+ 
++/*
++ * RAID6: find the one data stripe that explains why P and Q of @sector_nr
++ * both differ from the ones calculated from the data.
++ *
++ * If data stripe z is off by e, P is off by e and Q by g^z * e, in every
++ * byte.  Return z if every differing byte of the sector shows that pattern
++ * with the same z, or -1 if it does not (P or Q alone is off, or more than
++ * one stripe is).
++ */
++static int raid6_locate_bad_data(struct btrfs_raid_bio *rbio, void *pointers[],
++                               unsigned int sector_nr)
++{
++      const int nr_data = rbio->nr_data;
++      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
++      const u8 *p_calc = pointers[nr_data];
++      const u8 *q_calc = pointers[rbio->real_stripes - 1];
++      int bad = -1;
++
++      for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++) {
++              const u8 *p;
++              const u8 *q;
++
++              gen_one_parity_step(rbio, pointers, sector_nr, step_nr);
++              p = kmap_local_paddr(rbio_pstripe_paddr(rbio, sector_nr, step_nr));
++              q = kmap_local_paddr(rbio_qstripe_paddr(rbio, sector_nr, step_nr));
++              for (u32 i = 0; i < step; i++) {
++                      const u8 dp = p[i] ^ p_calc[i];
++                      const u8 dq = q[i] ^ q_calc[i];
++                      int z;
++
++                      if (!dp && !dq)
++                              continue;
++                      if (!dp || !dq) {
++                              bad = -2;
++                              break;
++                      }
++                      z = (raid6_gflog[dq] + 255 - raid6_gflog[dp]) % 255;
++                      if (z >= nr_data || (bad >= 0 && z != bad)) {
++                              bad = -2;
++                              break;
++                      }
++                      bad = z;
++              }
++              kunmap_local(q);
++              kunmap_local(p);
++              if (bad == -2)
++                      break;
++      }
++      return bad < 0 ? -1 : bad;
++}
++
++/* Rebuild data stripe @stripe of @sector_nr: it is off by P ^ calculated P. */
++static void raid6_rebuild_data_sector(struct btrfs_raid_bio *rbio, void *pointers[],
++                                    unsigned int sector_nr, int stripe)
++{
++      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
++
++      for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++) {
++              void *srcs[2];
++              void *data;
++
++              gen_one_parity_step(rbio, pointers, sector_nr, step_nr);
++              data = kmap_local_paddr(rbio_stripe_paddr(rbio, stripe, sector_nr, step_nr));
++              srcs[0] = kmap_local_paddr(rbio_pstripe_paddr(rbio, sector_nr, step_nr));
++              srcs[1] = pointers[rbio->nr_data];
++              xor_gen(data, srcs, 2, step);
++              kunmap_local(srcs[0]);
++              kunmap_local(data);
++      }
++}
++
+ /*
+  * The @pointers array should have the P/Q parity already mapped.
++ *
++ * Return the data stripe that was rebuilt instead of rewriting the parity,
++ * or -1.
+  */
+-static void verify_one_parity_sector(struct btrfs_raid_bio *rbio,
+-                                   void *pointers[], unsigned int sector_nr)
++static int verify_one_parity_sector(struct btrfs_raid_bio *rbio,
++                                  void *pointers[], unsigned int sector_nr,
++                                  bool can_locate)
+ {
++      const bool has_qstripe = (rbio->real_stripes - rbio->nr_data == 2);
+       bool found_error = false;
+ 
+       for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++) {
+               bool match;
+ 
+-              match = verify_one_parity_step(rbio, pointers, sector_nr, step_nr);
++              match = verify_one_parity_step(rbio, pointers, sector_nr, step_nr, false);
+               if (!match)
+                       found_error = true;
+       }
+-      if (!found_error)
++      if (!found_error) {
+               bitmap_clear(&rbio->dbitmap, sector_nr, 1);
++              return -1;
++      }
++
++      /*
++       * Data without a checksum is taken as it was read, so parity
++       * calculated from it is not necessarily right: one data stripe may be
++       * stale, e.g. after a write that failed on its device but succeeded on
++       * the others.  On RAID6, P and Q together tell which one, so rebuild
++       * that data stripe instead of rewriting the parity from it.
++       */
++      if (has_qstripe && can_locate) {
++              const int bad = raid6_locate_bad_data(rbio, pointers, sector_nr);
++
++              if (bad >= 0) {
++                      /*
++                       * P and Q are scrubbed in parallel, each with its own
++                       * read of the data: leave the rebuild to the scrub of P,
++                       * so it is done and counted once.  Q is right.
++                       */
++                      bitmap_clear(&rbio->dbitmap, sector_nr, 1);
++                      if (rbio->scrubp != rbio->nr_data)
++                              return -1;
++                      raid6_rebuild_data_sector(rbio, pointers, sector_nr, bad);
++                      return bad;
++              }
++      }
++
++      for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++)
++              verify_one_parity_step(rbio, pointers, sector_nr, step_nr, true);
++      return -1;
+ }
+ 
+ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+@@ -2727,6 +2848,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;
++      unsigned long read_errors = 0;
++      unsigned long rebuilt = 0;
++      u8 rebuilt_stripe[BITS_PER_LONG];
+       int ret;
+ 
+       bio_list_init(&bio_list);
+@@ -2767,12 +2891,27 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+               pointers[rbio->real_stripes - 1] = kmap_local_paddr(q_paddr);
+       }
+ 
++      /*
++       * Rows with a read error were rebuilt by recover_scrub_rbio(): do not
++       * look for a bad data stripe there.
++       */
++      for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors)
++              if (get_rbio_vertical_errors(rbio, sectornr, NULL, NULL))
++                      __set_bit(sectornr, &read_errors);
++
+       bitmap_clear(rbio->error_bitmap, 0, rbio->nr_sectors);
+ 
+       /* Map the parity stripe just once */
+ 
+-      for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors)
+-              verify_one_parity_sector(rbio, pointers, sectornr);
++      for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors) {
++              const int stripe = verify_one_parity_sector(rbio, pointers, sectornr,
++                                              !test_bit(sectornr, &read_errors));
++
++              if (stripe >= 0) {
++                      __set_bit(sectornr, &rebuilt);
++                      rebuilt_stripe[sectornr] = stripe;
++              }
++      }
+ 
+       kunmap_local(pointers[nr_data]);
+       __free_page(phys_to_page(p_paddr));
+@@ -2786,6 +2925,26 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+       if (rbio->scrub_readonly)
+               goto submit_write;
+ 
++      /* Write the data sectors rebuilt from P and Q. */
++      for_each_set_bit(sectornr, &rebuilt, rbio->stripe_nsectors) {
++              const int stripe = rebuilt_stripe[sectornr];
++              const struct btrfs_io_stripe *io_stripe = &bioc->stripes[stripe];
++
++              btrfs_warn_rl(bioc->fs_info,
++"scrub: raid6 data at logical %llu on devid %llu physical %llu did not match P and Q, rebuilt it",
++                            bioc->full_stripe_logical +
++                            btrfs_stripe_nr_to_offset(stripe, bioc->stripe_len) +
++                            ((u64)sectornr << bioc->fs_info->sectorsize_bits),
++                            io_stripe->dev->devid,
++                            io_stripe->physical +
++                            ((u64)sectornr << bioc->fs_info->sectorsize_bits));
++              ret = rbio_add_io_paddrs(rbio, &bio_list,
++                                       rbio_stripe_paddrs(rbio, stripe, sectornr),
++                                       stripe, sectornr, REQ_OP_WRITE);
++              if (ret)
++                      goto cleanup;
++      }
++
+       /*
+        * time to start writing.  Make bios for everything from the
+        * higher layers (the bio_list in our rbio) and our p/q.  Ignore
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0010-btrfs-scrub-count-raid56-parity-mismatches-as-corrup.patch b/topics/raid56-scrub-replace/0010-btrfs-scrub-count-raid56-parity-mismatches-as-corrup.patch
new file mode 100644 (file)
index 0000000..4cff0bc
--- /dev/null
@@ -0,0 +1,171 @@
+From 0c60a08b66859c207b4c5bca366910ef8334e3bb 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
+ corruption errors
+To: linux-btrfs@vger.kernel.org
+
+When scrub finds raid56 parity that does not match the data, it rewrites
+the parity (or, on RAID6, rebuilds the data stripe that P and Q locate),
+but counts nothing: the device stats do not change, and the scrub
+progress, and so `btrfs scrub status`, says "no errors found".  A
+corrupted parity strip, a stale data strip, or a write hole is repaired
+or papered over without a trace.
+
+Count every sector that did not match as a corruption error
+(BTRFS_DEV_STAT_CORRUPTION_ERRS) of the device that held the bad copy,
+and add it to the scrub's corrected_errors:
+
+- a data stripe that P and Q located and that was rebuilt: its device;
+- otherwise the parity being scrubbed: its device.
+
+The second case is not always right.  Without a checksum on the data and
+without a second parity to locate the error (RAID5, or a RAID6 row that
+the decode cannot place), a mismatch may as well be a corrupt or stale
+data sector that nothing can detect; scrub rewrites the parity from that
+data, and the parity device is charged.  Rows whose stripes had a read
+error are not counted again: the read error was.
+
+The device is the one in the scrub rbio's io context at the stripe that
+held the bad copy.  During dev-replace the scrubbed parity is the
+source's (the target is only written), so the source is charged.
+
+Test (raid56-wh-harness raid56-devstats-test.sh, arm P): 4 sectors of a
+P strip (on raid6 also 4 of a Q strip, other rows) overwritten, then
+scrub.  Before: no counter moved and scrub said "no errors found".
+After: corruption_errs +4 on exactly the corrupted member(s), Corrected
+4 (raid6 8), and a second scrub finds nothing.
+nodatasum-scrub-repair-test.sh, raid6 with one stale member per row:
+every stale sector is charged once, to the member that held it.
+
+Assisted-by: Claude:claude-opus-5-5
+---
+ fs/btrfs/raid56.c | 33 ++++++++++++++++++++++++++++++++-
+ fs/btrfs/raid56.h |  5 ++++-
+ fs/btrfs/scrub.c  |  8 +++++++-
+ 3 files changed, 43 insertions(+), 3 deletions(-)
+
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 730fbd5225c1e..37a077b64f99b 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -2576,7 +2576,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,
+-                              bool readonly)
++                              bool readonly, u32 *corrected)
+ {
+       struct btrfs_fs_info *fs_info = bioc->fs_info;
+       struct btrfs_raid_bio *rbio;
+@@ -2608,6 +2608,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
+ 
+       bitmap_copy(&rbio->dbitmap, dbitmap, stripe_nsectors);
+       rbio->scrub_readonly = readonly;
++      rbio->scrub_corrected = corrected;
+       return rbio;
+ }
+ 
+@@ -2835,6 +2836,35 @@ static int verify_one_parity_sector(struct btrfs_raid_bio *rbio,
+       return -1;
+ }
+ 
++/*
++ * Count each sector that did not match as a corruption error of the device
++ * that held it: the data stripe rebuilt from P and Q, or else the scrubbed
++ * parity, which is rewritten from the data.  Without a checksum and without
++ * a decode (RAID5, or a RAID6 row the decode cannot place), the mismatch may
++ * as well be corrupt data that nothing can find; the parity is charged.
++ * Rows with a read error are not counted here: the read error was.
++ */
++static void count_parity_scrub_errors(struct btrfs_raid_bio *rbio,
++                                    unsigned long read_errors,
++                                    unsigned long rebuilt,
++                                    const u8 *rebuilt_stripe)
++{
++      struct btrfs_io_context *bioc = rbio->bioc;
++      unsigned long parity_bad;
++      unsigned int sectornr;
++
++      bitmap_andnot(&parity_bad, &rbio->dbitmap, &read_errors, rbio->stripe_nsectors);
++      for_each_set_bit(sectornr, &rebuilt, rbio->stripe_nsectors)
++              btrfs_dev_stat_inc_and_print(bioc->stripes[rebuilt_stripe[sectornr]].dev,
++                                           BTRFS_DEV_STAT_CORRUPTION_ERRS);
++      for_each_set_bit(sectornr, &parity_bad, rbio->stripe_nsectors)
++              btrfs_dev_stat_inc_and_print(bioc->stripes[rbio->scrubp].dev,
++                                           BTRFS_DEV_STAT_CORRUPTION_ERRS);
++      if (rbio->scrub_corrected)
++              *rbio->scrub_corrected += bitmap_weight(&rebuilt, rbio->stripe_nsectors) +
++                                        bitmap_weight(&parity_bad, rbio->stripe_nsectors);
++}
++
+ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+ {
+       struct btrfs_io_context *bioc = rbio->bioc;
+@@ -2912,6 +2942,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
+                       rebuilt_stripe[sectornr] = stripe;
+               }
+       }
++      count_parity_scrub_errors(rbio, read_errors, rebuilt, rebuilt_stripe);
+ 
+       kunmap_local(pointers[nr_data]);
+       __free_page(phys_to_page(p_paddr));
+diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
+index d213ddcb102dc..2f5c05d5a00a4 100644
+--- a/fs/btrfs/raid56.h
++++ b/fs/btrfs/raid56.h
+@@ -165,6 +165,9 @@ struct btrfs_raid_bio {
+       /* Stripe number that we're scrubbing  */
+       u8 scrubp;
+ 
++      /* Parity scrub: where to add the number of mismatching sectors. */
++      u32 *scrub_corrected;
++
+       /* Parity scrub of a read-only scrub: check, but write nothing. */
+       bool scrub_readonly;
+ 
+@@ -278,7 +281,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,
+-                              bool readonly);
++                              bool readonly, u32 *corrected);
+ void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio);
+ 
+ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index e1544cf597957..799e78a892d10 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -2295,6 +2295,7 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
+       struct bio bio;
+       const int data_stripes = nr_data_stripes(map);
+       u64 length = btrfs_stripe_nr_to_offset(data_stripes, map->stripe_len);
++      u32 corrected = 0;
+       int ret;
+ 
+       bio_init(&bio, NULL, NULL, 0, REQ_OP_READ);
+@@ -2311,7 +2312,7 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
+       ASSERT(bioc);
+       rbio = raid56_parity_alloc_scrub_rbio(&bio, bioc, scrub_dev, extent_bitmap,
+                               map->stripe_len >> fs_info->sectorsize_bits,
+-                              sctx->readonly);
++                              sctx->readonly, &corrected);
+       btrfs_put_bioc(bioc);
+       if (!rbio) {
+               ret = -ENOMEM;
+@@ -2327,6 +2328,11 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
+       raid56_parity_submit_scrub_rbio(rbio);
+       wait_for_completion_io(&io_done);
+       ret = blk_status_to_errno(bio.bi_status);
++      if (corrected) {
++              spin_lock(&sctx->stat_lock);
++              sctx->stat.corrected_errors += corrected;
++              spin_unlock(&sctx->stat_lock);
++      }
+ out:
+       btrfs_bio_counter_dec(fs_info);
+       bio_uninit(&bio);
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0010-btrfs-scrub-rebuild-a-raid6-data-stripe-that-both-P-.patch b/topics/raid56-scrub-replace/0010-btrfs-scrub-rebuild-a-raid6-data-stripe-that-both-P-.patch
deleted file mode 100644 (file)
index ca47be9..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-From 1395225e695d542703268c68a433194058a322de 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 10/13] btrfs: scrub: rebuild a raid6 data stripe that both P
- and Q disagree with
-To: linux-btrfs@vger.kernel.org
-
-Scrub checks raid56 parity against the data stripes as they read.  Data
-without checksums (nodatasum and nodatacow files) cannot be verified, so
-it is taken as it reads, and when the parity being scrubbed differs,
-finish_parity_scrub() rewrites it from that data.
-
-That is wrong when the data is what is stale.  A write that fails on one
-device but succeeds within the profile's tolerance is acked and leaves
-that device's strip with its old contents, while P and Q were written
-from the new data.  With the device missing, the new data still rebuilds
-from parity.  Scrub then rewrites P and Q from the stale strip, and from
-then on the acked data is gone: with that device missing it rebuilds to
-the old contents.
-
-On RAID6, P and Q together locate one bad stripe without a checksum: if
-data stripe z is off by e, P is off by e and Q by g^z * e, in every
-byte.  When both differ from the data in that pattern, rebuild data
-stripe z and write it back instead of rewriting the parity.  Two parity
-strips that are stale independently do not fit that pattern by chance
-over a whole sector.  Any other difference (P or Q alone, or no single
-z) keeps the parity rewrite.  The P and Q devices are scrubbed in
-parallel, each from its own read of the data, so only the scrub of P
-rebuilds; the scrub of Q leaves such a row alone (Q is right).  A torn
-write that reached one data stripe but neither P nor Q fits the pattern
-too; the rebuild returns that stripe to its old contents, as valid for
-an unacked write as the new ones.  Rows with a read error were rebuilt
-by recover_scrub_rbio() from the parity that is not being scrubbed, and
-are left alone.  In a read-only scrub nothing is written (previous
-patch).
-
-RAID5 has a single parity, so it cannot tell a stale data strip from
-stale parity, and is unchanged.
-
-Test (raid56-wh-harness nodatasum-scrub-repair-test.sh): nodatasum files
-on a 5-device raid6, each file written with one member failing writes
-during its writeback (each member in turn; within tolerance, so acked),
-then scrub, then every file read with no member, each member and each
-pair missing.  Before: scrub kept the 6 stale data strips and rewrote P
-and Q from them; 64 of 80 reads were wrong afterwards, 20 of them correct
-before the scrub.  After: the stale strips are rebuilt, P and Q match the
-data, and 80 of 80 reads are correct, with and without stripe_alloc.  Two
-stale strips per row (two members failing) cannot be located and still
-get their parity rewritten, as before.
-
-Fixes: 5a6ac9eacb49 ("Btrfs, raid56: support parity scrub on raid56")
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/raid56.c | 195 +++++++++++++++++++++++++++++++++++++++++-----
- 1 file changed, 177 insertions(+), 18 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 637be11a1ab4a..b3366434f0d90 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -9,6 +9,7 @@
- #include <linux/slab.h>
- #include <linux/blkdev.h>
- #include <linux/raid/pq.h>
-+#include <linux/raid/pq_tables.h>
- #include <linux/hash.h>
- #include <linux/list_sort.h>
- #include <linux/raid/xor.h>
-@@ -2636,16 +2637,13 @@ static int alloc_rbio_essential_pages(struct btrfs_raid_bio *rbio)
-       return 0;
- }
- 
--/* Return true if the content of the step matches the calculated one. */
--static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
--                                 void *pointers[], unsigned int sector_nr,
--                                 unsigned int step_nr)
-+/* Calculate P (and Q) of one step into the temporary pages in @pointers. */
-+static void gen_one_parity_step(struct btrfs_raid_bio *rbio, void *pointers[],
-+                              unsigned int sector_nr, unsigned int step_nr)
- {
-       const unsigned int nr_data = rbio->nr_data;
-       const bool has_qstripe = (rbio->real_stripes - rbio->nr_data == 2);
-       const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
--      void *parity;
--      bool ret = false;
- 
-       ASSERT(step_nr < rbio->sector_nsteps);
- 
-@@ -2665,36 +2663,159 @@ static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
-               xor_gen(pointers[nr_data], pointers + 1, nr_data - 1, step);
-       }
- 
-+      for (int stripe = nr_data - 1; stripe >= 0; stripe--)
-+              kunmap_local(pointers[stripe]);
-+}
-+
-+/*
-+ * Return true if the content of the step matches the calculated one.  If not
-+ * and @repair is set, replace it with the calculated one.
-+ */
-+static bool verify_one_parity_step(struct btrfs_raid_bio *rbio,
-+                                 void *pointers[], unsigned int sector_nr,
-+                                 unsigned int step_nr, bool repair)
-+{
-+      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
-+      void *parity;
-+      bool ret = false;
-+
-+      gen_one_parity_step(rbio, pointers, sector_nr, step_nr);
-+
-       /* Check scrubbing parity and repair it. */
-       parity = kmap_local_paddr(rbio_stripe_paddr(rbio, rbio->scrubp, sector_nr, step_nr));
--      if (memcmp(parity, pointers[rbio->scrubp], step) != 0)
--              memcpy(parity, pointers[rbio->scrubp], step);
--      else
-+      if (memcmp(parity, pointers[rbio->scrubp], step) != 0) {
-+              if (repair)
-+                      memcpy(parity, pointers[rbio->scrubp], step);
-+      } else {
-               ret = true;
-+      }
-       kunmap_local(parity);
--
--      for (int stripe = nr_data - 1; stripe >= 0; stripe--)
--              kunmap_local(pointers[stripe]);
-       return ret;
- }
- 
-+/*
-+ * RAID6: find the one data stripe that explains why P and Q of @sector_nr
-+ * both differ from the ones calculated from the data.
-+ *
-+ * If data stripe z is off by e, P is off by e and Q by g^z * e, in every
-+ * byte.  Return z if every differing byte of the sector shows that pattern
-+ * with the same z, or -1 if it does not (P or Q alone is off, or more than
-+ * one stripe is).
-+ */
-+static int raid6_locate_bad_data(struct btrfs_raid_bio *rbio, void *pointers[],
-+                               unsigned int sector_nr)
-+{
-+      const int nr_data = rbio->nr_data;
-+      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
-+      const u8 *p_calc = pointers[nr_data];
-+      const u8 *q_calc = pointers[rbio->real_stripes - 1];
-+      int bad = -1;
-+
-+      for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++) {
-+              const u8 *p;
-+              const u8 *q;
-+
-+              gen_one_parity_step(rbio, pointers, sector_nr, step_nr);
-+              p = kmap_local_paddr(rbio_pstripe_paddr(rbio, sector_nr, step_nr));
-+              q = kmap_local_paddr(rbio_qstripe_paddr(rbio, sector_nr, step_nr));
-+              for (u32 i = 0; i < step; i++) {
-+                      const u8 dp = p[i] ^ p_calc[i];
-+                      const u8 dq = q[i] ^ q_calc[i];
-+                      int z;
-+
-+                      if (!dp && !dq)
-+                              continue;
-+                      if (!dp || !dq) {
-+                              bad = -2;
-+                              break;
-+                      }
-+                      z = (raid6_gflog[dq] + 255 - raid6_gflog[dp]) % 255;
-+                      if (z >= nr_data || (bad >= 0 && z != bad)) {
-+                              bad = -2;
-+                              break;
-+                      }
-+                      bad = z;
-+              }
-+              kunmap_local(q);
-+              kunmap_local(p);
-+              if (bad == -2)
-+                      break;
-+      }
-+      return bad < 0 ? -1 : bad;
-+}
-+
-+/* Rebuild data stripe @stripe of @sector_nr: it is off by P ^ calculated P. */
-+static void raid6_rebuild_data_sector(struct btrfs_raid_bio *rbio, void *pointers[],
-+                                    unsigned int sector_nr, int stripe)
-+{
-+      const u32 step = min(rbio->bioc->fs_info->sectorsize, PAGE_SIZE);
-+
-+      for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++) {
-+              void *srcs[2];
-+              void *data;
-+
-+              gen_one_parity_step(rbio, pointers, sector_nr, step_nr);
-+              data = kmap_local_paddr(rbio_stripe_paddr(rbio, stripe, sector_nr, step_nr));
-+              srcs[0] = kmap_local_paddr(rbio_pstripe_paddr(rbio, sector_nr, step_nr));
-+              srcs[1] = pointers[rbio->nr_data];
-+              xor_gen(data, srcs, 2, step);
-+              kunmap_local(srcs[0]);
-+              kunmap_local(data);
-+      }
-+}
-+
- /*
-  * The @pointers array should have the P/Q parity already mapped.
-+ *
-+ * Return the data stripe that was rebuilt instead of rewriting the parity,
-+ * or -1.
-  */
--static void verify_one_parity_sector(struct btrfs_raid_bio *rbio,
--                                   void *pointers[], unsigned int sector_nr)
-+static int verify_one_parity_sector(struct btrfs_raid_bio *rbio,
-+                                  void *pointers[], unsigned int sector_nr,
-+                                  bool can_locate)
- {
-+      const bool has_qstripe = (rbio->real_stripes - rbio->nr_data == 2);
-       bool found_error = false;
- 
-       for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++) {
-               bool match;
- 
--              match = verify_one_parity_step(rbio, pointers, sector_nr, step_nr);
-+              match = verify_one_parity_step(rbio, pointers, sector_nr, step_nr, false);
-               if (!match)
-                       found_error = true;
-       }
--      if (!found_error)
-+      if (!found_error) {
-               bitmap_clear(&rbio->dbitmap, sector_nr, 1);
-+              return -1;
-+      }
-+
-+      /*
-+       * Data without a checksum is taken as it was read, so parity
-+       * calculated from it is not necessarily right: one data stripe may be
-+       * stale, e.g. after a write that failed on its device but succeeded on
-+       * the others.  On RAID6, P and Q together tell which one, so rebuild
-+       * that data stripe instead of rewriting the parity from it.
-+       */
-+      if (has_qstripe && can_locate) {
-+              const int bad = raid6_locate_bad_data(rbio, pointers, sector_nr);
-+
-+              if (bad >= 0) {
-+                      /*
-+                       * P and Q are scrubbed in parallel, each with its own
-+                       * read of the data: leave the rebuild to the scrub of P,
-+                       * so it is done and counted once.  Q is right.
-+                       */
-+                      bitmap_clear(&rbio->dbitmap, sector_nr, 1);
-+                      if (rbio->scrubp != rbio->nr_data)
-+                              return -1;
-+                      raid6_rebuild_data_sector(rbio, pointers, sector_nr, bad);
-+                      return bad;
-+              }
-+      }
-+
-+      for (int step_nr = 0; step_nr < rbio->sector_nsteps; step_nr++)
-+              verify_one_parity_step(rbio, pointers, sector_nr, step_nr, true);
-+      return -1;
- }
- 
- static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-@@ -2710,6 +2831,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;
-+      unsigned long read_errors = 0;
-+      unsigned long rebuilt = 0;
-+      u8 rebuilt_stripe[BITS_PER_LONG];
-       int ret;
- 
-       bio_list_init(&bio_list);
-@@ -2757,12 +2881,27 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-               pointers[rbio->real_stripes - 1] = kmap_local_paddr(q_paddr);
-       }
- 
-+      /*
-+       * Rows with a read error were rebuilt by recover_scrub_rbio(): do not
-+       * look for a bad data stripe there.
-+       */
-+      for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors)
-+              if (get_rbio_vertical_errors(rbio, sectornr, NULL, NULL))
-+                      __set_bit(sectornr, &read_errors);
-+
-       bitmap_clear(rbio->error_bitmap, 0, rbio->nr_sectors);
- 
-       /* Map the parity stripe just once */
- 
--      for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors)
--              verify_one_parity_sector(rbio, pointers, sectornr);
-+      for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors) {
-+              const int stripe = verify_one_parity_sector(rbio, pointers, sectornr,
-+                                              !test_bit(sectornr, &read_errors));
-+
-+              if (stripe >= 0) {
-+                      __set_bit(sectornr, &rebuilt);
-+                      rebuilt_stripe[sectornr] = stripe;
-+              }
-+      }
- 
-       kunmap_local(pointers[nr_data]);
-       __free_page(phys_to_page(p_paddr));
-@@ -2776,6 +2915,26 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-       if (rbio->scrub_readonly)
-               goto submit_write;
- 
-+      /* Write the data sectors rebuilt from P and Q. */
-+      for_each_set_bit(sectornr, &rebuilt, rbio->stripe_nsectors) {
-+              const int stripe = rebuilt_stripe[sectornr];
-+              const struct btrfs_io_stripe *io_stripe = &bioc->stripes[stripe];
-+
-+              btrfs_warn_rl(bioc->fs_info,
-+"scrub: raid6 data at logical %llu on devid %llu physical %llu did not match P and Q, rebuilt it",
-+                            bioc->full_stripe_logical +
-+                            btrfs_stripe_nr_to_offset(stripe) +
-+                            ((u64)sectornr << bioc->fs_info->sectorsize_bits),
-+                            io_stripe->dev->devid,
-+                            io_stripe->physical +
-+                            ((u64)sectornr << bioc->fs_info->sectorsize_bits));
-+              ret = rbio_add_io_paddrs(rbio, &bio_list,
-+                                       rbio_stripe_paddrs(rbio, stripe, sectornr),
-+                                       stripe, sectornr, REQ_OP_WRITE);
-+              if (ret)
-+                      goto cleanup;
-+      }
-+
-       /*
-        * time to start writing.  Make bios for everything from the
-        * higher layers (the bio_list in our rbio) and our p/q.  Ignore
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0011-btrfs-scrub-count-raid56-parity-mismatches-as-corrup.patch b/topics/raid56-scrub-replace/0011-btrfs-scrub-count-raid56-parity-mismatches-as-corrup.patch
deleted file mode 100644 (file)
index 9bb9490..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-From f6b508f255f92a45cbceff07ac7b080e98c49f7d 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 11/13] btrfs: scrub: count raid56 parity mismatches as
- corruption errors
-To: linux-btrfs@vger.kernel.org
-
-When scrub finds raid56 parity that does not match the data, it rewrites
-the parity (or, on RAID6, rebuilds the data stripe that P and Q locate),
-but counts nothing: the device stats do not change, and the scrub
-progress, and so `btrfs scrub status`, says "no errors found".  A
-corrupted parity strip, a stale data strip, or a write hole is repaired
-or papered over without a trace.
-
-Count every sector that did not match as a corruption error
-(BTRFS_DEV_STAT_CORRUPTION_ERRS) of the device that held the bad copy,
-and add it to the scrub's corrected_errors:
-
-- a data stripe that P and Q located and that was rebuilt: its device;
-- otherwise the parity being scrubbed: its device.
-
-The second case is not always right.  Without a checksum on the data and
-without a second parity to locate the error (RAID5, or a RAID6 row that
-the decode cannot place), a mismatch may as well be a corrupt or stale
-data sector that nothing can detect; scrub rewrites the parity from that
-data, and the parity device is charged.  Rows whose stripes had a read
-error are not counted again: the read error was.
-
-The device is the one in the scrub rbio's io context at the stripe that
-held the bad copy.  During dev-replace the scrubbed parity is the
-source's (the target is only written), so the source is charged.
-
-Test (raid56-wh-harness raid56-devstats-test.sh, arm P): 4 sectors of a
-P strip (on raid6 also 4 of a Q strip, other rows) overwritten, then
-scrub.  Before: no counter moved and scrub said "no errors found".
-After: corruption_errs +4 on exactly the corrupted member(s), Corrected
-4 (raid6 8), and a second scrub finds nothing.
-nodatasum-scrub-repair-test.sh, raid6 with one stale member per row:
-every stale sector is charged once, to the member that held it.
-
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/raid56.c | 33 ++++++++++++++++++++++++++++++++-
- fs/btrfs/raid56.h |  5 ++++-
- fs/btrfs/scrub.c  |  8 +++++++-
- 3 files changed, 43 insertions(+), 3 deletions(-)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index b3366434f0d90..4d5f61481226e 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -2559,7 +2559,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,
--                              bool readonly)
-+                              bool readonly, u32 *corrected)
- {
-       struct btrfs_fs_info *fs_info = bioc->fs_info;
-       struct btrfs_raid_bio *rbio;
-@@ -2591,6 +2591,7 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
- 
-       bitmap_copy(&rbio->dbitmap, dbitmap, stripe_nsectors);
-       rbio->scrub_readonly = readonly;
-+      rbio->scrub_corrected = corrected;
-       return rbio;
- }
- 
-@@ -2818,6 +2819,35 @@ static int verify_one_parity_sector(struct btrfs_raid_bio *rbio,
-       return -1;
- }
- 
-+/*
-+ * Count each sector that did not match as a corruption error of the device
-+ * that held it: the data stripe rebuilt from P and Q, or else the scrubbed
-+ * parity, which is rewritten from the data.  Without a checksum and without
-+ * a decode (RAID5, or a RAID6 row the decode cannot place), the mismatch may
-+ * as well be corrupt data that nothing can find; the parity is charged.
-+ * Rows with a read error are not counted here: the read error was.
-+ */
-+static void count_parity_scrub_errors(struct btrfs_raid_bio *rbio,
-+                                    unsigned long read_errors,
-+                                    unsigned long rebuilt,
-+                                    const u8 *rebuilt_stripe)
-+{
-+      struct btrfs_io_context *bioc = rbio->bioc;
-+      unsigned long parity_bad;
-+      unsigned int sectornr;
-+
-+      bitmap_andnot(&parity_bad, &rbio->dbitmap, &read_errors, rbio->stripe_nsectors);
-+      for_each_set_bit(sectornr, &rebuilt, rbio->stripe_nsectors)
-+              btrfs_dev_stat_inc_and_print(bioc->stripes[rebuilt_stripe[sectornr]].dev,
-+                                           BTRFS_DEV_STAT_CORRUPTION_ERRS);
-+      for_each_set_bit(sectornr, &parity_bad, rbio->stripe_nsectors)
-+              btrfs_dev_stat_inc_and_print(bioc->stripes[rbio->scrubp].dev,
-+                                           BTRFS_DEV_STAT_CORRUPTION_ERRS);
-+      if (rbio->scrub_corrected)
-+              *rbio->scrub_corrected += bitmap_weight(&rebuilt, rbio->stripe_nsectors) +
-+                                        bitmap_weight(&parity_bad, rbio->stripe_nsectors);
-+}
-+
- static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
- {
-       struct btrfs_io_context *bioc = rbio->bioc;
-@@ -2902,6 +2932,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-                       rebuilt_stripe[sectornr] = stripe;
-               }
-       }
-+      count_parity_scrub_errors(rbio, read_errors, rebuilt, rebuilt_stripe);
- 
-       kunmap_local(pointers[nr_data]);
-       __free_page(phys_to_page(p_paddr));
-diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 1f68218598072..dc125624fbf14 100644
---- a/fs/btrfs/raid56.h
-+++ b/fs/btrfs/raid56.h
-@@ -170,6 +170,9 @@ struct btrfs_raid_bio {
-       /* Stripe number that we're scrubbing  */
-       u8 scrubp;
- 
-+      /* Parity scrub: where to add the number of mismatching sectors. */
-+      u32 *scrub_corrected;
-+
-       /* Parity scrub of a read-only scrub: check, but write nothing. */
-       bool scrub_readonly;
- 
-@@ -283,7 +286,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,
--                              bool readonly);
-+                              bool readonly, u32 *corrected);
- void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio);
- 
- void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 690c8c9d76b5d..869e284aff461 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -2279,6 +2279,7 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
-       struct bio bio;
-       const int data_stripes = nr_data_stripes(map);
-       u64 length = btrfs_stripe_nr_to_offset(data_stripes);
-+      u32 corrected = 0;
-       int ret;
- 
-       bio_init(&bio, NULL, NULL, 0, REQ_OP_READ);
-@@ -2295,7 +2296,7 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
-       ASSERT(bioc);
-       rbio = raid56_parity_alloc_scrub_rbio(&bio, bioc, scrub_dev, extent_bitmap,
-                               BTRFS_STRIPE_LEN >> fs_info->sectorsize_bits,
--                              sctx->readonly);
-+                              sctx->readonly, &corrected);
-       btrfs_put_bioc(bioc);
-       if (!rbio) {
-               ret = -ENOMEM;
-@@ -2311,6 +2312,11 @@ static int scrub_raid56_cached_parity(struct scrub_ctx *sctx,
-       raid56_parity_submit_scrub_rbio(rbio);
-       wait_for_completion_io(&io_done);
-       ret = blk_status_to_errno(bio.bi_status);
-+      if (corrected) {
-+              spin_lock(&sctx->stat_lock);
-+              sctx->stat.corrected_errors += corrected;
-+              spin_unlock(&sctx->stat_lock);
-+      }
- out:
-       btrfs_bio_counter_dec(fs_info);
-       bio_uninit(&bio);
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0011-btrfs-scrub-name-the-device-a-raid56-data-sector-was.patch b/topics/raid56-scrub-replace/0011-btrfs-scrub-name-the-device-a-raid56-data-sector-was.patch
new file mode 100644 (file)
index 0000000..42fa313
--- /dev/null
@@ -0,0 +1,82 @@
+From 5a37421678943cb3293ea13905617134297aa7b3 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
+ read from
+To: linux-btrfs@vger.kernel.org
+
+scrub_stripe_report_errors() finds the device and physical address for
+its messages by mapping the stripe's logical address with
+BTRFS_MAP_GET_READ_MIRRORS and taking stripes[mirror_num - 1].  On RAID56
+that mapping is the full stripe's write mapping, and stripes[0] is the
+device of the full stripe's first data stripe, not the device the sector
+was read from.  So "checksum error at logical ... on dev ...", "fixed up
+error ... on dev ..." and "unable to fixup (regular) error ... on dev ..."
+name a device that rotates over the members with the full stripes, and a
+physical address on it that holds something else.  The device stats were
+always charged to the right device (stripe->dev).
+
+The scrub stripe already records where it was read from: use
+stripe->dev and stripe->physical.  For the mirrored and striped profiles
+that is the same device and address as before.
+
+Test (raid56-wh-harness scrub-blame-test.sh): with damaged data sectors
+on one raid5/raid6 member, every per-sector line names that member, in
+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(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 799e78a892d10..a776b519acb8f 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -1004,34 +1004,17 @@ static void scrub_stripe_report_errors(struct scrub_ctx *sctx,
+               return;
+ 
+       /*
+-       * Init needed infos for error reporting.
+-       *
+-       * Although our scrub_stripe infrastructure is mostly based on btrfs_submit_bio()
+-       * thus no need for dev/physical, error reporting still needs dev and physical.
++       * The sectors were read from @stripe->dev at @stripe->physical.  Mapping
++       * @stripe->logical back with BTRFS_MAP_GET_READ_MIRRORS does not give that
++       * on RAID56: it returns the full stripe's write mapping, whose
++       * stripes[mirror_num - 1] is the device of the full stripe's first data
++       * stripe.
+        */
+       if (!bitmap_empty(&errors->init_error_bitmap, stripe->nr_sectors)) {
+-              u64 mapped_len = fs_info->sectorsize;
+-              struct btrfs_io_context *bioc = NULL;
+-              int stripe_index = stripe->mirror_num - 1;
+-              int ret;
+-
+-              /* For scrub, our mirror_num should always start at 1. */
+-              ASSERT(stripe->mirror_num >= 1, "stripe->mirror_num=%d", stripe->mirror_num);
+-              ret = btrfs_map_block(fs_info, BTRFS_MAP_GET_READ_MIRRORS,
+-                                    stripe->logical, &mapped_len, &bioc,
+-                                    NULL, NULL);
+-              /*
+-               * If we failed, dev will be NULL, and later detailed reports
+-               * will just be skipped.
+-               */
+-              if (ret < 0)
+-                      goto skip;
+-              physical = bioc->stripes[stripe_index].physical;
+-              dev = bioc->stripes[stripe_index].dev;
+-              btrfs_put_bioc(bioc);
++              dev = stripe->dev;
++              physical = stripe->physical;
+       }
+ 
+-skip:
+       for_each_set_bit(sector_nr, &extent_bitmap, stripe->nr_sectors) {
+               const u64 sector_logical = stripe->logical +
+                                          ((u64)sector_nr << fs_info->sectorsize_bits);
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0012-btrfs-scrub-count-the-raid56-data-repairs-made-by-a-.patch b/topics/raid56-scrub-replace/0012-btrfs-scrub-count-the-raid56-data-repairs-made-by-a-.patch
new file mode 100644 (file)
index 0000000..821f34e
--- /dev/null
@@ -0,0 +1,228 @@
+From b7b4005cacc44b50375cbb55d550f35eed1662f6 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
+ parity scrub
+To: linux-btrfs@vger.kernel.org
+
+The scrub of a RAID56 P/Q device reads every data stripe of each full
+stripe it checks, verifies and repairs them, and writes the repairs back,
+but counts nothing (SCRUB_STRIPE_FLAG_NO_REPORT): neither the scrub
+progress nor the device stats.  When the P/Q device's scrub reaches a
+full stripe before the data device's own scrub does, the data device's
+scrub finds the sector already repaired, and the error is counted
+nowhere.  With all devices scrubbed at once that is a large share of the
+errors (one failing raid5 member: 25831 of 42371 damaged data sectors
+counted; raid6: 7894 of 34146), and when the damaged device is scrubbed
+last, none of them.
+
+Count the sectors that the parity scrub repaired and wrote back, as the
+data device's scrub would have: read, checksum and verify errors in the
+device stats of the data stripe's own device, and in the parity scrub's
+progress with corrected_errors.  To count each bad sector once:
+
+- errors left unrepaired are not counted: they stay on disk for the data
+  device's own scrub;
+- a read-only scrub counts nothing here: nothing is written back, and the
+  data device's own scrub will see the same errors;
+- when the data device is being scrubbed at the same time (its
+  scrub_ctx is set), that scrub repairs and counts its errors itself, so
+  the parity scrub neither writes back nor counts them.  It still uses
+  the repaired data for its parity check.  Crediting the data device's
+  scrub from here instead would count a sector twice whenever both scrubs
+  read it before either wrote the repair back, which is common when all
+  devices are scrubbed at once, since they move through the full stripes
+  together.
+
+A missing data device is not counted against.
+
+Test (raid56-wh-harness scrub-blame-test.sh): 8 damaged data sectors (or
+whole damaged strips: 288 raid5, 224 raid6) on one member, all devices
+scrubbed at once, the damaged one first, or last: every damaged sector
+counted once in every order, the device stats charged to that member
+only; read-only scrubs too.  Before: 7 of 8 (raid6 2 of 8) at once, 0
+with the damaged member last.  failing-member-scrub-test.sh, one member
+failing under load: raid5 36128 of 36128, raid6 30231 of 30231 damaged
+sectors counted; before, 26519 of 40556 and 11049 of 30723.
+
+Fixes: 1009254bf22a ("btrfs: scrub: use scrub_stripe to implement RAID56 P/Q scrub")
+Assisted-by: Claude:claude-opus-5-5
+---
+ fs/btrfs/scrub.c | 109 +++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 105 insertions(+), 4 deletions(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index a776b519acb8f..86c9801ca3155 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -85,10 +85,17 @@ enum scrub_stripe_flags {
+ 
+       /*
+        * Set for data stripes if it's triggered from P/Q stripe.
+-       * During such scrub, we should not report errors in data stripes, nor
+-       * update the accounting.
++       * During such scrub, only the errors repaired and written back are
++       * reported and counted, see scrub_report_parity_repairs().
+        */
+       SCRUB_STRIPE_FLAG_NO_REPORT,
++
++      /*
++       * Set for such a data stripe whose own device is being scrubbed at the
++       * same time: that scrub repairs and counts its errors, so they are not
++       * written back or counted here.
++       */
++      SCRUB_STRIPE_FLAG_OWN_SCRUB,
+ };
+ 
+ /*
+@@ -327,6 +334,12 @@ struct scrub_error_records {
+       unsigned int nr_csum_errors;
+       unsigned int nr_meta_errors;
+       unsigned int nr_meta_gen_errors;
++
++      /* The initial errors per type, for scrub_report_parity_repairs(). */
++      unsigned long init_io_error_bitmap;
++      unsigned long init_csum_error_bitmap;
++      unsigned long init_meta_error_bitmap;
++      unsigned long init_meta_gen_error_bitmap;
+ };
+ 
+ static void release_scrub_stripe(struct scrub_stripe *stripe)
+@@ -983,6 +996,73 @@ static void scrub_stripe_submit_repair_read(struct scrub_stripe *stripe,
+       }
+ }
+ 
++/*
++ * A RAID56 P/Q scrub reads, verifies and repairs the data stripes of each full
++ * stripe it checks, and writes the repairs back, so the data device's own
++ * scrub, if it gets there later, finds nothing.  Count here what was repaired
++ * and written back, as that scrub would have: in the device stats of the data
++ * stripe's device and in the progress of this scrub.
++ *
++ * Nothing else is counted here.  Errors left unrepaired, and everything in a
++ * read-only scrub, stay on disk for the data device's own scrub to find; and a
++ * data device that is being scrubbed at the same time repairs and counts its
++ * own errors (SCRUB_STRIPE_FLAG_OWN_SCRUB: nothing is written back here).  So
++ * each bad sector is counted once.
++ */
++static void scrub_report_parity_repairs(struct scrub_ctx *sctx,
++                                      struct scrub_stripe *stripe,
++                                      const struct scrub_error_records *errors)
++{
++      struct btrfs_fs_info *fs_info = sctx->fs_info;
++      const unsigned long error_bitmap = scrub_bitmap_read_error(stripe);
++      const unsigned int nr_sectors = stripe->nr_sectors;
++      unsigned long repaired;
++      unsigned int nr_io_errors;
++      unsigned int nr_csum_errors;
++      unsigned int nr_meta_errors;
++      unsigned int nr_meta_gen_errors;
++      int sector_nr;
++
++      if (sctx->readonly || test_bit(SCRUB_STRIPE_FLAG_OWN_SCRUB, &stripe->state) ||
++          !stripe->dev->bdev)
++              return;
++      bitmap_andnot(&repaired, &errors->init_error_bitmap, &error_bitmap, nr_sectors);
++      if (bitmap_empty(&repaired, nr_sectors))
++              return;
++
++      nr_io_errors = bitmap_weight_and(&repaired, &errors->init_io_error_bitmap,
++                                       nr_sectors);
++      nr_csum_errors = bitmap_weight_and(&repaired, &errors->init_csum_error_bitmap,
++                                         nr_sectors);
++      nr_meta_errors = bitmap_weight_and(&repaired, &errors->init_meta_error_bitmap,
++                                         nr_sectors);
++      nr_meta_gen_errors = bitmap_weight_and(&repaired,
++                                             &errors->init_meta_gen_error_bitmap,
++                                             nr_sectors);
++
++      for_each_set_bit(sector_nr, &repaired, nr_sectors)
++              btrfs_err_rl(fs_info,
++              "scrub: fixed up error at logical %llu on dev %s physical %llu",
++                           stripe->logical + ((u64)sector_nr << fs_info->sectorsize_bits),
++                           btrfs_dev_name(stripe->dev),
++                           stripe->physical + ((u64)sector_nr << fs_info->sectorsize_bits));
++
++      for (int i = 0; i < nr_io_errors; i++)
++              btrfs_dev_stat_inc_and_print(stripe->dev, BTRFS_DEV_STAT_READ_ERRS);
++      for (int i = 0; i < nr_csum_errors; i++)
++              btrfs_dev_stat_inc_and_print(stripe->dev, BTRFS_DEV_STAT_CORRUPTION_ERRS);
++      for (int i = 0; i < nr_meta_gen_errors;
++           i += (fs_info->nodesize >> fs_info->sectorsize_bits))
++              btrfs_dev_stat_inc_and_print(stripe->dev, BTRFS_DEV_STAT_GENERATION_ERRS);
++
++      spin_lock(&sctx->stat_lock);
++      sctx->stat.read_errors += nr_io_errors;
++      sctx->stat.csum_errors += nr_csum_errors;
++      sctx->stat.verify_errors += nr_meta_errors + nr_meta_gen_errors;
++      sctx->stat.corrected_errors += bitmap_weight(&repaired, nr_sectors);
++      spin_unlock(&sctx->stat_lock);
++}
++
+ static void scrub_stripe_report_errors(struct scrub_ctx *sctx,
+                                      struct scrub_stripe *stripe,
+                                      const struct scrub_error_records *errors)
+@@ -1000,8 +1080,10 @@ static void scrub_stripe_report_errors(struct scrub_ctx *sctx,
+       int nr_repaired_sectors = 0;
+       int sector_nr;
+ 
+-      if (test_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state))
++      if (test_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state)) {
++              scrub_report_parity_repairs(sctx, stripe, errors);
+               return;
++      }
+ 
+       /*
+        * The sectors were read from @stripe->dev at @stripe->physical.  Mapping
+@@ -1153,6 +1235,10 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
+       errors.nr_csum_errors = scrub_bitmap_weight_csum_error(stripe);
+       errors.nr_meta_errors = scrub_bitmap_weight_meta_error(stripe);
+       errors.nr_meta_gen_errors = scrub_bitmap_weight_meta_gen_error(stripe);
++      errors.init_io_error_bitmap = scrub_bitmap_read_io_error(stripe);
++      errors.init_csum_error_bitmap = scrub_bitmap_read_csum_error(stripe);
++      errors.init_meta_error_bitmap = scrub_bitmap_read_meta_error(stripe);
++      errors.init_meta_gen_error_bitmap = scrub_bitmap_read_meta_gen_error(stripe);
+ 
+       if (bitmap_empty(&errors.init_error_bitmap, stripe->nr_sectors))
+               goto out;
+@@ -1207,7 +1293,8 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
+        */
+       bitmap_andnot(&repaired, &errors.init_error_bitmap, &error,
+                     stripe->nr_sectors);
+-      if (!sctx->readonly && !bitmap_empty(&repaired, stripe->nr_sectors)) {
++      if (!sctx->readonly && !bitmap_empty(&repaired, stripe->nr_sectors) &&
++          !test_bit(SCRUB_STRIPE_FLAG_OWN_SCRUB, &stripe->state)) {
+               if (btrfs_is_zoned(fs_info)) {
+                       btrfs_repair_one_zone(fs_info, sctx->stripes[0].bg->start);
+               } else {
+@@ -2381,6 +2468,18 @@ static void scrub_raid56_copy_parity_rows(struct scrub_ctx *sctx,
+       kfree(buf);
+ }
+ 
++/* Is @dev being scrubbed right now, by a scrub other than @sctx? */
++static bool scrubbed_by_other(struct scrub_ctx *sctx, struct btrfs_device *dev)
++{
++      struct btrfs_fs_info *fs_info = sctx->fs_info;
++      bool ret;
++
++      mutex_lock(&fs_info->scrub_lock);
++      ret = dev->scrub_ctx && dev->scrub_ctx != sctx;
++      mutex_unlock(&fs_info->scrub_lock);
++      return ret;
++}
++
+ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+                                     struct btrfs_device *scrub_dev,
+                                     struct btrfs_block_group *bg,
+@@ -2439,6 +2538,8 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
+ 
+               scrub_reset_stripe(stripe);
+               set_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state);
++              if (scrubbed_by_other(sctx, map->stripes[stripe_index].dev))
++                      set_bit(SCRUB_STRIPE_FLAG_OWN_SCRUB, &stripe->state);
+               ret = scrub_find_fill_first_stripe(bg, &extent_path, &csum_path,
+                               map->stripes[stripe_index].dev, physical, 1,
+                               full_stripe_start +
+-- 
+2.47.3
+
diff --git a/topics/raid56-scrub-replace/0012-btrfs-scrub-name-the-device-a-raid56-data-sector-was.patch b/topics/raid56-scrub-replace/0012-btrfs-scrub-name-the-device-a-raid56-data-sector-was.patch
deleted file mode 100644 (file)
index 86c46e2..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-From 302044132402f123134b510a46f366a1a1544135 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 12/13] btrfs: scrub: name the device a raid56 data sector was
- read from
-To: linux-btrfs@vger.kernel.org
-
-scrub_stripe_report_errors() finds the device and physical address for
-its messages by mapping the stripe's logical address with
-BTRFS_MAP_GET_READ_MIRRORS and taking stripes[mirror_num - 1].  On RAID56
-that mapping is the full stripe's write mapping, and stripes[0] is the
-device of the full stripe's first data stripe, not the device the sector
-was read from.  So "checksum error at logical ... on dev ...", "fixed up
-error ... on dev ..." and "unable to fixup (regular) error ... on dev ..."
-name a device that rotates over the members with the full stripes, and a
-physical address on it that holds something else.  The device stats were
-always charged to the right device (stripe->dev).
-
-The scrub stripe already records where it was read from: use
-stripe->dev and stripe->physical.  For the mirrored and striped profiles
-that is the same device and address as before.
-
-Test (raid56-wh-harness scrub-blame-test.sh): with damaged data sectors
-on one raid5/raid6 member, every per-sector line names that member, in
-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(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 869e284aff461..d704fd0d64435 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -996,34 +996,17 @@ static void scrub_stripe_report_errors(struct scrub_ctx *sctx,
-               return;
- 
-       /*
--       * Init needed infos for error reporting.
--       *
--       * Although our scrub_stripe infrastructure is mostly based on btrfs_submit_bio()
--       * thus no need for dev/physical, error reporting still needs dev and physical.
-+       * The sectors were read from @stripe->dev at @stripe->physical.  Mapping
-+       * @stripe->logical back with BTRFS_MAP_GET_READ_MIRRORS does not give that
-+       * on RAID56: it returns the full stripe's write mapping, whose
-+       * stripes[mirror_num - 1] is the device of the full stripe's first data
-+       * stripe.
-        */
-       if (!bitmap_empty(&errors->init_error_bitmap, stripe->nr_sectors)) {
--              u64 mapped_len = fs_info->sectorsize;
--              struct btrfs_io_context *bioc = NULL;
--              int stripe_index = stripe->mirror_num - 1;
--              int ret;
--
--              /* For scrub, our mirror_num should always start at 1. */
--              ASSERT(stripe->mirror_num >= 1, "stripe->mirror_num=%d", stripe->mirror_num);
--              ret = btrfs_map_block(fs_info, BTRFS_MAP_GET_READ_MIRRORS,
--                                    stripe->logical, &mapped_len, &bioc,
--                                    NULL, NULL);
--              /*
--               * If we failed, dev will be NULL, and later detailed reports
--               * will just be skipped.
--               */
--              if (ret < 0)
--                      goto skip;
--              physical = bioc->stripes[stripe_index].physical;
--              dev = bioc->stripes[stripe_index].dev;
--              btrfs_put_bioc(bioc);
-+              dev = stripe->dev;
-+              physical = stripe->physical;
-       }
- 
--skip:
-       for_each_set_bit(sector_nr, &extent_bitmap, stripe->nr_sectors) {
-               const u64 sector_logical = stripe->logical +
-                                          ((u64)sector_nr << fs_info->sectorsize_bits);
--- 
-2.47.3
-
diff --git a/topics/raid56-scrub-replace/0013-btrfs-scrub-count-the-raid56-data-repairs-made-by-a-.patch b/topics/raid56-scrub-replace/0013-btrfs-scrub-count-the-raid56-data-repairs-made-by-a-.patch
deleted file mode 100644 (file)
index a4e0af7..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-From 9970d7e44abf0e5a7c67c93228908af5a0303f86 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 13/13] btrfs: scrub: count the raid56 data repairs made by a
- parity scrub
-To: linux-btrfs@vger.kernel.org
-
-The scrub of a RAID56 P/Q device reads every data stripe of each full
-stripe it checks, verifies and repairs them, and writes the repairs back,
-but counts nothing (SCRUB_STRIPE_FLAG_NO_REPORT): neither the scrub
-progress nor the device stats.  When the P/Q device's scrub reaches a
-full stripe before the data device's own scrub does, the data device's
-scrub finds the sector already repaired, and the error is counted
-nowhere.  With all devices scrubbed at once that is a large share of the
-errors (one failing raid5 member: 25831 of 42371 damaged data sectors
-counted; raid6: 7894 of 34146), and when the damaged device is scrubbed
-last, none of them.
-
-Count the sectors that the parity scrub repaired and wrote back, as the
-data device's scrub would have: read, checksum and verify errors in the
-device stats of the data stripe's own device, and in the parity scrub's
-progress with corrected_errors.  To count each bad sector once:
-
-- errors left unrepaired are not counted: they stay on disk for the data
-  device's own scrub;
-- a read-only scrub counts nothing here: nothing is written back, and the
-  data device's own scrub will see the same errors;
-- when the data device is being scrubbed at the same time (its
-  scrub_ctx is set), that scrub repairs and counts its errors itself, so
-  the parity scrub neither writes back nor counts them.  It still uses
-  the repaired data for its parity check.  Crediting the data device's
-  scrub from here instead would count a sector twice whenever both scrubs
-  read it before either wrote the repair back, which is common when all
-  devices are scrubbed at once, since they move through the full stripes
-  together.
-
-A missing data device is not counted against.
-
-Test (raid56-wh-harness scrub-blame-test.sh): 8 damaged data sectors (or
-whole damaged strips: 288 raid5, 224 raid6) on one member, all devices
-scrubbed at once, the damaged one first, or last: every damaged sector
-counted once in every order, the device stats charged to that member
-only; read-only scrubs too.  Before: 7 of 8 (raid6 2 of 8) at once, 0
-with the damaged member last.  failing-member-scrub-test.sh, one member
-failing under load: raid5 36128 of 36128, raid6 30231 of 30231 damaged
-sectors counted; before, 26519 of 40556 and 11049 of 30723.
-
-Fixes: 1009254bf22a ("btrfs: scrub: use scrub_stripe to implement RAID56 P/Q scrub")
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/scrub.c | 109 +++++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 105 insertions(+), 4 deletions(-)
-
-diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index d704fd0d64435..5cf7830c63a4b 100644
---- a/fs/btrfs/scrub.c
-+++ b/fs/btrfs/scrub.c
-@@ -85,10 +85,17 @@ enum scrub_stripe_flags {
- 
-       /*
-        * Set for data stripes if it's triggered from P/Q stripe.
--       * During such scrub, we should not report errors in data stripes, nor
--       * update the accounting.
-+       * During such scrub, only the errors repaired and written back are
-+       * reported and counted, see scrub_report_parity_repairs().
-        */
-       SCRUB_STRIPE_FLAG_NO_REPORT,
-+
-+      /*
-+       * Set for such a data stripe whose own device is being scrubbed at the
-+       * same time: that scrub repairs and counts its errors, so they are not
-+       * written back or counted here.
-+       */
-+      SCRUB_STRIPE_FLAG_OWN_SCRUB,
- };
- 
- /*
-@@ -326,6 +333,12 @@ struct scrub_error_records {
-       unsigned int nr_csum_errors;
-       unsigned int nr_meta_errors;
-       unsigned int nr_meta_gen_errors;
-+
-+      /* The initial errors per type, for scrub_report_parity_repairs(). */
-+      unsigned long init_io_error_bitmap;
-+      unsigned long init_csum_error_bitmap;
-+      unsigned long init_meta_error_bitmap;
-+      unsigned long init_meta_gen_error_bitmap;
- };
- 
- static void release_scrub_stripe(struct scrub_stripe *stripe)
-@@ -975,6 +988,73 @@ static void scrub_stripe_submit_repair_read(struct scrub_stripe *stripe,
-       }
- }
- 
-+/*
-+ * A RAID56 P/Q scrub reads, verifies and repairs the data stripes of each full
-+ * stripe it checks, and writes the repairs back, so the data device's own
-+ * scrub, if it gets there later, finds nothing.  Count here what was repaired
-+ * and written back, as that scrub would have: in the device stats of the data
-+ * stripe's device and in the progress of this scrub.
-+ *
-+ * Nothing else is counted here.  Errors left unrepaired, and everything in a
-+ * read-only scrub, stay on disk for the data device's own scrub to find; and a
-+ * data device that is being scrubbed at the same time repairs and counts its
-+ * own errors (SCRUB_STRIPE_FLAG_OWN_SCRUB: nothing is written back here).  So
-+ * each bad sector is counted once.
-+ */
-+static void scrub_report_parity_repairs(struct scrub_ctx *sctx,
-+                                      struct scrub_stripe *stripe,
-+                                      const struct scrub_error_records *errors)
-+{
-+      struct btrfs_fs_info *fs_info = sctx->fs_info;
-+      const unsigned long error_bitmap = scrub_bitmap_read_error(stripe);
-+      const unsigned int nr_sectors = stripe->nr_sectors;
-+      unsigned long repaired;
-+      unsigned int nr_io_errors;
-+      unsigned int nr_csum_errors;
-+      unsigned int nr_meta_errors;
-+      unsigned int nr_meta_gen_errors;
-+      int sector_nr;
-+
-+      if (sctx->readonly || test_bit(SCRUB_STRIPE_FLAG_OWN_SCRUB, &stripe->state) ||
-+          !stripe->dev->bdev)
-+              return;
-+      bitmap_andnot(&repaired, &errors->init_error_bitmap, &error_bitmap, nr_sectors);
-+      if (bitmap_empty(&repaired, nr_sectors))
-+              return;
-+
-+      nr_io_errors = bitmap_weight_and(&repaired, &errors->init_io_error_bitmap,
-+                                       nr_sectors);
-+      nr_csum_errors = bitmap_weight_and(&repaired, &errors->init_csum_error_bitmap,
-+                                         nr_sectors);
-+      nr_meta_errors = bitmap_weight_and(&repaired, &errors->init_meta_error_bitmap,
-+                                         nr_sectors);
-+      nr_meta_gen_errors = bitmap_weight_and(&repaired,
-+                                             &errors->init_meta_gen_error_bitmap,
-+                                             nr_sectors);
-+
-+      for_each_set_bit(sector_nr, &repaired, nr_sectors)
-+              btrfs_err_rl(fs_info,
-+              "scrub: fixed up error at logical %llu on dev %s physical %llu",
-+                           stripe->logical + ((u64)sector_nr << fs_info->sectorsize_bits),
-+                           btrfs_dev_name(stripe->dev),
-+                           stripe->physical + ((u64)sector_nr << fs_info->sectorsize_bits));
-+
-+      for (int i = 0; i < nr_io_errors; i++)
-+              btrfs_dev_stat_inc_and_print(stripe->dev, BTRFS_DEV_STAT_READ_ERRS);
-+      for (int i = 0; i < nr_csum_errors; i++)
-+              btrfs_dev_stat_inc_and_print(stripe->dev, BTRFS_DEV_STAT_CORRUPTION_ERRS);
-+      for (int i = 0; i < nr_meta_gen_errors;
-+           i += (fs_info->nodesize >> fs_info->sectorsize_bits))
-+              btrfs_dev_stat_inc_and_print(stripe->dev, BTRFS_DEV_STAT_GENERATION_ERRS);
-+
-+      spin_lock(&sctx->stat_lock);
-+      sctx->stat.read_errors += nr_io_errors;
-+      sctx->stat.csum_errors += nr_csum_errors;
-+      sctx->stat.verify_errors += nr_meta_errors + nr_meta_gen_errors;
-+      sctx->stat.corrected_errors += bitmap_weight(&repaired, nr_sectors);
-+      spin_unlock(&sctx->stat_lock);
-+}
-+
- static void scrub_stripe_report_errors(struct scrub_ctx *sctx,
-                                      struct scrub_stripe *stripe,
-                                      const struct scrub_error_records *errors)
-@@ -992,8 +1072,10 @@ static void scrub_stripe_report_errors(struct scrub_ctx *sctx,
-       int nr_repaired_sectors = 0;
-       int sector_nr;
- 
--      if (test_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state))
-+      if (test_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state)) {
-+              scrub_report_parity_repairs(sctx, stripe, errors);
-               return;
-+      }
- 
-       /*
-        * The sectors were read from @stripe->dev at @stripe->physical.  Mapping
-@@ -1145,6 +1227,10 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
-       errors.nr_csum_errors = scrub_bitmap_weight_csum_error(stripe);
-       errors.nr_meta_errors = scrub_bitmap_weight_meta_error(stripe);
-       errors.nr_meta_gen_errors = scrub_bitmap_weight_meta_gen_error(stripe);
-+      errors.init_io_error_bitmap = scrub_bitmap_read_io_error(stripe);
-+      errors.init_csum_error_bitmap = scrub_bitmap_read_csum_error(stripe);
-+      errors.init_meta_error_bitmap = scrub_bitmap_read_meta_error(stripe);
-+      errors.init_meta_gen_error_bitmap = scrub_bitmap_read_meta_gen_error(stripe);
- 
-       if (bitmap_empty(&errors.init_error_bitmap, stripe->nr_sectors))
-               goto out;
-@@ -1199,7 +1285,8 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
-        */
-       bitmap_andnot(&repaired, &errors.init_error_bitmap, &error,
-                     stripe->nr_sectors);
--      if (!sctx->readonly && !bitmap_empty(&repaired, stripe->nr_sectors)) {
-+      if (!sctx->readonly && !bitmap_empty(&repaired, stripe->nr_sectors) &&
-+          !test_bit(SCRUB_STRIPE_FLAG_OWN_SCRUB, &stripe->state)) {
-               if (btrfs_is_zoned(fs_info)) {
-                       btrfs_repair_one_zone(fs_info, sctx->stripes[0].bg->start);
-               } else {
-@@ -2364,6 +2451,18 @@ static void scrub_raid56_copy_parity_rows(struct scrub_ctx *sctx,
-       kfree(buf);
- }
- 
-+/* Is @dev being scrubbed right now, by a scrub other than @sctx? */
-+static bool scrubbed_by_other(struct scrub_ctx *sctx, struct btrfs_device *dev)
-+{
-+      struct btrfs_fs_info *fs_info = sctx->fs_info;
-+      bool ret;
-+
-+      mutex_lock(&fs_info->scrub_lock);
-+      ret = dev->scrub_ctx && dev->scrub_ctx != sctx;
-+      mutex_unlock(&fs_info->scrub_lock);
-+      return ret;
-+}
-+
- static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
-                                     struct btrfs_device *scrub_dev,
-                                     struct btrfs_block_group *bg,
-@@ -2421,6 +2520,8 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
- 
-               scrub_reset_stripe(stripe);
-               set_bit(SCRUB_STRIPE_FLAG_NO_REPORT, &stripe->state);
-+              if (scrubbed_by_other(sctx, map->stripes[stripe_index].dev))
-+                      set_bit(SCRUB_STRIPE_FLAG_OWN_SCRUB, &stripe->state);
-               ret = scrub_find_fill_first_stripe(bg, &extent_path, &csum_path,
-                               map->stripes[stripe_index].dev, physical, 1,
-                               full_stripe_start + btrfs_stripe_nr_to_offset(i),
--- 
-2.47.3
-
index adc8bc59946bd3429d63f0afece155a7705eb5b5..91edfa9296fb398440bc9ff1271fcea4a9e8d68c 100644 (file)
@@ -1,5 +1,10 @@
 # Testing: raid56-scrub-replace
 
+> **Numbering (2026-10-25):** the lane was rebased onto btrfs/for-next
+> `0713fa6a4356`, which contains Filipe Manana's -EIO fix (`ec0795c045c3`),
+> so the series is now 0/12.  The patch numbers below are from the earlier
+> 13-patch export: "patch 1" is Filipe's, and patch N here is patch N-1 now.
+
 RAID5/6 scrub and device replace with unrepairable data, made to behave
 like the other profiles.  Patch 1 (Filipe Manana's, in for-next) restores
 the -EIO of a full stripe with unrepaired data.  Patch 2 checks and
index 93ee3874b040500a9937e9b8c0bfe4502731ce9a..542808f0b70933c670625c63a653fa9698051b57 100644 (file)
@@ -1,6 +1,6 @@
-From 18680c6045be2df3dd156e7cce746b6dcb9532b3 Mon Sep 17 00:00:00 2001
+From ccf8a6c6d49bbbf18675148d9af1a74d7512f6aa Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 17 Oct 2026 22:32:18 -0400
+Date: Sun, 25 Oct 2026 03:13:47 -0400
 Subject: [PATCH 0/9] btrfs: read policies and per-device read stats (Kai Krakow's series, as carried on misc-next)
 To: linux-btrfs@vger.kernel.org
 
@@ -40,7 +40,7 @@ Kai Krakow (9):
  6 files changed, 510 insertions(+), 32 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 921fd4f94f1c5ba0fd09f3bb12146d628395f605..1168c037f6c9ac162b29617543161b70d7134f7e 100644 (file)
@@ -1,4 +1,4 @@
-From e0b5265e83e087232fef5a48067242e0f2602eb8 Mon Sep 17 00:00:00 2001
+From ec0c9ea075a4fa3b568c350fb6b77326ee73178f 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
@@ -46,7 +46,7 @@ index 0b8d8905e38e2..63573bda0ea4c 100644
        bool "Btrfs experimental features"
        depends on BTRFS_FS
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..145516adffb73 100644
+index 89b0a4ef4063e..da3c434cd858b 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -26,6 +26,10 @@
@@ -60,7 +60,7 @@ index 3ac1fa608d3b5..145516adffb73 100644
  /*
   * Structure name                       Path
   * --------------------------------------------------------------------------
-@@ -1983,12 +1987,37 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
+@@ -1984,12 +1988,37 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
  }
  BTRFS_ATTR(devid, error_stats, btrfs_devinfo_error_stats_show);
  
@@ -99,10 +99,10 @@ index 3ac1fa608d3b5..145516adffb73 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 d3e6a9b429dd9..da86a8a5a3e99 100644
+index ce78a9441c64f..1ee88bb257ac1 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6669,6 +6669,15 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6682,6 +6682,15 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        else
                num_stripes = map->num_stripes;
  
@@ -118,7 +118,7 @@ index d3e6a9b429dd9..da86a8a5a3e99 100644
        switch (policy) {
        default:
                /* Shouldn't happen, just warn and use pid instead of failing */
-@@ -6704,14 +6713,29 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6717,14 +6726,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 d3e6a9b429dd9..da86a8a5a3e99 100644
         * and the io error handling code will clean up eventually
         */
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 6eddda2392215..b3a4e1c085ab7 100644
+index 75b1179776c80..d065cec44e547 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -217,6 +217,14 @@ struct btrfs_device {
index 0d14058f460c5ae117b756e8675c1ea5b2f3c66e..ae710e727fce7e866c3aa4d7c18991b72b360a78 100644 (file)
@@ -1,4 +1,4 @@
-From 5edcbb7d3b4a947aebc5495fca7e112b191fe86c Mon Sep 17 00:00:00 2001
+From 06930d250a45b0deb76222acf79694e5a40b5992 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
@@ -45,10 +45,10 @@ index 63573bda0ea4c..76ab83e7408e3 100644
        bool "Btrfs experimental features"
        depends on BTRFS_FS
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index acb704b20c2be..12b2ee47bb383 100644
+index b424cc836bd4a..d975cfb86547e 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
-@@ -2587,7 +2587,7 @@ static int __init btrfs_print_mod_info(void)
+@@ -2589,7 +2589,7 @@ static int __init btrfs_print_mod_info(void)
  #endif
                        ;
  
@@ -57,7 +57,7 @@ index acb704b20c2be..12b2ee47bb383 100644
        if (btrfs_get_mod_read_policy() == NULL)
                pr_info("Btrfs loaded%s\n", options);
        else
-@@ -2595,7 +2595,7 @@ static int __init btrfs_print_mod_info(void)
+@@ -2597,7 +2597,7 @@ static int __init btrfs_print_mod_info(void)
                         options, btrfs_get_mod_read_policy());
  #else
        pr_info("Btrfs loaded%s\n", options);
@@ -66,7 +66,7 @@ index acb704b20c2be..12b2ee47bb383 100644
  
        return 0;
  }
-@@ -2657,11 +2657,11 @@ static const struct init_sequence mod_init_seq[] = {
+@@ -2659,11 +2659,11 @@ static const struct init_sequence mod_init_seq[] = {
        }, {
                .init_func = btrfs_extent_map_init,
                .exit_func = btrfs_extent_map_exit,
@@ -81,7 +81,7 @@ index acb704b20c2be..12b2ee47bb383 100644
                .init_func = ordered_data_init,
                .exit_func = ordered_data_exit,
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 145516adffb73..f920334f4cf5d 100644
+index da3c434cd858b..59e0d97e7ee64 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1209,13 +1209,13 @@ BTRFS_ATTR(, temp_fsid, btrfs_temp_fsid_show);
@@ -196,7 +196,7 @@ index 05498e5346c39..abc5ac356c8dc 100644
  
  #endif
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index da86a8a5a3e99..69aaeaba032b5 100644
+index 1ee88bb257ac1..983f4d7910bc6 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,
@@ -217,7 +217,7 @@ index da86a8a5a3e99..69aaeaba032b5 100644
  
        return 0;
  }
-@@ -6580,7 +6580,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
+@@ -6593,7 +6593,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
        return len;
  }
  
@@ -226,7 +226,7 @@ index da86a8a5a3e99..69aaeaba032b5 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++) {
-@@ -6648,7 +6648,7 @@ static int btrfs_read_rr(const struct btrfs_chunk_map *map, int first, int num_s
+@@ -6661,7 +6661,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 da86a8a5a3e99..69aaeaba032b5 100644
  
  static int find_live_mirror(struct btrfs_fs_info *fs_info,
                            struct btrfs_chunk_map *map, int first,
-@@ -6688,14 +6688,14 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6701,14 +6701,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 da86a8a5a3e99..69aaeaba032b5 100644
  
        if (dev_replace_is_ongoing &&
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index b3a4e1c085ab7..4ee18de14376f 100644
+index d065cec44e547..fc9bc3f462795 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -334,12 +334,12 @@ enum btrfs_chunk_allocation_policy {
index c24e8d9a3bcc52d0ea5f0754a2f6d92a6c6ae7d7..3a7f51f24bb6616fc679e1d56f5b751733f48129 100644 (file)
@@ -1,4 +1,4 @@
-From 58f1d153286feb1ac4e12b601fd69aa8b831f4b3 Mon Sep 17 00:00:00 2001
+From 9f84f0ee680adf55ff17a0c10277b21216eb100d 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
@@ -21,7 +21,7 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  3 files changed, 56 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index f920334f4cf5d..153e3de6b17d2 100644
+index 59e0d97e7ee64..c851f6c44207b 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1211,6 +1211,7 @@ static const char *btrfs_read_policy_name[] = {
@@ -42,7 +42,7 @@ index f920334f4cf5d..153e3de6b17d2 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 69aaeaba032b5..39e33f1b7623a 100644
+index 983f4d7910bc6..f94e9a2f58e3b 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -35,6 +35,10 @@
@@ -56,7 +56,7 @@ index 69aaeaba032b5..39e33f1b7623a 100644
  #define BTRFS_BLOCK_GROUP_STRIPE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
                                         BTRFS_BLOCK_GROUP_RAID10 | \
                                         BTRFS_BLOCK_GROUP_RAID56_MASK)
-@@ -6581,6 +6585,50 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
+@@ -6594,6 +6598,50 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
  }
  
  #ifdef CONFIG_BTRFS_READ_POLICIES
@@ -107,7 +107,7 @@ index 69aaeaba032b5..39e33f1b7623a 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++) {
-@@ -6692,6 +6740,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6705,6 +6753,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 69aaeaba032b5..39e33f1b7623a 100644
                preferred_mirror = btrfs_read_preferred(map, first, num_stripes);
                break;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 4ee18de14376f..8cbdc5f046d37 100644
+index fc9bc3f462795..e81d80273254c 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -337,6 +337,8 @@ enum btrfs_read_policy {
index 86ecf8ac246348f8d495a1803efd660a8aaf5551..707469a2b386c057cd0994aa1d9840b7a77de250 100644 (file)
@@ -1,4 +1,4 @@
-From e8d03a2eb2b967ebb4dac78581caafa3bd09a484 Mon Sep 17 00:00:00 2001
+From 244eddf9e713458014856e0cc62ab0c5be764871 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 39e33f1b7623a..d9a6aded882bd 100644
+index f94e9a2f58e3b..42d537ef1b67f 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6717,14 +6717,17 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6730,14 +6730,17 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        else
                num_stripes = map->num_stripes;
  
@@ -40,7 +40,7 @@ index 39e33f1b7623a..d9a6aded882bd 100644
  
        switch (policy) {
        default:
-@@ -6776,17 +6779,19 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6789,17 +6792,19 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
        }
  
  out:
@@ -63,7 +63,7 @@ index 39e33f1b7623a..d9a6aded882bd 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 8cbdc5f046d37..8a9121a3a9a6a 100644
+index e81d80273254c..5b94161023664 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -218,10 +218,10 @@ struct btrfs_device {
index 293a9757e7f26b06bd5e524aa3637b3a9695e52e..db1499c82e5b2503199abd834e37cd78b63adbed 100644 (file)
@@ -1,4 +1,4 @@
-From cc52421fcb450bc901264391a0873211ee15e033 Mon Sep 17 00:00:00 2001
+From 776a329bca41446491777ce2bdd5a02518111a19 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 d9a6aded882bd..bc1d10f04c1d1 100644
+index 42d537ef1b67f..c14768795cda1 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6600,28 +6600,48 @@ static unsigned int part_in_flight(struct block_device *part)
+@@ -6613,28 +6613,48 @@ static unsigned int part_in_flight(struct block_device *part)
        return inflight;
  }
  
index e16f202d96d7f86738071ecf801a8fc8586486fc..c68404709c69bb805621b8a3078efa0d89ceff6d 100644 (file)
@@ -1,4 +1,4 @@
-From 30bcda8ddcc9e827bb1e552f4f1b7b0206f4d13e Mon Sep 17 00:00:00 2001
+From 9e1ef3d3ea2434fb152e0bfcb8e1695989a00889 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
@@ -44,10 +44,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  3 files changed, 100 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 153e3de6b17d2..41dabaa74d7cb 100644
+index c851f6c44207b..aa7cac991e684 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
-@@ -1997,15 +1997,18 @@ static ssize_t btrfs_devinfo_read_stats_show(struct kobject *kobj,
+@@ -1998,15 +1998,18 @@ static ssize_t btrfs_devinfo_read_stats_show(struct kobject *kobj,
        u64 read_wait = device->bdev ? part_stat_read(device->bdev, nsecs[READ]) : 0;
        unsigned long read_ios = device->bdev ?
                part_stat_read(device->bdev, ios[READ]) : 0;
@@ -69,7 +69,7 @@ index 153e3de6b17d2..41dabaa74d7cb 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 bc1d10f04c1d1..41916fccbd534 100644
+index c14768795cda1..d7bbe94175c2d 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -35,9 +35,12 @@
@@ -87,7 +87,7 @@ index bc1d10f04c1d1..41916fccbd534 100644
  
  #define BTRFS_BLOCK_GROUP_STRIPE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
                                         BTRFS_BLOCK_GROUP_RAID10 | \
-@@ -6649,6 +6652,77 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6662,6 +6665,77 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
        return best_stripe;
  }
  
@@ -165,7 +165,7 @@ index bc1d10f04c1d1..41916fccbd534 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++) {
-@@ -6749,6 +6823,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6762,6 +6836,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 bc1d10f04c1d1..41916fccbd534 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 8a9121a3a9a6a..f53f7054370d7 100644
+index 5b94161023664..c06dc6b33c839 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -224,6 +224,21 @@ struct btrfs_device {
index 3d9908bdfa2f12683c1fdd4850aaddf735ea2647..edf9b0498092efaed60e19b95338607f43b8024c 100644 (file)
@@ -1,4 +1,4 @@
-From ce4d2122a02179d86eff1fab2ce14608bbcd9b19 Mon Sep 17 00:00:00 2001
+From 498e825a967d96cc549d310fbad098402fc60224 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
@@ -50,7 +50,7 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  3 files changed, 200 insertions(+), 19 deletions(-)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 41dabaa74d7cb..53acacb491d7c 100644
+index aa7cac991e684..953b47cbf38ea 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -11,6 +11,10 @@
@@ -92,7 +92,7 @@ index 41dabaa74d7cb..53acacb491d7c 100644
  #endif /* CONFIG_BTRFS_READ_POLICIES */
  
  int btrfs_read_policy_to_enum(const char *str, s64 *value_ret)
-@@ -1998,17 +1999,45 @@ static ssize_t btrfs_devinfo_read_stats_show(struct kobject *kobj,
+@@ -1999,17 +2000,45 @@ static ssize_t btrfs_devinfo_read_stats_show(struct kobject *kobj,
        unsigned long read_ios = device->bdev ?
                part_stat_read(device->bdev, ios[READ]) : 0;
        u64 health_avg = (u64)atomic64_read(&device->health_avg_ns);
@@ -141,7 +141,7 @@ index 41dabaa74d7cb..53acacb491d7c 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 41916fccbd534..e12cb8df96aa5 100644
+index d7bbe94175c2d..245ae1ef7b363 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -36,11 +36,9 @@
@@ -157,7 +157,7 @@ index 41916fccbd534..e12cb8df96aa5 100644
  
  #define BTRFS_BLOCK_GROUP_STRIPE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
                                         BTRFS_BLOCK_GROUP_RAID10 | \
-@@ -6652,9 +6650,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6665,9 +6663,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
        return best_stripe;
  }
  
@@ -168,7 +168,7 @@ index 41916fccbd534..e12cb8df96aa5 100644
  #define BTRFS_READ_HEALTH_RECHECK_INTERVAL    HZ
  #define BTRFS_READ_HEALTH_MIN_SAMPLE_IOS      256ULL
  
-@@ -6662,6 +6659,15 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6675,6 +6672,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 41916fccbd534..e12cb8df96aa5 100644
   */
  static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
                                     int num_stripes)
-@@ -6717,11 +6723,129 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6730,11 +6736,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 41916fccbd534..e12cb8df96aa5 100644
  
  static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first, int num_stripes)
  {
-@@ -6823,10 +6947,6 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6836,10 +6960,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 41916fccbd534..e12cb8df96aa5 100644
        switch (policy) {
        default:
                /* Shouldn't happen, just warn and use pid instead of failing */
-@@ -6845,6 +6965,10 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
+@@ -6858,6 +6978,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 41916fccbd534..e12cb8df96aa5 100644
                preferred_mirror = btrfs_read_preferred(map, first, num_stripes);
                break;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index f53f7054370d7..c03f4fadf6c02 100644
+index c06dc6b33c839..211b406ab3413 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -225,6 +225,14 @@ struct btrfs_device {
index 8e4952a2d14bfa6b1c0ee3bbd9224e0f1f1bcb33..fa3267aa3001fc59adde7a61c9ca285cb9d34dd9 100644 (file)
@@ -1,4 +1,4 @@
-From c433a2eb15764ab90d4dba71a7f35a79a6950f2a Mon Sep 17 00:00:00 2001
+From 5fa641efa7da094fc3322d307f9077f0f355e2dd 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 e12cb8df96aa5..15d6fe7b7ab02 100644
+index 245ae1ef7b363..5cbec0f704129 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6650,7 +6650,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
+@@ -6663,7 +6663,8 @@ static int btrfs_read_earliest(struct btrfs_fs_info *fs_info,
        return best_stripe;
  }
  
@@ -37,7 +37,7 @@ index e12cb8df96aa5..15d6fe7b7ab02 100644
  
  #define BTRFS_READ_HEALTH_RECHECK_INTERVAL    HZ
  #define BTRFS_READ_HEALTH_MIN_SAMPLE_IOS      256ULL
-@@ -6745,14 +6746,14 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6758,14 +6759,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 e12cb8df96aa5..15d6fe7b7ab02 100644
   */
  static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
                                      struct btrfs_chunk_map *map, int first,
-@@ -6768,6 +6769,8 @@ static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
+@@ -6781,6 +6782,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 e12cb8df96aa5..15d6fe7b7ab02 100644
  
        btrfs_update_read_health(map, first, num_stripes);
  
-@@ -6835,7 +6838,21 @@ static int btrfs_read_queue_adaptive(struct btrfs_fs_info *fs_info,
+@@ -6848,7 +6851,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 15cdb8b83dd6e870a11a8fa3596778a96d0bd107..1fa55c4d67c3e4ce2b85928bacf392d4fc6b5c9b 100644 (file)
@@ -1,4 +1,4 @@
-From 18680c6045be2df3dd156e7cce746b6dcb9532b3 Mon Sep 17 00:00:00 2001
+From ccf8a6c6d49bbbf18675148d9af1a74d7512f6aa 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
@@ -26,10 +26,10 @@ Signed-off-by: Kai Krakow <kai@kaishome.de>
  3 files changed, 19 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 53acacb491d7c..e8d9ac077b87f 100644
+index 953b47cbf38ea..ec077db33ee4f 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
-@@ -2031,13 +2031,15 @@ static ssize_t btrfs_devinfo_read_stats_show(struct kobject *kobj,
+@@ -2032,13 +2032,15 @@ static ssize_t btrfs_devinfo_read_stats_show(struct kobject *kobj,
        }
  
        return scnprintf(buf, PAGE_SIZE,
@@ -48,10 +48,10 @@ index 53acacb491d7c..e8d9ac077b87f 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 15d6fe7b7ab02..5070cbf18ebca 100644
+index 5cbec0f704129..63b646073e423 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6696,6 +6696,10 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6709,6 +6709,10 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
                    checked_jiffies)
                        continue;
  
@@ -62,7 +62,7 @@ index 15d6fe7b7ab02..5070cbf18ebca 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.
-@@ -6703,8 +6707,12 @@ static void btrfs_update_read_health(struct btrfs_chunk_map *map, int first,
+@@ -6716,8 +6720,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 15d6fe7b7ab02..5070cbf18ebca 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 c03f4fadf6c02..6b5b71b370ba2 100644
+index 211b406ab3413..0234e95d845a0 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -230,6 +230,12 @@ struct btrfs_device {
index f91354f7e7bad6cb50c5b176e370c9f2f5a8ab20..5d20c45822cc1859820abb8d92d69795851fd05b 100644 (file)
@@ -1,6 +1,6 @@
-From 035bd2f8c1e3e4a22eeb388f4a35a558af9ea424 Mon Sep 17 00:00:00 2001
+From df4629dcf9ad9994c9d40ed0705d072cf58c05d5 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 21:56:55 -0400
+Date: Sun, 25 Oct 2026 03:13:48 -0400
 Subject: [PATCH 0/4] btrfs: read repair and scrub after a transaction abort
 To: linux-btrfs@vger.kernel.org
 
@@ -74,7 +74,7 @@ Zygo Blaxell (4):
  3 files changed, 47 insertions(+), 3 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 01e0bd0230b426294f72c5785c7ef8c8958944ff..4038df6b2abec5777614e988db1b7d2c31d65250 100644 (file)
@@ -1,4 +1,4 @@
-From a0d12f2d99a3c84f17228e42e6b0c0c99a798711 Mon Sep 17 00:00:00 2001
+From 020df2f9856ef39d4216e12bbded5107c556506b 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
index 4925850622b6e86da2d1f9c5e192067f766368c4..93438af7ea9ffa74967ea0db08f1b056f36bf6e7 100644 (file)
@@ -1,4 +1,4 @@
-From 49af9ece472850eaf172378e92763600c4792be9 Mon Sep 17 00:00:00 2001
+From f05da064ee63244a7a89d77b6020e44433f2b5f2 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
index 2a27383b5b969e9a7f99e27812ee0ca454990d14..4d35fafd176a8606fb7ea41d1d863b02423bcd9c 100644 (file)
@@ -1,4 +1,4 @@
-From 0f853995814e3ab2c39bc79e6ba8a97b2c0caae1 Mon Sep 17 00:00:00 2001
+From 7bc1870e25ad7e6ad2171059bafa41f656acdb9f 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
index 52df950a12e6d8e2c05000922fe785e9e644ea0d..f29a013e9cc46a7e1663331ca8c4d558794bd5d2 100644 (file)
@@ -1,4 +1,4 @@
-From 035bd2f8c1e3e4a22eeb388f4a35a558af9ea424 Mon Sep 17 00:00:00 2001
+From df4629dcf9ad9994c9d40ed0705d072cf58c05d5 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
@@ -37,10 +37,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 479c0e037015a..6f27040d03eb2 100644
+index 98362c91bce43..4770fd5e8039c 100644
 --- a/fs/btrfs/scrub.c
 +++ b/fs/btrfs/scrub.c
-@@ -1213,10 +1213,14 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
+@@ -1221,10 +1221,14 @@ static void scrub_stripe_read_repair_worker(struct work_struct *work)
        /*
         * Submit the repaired sectors.  For zoned case, we cannot do repair
         * in-place, but queue the bg to be relocated.
index 86418a13e2fae1e8e6687c134b029549067424b5..34f670aeb84252ccd64c560d7bf9d718d7c60009 100644 (file)
@@ -1,6 +1,6 @@
-From 43c8a1e60a5ae00c430c186df89d3ac462c08b96 Mon Sep 17 00:00:00 2001
+From 1c26761301041e16e2d84460c570ba92f4f66c58 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Sat, 17 Oct 2026 22:32:18 -0400
+Date: Sun, 25 Oct 2026 03:13:47 -0400
 Subject: [PATCH 0/7] btrfs: dev-replace error accounting, cancel state, and an abort option
 To: linux-btrfs@vger.kernel.org
 
@@ -71,7 +71,7 @@ Zygo Blaxell (7):
  5 files changed, 107 insertions(+), 14 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 65b1a4845e61250ad7c361e525c5929bec09018b..8ff11e4dfba6edcef4f1d41f8394356f1beb3e6d 100644 (file)
@@ -1,4 +1,4 @@
-From 065b371cedd915e03a3eddfc6fa39111e4b8dfb9 Mon Sep 17 00:00:00 2001
+From c4c21d9a929883dd69fcdfeae2a9e34ed627477c 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 1/7] btrfs: commit the canceled state when a device replace
index 8bbab57d5de73e8347b8fc2aeffba5e106f669ff..c867c2cc7c80d17a267341af2d5b7d5cbc37bead 100644 (file)
@@ -1,4 +1,4 @@
-From 8707d0c1fdbefadce170e75c3ade095e703ad29f Mon Sep 17 00:00:00 2001
+From 2b3a5ba66685a3924a2db09393c2c506dd772d8e 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 2/7] btrfs: scrub: do not count write errors twice, or on the
@@ -26,10 +26,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 3 deletions(-)
 
 diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 479c0e037015a..268b79ad7601d 100644
+index 98362c91bce43..5128e2989016b 100644
 --- a/fs/btrfs/scrub.c
 +++ b/fs/btrfs/scrub.c
-@@ -1257,9 +1257,6 @@ static void scrub_write_endio(struct btrfs_bio *bbio)
+@@ -1265,9 +1265,6 @@ static void scrub_write_endio(struct btrfs_bio *bbio)
                bitmap_set(&stripe->write_error_bitmap, sector_nr,
                           bio_size >> fs_info->sectorsize_bits);
                spin_unlock_irqrestore(&stripe->write_error_lock, flags);
index 85fa22a8c9369035c00c5c28381fd605ef7de8ef..8980cb1994ae98046fbde73b9ea750099e881842 100644 (file)
@@ -1,4 +1,4 @@
-From ad55d5c186f5dc1e6078583063b7b680f84ce413 Mon Sep 17 00:00:00 2001
+From f217a9f8ee76116618ddf8ef59358c69318ba8c5 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 3/7] btrfs: dev-replace: count uncorrectable read errors
@@ -30,10 +30,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 4 insertions(+)
 
 diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index 268b79ad7601d..d9f0a260b7981 100644
+index 5128e2989016b..88b1f5d43ce89 100644
 --- a/fs/btrfs/scrub.c
 +++ b/fs/btrfs/scrub.c
-@@ -1968,6 +1968,10 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+@@ -1984,6 +1984,10 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
  
                        has_extent = scrub_bitmap_read_has_extent(stripe);
                        error = scrub_bitmap_read_error(stripe);
index 54e85ee4438bb1c78ea1f5db393fe3b96e05b3c4..c13721a7343765516d4ca553d4f6d307a96ad89a 100644 (file)
@@ -1,4 +1,4 @@
-From f8524757e3ff31fefe7c8b61a4315bb224034978 Mon Sep 17 00:00:00 2001
+From 9488e7f09b4faec770edaf9eda837801d15109f5 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 4/7] btrfs: dev-replace: do not warn when a resumed replace
index 3b0998c281a8501b133314a0185a0f663123d932..fe42f039ca7a661b2e8fb4a04eebdde699af54d0 100644 (file)
@@ -1,4 +1,4 @@
-From 6289b310515269227ca61d4ce470a0440a486bdc Mon Sep 17 00:00:00 2001
+From 92f953d555b6e195808b2a299709c2462a0e1aa9 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 5/7] btrfs: dev-replace: count write errors to the target
@@ -24,10 +24,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 19 insertions(+)
 
 diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index d9f0a260b7981..ffba93f242763 100644
+index 88b1f5d43ce89..1a2bde86c305a 100644
 --- a/fs/btrfs/scrub.c
 +++ b/fs/btrfs/scrub.c
-@@ -1966,6 +1966,14 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+@@ -1982,6 +1982,14 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
  
                        ASSERT(stripe->dev == fs_info->dev_replace.srcdev);
  
@@ -42,7 +42,7 @@ index d9f0a260b7981..ffba93f242763 100644
                        has_extent = scrub_bitmap_read_has_extent(stripe);
                        error = scrub_bitmap_read_error(stripe);
                        bitmap_and(&error, &error, &has_extent, stripe->nr_sectors);
-@@ -1982,6 +1990,17 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+@@ -1998,6 +2006,17 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
                stripe = &sctx->stripes[i];
  
                wait_scrub_stripe_io(stripe);
index 770d197507761f476786e69fdc5d399c4c9cdaa4..3a852dfa290a6b7b6729b41e3ccab5dc447ec59c 100644 (file)
@@ -1,4 +1,4 @@
-From ac61cc3d2484868f5d3f18747768721d622b7d6d Mon Sep 17 00:00:00 2001
+From c010dc2e430ea26fa70d328e45b59da13f217301 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 6/7] btrfs: dev-replace: report the progress of a canceled
index 305045130abdbec95e80e6b889b72771b78bc1f5..43c5ac9c9ac68097423c1cb3a457ab649c83f7e3 100644 (file)
@@ -1,4 +1,4 @@
-From 43c8a1e60a5ae00c430c186df89d3ac462c08b96 Mon Sep 17 00:00:00 2001
+From 1c26761301041e16e2d84460c570ba92f4f66c58 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 7/7] btrfs: dev-replace: optionally abort on uncorrectable
@@ -161,10 +161,10 @@ index a3b0edf4025ce..4cf6672459e3a 100644
        int is_valid;
        int item_needs_writeback;
 diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
-index ffba93f242763..f36299ed6bb0c 100644
+index 1a2bde86c305a..b443c80d8e72f 100644
 --- a/fs/btrfs/scrub.c
 +++ b/fs/btrfs/scrub.c
-@@ -2920,6 +2920,16 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
+@@ -2957,6 +2957,16 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
                        ret = -EIO;
                        break;
                }
index 563d3b10bffd69d291a203d62ba518a4cb285c5f..1a4eb1c5aa999a54ccb03aaae1edea251f4f0d55 100644 (file)
@@ -1,6 +1,6 @@
-From 8763f9e2126d43bc4504612d63f08807aec86a7e Mon Sep 17 00:00:00 2001
+From 2d41f2a9495dc15edd86861c4e57dcfd6bba3bf6 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Wed, 21 Oct 2026 19:15:12 -0400
+Date: Sun, 25 Oct 2026 03:13:48 -0400
 Subject: [PATCH 0/1] btrfs: resize: allow shrinking a missing device
 To: linux-btrfs@vger.kernel.org
 
@@ -42,7 +42,7 @@ Qu Wenruo (1):
  1 file changed, 28 insertions(+), 4 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index ecd0e40af2d1b4340fed32080671f590807224c1..dfed61b376584faf0b2025e88c614e4a14207501 100644 (file)
@@ -1,4 +1,4 @@
-From 8763f9e2126d43bc4504612d63f08807aec86a7e Mon Sep 17 00:00:00 2001
+From 2d41f2a9495dc15edd86861c4e57dcfd6bba3bf6 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 dec015e6bd29a..ceec0d43123c7 100644
+index ac070c745b0eb..b7ad8289108a4 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 e2b210f239a71dd71e3cebbd4da0f95e04863ce2..8354f5676418103309ae33430b515b5783c52bfd 100644 (file)
@@ -1,6 +1,6 @@
-From a23064467620f3d39e4cc8c71b5ae12a9bab7572 Mon Sep 17 00:00:00 2001
+From bc8cd9cac405fb573a08f798266215560f19b234 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 07:29:47 -0400
+Date: Sun, 25 Oct 2026 03:13:40 -0400
 Subject: [RFC PATCH 000/116] btrfs: close the raid56 write hole for datacow with stripe-exclusive allocation
 To: linux-btrfs@vger.kernel.org
 
@@ -121,7 +121,7 @@ left for either.
 Prerequisites and related series
 ================================
 
-The series applies on its own to the base (0c48d26d46bd).  It was
+The series applies on its own to the base (99bc6552614f).  It was
 developed and tested on top of these separate series, and the
 guarantees below are stated with them applied.  Each fixes a
 pre-existing bug that this series' tests found:
@@ -1068,7 +1068,7 @@ Zygo Blaxell (116):
  fs/btrfs/raid56.h                 |   34 +
  fs/btrfs/relocation.c             |  302 ++-
  fs/btrfs/relocation.h             |    2 +-
- fs/btrfs/space-info.c             |  339 ++-
+ fs/btrfs/space-info.c             |  340 ++-
  fs/btrfs/space-info.h             |   87 +-
  fs/btrfs/super.c                  |   42 +
  fs/btrfs/sysfs.c                  |  428 ++++
@@ -1082,10 +1082,10 @@ Zygo Blaxell (116):
  fs/btrfs/zoned.c                  |   10 -
  fs/btrfs/zoned.h                  |    3 -
  include/trace/events/btrfs.h      |   60 +
- 42 files changed, 10552 insertions(+), 133 deletions(-)
+ 42 files changed, 10553 insertions(+), 133 deletions(-)
 
 
-base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
+base-commit: 99bc6552614f6b25a4a6f07789300d65d384d6ed
 -- 
 2.47.3
 
index 5e3ad4e4ec3a787b318326e5b644d07b5db5d21b..f58d7785481f154abfd3f9ea5e01b434571e9e0f 100644 (file)
@@ -1,4 +1,4 @@
-From f8aefd3a65eef1fc6ca498e3f7d34fd24bd2d1aa Mon Sep 17 00:00:00 2001
+From 9b74e9eed7b1269451a10e04c2dbd5ffaf04f20b 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 001/116] btrfs: add btrfs_claim_free_stripe_run() for
@@ -43,10 +43,10 @@ Assisted-by: Claude:claude-fable-5
  3 files changed, 376 insertions(+)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 2a40167c3fb65..3f0f25dff0c81 100644
+index bff6e5b372d6c..c776d36b69776 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1874,6 +1874,171 @@ u64 btrfs_find_space_for_alloc(struct btrfs_block_group *block_group,
+@@ -1884,6 +1884,171 @@ u64 btrfs_find_space_for_alloc(struct btrfs_block_group *block_group,
        return ret;
  }
  
index 5251c0541c8848083b3ac57ef232e56b285fea35..4ee5ef021390e4f93ff536d9ea30d50bf96706d4 100644 (file)
@@ -1,4 +1,4 @@
-From e4a454e34f91c3246fb8a922f3e472b546622e33 Mon Sep 17 00:00:00 2001
+From edb82fe6c54fbdac3bdb6a7db37bc79827b5117d 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 002/116] btrfs: add open stripe run tracking for
@@ -48,7 +48,7 @@ Assisted-by: Claude:claude-fable-5
  6 files changed, 519 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index b23a543bb3823..4235c924fdaac 100644
+index 027830a53f7dc..9a5d80f77f3f7 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -440,6 +440,350 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group *bg)
@@ -402,7 +402,7 @@ index b23a543bb3823..4235c924fdaac 100644
  struct btrfs_caching_control *btrfs_get_caching_control(
                struct btrfs_block_group *cache)
  {
-@@ -2432,9 +2776,13 @@ static struct btrfs_block_group *btrfs_create_block_group(
+@@ -2435,9 +2779,13 @@ static struct btrfs_block_group *btrfs_create_block_group(
  
        refcount_set(&cache->refs, 1);
        spin_lock_init(&cache->lock);
@@ -469,10 +469,10 @@ index d567ed822e55d..3fb0e5dfc0adf 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 c45cda4290d5a..8626dc042944c 100644
+index c628c5081d923..ccefc67fcbd68 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -2783,6 +2783,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
+@@ -2803,6 +2803,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
        INIT_LIST_HEAD(&fs_info->delayed_iputs);
        INIT_LIST_HEAD(&fs_info->delalloc_roots);
        INIT_LIST_HEAD(&fs_info->caching_block_groups);
index b407be8a07c33024f6ac19ded4b3bdfdfb14bb1a..ea712341e4f160d4bb30608809bf3d2ae356a160 100644 (file)
@@ -1,4 +1,4 @@
-From a240872477979ccf01ce59b6481be002eac1d59d Mon Sep 17 00:00:00 2001
+From 37db945f876b595303f82b8a24d1bb29a8771479 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 003/116] btrfs: add the stripe_alloc allocation policy for
@@ -45,7 +45,7 @@ Assisted-by: Claude:claude-fable-5
  8 files changed, 322 insertions(+), 97 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 4235c924fdaac..7ec2feb50f85a 100644
+index 9a5d80f77f3f7..7a1b2c5b91484 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -491,6 +491,7 @@ struct btrfs_open_stripe_run {
@@ -354,7 +354,7 @@ index 4235c924fdaac..7ec2feb50f85a 100644
  
        path = btrfs_alloc_path();
        if (unlikely(!path)) {
-@@ -3578,6 +3658,14 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
+@@ -3581,6 +3661,14 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
        mutex_unlock(&fs_info->ro_block_group_mutex);
  
        btrfs_end_transaction(trans);
@@ -720,10 +720,10 @@ index c439d2ecfd9bc..5fd65251f9b45 100644
  out:
        cache->full_stripe_len = orig_fsl;
 diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
-index 1cda88332284e..d653e84bbdd13 100644
+index 1fa855a0c31a8..4082ac106551e 100644
 --- a/fs/btrfs/zoned.c
 +++ b/fs/btrfs/zoned.c
-@@ -2771,16 +2771,6 @@ void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg,
+@@ -2797,16 +2797,6 @@ void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg,
        queue_work(system_dfl_wq, &bg->zone_finish_work);
  }
  
index af6850876075cbefca914b6e2a3bfa92555379c1..2befd5baa10ffefcac8e92609a8bfb78301b7075 100644 (file)
@@ -1,4 +1,4 @@
-From 34e5adb74d1c65145b60d1a79aac6ba32cf9f5a2 Mon Sep 17 00:00:00 2001
+From 26dd0509689daee7517c91dc14320aba5f01fde2 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 004/116] btrfs: stripe_alloc: control the policy with a
@@ -62,7 +62,7 @@ Assisted-by: Claude:claude-fable-5
  4 files changed, 162 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 7ec2feb50f85a..2fdfb4ba67ca6 100644
+index 7a1b2c5b91484..242a4b074e71d 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -760,6 +760,76 @@ static bool bg_open_stripes_settled(struct btrfs_block_group *bg, u64 seq)
@@ -157,10 +157,10 @@ index 2fabfd813f860..93088b93e9496 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 8626dc042944c..6cc4c609a7d8b 100644
+index ccefc67fcbd68..7540f7d9e3de1 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -3742,6 +3742,30 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
+@@ -3762,6 +3762,30 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
                goto fail_qgroup;
        }
  
index a66cc7cf024a7fe501429097d9a7a97ce9888448..dd029df54ebf663de7815b37c558f82c8b9e2230 100644 (file)
@@ -1,4 +1,4 @@
-From f4900f9d5af6f1fcf7328e5c15eafef33ac4e37d Mon Sep 17 00:00:00 2001
+From fddee442cc1300ee68be619ac1df4cbb9975eab6 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 005/116] btrfs: report stripe run data IO through the
@@ -40,7 +40,7 @@ Assisted-by: Claude:claude-fable-5
  7 files changed, 168 insertions(+), 5 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 2fdfb4ba67ca6..29b3671f2f03f 100644
+index 242a4b074e71d..f4453da153f6a 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -682,6 +682,57 @@ void btrfs_open_stripe_write_done(struct btrfs_block_group *bg, u64 start,
@@ -231,10 +231,10 @@ 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 7c6f6dbfa7798..b91c557441bde 100644
+index b071ed59a583f..5803f5d95d654 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -3400,7 +3400,7 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
+@@ -3398,7 +3398,7 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
                                                ordered_extent->disk_bytenr,
                                                ordered_extent->disk_num_bytes,
                                                NULL, true);
@@ -243,7 +243,7 @@ index 7c6f6dbfa7798..b91c557441bde 100644
                                        ordered_extent->disk_bytenr,
                                        ordered_extent->disk_num_bytes, true);
                        /*
-@@ -9200,6 +9200,17 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9198,6 +9198,17 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
                                min_size, 0, *alloc_hint, &ins, true, false);
                if (ret)
                        break;
@@ -261,7 +261,7 @@ index 7c6f6dbfa7798..b91c557441bde 100644
  
                /*
                 * We've reserved this space, and thus converted it from
-@@ -9222,8 +9233,8 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9220,8 +9231,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 c74f12b15c93f61b390ffd98d4937f70ae55643d..233c22fcebee6293ba2f898ade0ffae5ec4bc497 100644 (file)
@@ -1,4 +1,4 @@
-From dc05aa382bdb79b8f81db968b8d96236d5350ebb Mon Sep 17 00:00:00 2001
+From 3a96b8a5cf6b3ca15e47511ad7e178eed3826067 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 006/116] btrfs: retire stripe runs at commit and gate
@@ -116,7 +116,7 @@ Assisted-by: Claude:claude-fable-5
  9 files changed, 228 insertions(+), 44 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 29b3671f2f03f..0e7fc096245c3 100644
+index f4453da153f6a..d28895e03f766 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -457,24 +457,28 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group *bg)
@@ -312,7 +312,7 @@ index 29b3671f2f03f..0e7fc096245c3 100644
  /*
   * Drop the dedication of a block group to data relocation.  Shared by the
   * zoned allocator and the stripe allocation policy; both dedicate one
-@@ -4908,6 +4946,14 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
+@@ -4911,6 +4949,14 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
        struct btrfs_caching_control *caching_ctl;
        struct rb_node *n;
  
@@ -377,7 +377,7 @@ index 2da8a7d5fa1c9..4653ae595dbae 100644
  }
  
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index b91c557441bde..d65b79764d940 100644
+index 5803f5d95d654..b69cc44f58d70 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,
@@ -399,7 +399,7 @@ index b91c557441bde..d65b79764d940 100644
        /*
         * Force COW if csums exist in the range. This ensures that csums for a
         * given extent are either valid or do not exist.
-@@ -3268,6 +3280,55 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
+@@ -3262,6 +3274,55 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
                goto out;
        }
  
@@ -520,10 +520,10 @@ 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 7431a06f168da..905d3125ad32a 100644
+index d265fac023e58..c2e9a4fd69d3b 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
-@@ -377,6 +377,7 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
+@@ -367,6 +367,7 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
        atomic_set(&cur_trans->pending_ordered, 0);
        init_waitqueue_head(&cur_trans->pending_wait);
        atomic_set(&cur_trans->num_writers, 1);
@@ -531,7 +531,7 @@ index 7431a06f168da..905d3125ad32a 100644
        extwriter_counter_init(cur_trans, type);
        init_waitqueue_head(&cur_trans->writer_wait);
        init_waitqueue_head(&cur_trans->commit_wait);
-@@ -564,6 +565,31 @@ static inline int is_transaction_blocked(struct btrfs_transaction *trans)
+@@ -554,6 +555,31 @@ static inline int is_transaction_blocked(struct btrfs_transaction *trans)
                !TRANS_ABORTED(trans));
  }
  
@@ -563,7 +563,7 @@ index 7431a06f168da..905d3125ad32a 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.
-@@ -2442,6 +2468,27 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2426,6 +2452,27 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
        wait_event(cur_trans->pending_wait,
                   atomic_read(&cur_trans->pending_ordered) == 0);
  
index fbdd74b18a733be9b619baddd1ae95c02c7bc7f7..c29a595727ddc739327a94b13c0446af513e5697 100644 (file)
@@ -1,4 +1,4 @@
-From c332d36b889a12ff768cdd448c5b31f72374837e Mon Sep 17 00:00:00 2001
+From 98133152306858e37e4e7d8cf05b155e992252d3 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 007/116] btrfs: add a write-hole invariant checker to the
@@ -35,7 +35,7 @@ Assisted-by: Claude:claude-fable-5
  4 files changed, 80 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 0e7fc096245c3..bfdbc7b8ff1d5 100644
+index d28895e03f766..aa363733b4df4 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -978,6 +978,57 @@ bool btrfs_stripe_alloc_forces_cow(struct btrfs_fs_info *fs_info, u64 bytenr)
@@ -144,7 +144,7 @@ index 4653ae595dbae..8755c8c4d0a0d 100644
        ffe_ctl->search_start = offset;
        return 0;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5ec31299f1c30..75154f43261ac 100644
+index 59aad807f98ab..4be6361413f21 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -21,6 +21,7 @@
@@ -155,7 +155,7 @@ index 5ec31299f1c30..75154f43261ac 100644
  
  /* set when additional merges to this rbio are not allowed */
  #define RBIO_RMW_LOCKED_BIT   1
-@@ -2451,6 +2452,16 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2468,6 +2469,16 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
        int sectornr;
        int ret = 0;
  
index e558d09297d3dc505f1a0c7b00a649d1204c5acc..2999c688779284ddaf3732a58c7e2f49b131e816 100644 (file)
@@ -1,4 +1,4 @@
-From ee439d57937755a384015dabef3bd5fea72283c7 Mon Sep 17 00:00:00 2001
+From 2f1ee8114d2451c80045b6bea0de84f7d3ca9e13 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 008/116] btrfs: account stripe_alloc trapped free space
@@ -78,7 +78,7 @@ Assisted-by: Claude:claude-opus-4-8
  9 files changed, 474 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index bfdbc7b8ff1d5..1a6aa23920a3b 100644
+index aa363733b4df4..03ecf86d707f6 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -855,6 +855,38 @@ int btrfs_stripe_alloc_check_support(struct btrfs_fs_info *fs_info)
@@ -241,7 +241,7 @@ index bfdbc7b8ff1d5..1a6aa23920a3b 100644
        btrfs_remove_free_space_cache(block_group);
  
        spin_lock(&block_group->space_info->lock);
-@@ -2066,12 +2184,26 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -2068,12 +2186,26 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                ret = 0;
        } else if (sinfo->flags & BTRFS_BLOCK_GROUP_DATA) {
                u64 sinfo_used = btrfs_space_info_used(sinfo, true);
@@ -269,7 +269,7 @@ index bfdbc7b8ff1d5..1a6aa23920a3b 100644
                        ret = 0;
        } else {
                /*
-@@ -2098,6 +2230,14 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -2100,6 +2232,14 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
  out:
        spin_unlock(&cache->lock);
        spin_unlock(&sinfo->lock);
@@ -284,9 +284,9 @@ index bfdbc7b8ff1d5..1a6aa23920a3b 100644
        if (ret == -ENOSPC && btrfs_test_opt(cache->fs_info, ENOSPC_DEBUG)) {
                btrfs_info(cache->fs_info,
                        "unable to make block group %llu ro", cache->start);
-@@ -3223,6 +3363,15 @@ static int read_one_block_group(struct btrfs_fs_info *info,
+@@ -3226,6 +3366,15 @@ static int read_one_block_group(struct btrfs_fs_info *info,
        trace_btrfs_add_block_group(info, cache, 0);
-       btrfs_add_bg_to_space_info(info, cache);
+       btrfs_add_bg_to_space_info(cache);
  
 +      /*
 +       * Full or empty groups are marked cached above without going through
@@ -300,7 +300,7 @@ index bfdbc7b8ff1d5..1a6aa23920a3b 100644
        set_avail_alloc_bits(info, cache->flags);
        if (btrfs_chunk_writeable(info, cache->start)) {
                if (cache->used == 0 && cache->remap_bytes == 0) {
-@@ -3739,6 +3888,9 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
+@@ -3742,6 +3891,9 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
        btrfs_link_bg_list(cache, &trans->new_bgs);
        btrfs_inc_delayed_refs_rsv_bg_inserts(fs_info);
  
@@ -310,7 +310,7 @@ index bfdbc7b8ff1d5..1a6aa23920a3b 100644
        set_avail_alloc_bits(fs_info, type);
        return cache;
  }
-@@ -3882,6 +4034,7 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
+@@ -3885,6 +4037,7 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
  void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
  {
        struct btrfs_space_info *sinfo = cache->space_info;
@@ -318,7 +318,7 @@ index bfdbc7b8ff1d5..1a6aa23920a3b 100644
  
        BUG_ON(!cache->ro);
  
-@@ -3899,9 +4052,18 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
+@@ -3902,9 +4055,18 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
                }
                sinfo->bytes_readonly -= btrfs_block_group_available_space(cache);
                list_del_init(&cache->ro_list);
@@ -382,10 +382,10 @@ index 6c6b8b6dce4cd..89bdb04edb421 100644
  void btrfs_stripe_check_write(struct btrfs_fs_info *fs_info,
                              u64 full_stripe_start, bool sub_stripe);
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 3f0f25dff0c81..b85084f8c8698 100644
+index c776d36b69776..9837562d348a5 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1481,6 +1481,8 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
+@@ -1491,6 +1491,8 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
        return 0;
  }
  
@@ -394,7 +394,7 @@ index 3f0f25dff0c81..b85084f8c8698 100644
  int btrfs_add_free_space(struct btrfs_block_group *block_group,
                         u64 bytenr, u64 size)
  {
-@@ -1496,6 +1498,7 @@ int btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1506,6 +1508,7 @@ int btrfs_add_free_space(struct btrfs_block_group *block_group,
        if (btrfs_test_opt(block_group->fs_info, DISCARD_SYNC))
                trim_state = BTRFS_TRIM_STATE_TRIMMED;
  
@@ -402,7 +402,7 @@ index 3f0f25dff0c81..b85084f8c8698 100644
        return __btrfs_add_free_space(block_group, bytenr, size, trim_state);
  }
  
-@@ -1874,6 +1877,218 @@ u64 btrfs_find_space_for_alloc(struct btrfs_block_group *block_group,
+@@ -1884,6 +1887,218 @@ u64 btrfs_find_space_for_alloc(struct btrfs_block_group *block_group,
        return ret;
  }
  
@@ -621,7 +621,7 @@ index 3f0f25dff0c81..b85084f8c8698 100644
  /*
   * Align an offset up to the next full stripe boundary.  Full stripe geometry
   * is relative to the start of the block group, which is not necessarily
-@@ -2033,6 +2248,8 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2043,6 +2258,8 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
        btrfs_discard_update_discardable(block_group);
        spin_unlock(&ctl->tree_lock);
  
@@ -645,7 +645,7 @@ index 06a6bc70d9ac4..6bee1e7a7913c 100644
                           u64 bytes);
  int btrfs_find_space_cluster(struct btrfs_block_group *block_group,
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index d0130c8ba3dda..ef5a0ea9039db 100644
+index 0456b0d2d1b4a..51098227f9171 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -150,6 +150,12 @@ struct btrfs_space_info {
@@ -678,10 +678,10 @@ index d0130c8ba3dda..ef5a0ea9039db 100644
  }
  
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index acb704b20c2be..4416fd622019d 100644
+index b424cc836bd4a..a64d9cd48d12e 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
-@@ -1733,6 +1733,24 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
+@@ -1735,6 +1735,24 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
                                        factor = btrfs_bg_type_to_factor(
                                                btrfs_raid_array[i].bg_flag);
                        }
@@ -707,7 +707,7 @@ index acb704b20c2be..4416fd622019d 100644
  
                /*
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..9bb5ee9217318 100644
+index 89b0a4ef4063e..357c669e6ea15 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -778,6 +778,35 @@ static ssize_t btrfs_force_chunk_alloc_store(struct kobject *kobj,
@@ -771,10 +771,10 @@ index 3ac1fa608d3b5..9bb5ee9217318 100644
        NULL,
  };
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index 905d3125ad32a..0dccce2c57c9d 100644
+index c2e9a4fd69d3b..4f781df772202 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
-@@ -2700,6 +2700,12 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2684,6 +2684,12 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
        if (unlikely(ret))
                goto scrub_continue;
  
index 8945cf1e9b2a1c293c8ce849784392c4610ef5c2..1587be585642d01e0709702153eefcd82b39a19d 100644 (file)
@@ -1,4 +1,4 @@
-From a3f76d9a2a78b3892650a7be8380d418b53e761a Mon Sep 17 00:00:00 2001
+From 427ea2e48fe7637468e2647834a26d2c9b069800 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 009/116] btrfs: stripe_alloc: keep an open run per size
@@ -50,7 +50,7 @@ Assisted-by: Claude:claude-opus-4-8
  3 files changed, 176 insertions(+), 67 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 1a6aa23920a3b..4388d21cdfaf8 100644
+index 03ecf86d707f6..0141b06ed0639 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -504,12 +504,30 @@ static bool open_stripe_run_drained(const struct btrfs_open_stripe_run *run)
index dbc57b12bd803b656e95a277785efd1d42150b8c..bed844c181dfe8c56afd92b8fc4da3c2407c18a8 100644 (file)
@@ -1,4 +1,4 @@
-From 05efb9e0701c1438661bf6ac88349252b9a2c8ee Mon Sep 17 00:00:00 2001
+From 03b190f8691326607d8d2ef286b54bde277fe7bc 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 010/116] btrfs: stripe_alloc: grow the frontier run
@@ -56,7 +56,7 @@ Assisted-by: Claude:claude-fable-5
  2 files changed, 76 insertions(+), 29 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 4388d21cdfaf8..480af5c67d538 100644
+index 0141b06ed0639..f88fc9fe9bd10 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -589,8 +589,11 @@ static u64 stripe_run_place(struct btrfs_block_group *bg,
index a0ad6dc2b051b78983afe6e855141c5de2b5fce9..cec39c74bf5d27533bd75184aa0702c95b37b440 100644 (file)
@@ -1,4 +1,4 @@
-From 19fdab82489824f188e6656c429f9f44d633c593 Mon Sep 17 00:00:00 2001
+From 760a3334bc0d471e65f3dda103c4f4dcb6518588 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 011/116] btrfs: raid56: batch stripe_alloc partial writes
@@ -78,7 +78,7 @@ Assisted-by: Claude:claude-fable-5
  5 files changed, 448 insertions(+), 113 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 480af5c67d538..6c2131985c3b7 100644
+index f88fc9fe9bd10..a10d59bb8aa49 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -770,6 +770,152 @@ int btrfs_alloc_from_open_stripe(struct btrfs_block_group *bg, u64 num_bytes,
@@ -430,7 +430,7 @@ index 0ca6b7dc7e497..e7aeee5c7172d 100644
  }
  
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 75154f43261ac..1503dcaa0223c 100644
+index 4be6361413f21..279c15cf229e8 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -37,8 +37,28 @@
@@ -496,7 +496,7 @@ index 75154f43261ac..1503dcaa0223c 100644
  
        h = table->table;
  
-@@ -563,6 +596,8 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
+@@ -567,6 +600,8 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
  {
        if (!info->stripe_hash_table)
                return;
@@ -505,7 +505,7 @@ index 75154f43261ac..1503dcaa0223c 100644
        btrfs_clear_rbio_cache(info);
        kvfree(info->stripe_hash_table);
        info->stripe_hash_table = NULL;
-@@ -687,6 +722,196 @@ static int rbio_can_merge(struct btrfs_raid_bio *last,
+@@ -692,6 +727,196 @@ static int rbio_can_merge(struct btrfs_raid_bio *last,
        return 1;
  }
  
@@ -651,7 +651,7 @@ index 75154f43261ac..1503dcaa0223c 100644
 +      spin_lock(&table->parked_lock);
 +      list_for_each_entry_safe(rbio, tmp, &table->parked, parked_node) {
 +              u64 rbio_start = rbio->bioc->full_stripe_logical;
-+              u64 rbio_len = (u64)rbio->nr_data * BTRFS_STRIPE_LEN;
++              u64 rbio_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
 +
 +              if (rbio_start + rbio_len <= start ||
 +                  (num_bytes != U64_MAX && rbio_start >= start + num_bytes))
@@ -702,7 +702,7 @@ index 75154f43261ac..1503dcaa0223c 100644
  /* Return the sector index for @stripe_nr and @sector_nr. */
  static unsigned int rbio_sector_index(const struct btrfs_raid_bio *rbio,
                                      unsigned int stripe_nr,
-@@ -802,7 +1027,35 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+@@ -807,7 +1032,35 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
  
                /* Can we merge into the lock owner? */
                if (rbio_can_merge(cur, rbio)) {
@@ -719,7 +719,7 @@ index 75154f43261ac..1503dcaa0223c 100644
 +                       */
 +                      if (test_bit(RBIO_PARKED_BIT, &cur->flags)) {
 +                              if (cur->bio_list_bytes ==
-+                                  cur->nr_data * BTRFS_STRIPE_LEN) {
++                                  cur->nr_data * cur->bioc->stripe_len) {
 +                                      unpark_full_rbio(cur);
 +                              } else if (sync) {
 +                                      struct btrfs_stripe_hash_table *table =
@@ -738,7 +738,7 @@ index 75154f43261ac..1503dcaa0223c 100644
                        spin_unlock(&cur->bio_list_lock);
                        freeit = rbio;
                        ret = 1;
-@@ -1101,6 +1354,7 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
+@@ -1107,6 +1360,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);
@@ -746,7 +746,7 @@ index 75154f43261ac..1503dcaa0223c 100644
        btrfs_get_bioc(bioc);
        rbio->bioc = bioc;
        rbio->nr_pages = num_pages;
-@@ -2546,8 +2800,11 @@ static void rmw_rbio_work(struct work_struct *work)
+@@ -2563,8 +2817,11 @@ static void rmw_rbio_work(struct work_struct *work)
        struct btrfs_raid_bio *rbio;
  
        rbio = container_of(work, struct btrfs_raid_bio, work);
@@ -760,10 +760,10 @@ index 75154f43261ac..1503dcaa0223c 100644
  
  static void rmw_rbio_work_locked(struct work_struct *work)
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 8542648199f1a..07ba71ae8e54f 100644
+index 8700910b8dc99..f5b8d788b1fff 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -132,6 +132,15 @@ struct btrfs_raid_bio {
+@@ -130,6 +130,15 @@ struct btrfs_raid_bio {
         */
        struct list_head plug_list;
  
@@ -779,7 +779,7 @@ index 8542648199f1a..07ba71ae8e54f 100644
        /* Flags that tell us if it is safe to merge with this bio. */
        unsigned long flags;
  
-@@ -287,5 +296,7 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+@@ -282,5 +291,7 @@ 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);
index 2e0f0f13a997b7e26c5d2b84abe5f5a4dfea4f16..32cb37cb48da2ba0bf139cd8201020513921d8b8 100644 (file)
@@ -1,4 +1,4 @@
-From d012dbc97bfc5dc275a789a7e3c464efa09851f6 Mon Sep 17 00:00:00 2001
+From 39bf390edbf806623171491e8928f1c26b15062a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:30 -0400
 Subject: [RFC PATCH 012/116] btrfs: stripe_alloc: never claim stripes covered
@@ -50,7 +50,7 @@ Assisted-by: Claude:claude-fable-5
  3 files changed, 42 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 6c2131985c3b7..9f8f73dbfe0a0 100644
+index a10d59bb8aa49..7e820fd50bb03 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -770,6 +770,40 @@ int btrfs_alloc_from_open_stripe(struct btrfs_block_group *bg, u64 num_bytes,
@@ -108,10 +108,10 @@ index a726f9da7f1fc..6740c65870222 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/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index b85084f8c8698..6c086dbe1bd41 100644
+index 9837562d348a5..4a1db014b19b0 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2201,7 +2201,9 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2211,7 +2211,9 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
  
                if (entry->bitmap) {
                        if (find_stripe_run_in_bitmap(ctl, entry, want_bytes,
@@ -122,7 +122,7 @@ index b85084f8c8698..6c086dbe1bd41 100644
                                goto found;
                        continue;
                }
-@@ -2212,6 +2214,9 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2222,6 +2224,9 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                run_len = min(want_bytes,
                              div64_u64(entry->offset + entry->bytes - run_start,
                                        fsl) * fsl);
index 7e57940442d0bc5f789473af84430f8c0331c55f..49bc02e1ac8add96666b9a97ec261065dca6f6f8 100644 (file)
@@ -1,4 +1,4 @@
-From 14839547353dd2ff06d13c3a321b286878abf7c1 Mon Sep 17 00:00:00 2001
+From 6841c0aaa73bc51fea259a58d46b66268d6cd7ab 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 013/116] btrfs: stripe_alloc: settle a logged extent's
@@ -52,7 +52,7 @@ Assisted-by: Claude:claude-fable-5
  3 files changed, 111 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 9f8f73dbfe0a0..cb632a48c8851 100644
+index 7e820fd50bb03..c5f7df4ca8f3d 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -804,6 +804,86 @@ bool btrfs_stripe_run_range_usable(struct btrfs_block_group *bg,
@@ -156,12 +156,12 @@ index 6740c65870222..74528f0175e98 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/tree-log.c b/fs/btrfs/tree-log.c
-index 1d9dfb63fc5a4..51aeb3ed680e9 100644
+index e50f924bca59f..6aa8db5b1044e 100644
 --- a/fs/btrfs/tree-log.c
 +++ b/fs/btrfs/tree-log.c
-@@ -4847,6 +4847,23 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
-                   inode->last_reflink_trans < trans->transid)
-                       continue;
+@@ -4875,6 +4875,23 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
+                               return BTRFS_LOG_FORCE_COMMIT;
+               }
  
 +              /*
 +               * New data extent made durable by this log commit: settle its
@@ -183,7 +183,7 @@ index 1d9dfb63fc5a4..51aeb3ed680e9 100644
                if (skip_csum)
                        goto add_to_batch;
  
-@@ -5132,6 +5149,18 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
+@@ -5163,6 +5180,18 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
  
        block_len = em->disk_num_bytes;
        compress_type = btrfs_extent_map_compression(em);
index 72623ba8bd2a1f01d4fd7405cb0c302f5089928a..8aef567fab6aebdaac93920b6c80b73b99314fdd 100644 (file)
@@ -1,4 +1,4 @@
-From 36f2da531ea7492f5eadadcbcc1865d5e7bfec58 Mon Sep 17 00:00:00 2001
+From c92a00aaf5df8f99c84022b2efbf24badeb03954 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 014/116] btrfs: stripe_alloc: private per-inode stripe
@@ -50,7 +50,7 @@ Assisted-by: Claude:claude-fable-5
  9 files changed, 245 insertions(+), 31 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index cb632a48c8851..3b2379ebb60c4 100644
+index c5f7df4ca8f3d..25cb8dac15a9e 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -495,6 +495,7 @@ struct btrfs_open_stripe_run {
@@ -467,7 +467,7 @@ index f978c6524aa03..73cec267971ff 100644
  
        /*
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index d65b79764d940..d39947e779a4f 100644
+index b69cc44f58d70..faa45e7231e79 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,
@@ -491,7 +491,7 @@ index d65b79764d940..d39947e779a4f 100644
        if (ret < 0) {
                *ret_alloc_size = cur_len;
                return ret;
-@@ -8096,6 +8097,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
+@@ -8094,6 +8095,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
        ei->last_unlink_trans = 0;
        ei->last_reflink_trans = 0;
        ei->last_log_commit = 0;
@@ -499,7 +499,7 @@ index d65b79764d940..d39947e779a4f 100644
  
        spin_lock_init(&ei->lock);
        ei->outstanding_extents = 0;
-@@ -9257,7 +9259,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9255,7 +9257,7 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
                 * sized chunks.
                 */
                cur_bytes = min(cur_bytes, last_alloc);
@@ -508,7 +508,7 @@ index d65b79764d940..d39947e779a4f 100644
                                min_size, 0, *alloc_hint, &ins, true, false);
                if (ret)
                        break;
-@@ -10094,7 +10096,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10092,7 +10094,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
                }
        }
  
index e946bad2a7ff297590de0bedec9f7aa127323412..898a7523b3c2ca9f987a05b5d15892d5af739d99 100644 (file)
@@ -1,4 +1,4 @@
-From 720d3e3ab3b0c4ed892edddf9a210034a30dd06b Mon Sep 17 00:00:00 2001
+From 4a26f6f8349a32272a71baa5f307b73e65e7998b 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 015/116] btrfs: stripe_alloc: carry an inode's log tail
@@ -68,7 +68,7 @@ Assisted-by: Claude:claude-fable-5
  8 files changed, 295 insertions(+), 9 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 3b2379ebb60c4..f70adc063a22d 100644
+index 25cb8dac15a9e..be8aa2fc103f8 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -937,6 +937,63 @@ static bool stripe_log_range_settled(struct btrfs_block_group *bg, u64 bytenr)
@@ -266,10 +266,10 @@ index 979adcdbe32e3..00fd4e6e668d6 100644
         * Start of the last extent allocated from this inode's private
         * LOG-class stripe run (see BTRFS_INODE_LOG_ALLOC).  Advisory only:
 diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
-index 7010d714cfe10..6c460dcc431a6 100644
+index cbc532b49c67d..d383a5abe7e2b 100644
 --- a/fs/btrfs/defrag.c
 +++ b/fs/btrfs/defrag.c
-@@ -1254,6 +1254,157 @@ static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len,
+@@ -1263,6 +1263,157 @@ static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len,
        return ret;
  }
  
@@ -468,10 +468,10 @@ index 73cec267971ff..d927b559aa327 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 d39947e779a4f..792b834005fa5 100644
+index faa45e7231e79..afe0cc331deb8 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -8098,6 +8098,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
+@@ -8096,6 +8096,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
        ei->last_reflink_trans = 0;
        ei->last_log_commit = 0;
        ei->log_run_hint = 0;
@@ -479,7 +479,7 @@ index d39947e779a4f..792b834005fa5 100644
  
        spin_lock_init(&ei->lock);
        ei->outstanding_extents = 0;
-@@ -8137,6 +8138,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
+@@ -8135,6 +8136,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
  void btrfs_test_destroy_inode(struct inode *inode)
  {
        btrfs_drop_extent_map_range(BTRFS_I(inode), 0, (u64)-1, false);
@@ -487,7 +487,7 @@ index d39947e779a4f..792b834005fa5 100644
        kfree(BTRFS_I(inode)->file_extent_tree);
        kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
  }
-@@ -8144,6 +8146,7 @@ void btrfs_test_destroy_inode(struct inode *inode)
+@@ -8142,6 +8144,7 @@ void btrfs_test_destroy_inode(struct inode *inode)
  
  void btrfs_free_inode(struct inode *inode)
  {
@@ -496,10 +496,10 @@ index d39947e779a4f..792b834005fa5 100644
        kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
  }
 diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
-index 51aeb3ed680e9..e9b688024aed6 100644
+index 6aa8db5b1044e..d902d169680a4 100644
 --- a/fs/btrfs/tree-log.c
 +++ b/fs/btrfs/tree-log.c
-@@ -4859,9 +4859,12 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
+@@ -4887,9 +4887,12 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
                        disk_num_bytes =
                                btrfs_file_extent_disk_num_bytes(src, extent);
                        if (disk_bytenr)
@@ -515,7 +515,7 @@ index 51aeb3ed680e9..e9b688024aed6 100644
                }
  
                if (skip_csum)
-@@ -5158,8 +5161,10 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
+@@ -5189,8 +5192,10 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
         */
        if (!(em->flags & EXTENT_FLAG_PREALLOC) &&
            em->disk_bytenr < EXTENT_MAP_LAST_BYTE)
index ebdddfbfbfed81e2945883a09bc0de41a52a5ea1..eddb727fa43a718581b14af4279f2e77a6e03809 100644 (file)
@@ -1,4 +1,4 @@
-From bdc754626ebf4622fdb443bf7618eb55d626bf1c Mon Sep 17 00:00:00 2001
+From 4125cef50ff22f035dce63a99a06c3bddb8d6250 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 016/116] btrfs: stripe_alloc: kick parked rbios before the
index 1b491f719bb983547fec0962623b2ec4dd81c26c..e3ce86e5749d10b20b8d63a57ddacfcb5baf847e 100644 (file)
@@ -1,4 +1,4 @@
-From a737dc4313e4b2f0d01d818cb220ae1b79682676 Mon Sep 17 00:00:00 2001
+From d751a574bd21ed06cfd5ba7163822ec3c07249e7 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 017/116] btrfs: raid56: pad sub-stripe writes to full
@@ -33,7 +33,7 @@ Assisted-by: Claude:claude-fable-5
  3 files changed, 144 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index f70adc063a22d..04bd5feec1f1c 100644
+index be8aa2fc103f8..2e5bb7491363a 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -919,6 +919,49 @@ bool btrfs_stripe_run_range_usable(struct btrfs_block_group *bg,
@@ -101,7 +101,7 @@ index 0edfafab20eb4..32b114fa4fede 100644
                              u64 file_len, u64 bytenr, u64 num_bytes);
  int btrfs_stripe_alloc_check_support(struct btrfs_fs_info *fs_info);
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 1503dcaa0223c..34098e7414051 100644
+index 279c15cf229e8..30c664babecd3 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -45,6 +45,16 @@
@@ -121,7 +121,7 @@ index 1503dcaa0223c..34098e7414051 100644
  #define RBIO_CACHE_SIZE 1024
  
  /*
-@@ -1724,7 +1734,12 @@ static int rmw_assemble_write_bios(struct btrfs_raid_bio *rbio,
+@@ -1737,7 +1747,12 @@ static int rmw_assemble_write_bios(struct btrfs_raid_bio *rbio,
                        continue;
  
                if (stripe < rbio->nr_data) {
@@ -135,7 +135,7 @@ index 1503dcaa0223c..34098e7414051 100644
                        if (paddrs == NULL)
                                continue;
                } else {
-@@ -2677,6 +2692,73 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -2694,6 +2709,73 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
        }
  }
  
@@ -153,7 +153,7 @@ index 1503dcaa0223c..34098e7414051 100644
 +      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
 +      const u64 stripe_start = rbio->bioc->full_stripe_logical;
 +      const u32 sectorsize = fs_info->sectorsize;
-+      const u64 stripe_len = (u64)rbio->nr_data * BTRFS_STRIPE_LEN;
++      const u64 stripe_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
 +      u64 pad_from;
 +      int i;
 +
@@ -209,7 +209,7 @@ index 1503dcaa0223c..34098e7414051 100644
  /*
   * To determine if we need to read any sector from the disk.
   * Should only be utilized in RMW path, to skip cached rbio.
-@@ -2727,8 +2809,22 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2744,8 +2826,22 @@ 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 6f1671198c8e949ce0a9d15d38e87217d6855a91..eaff399148c20fc23940b4dfc4c97c4a321cfb5c 100644 (file)
@@ -1,4 +1,4 @@
-From 56d65bde49a8f81bcbcbea7083ff885ceb6edeb7 Mon Sep 17 00:00:00 2001
+From 56f960dce657f0f9a18ba36bc984d1d967365e67 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 018/116] btrfs: stripe_alloc: isolate nodatacow and
@@ -37,7 +37,7 @@ Assisted-by: Claude:claude-fable-5
  7 files changed, 72 insertions(+), 38 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 04bd5feec1f1c..4e9c8c6c4be81 100644
+index 2e5bb7491363a..490a2bd401c72 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -793,6 +793,7 @@ int btrfs_alloc_from_open_stripe(struct btrfs_block_group *bg, u64 num_bytes,
@@ -254,7 +254,7 @@ index a75eb49437030..13096c06fe61d 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 792b834005fa5..ea95ebd1b17f1 100644
+index afe0cc331deb8..0aaa5a568ba71 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,
@@ -275,7 +275,7 @@ index 792b834005fa5..ea95ebd1b17f1 100644
        if (ret < 0) {
                *ret_alloc_size = cur_len;
                return ret;
-@@ -9262,8 +9262,9 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
+@@ -9260,8 +9260,9 @@ int btrfs_prealloc_file_range(struct inode *inode, int mode,
                 * sized chunks.
                 */
                cur_bytes = min(cur_bytes, last_alloc);
@@ -287,7 +287,7 @@ index 792b834005fa5..ea95ebd1b17f1 100644
                if (ret)
                        break;
                /*
-@@ -10100,7 +10101,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10098,7 +10099,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 f97d0b66106b7d5017d7853d7a326aa25e2b82d6..aadccb1db565da00756fb2b20f15b83a0d1b83ca 100644 (file)
@@ -1,4 +1,4 @@
-From 7a2128a6af7b447537f4ce836354b9071f914cc4 Mon Sep 17 00:00:00 2001
+From bd29e332429ed54addde7e66642710d851633b10 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 019/116] btrfs: stripe_alloc: allow-rmw policy, and
@@ -71,7 +71,7 @@ Assisted-by: Claude:claude-fable-5
  8 files changed, 368 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 4e9c8c6c4be81..e2d9b32107a41 100644
+index 490a2bd401c72..88fcd964b7036 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -919,6 +919,247 @@ bool btrfs_stripe_run_range_usable(struct btrfs_block_group *bg,
@@ -426,10 +426,10 @@ index 568c07929c578..412039daf6b8f 100644
                              u64 file_len, u64 bytenr, u64 num_bytes);
  int btrfs_stripe_alloc_check_support(struct btrfs_fs_info *fs_info);
 diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
-index 6c460dcc431a6..d2d5f41b578e6 100644
+index d383a5abe7e2b..918a82f6b9035 100644
 --- a/fs/btrfs/defrag.c
 +++ b/fs/btrfs/defrag.c
-@@ -1383,6 +1383,9 @@ void btrfs_carry_log_tail(struct btrfs_inode *inode)
+@@ -1392,6 +1392,9 @@ void btrfs_carry_log_tail(struct btrfs_inode *inode)
  
        if (!btrfs_test_opt(inode->root->fs_info, STRIPE_ALLOC))
                return;
@@ -515,7 +515,7 @@ index b085e198f23da..d126b9fab9349 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 ea95ebd1b17f1..6cb5c292899f0 100644
+index 0aaa5a568ba71..7a9cc1ba095c6 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1877,9 +1877,18 @@ static int can_nocow_file_extent(struct btrfs_path *path,
index 857b448991edacb9f9a3ab02a9aa742cdff6485a..a26017b32a8cf18170d61d7d614bd14d8eb3473e 100644 (file)
@@ -1,4 +1,4 @@
-From ff24d23dc643075ff828e20456e26b7fafb21566 Mon Sep 17 00:00:00 2001
+From efce6f5f7eaa8a46e982e2b61d0acddec70c5f6a 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 020/116] btrfs: stripe_alloc: persist nocow runs across
@@ -61,7 +61,7 @@ Assisted-by: Claude:claude-fable-5
  6 files changed, 289 insertions(+), 10 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index e2d9b32107a41..42c50bfca2ee5 100644
+index 88fcd964b7036..c7b21de26540e 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -487,6 +487,12 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group *bg)
@@ -413,10 +413,10 @@ index 3d148310cecee..dedee06848e24 100644
        }
  
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 6c086dbe1bd41..2e7bf3505d1c7 100644
+index 4a1db014b19b0..118fced160032 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2157,6 +2157,68 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
+@@ -2167,6 +2167,68 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
   * Returns 0 on success, -ENOSPC if no aligned fully-free stripe is present
   * in this block group.
   */
@@ -499,10 +499,10 @@ index 6bee1e7a7913c..1cff596a4900d 100644
                                u64 want_bytes, u64 *start, u64 *len);
  void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *block_group);
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 6cb5c292899f0..511f4aa7f3c19 100644
+index 7a9cc1ba095c6..d243e078435b5 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -5671,6 +5671,7 @@ void btrfs_evict_inode(struct inode *inode)
+@@ -5669,6 +5669,7 @@ void btrfs_evict_inode(struct inode *inode)
                goto clear_inode;
  
        fs_info = inode_to_fs_info(inode);
index dfead22854e711654be8346a56b1acac6e3d2886..6f8aeecf6e789a5058fc7a1875218432496b4a09 100644 (file)
@@ -1,4 +1,4 @@
-From aee560fcabf96893e8ec946cfcb4693942e697c3 Mon Sep 17 00:00:00 2001
+From ddcf7587cde779f7f02de4e59be48768ad92b0fc Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:42 -0400
 Subject: [RFC PATCH 021/116] btrfs: raid56: do not park sync writes into nocow
@@ -21,10 +21,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 15 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 34098e7414051..5430824cd80b8 100644
+index 30c664babecd3..eeeef54635e60 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -779,8 +779,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -784,8 +784,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
        struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
        struct btrfs_stripe_hash_table *table = fs_info->stripe_hash_table;
        unsigned int timeout_ms = BTRFS_RBIO_PARK_TIMEOUT_MS;
@@ -37,7 +37,7 @@ index 34098e7414051..5430824cd80b8 100644
                return false;
  
        spin_lock(&rbio->bio_list_lock);
-@@ -788,6 +791,17 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -793,6 +796,17 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
                timeout_ms = BTRFS_RBIO_PARK_SYNC_TIMEOUT_MS;
        spin_unlock(&rbio->bio_list_lock);
  
index 8da8a88d0789f3a3090e4e8bb139cb0359f985fe..688f19e98fe44368e3f7ab992f70222422b165b6 100644 (file)
@@ -1,4 +1,4 @@
-From 45a865e1a62c17737f0839e3178dd45790b9999a Mon Sep 17 00:00:00 2001
+From 9218820fa26e920552140a8015c978c674b13bb6 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 022/116] btrfs: raid56: expose parking statistics in sysfs
@@ -48,7 +48,7 @@ index d126b9fab9349..fab55620af0e9 100644
        u32 stripe_rmw_opt;
        u32 stripe_rmw_prop;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5430824cd80b8..6d1c4127b7e23 100644
+index eeeef54635e60..4f3968313f501 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -55,6 +55,9 @@
@@ -61,7 +61,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
  #define RBIO_CACHE_SIZE 1024
  
  /*
-@@ -494,6 +497,9 @@ static void steal_rbio(struct btrfs_raid_bio *src, struct btrfs_raid_bio *dest)
+@@ -498,6 +501,9 @@ static void steal_rbio(struct btrfs_raid_bio *src, struct btrfs_raid_bio *dest)
  static void merge_rbio(struct btrfs_raid_bio *dest,
                       struct btrfs_raid_bio *victim)
  {
@@ -71,7 +71,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
        bio_list_merge_init(&dest->bio_list, &victim->bio_list);
        dest->bio_list_bytes += victim->bio_list_bytes;
        /* Also inherit the bitmaps from @victim. */
-@@ -804,6 +810,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -809,6 +815,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
  
        spin_lock(&table->parked_lock);
        set_bit(RBIO_PARKED_BIT, &rbio->flags);
@@ -79,7 +79,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
        rbio->park_deadline = jiffies + msecs_to_jiffies(timeout_ms);
        /*
         * Take a reference of our own before publishing.  The moment
-@@ -822,6 +829,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -827,6 +834,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
        refcount_inc(&rbio->refs);
        list_add_tail(&rbio->parked_node, &table->parked);
        spin_unlock(&table->parked_lock);
@@ -87,7 +87,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
        queue_delayed_work(system_percpu_wq, &table->parked_work,
                           msecs_to_jiffies(BTRFS_RBIO_PARK_SCAN_MS));
  
-@@ -867,6 +875,7 @@ static void unpark_full_rbio(struct btrfs_raid_bio *rbio)
+@@ -872,6 +880,7 @@ static void unpark_full_rbio(struct btrfs_raid_bio *rbio)
        }
        rbio_unpark_locked(rbio);
        spin_unlock(&table->parked_lock);
@@ -95,7 +95,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
        start_async_work(rbio, rmw_rbio_work_locked);
  }
  
-@@ -900,6 +909,7 @@ void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
+@@ -905,6 +914,7 @@ void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
  
        list_for_each_entry_safe(rbio, tmp, &flush, parked_node) {
                list_del_init(&rbio->parked_node);
@@ -103,7 +103,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
                start_async_work(rbio, rmw_rbio_work_locked);
        }
  }
-@@ -929,6 +939,7 @@ static void parked_rbios_timeout_work(struct work_struct *work)
+@@ -934,6 +944,7 @@ static void parked_rbios_timeout_work(struct work_struct *work)
  
        list_for_each_entry_safe(rbio, tmp, &flush, parked_node) {
                list_del_init(&rbio->parked_node);
@@ -111,7 +111,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
                start_async_work(rbio, rmw_rbio_work_locked);
        }
        if (rearm)
-@@ -2770,6 +2781,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2787,6 +2798,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        set_bit(RBIO_PADDED_BIT, &rbio->flags);
        /* The whole stripe goes out: every vertical position is written. */
        bitmap_set(&rbio->dbitmap, 0, rbio->stripe_nsectors);
@@ -119,7 +119,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
        return true;
  }
  
-@@ -2839,6 +2851,10 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2856,6 +2868,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)) {
@@ -131,7 +131,7 @@ index 5430824cd80b8..6d1c4127b7e23 100644
                 * Now we're doing sub-stripe write, also need all data stripes
                 * to do the full RMW.
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 9bb5ee9217318..46389b3688e64 100644
+index 357c669e6ea15..a36754036846b 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1109,6 +1109,29 @@ static ssize_t btrfs_commit_stats_store(struct kobject *kobj,
index cae2ca17e125bd4db18bb6dc78e7ccb08a1fa54e..bf92ed73c529934beecaba2239264652e30ac2ef 100644 (file)
@@ -1,4 +1,4 @@
-From a7895fde7eb406a254050d73cca1962ec84111e9 Mon Sep 17 00:00:00 2001
+From f5b0c9d155f96d732d35de297cafc368c6240d40 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:44 -0400
 Subject: [RFC PATCH 023/116] btrfs: raid56: skip parking for sync rbios
@@ -24,7 +24,7 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 24 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 6d1c4127b7e23..f78ed04cf9d17 100644
+index 4f3968313f501..850011c8b5555 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -55,6 +55,14 @@
@@ -42,7 +42,7 @@ index 6d1c4127b7e23..f78ed04cf9d17 100644
  /* Set at park time and never cleared: this rbio once parked (stats). */
  #define RBIO_WAS_PARKED_BIT   7
  
-@@ -808,6 +816,18 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -813,6 +821,18 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
            timeout_ms == BTRFS_RBIO_PARK_SYNC_TIMEOUT_MS)
                return false;
  
@@ -61,7 +61,7 @@ index 6d1c4127b7e23..f78ed04cf9d17 100644
        spin_lock(&table->parked_lock);
        set_bit(RBIO_PARKED_BIT, &rbio->flags);
        set_bit(RBIO_WAS_PARKED_BIT, &rbio->flags);
-@@ -2078,12 +2098,15 @@ static void raid_unplug(struct blk_plug_cb *cb, bool from_schedule)
+@@ -2095,12 +2115,15 @@ static void raid_unplug(struct blk_plug_cb *cb, bool from_schedule)
                                free_raid_bio(cur);
                                continue;
                        }
index 152b4b27a96da089b67ea75fb8d51a4d9efaf768..7eb8712e35ae1cebbc4ca562ac7bf63cdd54e472 100644 (file)
@@ -1,4 +1,4 @@
-From 807bda7889b06996e4506808acb3a7536a460d8d Mon Sep 17 00:00:00 2001
+From 70f17f325b3784e23a50958d3a80c500bffe3759 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 024/116] btrfs: stripe_alloc: count open stripe run
@@ -35,7 +35,7 @@ Assisted-by: Claude:claude-fable-5
  3 files changed, 76 insertions(+), 6 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 42c50bfca2ee5..058778a519d9d 100644
+index c7b21de26540e..31b420a979943 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -557,11 +557,46 @@ static u64 close_open_stripe_run(struct btrfs_block_group *bg,
@@ -217,7 +217,7 @@ index 29cbf6f225329..590d62f59f9b9 100644
         * Membership in fs_info->open_stripe_bgs, protected by
         * fs_info->open_stripe_lock; holds a block group reference.
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index ef5a0ea9039db..c50f0046f3609 100644
+index 51098227f9171..44d7014b697f8 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -153,9 +153,19 @@ struct btrfs_space_info {
index 69ebe82ea069d6659449916f97cbf73144b00784..76f78704ac015d7b510e810c73ba21474caf74de 100644 (file)
@@ -1,4 +1,4 @@
-From 697d334f1241e81347df4ce5a5eab5a7fa90352d Mon Sep 17 00:00:00 2001
+From eecce5dd3ebd561dc1e7888d98ef8c38e3012a2f 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 025/116] btrfs: stripe_alloc: pessimistic data reservation
@@ -76,24 +76,24 @@ releases are not, and the counter clamps at zero).
 
 Assisted-by: Claude:claude-fable-5
 ---
- fs/btrfs/block-group.c      |  6 ++++
+ fs/btrfs/block-group.c      |  6 +++
  fs/btrfs/btrfs_inode.h      |  3 ++
- fs/btrfs/defrag.c           |  4 ++-
- fs/btrfs/delalloc-space.c   | 50 ++++++++++++++++++++++++--
+ fs/btrfs/defrag.c           |  4 +-
+ fs/btrfs/delalloc-space.c   | 50 +++++++++++++++++++++++--
  fs/btrfs/delalloc-space.h   |  3 +-
  fs/btrfs/direct-io.c        |  9 ++++-
- fs/btrfs/extent-tree.c      | 26 ++++++++++++++
- fs/btrfs/file.c             |  9 +++--
- fs/btrfs/free-space-cache.c | 46 ++++++++++++++++++++++++
- fs/btrfs/fs.h               |  8 +++++
- fs/btrfs/inode.c            |  4 ++-
- fs/btrfs/space-info.c       | 72 +++++++++++++++++++++++++++++++++++--
- fs/btrfs/space-info.h       | 14 ++++++++
- fs/btrfs/sysfs.c            |  4 +++
- 14 files changed, 247 insertions(+), 11 deletions(-)
+ fs/btrfs/extent-tree.c      | 26 +++++++++++++
+ fs/btrfs/file.c             |  9 ++++-
+ fs/btrfs/free-space-cache.c | 46 +++++++++++++++++++++++
+ fs/btrfs/fs.h               |  8 ++++
+ fs/btrfs/inode.c            |  4 +-
+ fs/btrfs/space-info.c       | 73 ++++++++++++++++++++++++++++++++++++-
+ fs/btrfs/space-info.h       | 14 +++++++
+ fs/btrfs/sysfs.c            |  4 ++
+ 14 files changed, 248 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 058778a519d9d..11848c9ab51e1 100644
+index 31b420a979943..29473031c9226 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2095,6 +2095,12 @@ void btrfs_scan_stripe_unusable(struct btrfs_fs_info *fs_info, bool force)
@@ -131,10 +131,10 @@ index 00fd4e6e668d6..fc0421de26bf4 100644
  
  /*
 diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
-index d2d5f41b578e6..3fc0d4100f502 100644
+index 918a82f6b9035..5d319df6524d8 100644
 --- a/fs/btrfs/defrag.c
 +++ b/fs/btrfs/defrag.c
-@@ -1276,6 +1276,7 @@ static int carry_one_range(struct btrfs_inode *inode, u64 start, u64 len,
+@@ -1285,6 +1285,7 @@ static int carry_one_range(struct btrfs_inode *inode, u64 start, u64 len,
        const unsigned int nr_pages = ((start + len - 1) >> PAGE_SHIFT) -
                                      (start >> PAGE_SHIFT) + 1;
        u64 cur;
@@ -142,7 +142,7 @@ index d2d5f41b578e6..3fc0d4100f502 100644
        int ret = 0;
  
        ASSERT(IS_ALIGNED(start, fs_info->sectorsize) &&
-@@ -1329,10 +1330,11 @@ static int carry_one_range(struct btrfs_inode *inode, u64 start, u64 len,
+@@ -1338,10 +1339,11 @@ static int carry_one_range(struct btrfs_inode *inode, u64 start, u64 len,
         * stays in its old stripe (see btrfs_carry_log_tail).
         */
        ret = btrfs_check_data_free_space(inode, &data_reserved, start, len,
@@ -401,10 +401,10 @@ index 94eedf224daa8..dce4880737eb3 100644
                if (!only_release_metadata)
                        btrfs_free_reserved_data_space(inode, data_reserved,
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 2e7bf3505d1c7..594396b738fa7 100644
+index 118fced160032..62b8803e63251 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1483,6 +1483,51 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
+@@ -1493,6 +1493,51 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
  
  static void stripe_unusable_mark_dirty(struct btrfs_block_group *bg);
  
@@ -456,7 +456,7 @@ index 2e7bf3505d1c7..594396b738fa7 100644
  int btrfs_add_free_space(struct btrfs_block_group *block_group,
                         u64 bytenr, u64 size)
  {
-@@ -1499,6 +1544,7 @@ int btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1509,6 +1554,7 @@ int btrfs_add_free_space(struct btrfs_block_group *block_group,
                trim_state = BTRFS_TRIM_STATE_TRIMMED;
  
        stripe_unusable_mark_dirty(block_group);
@@ -484,10 +484,10 @@ index fab55620af0e9..eb05e89bb5a15 100644
        spinlock_t swapfile_pins_lock;
        struct rb_root swapfile_pins;
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 511f4aa7f3c19..7b5e55c926e17 100644
+index d243e078435b5..98d376ce99eb8 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -5087,6 +5087,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
+@@ -5085,6 +5085,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
        struct extent_changeset *data_reserved = NULL;
        bool only_release_metadata = false;
        u32 blocksize = fs_info->sectorsize;
@@ -495,7 +495,7 @@ index 511f4aa7f3c19..7b5e55c926e17 100644
        pgoff_t index = (offset >> PAGE_SHIFT);
        struct folio *folio;
        gfp_t mask = btrfs_alloc_write_mask(mapping);
-@@ -5139,7 +5140,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
+@@ -5137,7 +5138,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
        block_end = block_start + blocksize - 1;
  
        ret = btrfs_check_data_free_space(inode, &data_reserved, block_start,
@@ -504,7 +504,7 @@ index 511f4aa7f3c19..7b5e55c926e17 100644
        if (ret < 0) {
                size_t write_bytes = blocksize;
  
-@@ -5153,6 +5154,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
+@@ -5151,6 +5152,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
                }
        }
        ret = btrfs_delalloc_reserve_metadata(inode, blocksize, blocksize, false);
@@ -513,7 +513,7 @@ index 511f4aa7f3c19..7b5e55c926e17 100644
                if (!only_release_metadata)
                        btrfs_free_reserved_data_space(inode, data_reserved,
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 82d4ac418a2de..b7ce04192af22 100644
+index d5a84fa97462c..2137d58015412 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
 @@ -16,6 +16,7 @@
@@ -524,7 +524,7 @@ index 82d4ac418a2de..b7ce04192af22 100644
  
  /*
   * HOW DOES SPACE RESERVATION WORK
-@@ -387,6 +388,18 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
+@@ -386,6 +387,19 @@ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group)
  
        factor = btrfs_bg_type_to_factor(block_group->flags);
  
@@ -536,14 +536,15 @@ index 82d4ac418a2de..b7ce04192af22 100644
 +       */
 +      if ((block_group->flags & BTRFS_BLOCK_GROUP_DATA) &&
 +          (block_group->flags & BTRFS_BLOCK_GROUP_RAID56_MASK) &&
-+          block_group->full_stripe_len > READ_ONCE(info->stripe_margin_unit))
-+              WRITE_ONCE(info->stripe_margin_unit,
++          block_group->full_stripe_len >
++          READ_ONCE(block_group->fs_info->stripe_margin_unit))
++              WRITE_ONCE(block_group->fs_info->stripe_margin_unit,
 +                         block_group->full_stripe_len);
 +
        spin_lock(&space_info->lock);
  
        if (!(block_group->flags & BTRFS_BLOCK_GROUP_REMAPPED) ||
-@@ -412,6 +425,59 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
+@@ -409,6 +423,59 @@ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group)
        up_write(&space_info->groups_sem);
  }
  
@@ -603,7 +604,7 @@ index 82d4ac418a2de..b7ce04192af22 100644
  struct btrfs_space_info *btrfs_find_space_info(const struct btrfs_fs_info *info,
                                               u64 flags)
  {
-@@ -655,10 +721,12 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
+@@ -652,10 +719,12 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
                   (s64)(info->total_bytes - btrfs_space_info_used(info, true)),
                   info->full ? "" : "not ");
        btrfs_info(fs_info,
@@ -619,7 +620,7 @@ index 82d4ac418a2de..b7ce04192af22 100644
  
  void btrfs_dump_space_info(struct btrfs_space_info *info, u64 bytes,
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index c50f0046f3609..39e32ed85636e 100644
+index 44d7014b697f8..13c24536731c5 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -166,6 +166,16 @@ struct btrfs_space_info {
@@ -651,11 +652,11 @@ index c50f0046f3609..39e32ed85636e 100644
 +
  int btrfs_init_space_info(struct btrfs_fs_info *fs_info);
 +void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod);
- void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
-                               struct btrfs_block_group *block_group);
+ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group);
  void btrfs_update_space_info_chunk_size(struct btrfs_space_info *space_info,
+                                       u64 chunk_size);
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 46389b3688e64..8d89c8e521952 100644
+index a36754036846b..dc12af3ed39a9 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -818,6 +818,8 @@ SPACE_INFO_ATTR(bytes_may_use);
index 65d0948da9dedb0e2eee2b31ff989c5a07df6d92..7317e159c6caba89f94faf9af9c5bc4dab6e16db 100644 (file)
@@ -1,4 +1,4 @@
-From b639bc5d11cf7bddb4d4237ab937eadad2f0a677 Mon Sep 17 00:00:00 2001
+From bd75d78d258e5774fe98c815c3b879113b515f3f 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 026/116] btrfs: stripe_alloc: claim fully-free stripes
@@ -39,10 +39,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 212 insertions(+), 5 deletions(-)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 594396b738fa7..0a4380e4637cb 100644
+index 62b8803e63251..c266c0f35f2f1 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2195,13 +2195,19 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
+@@ -2205,13 +2205,19 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
   *
   * want_bytes must be a full_stripe_len multiple and is a maximum; the
   * smallest successful claim is a single full stripe.  A fully-free stripe
@@ -67,7 +67,7 @@ index 594396b738fa7..0a4380e4637cb 100644
   */
  /*
   * Claim exactly [start, start + len) from the free space cache, failing
-@@ -2265,6 +2271,183 @@ int btrfs_claim_stripe_tail(struct btrfs_block_group *block_group,
+@@ -2275,6 +2281,183 @@ int btrfs_claim_stripe_tail(struct btrfs_block_group *block_group,
        return btrfs_remove_free_space(block_group, start, len);
  }
  
@@ -251,7 +251,7 @@ index 594396b738fa7..0a4380e4637cb 100644
  int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                                u64 want_bytes, u64 *start, u64 *len)
  {
-@@ -2274,7 +2457,9 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2284,7 +2467,9 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
        const u64 fsl = block_group->full_stripe_len;
        struct btrfs_free_space *entry;
        struct rb_node *node;
@@ -261,7 +261,7 @@ index 594396b738fa7..0a4380e4637cb 100644
        u64 head_start = 0;
        u64 head_len = 0;
        u64 run_start;
-@@ -2327,6 +2512,26 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2337,6 +2522,26 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                        continue;
                goto found;
        }
@@ -288,7 +288,7 @@ index 594396b738fa7..0a4380e4637cb 100644
        goto out;
  
  found:
-@@ -2361,6 +2566,8 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2371,6 +2576,8 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
        btrfs_discard_update_discardable(block_group);
        spin_unlock(&ctl->tree_lock);
  
index d8c801b92d04848af6c32492d31b0268ac590e23..5220dbcf20cdd8f3200beb412a29a0391eab7405 100644 (file)
@@ -1,4 +1,4 @@
-From 7a956b197fb633fae63d44cea3d3aba1ab518989 Mon Sep 17 00:00:00 2001
+From 8e25e060df10050ba0d652f78319d7fd1a4a275c 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 027/116] btrfs: stripe_alloc: warn when raid56 metadata is
@@ -25,7 +25,7 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 23 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 11848c9ab51e1..0d41c6ecdd735 100644
+index 29473031c9226..81eecb45190b8 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1690,6 +1690,28 @@ static void stripe_alloc_sweep_groups(struct btrfs_fs_info *fs_info, bool arm)
index 33f799a08aa778670669cd564b28ce8af309e9fb..a2af4097e4af854fd1b1e80042951ec5314765c5 100644 (file)
@@ -1,4 +1,4 @@
-From cde49689a8ca53fa1964cc93e1afc3ac5329368a Mon Sep 17 00:00:00 2001
+From cf439cf4ee591597df487b491b3b8641d5361f3b 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 028/116] btrfs: stripe_alloc: report read-modify-write of
@@ -42,10 +42,10 @@ index eb05e89bb5a15..c0f174cf5f256 100644
        /* BTRFS_STRIPE_RMW_* masks; see btrfs_stripe_allow_rmw(). */
        u32 stripe_rmw_opt;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index f78ed04cf9d17..dcd59c92766de 100644
+index 850011c8b5555..8248960c7c150 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2831,6 +2831,43 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+@@ -2848,6 +2848,43 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
        return false;
  }
  
@@ -89,7 +89,7 @@ index f78ed04cf9d17..dcd59c92766de 100644
  static void rmw_rbio(struct btrfs_raid_bio *rbio)
  {
        struct bio_list bio_list;
-@@ -2893,6 +2930,10 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -2910,6 +2947,10 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                        goto out;
        }
  
@@ -101,7 +101,7 @@ index f78ed04cf9d17..dcd59c92766de 100644
         * At this stage we're not allowed to add any new bios to the
         * bio list any more, anyone else that wants to change this stripe
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 8d89c8e521952..125dc4c601d76 100644
+index dc12af3ed39a9..106e804b6363e 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1125,14 +1125,16 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 872fb5015a7b8efa5ad0aad2a1632f58ab67b59f..4a30e3913c9493944713efd2b39e00f0a7461d41 100644 (file)
@@ -1,4 +1,4 @@
-From 3758928da147179fac4d9ecdbd3e6c703eda36d1 Mon Sep 17 00:00:00 2001
+From 30d77543640f438ee389f66b5e06fb766dbab2bc 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 029/116] btrfs: raid56: say whether a metadata
@@ -74,10 +74,10 @@ index c0f174cf5f256..c5c8e26ea00a4 100644
        /* BTRFS_STRIPE_RMW_* masks; see btrfs_stripe_allow_rmw(). */
        u32 stripe_rmw_opt;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index dcd59c92766de..7dbf0a71405d4 100644
+index 8248960c7c150..7c15583651fc2 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2831,6 +2831,132 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
+@@ -2848,6 +2848,132 @@ static bool need_read_stripe_sectors(struct btrfs_raid_bio *rbio)
        return false;
  }
  
@@ -97,7 +97,7 @@ index dcd59c92766de..7dbf0a71405d4 100644
 +      const int stripe_nr = i / rbio->stripe_nsectors;
 +      const int sectornr = i % rbio->stripe_nsectors;
 +      const u64 logical = rbio->bioc->full_stripe_logical +
-+                          (u64)stripe_nr * BTRFS_STRIPE_LEN +
++                          (u64)stripe_nr * rbio->bioc->stripe_len +
 +                          (u64)sectornr * fs_info->sectorsize;
 +      const phys_addr_t *paddrs = from_bio ? rbio->bio_paddrs
 +                                           : rbio->stripe_paddrs;
@@ -210,7 +210,7 @@ index dcd59c92766de..7dbf0a71405d4 100644
  /*
   * Report a sub-stripe write that is going out as a read-modify-write.
   *
-@@ -2863,6 +2989,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -2880,6 +3006,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
                return;
  
        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw);
@@ -219,7 +219,7 @@ index dcd59c92766de..7dbf0a71405d4 100644
  "read-modify-write of full stripe %llu: this block group is not covered by stripe_alloc, the raid56 write hole applies to it",
                      rbio->bioc->full_stripe_logical);
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 125dc4c601d76..0d9dcfb7bbd1a 100644
+index 106e804b6363e..beabada2eacd7 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1126,7 +1126,10 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 128bb119c2641ee7f84a9dff1d2819abfb00d489..f4ec41dc04790d5c68e150aa6df2f79055319a17 100644 (file)
@@ -1,4 +1,4 @@
-From 9bd6e8e81e4445fb261378e2f6386fc195cfe535 Mon Sep 17 00:00:00 2001
+From 897917b2d1c3004bd01f804fd778ef3360ee920c 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 030/116] btrfs: stripe_alloc: tunable park deadlines, and
@@ -44,7 +44,7 @@ Assisted-by: Claude:claude-fable-5
  5 files changed, 127 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 0d41c6ecdd735..602a7f2821745 100644
+index 81eecb45190b8..e46ce260f71ad 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1315,14 +1315,19 @@ bool btrfs_stripe_run_pad_start(struct btrfs_fs_info *fs_info,
@@ -94,10 +94,10 @@ index 0d41c6ecdd735..602a7f2821745 100644
        return ret;
  }
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 6cc4c609a7d8b..71e38307ee92b 100644
+index 7540f7d9e3de1..5d306267e3f47 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -2784,6 +2784,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
+@@ -2804,6 +2804,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
        INIT_LIST_HEAD(&fs_info->delalloc_roots);
        INIT_LIST_HEAD(&fs_info->caching_block_groups);
        INIT_LIST_HEAD(&fs_info->open_stripe_bgs);
@@ -170,7 +170,7 @@ index c5c8e26ea00a4..8c0456add9d47 100644
        /* Private scrub information */
        struct mutex scrub_lock;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 7dbf0a71405d4..aae82b458bb86 100644
+index 7c15583651fc2..d117cf701b807 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -75,8 +75,6 @@
@@ -182,7 +182,7 @@ index 7dbf0a71405d4..aae82b458bb86 100644
  /* Scan period of the park timer while anything is parked. */
  #define BTRFS_RBIO_PARK_SCAN_MS               3
  
-@@ -792,7 +790,9 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -797,7 +795,9 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
  {
        struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
        struct btrfs_stripe_hash_table *table = fs_info->stripe_hash_table;
@@ -193,7 +193,7 @@ index 7dbf0a71405d4..aae82b458bb86 100644
        enum btrfs_stripe_run_class class;
  
        if (!btrfs_stripe_open_run_class(fs_info,
-@@ -802,9 +802,13 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -807,9 +807,13 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
  
        spin_lock(&rbio->bio_list_lock);
        if (rbio_has_sync_bio(rbio))
@@ -208,7 +208,7 @@ index 7dbf0a71405d4..aae82b458bb86 100644
        /*
         * A sync write into a nodatacow inode's private run has a waiter
         * behind it and nothing worth waiting to merge with: in-place
-@@ -813,7 +817,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -818,7 +822,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
         * async writeback there.
         */
        if (class == BTRFS_STRIPE_RUN_NOCOW &&
@@ -217,7 +217,7 @@ index 7dbf0a71405d4..aae82b458bb86 100644
                return false;
  
        /*
-@@ -825,7 +829,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -830,7 +834,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
         * path kicks it as soon as they have all been submitted.)
         */
        if (test_bit(RBIO_BATCH_DONE_BIT, &rbio->flags) &&
@@ -226,7 +226,7 @@ index 7dbf0a71405d4..aae82b458bb86 100644
                return false;
  
        spin_lock(&table->parked_lock);
-@@ -1101,7 +1105,8 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+@@ -1106,7 +1110,8 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
                                        struct btrfs_stripe_hash_table *table =
                                                cur->bioc->fs_info->stripe_hash_table;
                                        unsigned long dl = jiffies +
@@ -236,7 +236,7 @@ index 7dbf0a71405d4..aae82b458bb86 100644
  
                                        spin_lock(&table->parked_lock);
                                        if (test_bit(RBIO_PARKED_BIT,
-@@ -3038,10 +3043,17 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -3055,10 +3060,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)) {
@@ -257,7 +257,7 @@ index 7dbf0a71405d4..aae82b458bb86 100644
                 * Now we're doing sub-stripe write, also need all data stripes
                 * to do the full RMW.
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 0d9dcfb7bbd1a..9369b05c7afc4 100644
+index beabada2eacd7..fbd5158babd99 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1126,6 +1126,10 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 8db6fbe32006879e9cb5edb11736f1f282e41e0f..41dd3d71b40e172439744ec35d7fa6c4c920b998 100644 (file)
@@ -1,4 +1,4 @@
-From addef1dec9727eecb057bc479be793829bd049f7 Mon Sep 17 00:00:00 2001
+From cae5a5d0a6e9a7a0a1b11229920cdb81b1f81769 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 031/116] btrfs: stripe_alloc: trace why padding declined,
@@ -33,7 +33,7 @@ Assisted-by: Claude:claude-fable-5
  6 files changed, 128 insertions(+), 7 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 602a7f2821745..d53f8f9e7bc0c 100644
+index e46ce260f71ad..5c3239f41f538 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1311,7 +1311,8 @@ bool btrfs_stripe_nocow_writable(struct btrfs_inode *inode, u64 start,
@@ -140,13 +140,13 @@ index 8c0456add9d47..6dd9e331d89f7 100644
                /*
                 * Breakdown of what a metadata read-modify-write found in the
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index aae82b458bb86..381834cf7fe83 100644
+index d117cf701b807..7f70c0ed81e9f 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2760,20 +2760,40 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2777,20 +2777,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 * BTRFS_STRIPE_LEN;
+       const u64 stripe_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
 -      u64 pad_from;
 +      struct btrfs_stripe_pad_info info;
 +      const u32 total = rbio->nr_data * rbio->stripe_nsectors;
@@ -188,7 +188,7 @@ index aae82b458bb86..381834cf7fe83 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 +
-@@ -2781,8 +2801,19 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2798,8 +2818,19 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
  
                if (rbio->bio_paddrs[i * rbio->sector_nsteps] != INVALID_PADDR)
                        continue;
@@ -210,7 +210,7 @@ index aae82b458bb86..381834cf7fe83 100644
  
        if (alloc_rbio_data_pages(rbio) < 0)
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 9369b05c7afc4..470094efa25b3 100644
+index fbd5158babd99..4059b8e0974a8 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1130,6 +1130,7 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 80d21a23ef98b6664ef382b50dd9607de26cbd56..56f83dff1cb6a74d09a091ee4ded70a2838a3296 100644 (file)
@@ -1,4 +1,4 @@
-From ba78c5bdb23c33d2159470c5a0b11b182ab90aa8 Mon Sep 17 00:00:00 2001
+From 138ec473477dae46a688181c42319f862d01ec56 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 032/116] btrfs: stripe_alloc: complete parked writes on
@@ -49,7 +49,7 @@ Assisted-by: Claude:claude-fable-5
  8 files changed, 155 insertions(+), 14 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index d53f8f9e7bc0c..4d63d1f7cd3d8 100644
+index 5c3239f41f538..59b7232c6482e 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1309,6 +1309,43 @@ bool btrfs_stripe_nocow_writable(struct btrfs_inode *inode, u64 start,
@@ -189,7 +189,7 @@ index e7aeee5c7172d..8e06a4266b3a3 100644
                                       test_bit(BTRFS_ORDERED_COMPLETE,
                                                &entry->flags),
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 381834cf7fe83..d778cc37667a0 100644
+index 7f70c0ed81e9f..370893ab20223 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -66,6 +66,13 @@
@@ -206,7 +206,7 @@ index 381834cf7fe83..d778cc37667a0 100644
  #define RBIO_CACHE_SIZE 1024
  
  /*
-@@ -780,6 +787,29 @@ static bool rbio_has_sync_bio(struct btrfs_raid_bio *rbio)
+@@ -785,6 +792,29 @@ static bool rbio_has_sync_bio(struct btrfs_raid_bio *rbio)
        return false;
  }
  
@@ -223,7 +223,7 @@ index 381834cf7fe83..d778cc37667a0 100644
 +{
 +      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
 +      const u64 stripe_start = rbio->bioc->full_stripe_logical;
-+      const u64 stripe_len = (u64)rbio->nr_data * BTRFS_STRIPE_LEN;
++      const u64 stripe_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
 +      u64 ceiling;
 +
 +      ceiling = btrfs_stripe_run_alloc_ceiling(fs_info, stripe_start,
@@ -236,7 +236,7 @@ index 381834cf7fe83..d778cc37667a0 100644
  /*
   * Park a partial write rbio that owns its stripe lock, if its stripe is
   * covered by an open stripe run.  Returns true if the rbio was parked (or
-@@ -835,7 +865,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -840,7 +870,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
        spin_lock(&table->parked_lock);
        set_bit(RBIO_PARKED_BIT, &rbio->flags);
        set_bit(RBIO_WAS_PARKED_BIT, &rbio->flags);
@@ -248,7 +248,7 @@ index 381834cf7fe83..d778cc37667a0 100644
        /*
         * Take a reference of our own before publishing.  The moment
         * parked_lock is dropped this rbio is visible to every flusher, and a
-@@ -887,7 +921,8 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -892,7 +926,8 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
   * write.  Callers may hold the stripe hash and bio_list locks; parked_lock
   * nests inside both.
   */
@@ -258,7 +258,7 @@ index 381834cf7fe83..d778cc37667a0 100644
  {
        struct btrfs_stripe_hash_table *table =
                rbio->bioc->fs_info->stripe_hash_table;
-@@ -899,7 +934,7 @@ static void unpark_full_rbio(struct btrfs_raid_bio *rbio)
+@@ -904,7 +939,7 @@ static void unpark_full_rbio(struct btrfs_raid_bio *rbio)
        }
        rbio_unpark_locked(rbio);
        spin_unlock(&table->parked_lock);
@@ -267,7 +267,7 @@ index 381834cf7fe83..d778cc37667a0 100644
        start_async_work(rbio, rmw_rbio_work_locked);
  }
  
-@@ -909,7 +944,7 @@ static void unpark_full_rbio(struct btrfs_raid_bio *rbio)
+@@ -914,7 +949,7 @@ static void unpark_full_rbio(struct btrfs_raid_bio *rbio)
   * ordered-extent waiters, and the park timer.
   */
  void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
@@ -276,7 +276,7 @@ index 381834cf7fe83..d778cc37667a0 100644
  {
        struct btrfs_stripe_hash_table *table = fs_info->stripe_hash_table;
        struct btrfs_raid_bio *rbio;
-@@ -926,6 +961,17 @@ void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
+@@ -931,6 +966,17 @@ void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
                if (rbio_start + rbio_len <= start ||
                    (num_bytes != U64_MAX && rbio_start >= start + num_bytes))
                        continue;
@@ -294,7 +294,7 @@ index 381834cf7fe83..d778cc37667a0 100644
                rbio_unpark_locked(rbio);
                list_add_tail(&rbio->parked_node, &flush);
        }
-@@ -956,14 +1002,35 @@ static void parked_rbios_timeout_work(struct work_struct *work)
+@@ -961,14 +1007,35 @@ static void parked_rbios_timeout_work(struct work_struct *work)
                        rearm = true;
                        continue;
                }
@@ -331,7 +331,7 @@ index 381834cf7fe83..d778cc37667a0 100644
                start_async_work(rbio, rmw_rbio_work_locked);
        }
        if (rearm)
-@@ -1098,9 +1165,21 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+@@ -1103,9 +1170,21 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
                         * this stripe.
                         */
                        if (test_bit(RBIO_PARKED_BIT, &cur->flags)) {
@@ -339,7 +339,7 @@ index 381834cf7fe83..d778cc37667a0 100644
 +                                      cur->bioc->fs_info;
 +
                                if (cur->bio_list_bytes ==
-                                   cur->nr_data * BTRFS_STRIPE_LEN) {
+                                   cur->nr_data * cur->bioc->stripe_len) {
 -                                      unpark_full_rbio(cur);
 +                                      unpark_ready_rbio(cur,
 +                                              &cfs->stripe_park_stats.filled);
@@ -354,7 +354,7 @@ index 381834cf7fe83..d778cc37667a0 100644
                                } else if (sync) {
                                        struct btrfs_stripe_hash_table *table =
                                                cur->bioc->fs_info->stripe_hash_table;
-@@ -1110,9 +1189,13 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
+@@ -1115,9 +1194,13 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
  
                                        spin_lock(&table->parked_lock);
                                        if (test_bit(RBIO_PARKED_BIT,
@@ -372,10 +372,10 @@ index 381834cf7fe83..d778cc37667a0 100644
                                }
                        }
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 07ba71ae8e54f..ca15c45f8f4be 100644
+index f5b8d788b1fff..11b843095903e 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -140,6 +140,8 @@ struct btrfs_raid_bio {
+@@ -138,6 +138,8 @@ struct btrfs_raid_bio {
         */
        struct list_head parked_node;
        unsigned long park_deadline;
@@ -384,7 +384,7 @@ index 07ba71ae8e54f..ca15c45f8f4be 100644
  
        /* Flags that tell us if it is safe to merge with this bio. */
        unsigned long flags;
-@@ -297,6 +299,6 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+@@ -292,6 +294,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_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
@@ -393,7 +393,7 @@ index 07ba71ae8e54f..ca15c45f8f4be 100644
  
  #endif
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 470094efa25b3..6d084a70758cd 100644
+index 4059b8e0974a8..25d8c61d72a9e 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1122,8 +1122,10 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 79fb0752392b7369731fdd4097cf2afebcc7f6b0..91634867a1acf64a517b9ed65b1fcaab99b7a9e5 100644 (file)
@@ -1,4 +1,4 @@
-From 470e5e7b910d21431589778c95abc362bc6c1712 Mon Sep 17 00:00:00 2001
+From b5b297cec9569dd1040ab925a60f6df4bc13c227 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 033/116] btrfs: stripe_alloc: track per-sector liveness
@@ -47,7 +47,7 @@ Assisted-by: Claude:claude-fable-5
  5 files changed, 357 insertions(+), 145 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 4d63d1f7cd3d8..572ecbfb3514f 100644
+index 59b7232c6482e..974ffc73f3b1e 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -504,6 +504,21 @@ struct btrfs_open_stripe_run {
@@ -540,10 +540,10 @@ index c2ba4abf0ec8c..fc97d1f78119f 100644
  
        if (root_objectid == BTRFS_TREE_RELOC_OBJECTID) {
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 0a4380e4637cb..80703492a5647 100644
+index c266c0f35f2f1..aabf456b70d97 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2272,9 +2272,70 @@ int btrfs_claim_stripe_tail(struct btrfs_block_group *block_group,
+@@ -2282,9 +2282,70 @@ int btrfs_claim_stripe_tail(struct btrfs_block_group *block_group,
  }
  
  /*
@@ -617,7 +617,7 @@ index 0a4380e4637cb..80703492a5647 100644
   * with point lookups, looking for a run of fully-free full stripes no
   * single entry contains.
   *
-@@ -2456,7 +2517,6 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2466,7 +2527,6 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                                        &block_group->fs_info->discard_ctl;
        const u64 fsl = block_group->full_stripe_len;
        struct btrfs_free_space *entry;
@@ -625,7 +625,7 @@ index 0a4380e4637cb..80703492a5647 100644
        struct btrfs_free_space *spare = NULL;
        enum btrfs_trim_state head_trim_state = BTRFS_TRIM_STATE_UNTRIMMED;
        bool spare_used = false;
-@@ -2473,68 +2533,30 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2483,68 +2543,30 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
  
        spin_lock(&ctl->tree_lock);
  
@@ -715,7 +715,7 @@ index 0a4380e4637cb..80703492a5647 100644
        if (!btrfs_free_space_trimmed(entry))
                atomic64_add(run_len, &discard_ctl->discard_bytes_saved);
  
-@@ -2576,6 +2598,7 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2586,6 +2608,7 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
        return ret;
  }
  
@@ -724,10 +724,10 @@ index 0a4380e4637cb..80703492a5647 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 d778cc37667a0..09fe3c65dd6df 100644
+index 370893ab20223..92c48cb4578da 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -2245,6 +2245,7 @@ void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc)
+@@ -2262,6 +2262,7 @@ void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc)
        rbio->operation = BTRFS_RBIO_WRITE;
        rbio_add_bio(rbio, bio);
  
@@ -735,7 +735,7 @@ index d778cc37667a0..09fe3c65dd6df 100644
        /*
         * Don't plug on full rbios, just get them out the door
         * as quickly as we can
-@@ -2830,74 +2831,78 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -2847,74 +2848,78 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
  
  /*
   * Try to avoid the RMW read phase of a sub-stripe write by zero-filling
@@ -755,7 +755,7 @@ index d778cc37667a0..09fe3c65dd6df 100644
        struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
        const u64 stripe_start = rbio->bioc->full_stripe_logical;
 -      const u32 sectorsize = fs_info->sectorsize;
-       const u64 stripe_len = (u64)rbio->nr_data * BTRFS_STRIPE_LEN;
+       const u64 stripe_len = (u64)rbio->nr_data * rbio->bioc->stripe_len;
 +      const u32 sectorsize = fs_info->sectorsize;
 +      const u32 nsectors = rbio->nr_data * rbio->stripe_nsectors;
        struct btrfs_stripe_pad_info info;
index 93da0dbd2a24e4b8af3a54e8d0092d06834a190f..79075e44fd30654b3cab3ff7c859d562e6b6dd0d 100644 (file)
@@ -1,4 +1,4 @@
-From 5eecaf54aa231b7e7a6bc68f5f16b905aee89bbb Mon Sep 17 00:00:00 2001
+From e41a35a9dc376c6b027def1b5cf16607cec0a75f 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 034/116] btrfs: stripe_alloc: count claimable whole-stripe
@@ -73,7 +73,7 @@ Assisted-by: Claude:claude-fable-5
  7 files changed, 138 insertions(+), 6 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 572ecbfb3514f..234db161586a7 100644
+index 974ffc73f3b1e..857638d2d506c 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2332,6 +2332,7 @@ void btrfs_scan_stripe_unusable(struct btrfs_fs_info *fs_info, bool force)
@@ -124,10 +124,10 @@ index 87d807639589d..4c59b0ba0f217 100644
  
        /*
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 80703492a5647..8995f90fdebc2 100644
+index aabf456b70d97..eed6f8b7de197 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1350,6 +1350,10 @@ static void steal_from_bitmap(struct btrfs_free_space_ctl *ctl,
+@@ -1360,6 +1360,10 @@ static void steal_from_bitmap(struct btrfs_free_space_ctl *ctl,
        }
  }
  
@@ -138,7 +138,7 @@ index 80703492a5647..8995f90fdebc2 100644
  static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
                           u64 offset, u64 bytes,
                           enum btrfs_trim_state trim_state)
-@@ -1404,6 +1408,19 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1414,6 +1418,19 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
        if (ret)
                kmem_cache_free(btrfs_free_space_cachep, info);
  out:
@@ -158,7 +158,7 @@ index 80703492a5647..8995f90fdebc2 100644
        btrfs_discard_update_discardable(block_group);
        spin_unlock(&ctl->tree_lock);
  
-@@ -1483,6 +1500,48 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
+@@ -1493,6 +1510,48 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
  
  static void stripe_unusable_mark_dirty(struct btrfs_block_group *bg);
  
@@ -207,7 +207,7 @@ index 80703492a5647..8995f90fdebc2 100644
  /*
   * stripe_alloc: count the sub-stripe fragments of a returning free range
   * as trapped immediately, without waiting for the commit-time rescan.
-@@ -1609,6 +1668,19 @@ int btrfs_remove_free_space(struct btrfs_block_group *block_group,
+@@ -1619,6 +1678,19 @@ int btrfs_remove_free_space(struct btrfs_block_group *block_group,
  
        spin_lock(&ctl->tree_lock);
  
@@ -227,7 +227,7 @@ index 80703492a5647..8995f90fdebc2 100644
  again:
        ret = 0;
        if (!bytes)
-@@ -2022,7 +2094,7 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
+@@ -2032,7 +2104,7 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
  void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
  {
        struct btrfs_free_space_ctl *ctl = bg->free_space_ctl;
@@ -236,7 +236,7 @@ index 80703492a5647..8995f90fdebc2 100644
        u32 *freep;
  
        if (!btrfs_is_stripe_alloc_bg(bg))
-@@ -2043,14 +2115,19 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2053,14 +2125,19 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
        }
        trapped = stripe_unusable_scan(bg, freep, nstripes);
        bg->stripe_unusable = trapped;
@@ -257,7 +257,7 @@ index 80703492a5647..8995f90fdebc2 100644
                spin_unlock(&bg->space_info->lock);
        }
  }
-@@ -2067,6 +2144,7 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2077,6 +2154,7 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
  {
        struct btrfs_free_space_ctl *ctl = bg->free_space_ctl;
        u64 trapped;
@@ -265,7 +265,7 @@ index 80703492a5647..8995f90fdebc2 100644
  
        if (!btrfs_is_stripe_alloc_bg(bg))
                return;
-@@ -2077,13 +2155,17 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2087,13 +2165,17 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
                return;
        }
        trapped = bg->stripe_unusable;
@@ -284,7 +284,7 @@ index 80703492a5647..8995f90fdebc2 100644
                spin_unlock(&bg->space_info->lock);
        }
  }
-@@ -2111,8 +2193,27 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2121,8 +2203,27 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
                return;
  
        spin_lock(&ctl->tree_lock);
@@ -313,7 +313,7 @@ index 80703492a5647..8995f90fdebc2 100644
        spin_unlock(&ctl->tree_lock);
        kvfree(freep);
        /*
-@@ -2551,6 +2652,7 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2561,6 +2662,7 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                        goto out;
                spare_used = claim_stripe_run_pieces(block_group, run_start,
                                                     run_len, spare);
@@ -321,7 +321,7 @@ index 80703492a5647..8995f90fdebc2 100644
                *start = run_start;
                *len = run_len;
                ret = 0;
-@@ -2581,6 +2683,7 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2591,6 +2693,7 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                        kmem_cache_free(btrfs_free_space_cachep, entry);
                }
        }
@@ -330,10 +330,10 @@ index 80703492a5647..8995f90fdebc2 100644
        *len = run_len;
        ret = 0;
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index b7ce04192af22..7222811993279 100644
+index 2137d58015412..13e0db4aa1c42 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -721,11 +721,12 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
+@@ -719,11 +719,12 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
                   (s64)(info->total_bytes - btrfs_space_info_used(info, true)),
                   info->full ? "" : "not ");
        btrfs_info(fs_info,
@@ -348,7 +348,7 @@ index b7ce04192af22..7222811993279 100644
  }
  
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 39e32ed85636e..65c976e84fcc3 100644
+index 13c24536731c5..c8143f39f89b0 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -158,6 +158,10 @@ struct btrfs_space_info {
@@ -371,7 +371,7 @@ index 39e32ed85636e..65c976e84fcc3 100644
  static inline u64 btrfs_space_info_used(const struct btrfs_space_info *s_info,
                                        bool may_use_included)
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 6d084a70758cd..198ca6a6c3735 100644
+index 25d8c61d72a9e..2559c37f8af85 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -818,6 +818,7 @@ SPACE_INFO_ATTR(bytes_may_use);
index 9f5bab7f69feca3335c9cc72ba4c7525328b8f7e..316c4d001f86184b6718e498904b5687e68557e1 100644 (file)
@@ -1,4 +1,4 @@
-From db091c0b27f9c41bde8be5b39e01f1dc63cf2a25 Mon Sep 17 00:00:00 2001
+From 4384767186cded93819133007b4b6eaf5117ddf6 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 035/116] btrfs: raid56: adaptive park deadline from the
@@ -69,10 +69,10 @@ index cfaf19d7528b3..035e0cc80edd8 100644
        /* Private scrub information */
        struct mutex scrub_lock;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 09fe3c65dd6df..1af74be9b6c87 100644
+index 92c48cb4578da..8c587dd13965a 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -774,6 +774,7 @@ static void rbio_unpark_locked(struct btrfs_raid_bio *rbio)
+@@ -779,6 +779,7 @@ static void rbio_unpark_locked(struct btrfs_raid_bio *rbio)
  {
        list_del_init(&rbio->parked_node);
        clear_bit(RBIO_PARKED_BIT, &rbio->flags);
@@ -80,7 +80,7 @@ index 09fe3c65dd6df..1af74be9b6c87 100644
  }
  
  /* Does any bio gathered in @rbio carry a sync hint (a blocked waiter)? */
-@@ -862,6 +863,29 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -867,6 +868,29 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
            timeout_ms == sync_timeout_ms)
                return false;
  
@@ -110,7 +110,7 @@ index 09fe3c65dd6df..1af74be9b6c87 100644
        spin_lock(&table->parked_lock);
        set_bit(RBIO_PARKED_BIT, &rbio->flags);
        set_bit(RBIO_WAS_PARKED_BIT, &rbio->flags);
-@@ -886,6 +910,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -891,6 +915,7 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
         */
        refcount_inc(&rbio->refs);
        list_add_tail(&rbio->parked_node, &table->parked);
@@ -119,7 +119,7 @@ index 09fe3c65dd6df..1af74be9b6c87 100644
        atomic64_inc(&fs_info->stripe_park_stats.parked);
        queue_delayed_work(system_percpu_wq, &table->parked_work,
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 198ca6a6c3735..6eb2d5362f204 100644
+index 2559c37f8af85..0369a7c04c54f 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1138,7 +1138,9 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 60f8ae1bbf24b375bb668924938669c029c495de..205d98eaace5dfaa048369346a30e0bfdc75ad9e 100644 (file)
@@ -1,4 +1,4 @@
-From aff2aee44cbf33530bdb4578906ef260a084049d Mon Sep 17 00:00:00 2001
+From 3002a7e4dce8259c68b19a47f454e8996e7c8cbf 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 036/116] btrfs: stripe_alloc: gate data admission on
@@ -30,10 +30,10 @@ Assisted-by: Claude:claude-opus-4-8
  1 file changed, 65 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 7222811993279..eb5e0a9472acc 100644
+index 13e0db4aa1c42..53a4d3c3decfb 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -649,6 +649,66 @@ static void remove_ticket(struct btrfs_space_info *space_info,
+@@ -647,6 +647,66 @@ static void remove_ticket(struct btrfs_space_info *space_info,
        spin_unlock(&ticket->lock);
  }
  
@@ -100,7 +100,7 @@ index 7222811993279..eb5e0a9472acc 100644
  /*
   * This is for space we already have accounted in space_info->bytes_may_use, so
   * basically when we're returning space from block_rsv's.
-@@ -671,8 +731,9 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
+@@ -669,8 +729,9 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
                used_after = used + ticket->bytes;
  
                /* Check and see if our ticket can be satisfied now. */
@@ -112,7 +112,7 @@ index 7222811993279..eb5e0a9472acc 100644
                        btrfs_space_info_update_bytes_may_use(space_info, ticket->bytes);
                        remove_ticket(space_info, ticket, 0);
                        space_info->tickets_id++;
-@@ -1904,7 +1965,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -1902,7 +1963,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
         */
        if (!pending_tickets &&
            ((used + orig_bytes <= space_info->total_bytes) ||
index 208823ea887a07bf17313cc029ed08f0558bc5b9..118cceb2a54304fbf1d85dc2134af127dcb64117 100644 (file)
@@ -1,4 +1,4 @@
-From 46fa2be98daec9cc359d0f216cd6725837f142b5 Mon Sep 17 00:00:00 2001
+From 9cbe3ca82143309b0b8e1fac5f67e131cbff4470 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:57 -0400
 Subject: [RFC PATCH 037/116] btrfs: stripe_alloc: cache a failed stripe run
@@ -50,10 +50,10 @@ Assisted-by: Claude:claude-fable-5
  3 files changed, 49 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 234db161586a7..f00ba4b29a47d 100644
+index 857638d2d506c..c984b5ffcf465 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -4529,6 +4529,7 @@ static struct btrfs_block_group *btrfs_create_block_group(
+@@ -4532,6 +4532,7 @@ static struct btrfs_block_group *btrfs_create_block_group(
  
        cache->fs_info = fs_info;
        cache->full_stripe_len = btrfs_full_stripe_len(fs_info, start);
@@ -85,10 +85,10 @@ index 4c59b0ba0f217..2f3091b848317 100644
  
        /*
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 8995f90fdebc2..dbda642a1d45d 100644
+index eed6f8b7de197..b9074d21f90f6 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1378,6 +1378,12 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1388,6 +1388,12 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
  
        spin_lock(&ctl->tree_lock);
  
@@ -101,7 +101,7 @@ index 8995f90fdebc2..dbda642a1d45d 100644
        if (try_merge_free_space(ctl, info, true))
                goto link;
  
-@@ -2634,6 +2640,26 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2644,6 +2650,26 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
  
        spin_lock(&ctl->tree_lock);
  
@@ -128,7 +128,7 @@ index 8995f90fdebc2..dbda642a1d45d 100644
        entry = find_free_stripe_run(block_group, want_bytes, &run_start, &run_len);
        if (!entry) {
                /*
-@@ -2648,8 +2674,17 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2658,8 +2684,17 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                        return -ENOMEM;
                spin_lock(&ctl->tree_lock);
                if (!find_free_stripe_run_slow(block_group, want_bytes,
index 82ed08db62e8eeee61fa41bedff51d4ef032f90d..dbd67708b8ded003c3bdb4d6121f15887766bc87 100644 (file)
@@ -1,4 +1,4 @@
-From 4b4d6efe8d64cc91a3d94c7de469b449fa6cf16e Mon Sep 17 00:00:00 2001
+From dde098ab4e495aebe9bb82a19e2d9ea01b6918e8 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 038/116] btrfs: stripe_meta: allocate tree blocks by whole
@@ -76,7 +76,7 @@ Assisted-by: Claude:claude-fable-5
  8 files changed, 482 insertions(+), 16 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index f00ba4b29a47d..6a1b84d917d99 100644
+index c984b5ffcf465..d64f882cec24d 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -501,6 +501,7 @@ struct btrfs_open_stripe_run {
@@ -693,7 +693,7 @@ index fc97d1f78119f..921c2c1956f70 100644
                                                    bg_ret);
                return do_allocation_clustered(block_group, ffe_ctl, bg_ret);
 diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
-index 55e9144d47595..b4fd33de1a615 100644
+index 5ff630630490e..188e167848f91 100644
 --- a/fs/btrfs/extent_io.c
 +++ b/fs/btrfs/extent_io.c
 @@ -2392,6 +2392,16 @@ static void end_bbio_meta_write(struct btrfs_bio *bbio)
@@ -729,10 +729,10 @@ index 55e9144d47595..b4fd33de1a615 100644
                        if (ret == -EBUSY) {
                                ret = 0;
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index dbda642a1d45d..075c00ea55b38 100644
+index b9074d21f90f6..e4671fc7e5c15 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2103,7 +2103,7 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2113,7 +2113,7 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
        u64 trapped, claimable, nstripes;
        u32 *freep;
  
@@ -742,10 +742,10 @@ index dbda642a1d45d..075c00ea55b38 100644
        if (READ_ONCE(bg->stripe_unusable_ready))
                return;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 1af74be9b6c87..d95211d124ef4 100644
+index 8c587dd13965a..d1e961ce4e490 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3125,6 +3125,8 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3142,6 +3142,8 @@ static void audit_uncovered_rmw(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;
@@ -754,7 +754,7 @@ index 1af74be9b6c87..d95211d124ef4 100644
  
        if (!btrfs_test_opt(fs_info, STRIPE_ALLOC))
                return;
-@@ -3139,6 +3141,21 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3156,6 +3158,21 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
  
        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw);
        audit_uncovered_rmw(rbio);
@@ -777,7 +777,7 @@ index 1af74be9b6c87..d95211d124ef4 100644
  "read-modify-write of full stripe %llu: this block group is not covered by stripe_alloc, the raid56 write hole applies to it",
                      rbio->bioc->full_stripe_logical);
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index 0dccce2c57c9d..c3cdaf2c6cc41 100644
+index 4f781df772202..6007dce716bf5 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
 @@ -23,6 +23,8 @@
@@ -789,7 +789,7 @@ index 0dccce2c57c9d..c3cdaf2c6cc41 100644
  #include "space-info.h"
  #include "fs.h"
  #include "accessors.h"
-@@ -1361,6 +1363,13 @@ static int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans)
+@@ -1345,6 +1347,13 @@ static int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans)
        blk_start_plug(&plug);
        ret = btrfs_write_marked_extents(fs_info, dirty_pages, EXTENT_DIRTY);
        blk_finish_plug(&plug);
@@ -803,7 +803,7 @@ index 0dccce2c57c9d..c3cdaf2c6cc41 100644
        ret2 = btrfs_wait_extents(fs_info, dirty_pages);
  
        if (ret)
-@@ -2677,6 +2686,16 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2661,6 +2670,16 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                goto scrub_continue;
        }
  
@@ -821,10 +821,10 @@ index 0dccce2c57c9d..c3cdaf2c6cc41 100644
        /*
         * the super is written, we can safely allow the tree-loggers
 diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
-index e9b688024aed6..28a1439f0416b 100644
+index d902d169680a4..3a2391b616694 100644
 --- a/fs/btrfs/tree-log.c
 +++ b/fs/btrfs/tree-log.c
-@@ -2936,6 +2936,28 @@ static int clean_log_buffer(struct btrfs_trans_handle *trans,
+@@ -2938,6 +2938,28 @@ static int clean_log_buffer(struct btrfs_trans_handle *trans,
        wait_on_extent_buffer_writeback(eb);
        btrfs_tree_unlock(eb);
  
index 294fa315b46426c52c507c13ac71283abb716772..6eae41927f6924a8d33c5cd239eb1137886ea512 100644 (file)
@@ -1,4 +1,4 @@
-From 4d8e0574bf5043d83a69e17e41ec1e48fbaea885 Mon Sep 17 00:00:00 2001
+From 5fc8c3c4793dfd054c91db27d0d7c85330922a4c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:17:59 -0400
 Subject: [RFC PATCH 039/116] btrfs: stripe_alloc: drain the legacy allocator's
@@ -33,7 +33,7 @@ Assisted-by: Claude:claude-fable-5-1
  4 files changed, 49 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 6a1b84d917d99..4997b00c4ae41 100644
+index d64f882cec24d..989cbbaa33c38 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -5,6 +5,8 @@
@@ -123,10 +123,10 @@ index bacabac29e351..f8cb733ad3772 100644
  void btrfs_stripe_check_write(struct btrfs_fs_info *fs_info,
                              u64 full_stripe_start, bool sub_stripe);
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 71e38307ee92b..a75fb22137e39 100644
+index 5d306267e3f47..37d87114f69e4 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -2784,6 +2784,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
+@@ -2804,6 +2804,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
        INIT_LIST_HEAD(&fs_info->delalloc_roots);
        INIT_LIST_HEAD(&fs_info->caching_block_groups);
        INIT_LIST_HEAD(&fs_info->open_stripe_bgs);
@@ -134,7 +134,7 @@ index 71e38307ee92b..a75fb22137e39 100644
        fs_info->stripe_park_timeout_ms = BTRFS_RBIO_PARK_TIMEOUT_MS;
        fs_info->stripe_park_sync_timeout_ms = BTRFS_RBIO_PARK_SYNC_TIMEOUT_MS;
        spin_lock_init(&fs_info->open_stripe_lock);
-@@ -4482,6 +4483,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
+@@ -4502,6 +4503,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
         */
        btrfs_run_delayed_iputs(fs_info);
  
index a45f3024c9066155874b235f6c5c973f1a1df35d..e3ddde783150c1ce022e5d01c81fc79b9acb9d84 100644 (file)
@@ -1,4 +1,4 @@
-From 3962fc1138c917d8bef1818bc692eb54b7e6e501 Mon Sep 17 00:00:00 2001
+From a453b51b9a437ef2b973388abb60efb07a27d2a4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:00 -0400
 Subject: [RFC PATCH 040/116] btrfs: stripe_alloc: keep the admitted bytes
@@ -28,10 +28,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 25 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 4997b00c4ae41..12fd159b096c9 100644
+index 989cbbaa33c38..2ca280f3d24bd 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -3879,6 +3879,31 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -3881,6 +3881,31 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                 */
                if (sinfo_used - trapped + num_bytes <= sinfo->total_bytes)
                        ret = 0;
index b4ffae6774aca83363764fec18cfef56cd69c9b1..32dc82e3fbd9abc2488b6cc5cfc3488890640fa9 100644 (file)
@@ -1,4 +1,4 @@
-From 8fd5354672fd14d804216a575c2ec72e5ad6c950 Mon Sep 17 00:00:00 2001
+From f43d637979ad59db61287dd03e80db53252d0b77 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:01 -0400
 Subject: [RFC PATCH 041/116] btrfs: stripe_alloc: never let relocation wait on
@@ -52,10 +52,10 @@ index 8aa5d113ccac8..27b492cb0c1d8 100644
        bytes = ALIGN(bytes, fs_info->sectorsize);
  
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index eb5e0a9472acc..e4091bef175ba 100644
+index 53a4d3c3decfb..1cc48844089f1 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -1820,6 +1820,7 @@ static int handle_reserve_ticket(struct btrfs_space_info *space_info,
+@@ -1818,6 +1818,7 @@ static int handle_reserve_ticket(struct btrfs_space_info *space_info,
  
        switch (flush) {
        case BTRFS_RESERVE_FLUSH_DATA:
@@ -63,7 +63,7 @@ index eb5e0a9472acc..e4091bef175ba 100644
        case BTRFS_RESERVE_FLUSH_ALL:
        case BTRFS_RESERVE_FLUSH_ALL_STEAL:
                wait_reserve_ticket(space_info, ticket);
-@@ -1897,8 +1898,13 @@ static inline bool can_steal(enum btrfs_reserve_flush_enum flush)
+@@ -1895,8 +1896,13 @@ static inline bool can_steal(enum btrfs_reserve_flush_enum flush)
   */
  static inline bool can_ticket(enum btrfs_reserve_flush_enum flush)
  {
@@ -78,7 +78,7 @@ index eb5e0a9472acc..e4091bef175ba 100644
  }
  
  /*
-@@ -1940,7 +1946,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -1938,7 +1944,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
                ASSERT(flush != BTRFS_RESERVE_FLUSH_EVICT, "flush=%d", flush);
        }
  
@@ -88,7 +88,7 @@ index eb5e0a9472acc..e4091bef175ba 100644
                async_work = &fs_info->async_data_reclaim_work;
        else
                async_work = &fs_info->async_reclaim_work;
-@@ -2098,9 +2105,12 @@ int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
+@@ -2096,9 +2103,12 @@ int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
        int ret;
  
        ASSERT(flush == BTRFS_RESERVE_FLUSH_DATA ||
@@ -103,7 +103,7 @@ index eb5e0a9472acc..e4091bef175ba 100644
               (unsigned long)current->journal_info, flush);
  
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 65c976e84fcc3..3d6141665a9d6 100644
+index c8143f39f89b0..867c0b9cc3eed 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -66,6 +66,14 @@ enum btrfs_reserve_flush_enum {
index 07f9ab0c601c5cf042ea785e33f0554dc29bae1a..92b9340840c6b91483e44dcd05bed0e452766ec8 100644 (file)
@@ -1,4 +1,4 @@
-From 6cbe3c02a360975097941fd3a390fd607a3c9c1f Mon Sep 17 00:00:00 2001
+From 306fa981802bac422d18668da6b26b483cabaebf Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:02 -0400
 Subject: [RFC PATCH 042/116] btrfs: stripe_alloc: give a queued stripe group a
@@ -30,10 +30,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 28 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 12fd159b096c9..0e3c23e2066a8 100644
+index 2ca280f3d24bd..186f06965412e 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -4427,6 +4427,34 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -4429,6 +4429,34 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        u64 old_total;
        int ret = 0;
  
index b4030c2e5e222dc444a73aebccdccd4140ebe7a6..33462f0a77a3c72332b36272656a289536dc692e 100644 (file)
@@ -1,4 +1,4 @@
-From 62886760223cf86cadcd40bfca85e7db871ef4f0 Mon Sep 17 00:00:00 2001
+From b32e47af319c32883e41c50ac16c18d3088e6539 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:03 -0400
 Subject: [RFC PATCH 043/116] btrfs: stripe_alloc: charge relocation a margin
@@ -26,10 +26,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 32 insertions(+), 15 deletions(-)
 
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index e4091bef175ba..2683ac00a2ecf 100644
+index 1cc48844089f1..9ff38370833e9 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -455,6 +455,12 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
+@@ -453,6 +453,12 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
  
        if (!unit || !sinfo || mod == 0)
                return;
@@ -42,7 +42,7 @@ index e4091bef175ba..2683ac00a2ecf 100644
        if (btrfs_test_opt(fs_info, STRIPE_ALLOC)) {
                /* charges and releases both live */
        } else if (mod > 0 || READ_ONCE(sinfo->bytes_stripe_margin) == 0) {
-@@ -667,7 +673,8 @@ static void remove_ticket(struct btrfs_space_info *space_info,
+@@ -665,7 +671,8 @@ static void remove_ticket(struct btrfs_space_info *space_info,
   * FLUSH_DATA ticket retry).  A later phase adds bytes_stripe_open to the bound to
   * match statfs exactly and recover that space.
   */
@@ -52,7 +52,7 @@ index e4091bef175ba..2683ac00a2ecf 100644
  {
        struct btrfs_fs_info *fs_info = space_info->fs_info;
        const u64 unit = READ_ONCE(fs_info->stripe_margin_unit);
-@@ -676,19 +683,28 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
+@@ -674,19 +681,28 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
            !(space_info->flags & BTRFS_BLOCK_GROUP_DATA) || !unit)
                return true;
        /*
@@ -93,7 +93,7 @@ index e4091bef175ba..2683ac00a2ecf 100644
        /*
         * Every outstanding data extent holds a whole-stripe margin
         * (bytes_stripe_margin) as collateral against the commit that
-@@ -733,7 +749,7 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
+@@ -731,7 +747,7 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
                /* Check and see if our ticket can be satisfied now. */
                if ((used_after <= space_info->total_bytes ||
                     can_overcommit(space_info, used, ticket->bytes, flush)) &&
@@ -102,7 +102,7 @@ index e4091bef175ba..2683ac00a2ecf 100644
                        btrfs_space_info_update_bytes_may_use(space_info, ticket->bytes);
                        remove_ticket(space_info, ticket, 0);
                        space_info->tickets_id++;
-@@ -1973,7 +1989,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -1971,7 +1987,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
        if (!pending_tickets &&
            ((used + orig_bytes <= space_info->total_bytes) ||
             can_overcommit(space_info, used, orig_bytes, flush)) &&
index 2778bc5779f1a22505d7a2356524928e3d59cb12..d56de0b4b04fafb5e00aba55f07ec4e2f228fb56 100644 (file)
@@ -1,4 +1,4 @@
-From acf9c88ceacb8d92f6a5fbc83674f1d3196864c3 Mon Sep 17 00:00:00 2001
+From 9d0303ebca525fb6bcfdbdf18579bf824c6e8ce2 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:04 -0400
 Subject: [RFC PATCH 044/116] btrfs: stripe_alloc: keep the relocation group's
@@ -48,7 +48,7 @@ Assisted-by: Claude:claude-fable-5-1
  5 files changed, 94 insertions(+), 35 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 0e3c23e2066a8..afd6b0b7e4525 100644
+index 186f06965412e..f100a2badde76 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2669,6 +2669,7 @@ void btrfs_scan_stripe_unusable(struct btrfs_fs_info *fs_info, bool force)
@@ -148,10 +148,10 @@ index 921c2c1956f70..a8dc64824034b 100644
                return 1;
  
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 075c00ea55b38..b4526c199ffb5 100644
+index e4671fc7e5c15..4533159a01929 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1533,6 +1533,12 @@ static void stripe_claimable_mod(struct btrfs_block_group *bg, s64 delta)
+@@ -1543,6 +1543,12 @@ static void stripe_claimable_mod(struct btrfs_block_group *bg, s64 delta)
                sinfo->bytes_stripe_claimable = 0;
        else
                btrfs_space_info_update_bytes_stripe_claimable(sinfo, delta);
@@ -164,7 +164,7 @@ index 075c00ea55b38..b4526c199ffb5 100644
        spin_unlock(&sinfo->lock);
  }
  
-@@ -2172,6 +2178,8 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2182,6 +2188,8 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
                                                              -(s64)trapped);
                btrfs_space_info_update_bytes_stripe_claimable(bg->space_info,
                                                               -(s64)claimable);
@@ -174,10 +174,10 @@ index 075c00ea55b38..b4526c199ffb5 100644
        }
  }
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 2683ac00a2ecf..3d74bdea16cac 100644
+index 9ff38370833e9..1e9946369c184 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -687,42 +687,59 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
+@@ -685,42 +685,59 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
         * placed): charge it whole stripes plus one, the tail its own open
         * runs can lose at the next commit.
         */
@@ -271,7 +271,7 @@ index 2683ac00a2ecf..3d74bdea16cac 100644
  
  /*
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 3d6141665a9d6..702222bb54ae4 100644
+index 867c0b9cc3eed..5abb8fd072b3c 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -166,6 +166,11 @@ struct btrfs_space_info {
index 99d2a326050f252b4d0997037942b86e5dd896d0..7286f9ec8c0a64e92582c6413371cafdc629f06b 100644 (file)
@@ -1,4 +1,4 @@
-From 8907d8718d7362ec87fc3f669bb819a07b1a9f57 Mon Sep 17 00:00:00 2001
+From fcea2a2a870153edcc955ec89836193e11a9395b Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:05 -0400
 Subject: [RFC PATCH 045/116] btrfs: stripe_alloc: let a data write fall back
index b747d24ea8dcea09f12b4398410986caa24e882c..c90fec07fdd57762ec499ed14e0338f6376f3d84 100644 (file)
@@ -1,4 +1,4 @@
-From 1646d2e379cbc9675bd69a08ea24ba28af54c64d Mon Sep 17 00:00:00 2001
+From d9236a5d0b0a3ce1ecc3243f5f6be0a636bb4d30 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 046/116] btrfs: stripe_alloc: hand groups full of trapped
@@ -55,10 +55,10 @@ Assisted-by: Claude:claude-fable-5-1
  4 files changed, 125 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index afd6b0b7e4525..c6ff2a7dc6010 100644
+index f100a2badde76..d9097e961f2a8 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -4684,21 +4684,74 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
+@@ -4686,21 +4686,74 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
        btrfs_reclaim_block_groups(fs_info, -1);
  }
  
@@ -159,10 +159,10 @@ index f8cb733ad3772..0f8e4c165d54c 100644
  struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *trans,
                                                 struct btrfs_space_info *space_info,
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index b4526c199ffb5..58f02314aef85 100644
+index 4533159a01929..b49c551276dd5 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2185,6 +2185,45 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2195,6 +2195,45 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
  }
  
  
@@ -208,7 +208,7 @@ index b4526c199ffb5..58f02314aef85 100644
  /*
   * Recompute a stripe_alloc block group's trapped free space from a fresh scan
   * and fold the change into the space_info total.  Called at commit for groups
-@@ -2195,6 +2234,7 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2205,6 +2244,7 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
  void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
  {
        struct btrfs_free_space_ctl *ctl = bg->free_space_ctl;
@@ -216,7 +216,7 @@ index b4526c199ffb5..58f02314aef85 100644
        u64 nstripes;
        u32 *freep;
  
-@@ -2227,9 +2267,34 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2237,9 +2277,34 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
                          "bg %llu incremental stripe_claimable %llu above scanned %llu",
                          bg->start, bg->stripe_claimable, scanned);
                bg->stripe_claimable = scanned;
index b51728c1d9eb728900295e93ea036d68279b1fa2..b88b78abd2d3e1289cfdf53e1219d4c7cdccd279 100644 (file)
@@ -1,4 +1,4 @@
-From 15b5f3d5a5f85702371cb95182b011bfcf3754e6 Mon Sep 17 00:00:00 2001
+From 5d738c8b02afd0dfa89f40059067b19f68082130 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 047/116] btrfs: stripe_alloc: relocate a queued stripe
@@ -22,10 +22,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 10 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index c6ff2a7dc6010..2442d3f274bbc 100644
+index d9097e961f2a8..64030c597705f 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -4479,12 +4479,21 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -4481,12 +4481,21 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
  
        spin_lock(&space_info->lock);
        spin_lock(&bg->lock);
index 6924a924b27cd6009e8bace204ac6d0b2f85c587..8280570e2d058ecf432812da95ba1f847883d313 100644 (file)
@@ -1,4 +1,4 @@
-From 6c71f48b7ba8a42c9cf25656b8c5e199be0e22e8 Mon Sep 17 00:00:00 2001
+From 62783d7e1cf15e3bf7142abededac55926f35cb3 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:07 -0400
 Subject: [RFC PATCH 048/116] btrfs: stripe_meta: maintain trapped free space
@@ -25,7 +25,7 @@ Assisted-by: Claude:claude-fable-5
  2 files changed, 18 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 2442d3f274bbc..4369501c81eec 100644
+index 64030c597705f..ef7f53471de4a 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2672,7 +2672,13 @@ void btrfs_scan_stripe_unusable(struct btrfs_fs_info *fs_info, bool force)
@@ -43,7 +43,7 @@ index 2442d3f274bbc..4369501c81eec 100644
                        continue;
                down_read(&sinfo->groups_sem);
                for (raid = 0; raid < BTRFS_NR_RAID_TYPES; raid++) {
-@@ -3929,8 +3935,16 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -3931,8 +3937,16 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                 * btrfs_can_overcommit check here, and we need to pass in
                 * BTRFS_RESERVE_NO_FLUSH to give ourselves the most amount of
                 * leeway to allow us to mark this block group as read only.
@@ -62,10 +62,10 @@ index 2442d3f274bbc..4369501c81eec 100644
        }
  
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 58f02314aef85..0c23fa3429dbe 100644
+index b49c551276dd5..c005065b2b532 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2158,7 +2158,7 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2168,7 +2168,7 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
        u64 trapped;
        u64 claimable;
  
@@ -74,7 +74,7 @@ index 58f02314aef85..0c23fa3429dbe 100644
                return;
  
        spin_lock(&ctl->tree_lock);
-@@ -2238,7 +2238,7 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2248,7 +2248,7 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
        u64 nstripes;
        u32 *freep;
  
index 06f40cfc90fc61cb48ad255abcb0ca346c88c6ee..0468d00c75a17d44f9c121b57a0177f107f5365e 100644 (file)
@@ -1,4 +1,4 @@
-From dcb5f0fbf44351d3d5ef2175b66c35649609deb8 Mon Sep 17 00:00:00 2001
+From 0af088bb8082f875a17f43d079ce2118ced9b8f7 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:08 -0400
 Subject: [RFC PATCH 049/116] btrfs: stripe_meta: back the global reserve with
index be37b06627b15f88370988a8d6e492042d1e7ae6..00edf944f477aec87a682bd9e6626e30a80f1306 100644 (file)
@@ -1,4 +1,4 @@
-From 04bca28a857b67ce23c2b2a8805cb17eca9bbd4b Mon Sep 17 00:00:00 2001
+From a2d61f5c5b26a8f88bc1f79eb1236e290937624c 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 050/116] btrfs: stripe_meta: hold back whole stripes so
@@ -69,7 +69,7 @@ Assisted-by: Claude:claude-opus-5-5
  6 files changed, 125 insertions(+), 10 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 4369501c81eec..849b91807485f 100644
+index ef7f53471de4a..3225bc71af203 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2006,8 +2006,21 @@ static void stripe_alloc_sweep_groups(struct btrfs_fs_info *fs_info, bool arm)
@@ -157,7 +157,7 @@ index 4369501c81eec..849b91807485f 100644
                /*
                 * The rescan usually lowers the counter (mid-transaction
                 * incremental adds overcount conservatively); admission
-@@ -3944,7 +3997,7 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -3946,7 +3999,7 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                if (READ_ONCE(cache->stripe_unusable_ready))
                        trapped = min(READ_ONCE(cache->stripe_unusable), num_bytes);
                if (btrfs_can_overcommit(sinfo, num_bytes - trapped,
@@ -229,7 +229,7 @@ index 03b9834b57223..f02d04eacf5f0 100644
  out_put_rc:
        put_reloc_control(rc);
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 3d74bdea16cac..1afec444a0f32 100644
+index 1e9946369c184..df50d0c7e1fd2 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
 @@ -187,6 +187,8 @@ struct reserve_ticket {
@@ -241,7 +241,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
        struct list_head list;
        wait_queue_head_t wait;
        spinlock_t lock;
-@@ -614,7 +616,7 @@ static inline bool can_overcommit(const struct btrfs_space_info *space_info,
+@@ -612,7 +614,7 @@ static inline bool can_overcommit(const struct btrfs_space_info *space_info,
  }
  
  bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
@@ -250,7 +250,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
  {
        u64 used;
  
-@@ -623,6 +625,13 @@ bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
+@@ -621,6 +623,13 @@ bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
                return false;
  
        used = btrfs_space_info_used(space_info, true);
@@ -264,7 +264,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
  
        return check_can_overcommit(space_info, used, bytes, flush);
  }
-@@ -759,14 +768,22 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
+@@ -757,14 +766,22 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
        while (!list_empty(head)) {
                struct reserve_ticket *ticket;
                u64 used_after;
@@ -290,7 +290,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
                        btrfs_space_info_update_bytes_may_use(space_info, ticket->bytes);
                        remove_ticket(space_info, ticket, 0);
                        space_info->tickets_id++;
-@@ -815,13 +832,13 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
+@@ -813,13 +830,13 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
                   (s64)(info->total_bytes - btrfs_space_info_used(info, true)),
                   info->full ? "" : "not ");
        btrfs_info(fs_info,
@@ -306,7 +306,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
  }
  
  void btrfs_dump_space_info(struct btrfs_space_info *info, u64 bytes,
-@@ -1964,6 +1981,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -1962,6 +1979,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
        u64 used;
        int ret = -ENOSPC;
        bool pending_tickets;
@@ -315,7 +315,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
  
        ASSERT(orig_bytes, "orig_bytes=%llu", orig_bytes);
        /*
-@@ -2003,6 +2022,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2001,6 +2020,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
         * Carry on if we have enough space (short-circuit) OR call
         * can_overcommit() to ensure we can overcommit to continue.
         */
@@ -324,7 +324,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
        if (!pending_tickets &&
            ((used + orig_bytes <= space_info->total_bytes) ||
             can_overcommit(space_info, used, orig_bytes, flush)) &&
-@@ -2039,6 +2060,7 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2037,6 +2058,7 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
                init_waitqueue_head(&ticket.wait);
                spin_lock_init(&ticket.lock);
                ticket.steal = can_steal(flush);
@@ -333,7 +333,7 @@ index 3d74bdea16cac..1afec444a0f32 100644
                        start_ns = ktime_get_ns();
  
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 702222bb54ae4..e9a984a7af34e 100644
+index 5abb8fd072b3c..6a3711ae00cf3 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -192,7 +192,25 @@ struct btrfs_space_info {
@@ -371,7 +371,7 @@ index 702222bb54ae4..e9a984a7af34e 100644
                (may_use_included ? s_info->bytes_may_use : 0);
  }
  
-@@ -359,7 +378,7 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
+@@ -358,7 +377,7 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
                                 enum btrfs_reserve_flush_enum flush);
  void btrfs_try_granting_tickets(struct btrfs_space_info *space_info);
  bool btrfs_can_overcommit(const struct btrfs_space_info *space_info, u64 bytes,
@@ -381,7 +381,7 @@ index 702222bb54ae4..e9a984a7af34e 100644
  static inline void btrfs_space_info_free_bytes_may_use(
                                struct btrfs_space_info *space_info,
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 6eb2d5362f204..ba2392dcb4efa 100644
+index 0369a7c04c54f..cb844168fde51 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -821,6 +821,7 @@ SPACE_INFO_ATTR(bytes_stripe_unusable);
index 8a5decf0d4abefd8ae9f003edb532974b384839b..6831605a42f3d547ccbd0bcfac9c8e66793a9585 100644 (file)
@@ -1,4 +1,4 @@
-From 7cff178b3a5b7d534853720b13afc9fb1021acbd Mon Sep 17 00:00:00 2001
+From a345272f69ec86151bdbbf98cbcd474333c50386 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:13 -0400
 Subject: [RFC PATCH 051/116] btrfs: stripe_meta: do not steal from the global
@@ -40,10 +40,10 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 41 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index a75fb22137e39..5e172348ee019 100644
+index 37d87114f69e4..8986bab67590e 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -3125,17 +3125,22 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
+@@ -3145,17 +3145,22 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
        if (ret)
                return ret;
  
@@ -88,7 +88,7 @@ index ff46ee994eb61..bb0ac9ce4ccba 100644
        /* data_alloc_cluster is only used in ssd_spread mode */
        struct btrfs_free_cluster data_alloc_cluster;
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 1afec444a0f32..a35fa570e3a7d 100644
+index df50d0c7e1fd2..ed883c7b398cb 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
 @@ -189,6 +189,8 @@ struct reserve_ticket {
@@ -100,7 +100,7 @@ index 1afec444a0f32..a35fa570e3a7d 100644
        struct list_head list;
        wait_queue_head_t wait;
        spinlock_t lock;
-@@ -1288,6 +1290,28 @@ static bool steal_from_global_rsv(struct btrfs_space_info *space_info,
+@@ -1286,6 +1288,28 @@ static bool steal_from_global_rsv(struct btrfs_space_info *space_info,
        if (global_rsv->space_info != space_info)
                return false;
  
@@ -129,7 +129,7 @@ index 1afec444a0f32..a35fa570e3a7d 100644
        spin_lock(&global_rsv->lock);
        min_bytes = mult_perc(global_rsv->size, 10);
        if (global_rsv->reserved < min_bytes + ticket->bytes) {
-@@ -2061,6 +2085,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2059,6 +2083,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
                spin_lock_init(&ticket.lock);
                ticket.steal = can_steal(flush);
                ticket.reloc = reloc;
index efdedab0dcc5193b14aef6d12cac11a15e422e65..3d129917c7ea53afa7c9ef294b531ce0e699ffa5 100644 (file)
@@ -1,4 +1,4 @@
-From dafd9cfe4b2fdba8bea8b5293b466176a027531b Mon Sep 17 00:00:00 2001
+From e14fa735950e55e7e840b6e6a5c60af1bf5525e1 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:14 -0400
 Subject: [RFC PATCH 052/116] btrfs: stripe_meta: let the transaction
@@ -30,10 +30,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 13 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index a35fa570e3a7d..361c4d40e90fd 100644
+index ed883c7b398cb..41ade2b7e89a1 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -2005,8 +2005,20 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2003,8 +2003,20 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
        u64 used;
        int ret = -ENOSPC;
        bool pending_tickets;
index b829fa4c068a414949f6df88bbf4762e1fbd72fe..5cc85a1fa14946b7ad79b916a02286d12dafd96b 100644 (file)
@@ -1,4 +1,4 @@
-From 4186b21d2136070c7e62e6ac601cb081752329c1 Mon Sep 17 00:00:00 2001
+From 046e0e80fdb7b805226ce232e0302807a1d4c4af Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:15 -0400
 Subject: [RFC PATCH 053/116] btrfs: stripe_meta: let a group go read-only for
@@ -23,10 +23,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 8 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 849b91807485f..b8244895a213f 100644
+index 3225bc71af203..6032c4dc6f7fe 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -3996,8 +3996,15 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -3998,8 +3998,15 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
  
                if (READ_ONCE(cache->stripe_unusable_ready))
                        trapped = min(READ_ONCE(cache->stripe_unusable), num_bytes);
index 21dd77f6a607a171de5a68422677ac1413a953ef..c7d9ee48ebc38888f9f4319d8b5560d54c62c22f 100644 (file)
@@ -1,4 +1,4 @@
-From a672e3917d47044aece23d6b98ff97c10ef29f16 Mon Sep 17 00:00:00 2001
+From b3cc985b256acbf78501db4bf618b11f962e5663 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 054/116] btrfs: stripe_alloc: show per-group trapped bytes
@@ -11,10 +11,10 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 361c4d40e90fd..5f8da071417a0 100644
+index 41ade2b7e89a1..07e5aacc07c58 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -866,11 +866,15 @@ void btrfs_dump_space_info(struct btrfs_space_info *info, u64 bytes,
+@@ -864,11 +864,15 @@ void btrfs_dump_space_info(struct btrfs_space_info *info, u64 bytes,
  
                spin_lock(&cache->lock);
                avail = btrfs_block_group_available_space(cache);
index c963f9abb9f78709ffee945a3bb8640f36539926..5e8f441074e7ad95bf1e992c0d00086f6df3d73c 100644 (file)
@@ -1,4 +1,4 @@
-From 7310972a63b8be7d9d744724270bf91f6e6f099b Mon Sep 17 00:00:00 2001
+From b6509d0f3eb7ec6b053b7e4881f0beeac41b6ab2 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:17 -0400
 Subject: [RFC PATCH 055/116] btrfs: stripe_alloc: tell a dead tree block from
@@ -46,10 +46,10 @@ index bb0ac9ce4ccba..a483722cfacaa 100644
                atomic64_t congestion_short;
        } stripe_park_stats;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index d95211d124ef4..e9ccf168693a5 100644
+index d1e961ce4e490..7a825b3507033 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3023,6 +3023,66 @@ static bool rmw_peek_eb_generation(struct btrfs_raid_bio *rbio, u32 i,
+@@ -3040,6 +3040,66 @@ static bool rmw_peek_eb_generation(struct btrfs_raid_bio *rbio, u32 i,
        return found_bytenr == logical && !bad_fsid;
  }
  
@@ -116,7 +116,7 @@ index d95211d124ef4..e9ccf168693a5 100644
  /*
   * Decide whether an uncovered read-modify-write is a write hole or only a
   * cost, by looking at what is actually in the stripe.
-@@ -3099,10 +3159,36 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3116,10 +3176,36 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
                        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw_cur);
                        continue;
                }
@@ -138,7 +138,7 @@ index d95211d124ef4..e9ccf168693a5 100644
 +                      const int stripe_nr = i / rbio->stripe_nsectors;
 +                      const int sectornr = i % rbio->stripe_nsectors;
 +                      const u64 logical = rbio->bioc->full_stripe_logical +
-+                              (u64)stripe_nr * BTRFS_STRIPE_LEN +
++                              (u64)stripe_nr * rbio->bioc->stripe_len +
 +                              (u64)sectornr * fs_info->sectorsize;
 +                      u64 refs;
 +                      u64 egen;
@@ -158,7 +158,7 @@ index d95211d124ef4..e9ccf168693a5 100644
  }
  
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index ba2392dcb4efa..609c6b458280f 100644
+index cb844168fde51..1481ed2cf1571 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1140,6 +1140,7 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 3cfb0eecf06e3180934475c9caa1290e3031e677..95abae6aa1d34556db3d5300edb22094d3a6b6ec 100644 (file)
@@ -1,4 +1,4 @@
-From 3ba7acf2e3c5e7ab07529aff1b016b49f0a8de40 Mon Sep 17 00:00:00 2001
+From 868e49a6d6d0474e799e3fb02bc41ab131b379d9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:18 -0400
 Subject: [RFC PATCH 056/116] btrfs: stripe_alloc: do not read an inline
@@ -34,7 +34,7 @@ Assisted-by: Claude:claude-fable-5
  1 file changed, 15 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index b8244895a213f..f69fc42484d97 100644
+index 6032c4dc6f7fe..09a6f47937882 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1437,6 +1437,21 @@ static bool stripe_extents_owned_by(struct btrfs_fs_info *fs_info,
index 7859c06c02963c5c7de1def9ac35493e5a823366..01c07f8f1444010817d70e7411a1c86bdec23ea9 100644 (file)
@@ -1,4 +1,4 @@
-From 72db9e2da64153d2e8f18458e596483dab5902e5 Mon Sep 17 00:00:00 2001
+From 46a0df1d2260a3afec5094779745bc6878f564ce 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 057/116] btrfs: stripe_alloc: count whole stripes stranded
@@ -54,7 +54,7 @@ Assisted-by: Claude:claude-fable-5
  6 files changed, 87 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index f69fc42484d97..ac086a889631d 100644
+index 09a6f47937882..94c5bbe457907 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -686,6 +686,14 @@ static void free_open_stripe_run(struct btrfs_block_group *bg,
@@ -174,10 +174,10 @@ index 0f8e4c165d54c..8e9e3b31f26e6 100644
                                   u64 run_start, u64 *run_len);
  /*
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 0c23fa3429dbe..6ec021f23ed1a 100644
+index c005065b2b532..5e8362205e3b9 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2091,6 +2091,13 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
+@@ -2101,6 +2101,13 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
               "stripe_unusable_scan counted=%llu != free_space=%llu",
               counted, ctl->free_space);
  
@@ -191,7 +191,7 @@ index 0c23fa3429dbe..6ec021f23ed1a 100644
        for (i = 0; i < nstripes; i++)
                if (freep[i] && freep[i] < fsl)
                        trapped += freep[i];
-@@ -2206,7 +2213,13 @@ bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg)
+@@ -2216,7 +2223,13 @@ bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg)
        struct btrfs_space_info *sinfo = bg->space_info;
        const int thresh = READ_ONCE(sinfo->bg_reclaim_threshold);
        const u64 used = READ_ONCE(bg->used);
@@ -207,10 +207,10 @@ index 0c23fa3429dbe..6ec021f23ed1a 100644
        u64 promised;
  
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 5f8da071417a0..39e5165923dc0 100644
+index 07e5aacc07c58..0c5757218960f 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -834,11 +834,12 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
+@@ -832,11 +832,12 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
                   (s64)(info->total_bytes - btrfs_space_info_used(info, true)),
                   info->full ? "" : "not ");
        btrfs_info(fs_info,
@@ -226,7 +226,7 @@ index 5f8da071417a0..39e5165923dc0 100644
                info->bytes_stripe_margin, info->bytes_stripe_reserve);
  }
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index e9a984a7af34e..34d8491e2605f 100644
+index 6a3711ae00cf3..b4d7e2ad9daf8 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -166,6 +166,11 @@ struct btrfs_space_info {
@@ -242,7 +242,7 @@ index e9a984a7af34e..34d8491e2605f 100644
                                           in the group dedicated to data
                                           relocation (fs_info->data_reloc_bg):
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 609c6b458280f..d583ce8dee057 100644
+index 1481ed2cf1571..391eeabd029f8 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -818,6 +818,7 @@ SPACE_INFO_ATTR(bytes_may_use);
index 8c4911166a2c9b599a1e07c58d4520aad03496ad..3c6118c61184485d52e2e2e3dfe53827bcc07d18 100644 (file)
@@ -1,4 +1,4 @@
-From 8d46931722459e4cace54fe7215127319d21744a Mon Sep 17 00:00:00 2001
+From 2c0f474a19cfc3a7cd92e3e19a78097cf20ea3ff 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 058/116] btrfs: stripe_alloc: give nocow extents a private
@@ -40,7 +40,7 @@ Assisted-by: Claude:claude-fable-5
  2 files changed, 38 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index ac086a889631d..1a388d5fa1974 100644
+index 94c5bbe457907..c13d6e4d4f8ae 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -507,6 +507,7 @@ struct btrfs_open_stripe_run {
index ca2046d8a865681340f2d275a3ea8137915ce643..d9676a141c763703d2a90978ac3f6e418fa6b90b 100644 (file)
@@ -1,4 +1,4 @@
-From 3e051c111fc267a5cc6ba4d9697008d527787ebe Mon Sep 17 00:00:00 2001
+From 6a7339d6329e4cb1899e0ef9d379aa6e58bb63f0 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 059/116] btrfs: stripe_alloc: count nocow run lifecycles
@@ -20,7 +20,7 @@ Assisted-by: Claude:claude-fable-5
  3 files changed, 43 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 1a388d5fa1974..d63568da84101 100644
+index c13d6e4d4f8ae..5edba31e090d3 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -693,8 +693,10 @@ static void free_open_stripe_run(struct btrfs_block_group *bg,
@@ -92,7 +92,7 @@ index a483722cfacaa..bce5cc5b09740 100644
        u32 stripe_rmw_opt;
        u32 stripe_rmw_prop;
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index d583ce8dee057..4a613361d0958 100644
+index 391eeabd029f8..786a6dbb02fe0 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1170,6 +1170,23 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index c69d2a045a3db616a21299ae9f7d0e83635c399c..dfde2f6b950e454993eb6447aa13f060b7802e59 100644 (file)
@@ -1,4 +1,4 @@
-From e6d0215595c784679b9190d820a1ece1741b7bc0 Mon Sep 17 00:00:00 2001
+From 452563014c9870e31709cf8dd8a271d8b0fdb26f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:21 -0400
 Subject: [RFC PATCH 060/116] btrfs: stripe_alloc: hold a stripe of margin
@@ -155,10 +155,10 @@ index 1cd9cc6f34b87..0a6e59c11b1f1 100644
                goto out_unlock;
  
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 7b5e55c926e17..512d4c579b4e3 100644
+index 98d376ce99eb8..d5732d8938f14 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
-@@ -9945,6 +9945,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -9943,6 +9943,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;
@@ -166,7 +166,7 @@ index 7b5e55c926e17..512d4c579b4e3 100644
        struct extent_map *em;
        ssize_t ret;
  
-@@ -10086,7 +10087,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10084,7 +10085,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.
         */
@@ -176,7 +176,7 @@ index 7b5e55c926e17..512d4c579b4e3 100644
        if (ret)
                goto out_unlock;
        ret = btrfs_qgroup_reserve_data(inode, &data_reserved, start, num_bytes);
-@@ -10115,6 +10117,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10113,6 +10115,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,
                                   false);
@@ -185,7 +185,7 @@ index 7b5e55c926e17..512d4c579b4e3 100644
        if (ret)
                goto out_delalloc_release;
        extent_reserved = true;
-@@ -10163,6 +10167,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
+@@ -10161,6 +10165,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:
@@ -226,7 +226,7 @@ index f02d04eacf5f0..ed44c1cd99f6a 100644
        if (cur_offset < prealloc_end)
                btrfs_free_reserved_data_space_noquota(inode,
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 39e5165923dc0..e9a6d4df82c7c 100644
+index 0c5757218960f..a672d1b304cfb 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
 @@ -191,6 +191,13 @@ struct reserve_ticket {
@@ -243,7 +243,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
        struct list_head list;
        wait_queue_head_t wait;
        spinlock_t lock;
-@@ -487,6 +494,52 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
+@@ -485,6 +492,52 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
        spin_unlock(&sinfo->lock);
  }
  
@@ -296,7 +296,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
  
  struct btrfs_space_info *btrfs_find_space_info(const struct btrfs_fs_info *info,
                                               u64 flags)
-@@ -787,6 +840,8 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
+@@ -785,6 +838,8 @@ void btrfs_try_granting_tickets(struct btrfs_space_info *space_info)
                     can_overcommit(space_info, tused, ticket->bytes, flush)) &&
                    stripe_claimable_admit(space_info, ticket->bytes, ticket->reloc)) {
                        btrfs_space_info_update_bytes_may_use(space_info, ticket->bytes);
@@ -305,7 +305,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
                        remove_ticket(space_info, ticket, 0);
                        space_info->tickets_id++;
                        used = used_after;
-@@ -2000,8 +2055,8 @@ static inline bool can_ticket(enum btrfs_reserve_flush_enum flush)
+@@ -1998,8 +2053,8 @@ static inline bool can_ticket(enum btrfs_reserve_flush_enum flush)
   * regain reservations will be made and this will fail if there is not enough
   * space already.
   */
@@ -316,7 +316,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
  {
        struct btrfs_fs_info *fs_info = space_info->fs_info;
        struct work_struct *async_work;
-@@ -2071,6 +2126,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2069,6 +2124,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
            stripe_claimable_admit(space_info, orig_bytes,
                                   flush == BTRFS_RESERVE_FLUSH_DATA_RELOC)) {
                btrfs_space_info_update_bytes_may_use(space_info, orig_bytes);
@@ -325,7 +325,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
                ret = 0;
        }
  
-@@ -2104,6 +2161,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2102,6 +2159,8 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
                ticket.reloc = reloc;
                ticket.mount_cleanup =
                        READ_ONCE(fs_info->mount_cleanup_task) == current;
@@ -334,7 +334,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
                if (trace_btrfs_reserve_ticket_enabled())
                        start_ns = ktime_get_ns();
  
-@@ -2151,7 +2210,10 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
+@@ -2149,7 +2208,10 @@ static int reserve_bytes(struct btrfs_space_info *space_info, u64 orig_bytes,
        if (!ret || !can_ticket(flush))
                return ret;
  
@@ -346,7 +346,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
  }
  
  /*
-@@ -2174,7 +2236,7 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
+@@ -2172,7 +2234,7 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
  {
        int ret;
  
@@ -355,7 +355,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
        if (ret == -ENOSPC) {
                struct btrfs_fs_info *fs_info = space_info->fs_info;
  
-@@ -2199,6 +2261,18 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
+@@ -2197,6 +2259,18 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
   */
  int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
                             enum btrfs_reserve_flush_enum flush)
@@ -374,7 +374,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
  {
        struct btrfs_fs_info *fs_info = space_info->fs_info;
        int ret;
-@@ -2213,7 +2287,9 @@ int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
+@@ -2211,7 +2285,9 @@ int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
               "current->journal_info=0x%lx flush=%d",
               (unsigned long)current->journal_info, flush);
  
@@ -386,7 +386,7 @@ index 39e5165923dc0..e9a6d4df82c7c 100644
                trace_btrfs_space_reservation(fs_info, "space_info:enospc",
                                              space_info->flags, bytes, 1);
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 34d8491e2605f..9031719314ec2 100644
+index b4d7e2ad9daf8..61f942e0141d0 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -369,6 +369,9 @@ struct btrfs_inode;
@@ -396,9 +396,9 @@ index 34d8491e2605f..9031719314ec2 100644
 +int btrfs_reserve_data_bytes_held(struct btrfs_space_info *space_info, u64 bytes,
 +                                enum btrfs_reserve_flush_enum flush, u64 *held);
 +void btrfs_stripe_prealloc_release(struct btrfs_fs_info *fs_info, u64 held);
- void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
-                               struct btrfs_block_group *block_group);
+ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group);
  void btrfs_update_space_info_chunk_size(struct btrfs_space_info *space_info,
+                                       u64 chunk_size);
 -- 
 2.47.3
 
index a8c7ea4a76fa666674705798270083fcad208325..3c42cd925563385247a225e2d9bae122c40ae877 100644 (file)
@@ -1,4 +1,4 @@
-From 9c3f5e2a5a7c2e6b251c0014c132b7341065a71f Mon Sep 17 00:00:00 2001
+From 8896655ef1341641de95f80d6ae08632f18e25df Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:22 -0400
 Subject: [RFC PATCH 061/116] btrfs: stripe_meta: carry raid56 metadata groups
@@ -53,7 +53,7 @@ Assisted-by: Claude:claude-fable-5-1
  1 file changed, 37 insertions(+), 18 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index d63568da84101..f880280200672 100644
+index 5edba31e090d3..aa1eee2a61ca5 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2080,8 +2080,9 @@ int btrfs_stripe_alloc_check_support(struct btrfs_fs_info *fs_info)
index 5cfd9e6b20e1f7bad5e58b3c22d41aff792f3231..b7d4e7f2476ac8083f007b4960a13a05feb80517 100644 (file)
@@ -1,4 +1,4 @@
-From 6269c79f5f2d9e468f4bb02952cb0cef6dae89d4 Mon Sep 17 00:00:00 2001
+From 0fd02d55577b85d92fb6429ed2065691fa3ce01e Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:23 -0400
 Subject: [RFC PATCH 062/116] btrfs: stripe_alloc: return a group's allocation
@@ -42,10 +42,10 @@ Assisted-by: Claude:claude-fable-5-1
  1 file changed, 27 insertions(+)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 6ec021f23ed1a..9809c4106f95f 100644
+index 5e8362205e3b9..d01d480609b6a 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2104,6 +2104,31 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
+@@ -2114,6 +2114,31 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
        return trapped;
  }
  
@@ -77,7 +77,7 @@ index 6ec021f23ed1a..9809c4106f95f 100644
  /*
   * Compute a stripe_alloc block group's initial trapped free space once its
   * free space cache is loaded, and enable incremental accounting from here on.
-@@ -2126,6 +2151,7 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2136,6 +2161,7 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
        if (!freep)
                return;
  
@@ -85,7 +85,7 @@ index 6ec021f23ed1a..9809c4106f95f 100644
        spin_lock(&ctl->tree_lock);
        if (bg->stripe_unusable_ready) {
                spin_unlock(&ctl->tree_lock);
-@@ -2259,6 +2285,7 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2269,6 +2295,7 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
        if (!freep)
                return;
  
index 610c44fc2210f2f4ec8dda69e519ad9a6a86a497..1a9222140e4b4a35b17cdb0a097e3b700279e8d8 100644 (file)
@@ -1,4 +1,4 @@
-From ec648ceaf7412f288964cd2f969132a3c886478a Mon Sep 17 00:00:00 2001
+From 3fe10c2fdcd6ba4afb17117499cf4403d11d132f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 19 Sep 2026 13:18:24 -0400
 Subject: [RFC PATCH 063/116] btrfs: stripe_alloc: release open stripe runs
@@ -41,7 +41,7 @@ Assisted-by: Claude:claude-fable-5-1
  3 files changed, 47 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index f880280200672..5e5381195d1e3 100644
+index aa1eee2a61ca5..98f78ca7897fc 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2551,6 +2551,50 @@ void btrfs_retire_block_group_stripes(struct btrfs_block_group *bg)
@@ -108,10 +108,10 @@ index 8e9e3b31f26e6..6a09ecc13f0c8 100644
  bool btrfs_stripe_in_open_run(struct btrfs_fs_info *fs_info, u64 logical);
  bool btrfs_defer_stripe_meta_write(struct btrfs_fs_info *fs_info,
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 5e172348ee019..b40f2a19abf3e 100644
+index 8986bab67590e..8c5070a598750 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -3836,6 +3836,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
+@@ -3856,6 +3856,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
  
  fail_sb_buffer:
        btrfs_stop_all_workers(fs_info);
@@ -119,7 +119,7 @@ index 5e172348ee019..b40f2a19abf3e 100644
        btrfs_free_block_groups(fs_info);
  fail_alloc:
        btrfs_mapping_tree_free(fs_info);
-@@ -4607,6 +4608,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
+@@ -4627,6 +4628,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.
         */
index 29e048855fa402842b2b22b9db8e3257a571efa6..dc35c50075a0e3b4251094eb74d9a6a11540b90d 100644 (file)
@@ -1,4 +1,4 @@
-From d7611f8eab54eddec75365914a085acbfe30808f Mon Sep 17 00:00:00 2001
+From 4b5986416d18781e2714aa6fda831007af8f2d95 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 064/116] btrfs: stripe_alloc: say at mount whether the
@@ -33,7 +33,7 @@ Assisted-by: Claude:claude-fable-5-1
  2 files changed, 28 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 5e5381195d1e3..8085c9998be90 100644
+index 98f78ca7897fc..9e4369b8b99f7 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2221,10 +2221,16 @@ int btrfs_enable_stripe_alloc(struct btrfs_fs_info *fs_info)
@@ -57,7 +57,7 @@ index 5e5381195d1e3..8085c9998be90 100644
  }
  
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index 4416fd622019d..d329181b98e9e 100644
+index a64d9cd48d12e..903bce51fb1fd 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
 @@ -943,6 +943,23 @@ static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objec
index 10133d9af68aa4766d08dc88c44a88135d2d18a1..570f0736884106a2def71e62f816ddbc494632c0 100644 (file)
@@ -1,4 +1,4 @@
-From 5f54dd568678edd647946e21d412f18c0aa344a4 Mon Sep 17 00:00:00 2001
+From cbab48fd82cc6f288ad264a5afcad068e2343b03 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 065/116] btrfs: stripe_meta: cover raid56 system chunks
@@ -44,7 +44,7 @@ Assisted-by: Claude:claude-fable-5-1
  3 files changed, 52 insertions(+), 39 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 8085c9998be90..28e64f7009e88 100644
+index 9e4369b8b99f7..60fcfde839ba1 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2092,7 +2092,8 @@ static void stripe_alloc_sweep_groups(struct btrfs_fs_info *fs_info, bool arm)
@@ -119,7 +119,7 @@ index 8085c9998be90..28e64f7009e88 100644
                        continue;
                down_read(&sinfo->groups_sem);
                for (raid = 0; raid < BTRFS_NR_RAID_TYPES; raid++) {
-@@ -4947,7 +4922,8 @@ static void btrfs_stripe_reclaim_tick(struct btrfs_fs_info *fs_info)
+@@ -4949,7 +4924,8 @@ static void btrfs_stripe_reclaim_tick(struct btrfs_fs_info *fs_info)
                int raid;
  
                if (!(sinfo->flags & (BTRFS_BLOCK_GROUP_DATA |
@@ -129,7 +129,7 @@ index 8085c9998be90..28e64f7009e88 100644
                        continue;
                if (READ_ONCE(sinfo->bg_reclaim_threshold) <= 0)
                        continue;
-@@ -7006,6 +6982,7 @@ static void reserve_chunk_space(struct btrfs_trans_handle *trans,
+@@ -7009,6 +6985,7 @@ static void reserve_chunk_space(struct btrfs_trans_handle *trans,
  {
        struct btrfs_fs_info *fs_info = trans->fs_info;
        struct btrfs_space_info *info;
@@ -137,7 +137,7 @@ index 8085c9998be90..28e64f7009e88 100644
        u64 left;
        bool want_system_chunk, need_system_chunk;
        int ret = 0;
-@@ -7020,12 +6997,41 @@ static void reserve_chunk_space(struct btrfs_trans_handle *trans,
+@@ -7023,12 +7000,41 @@ static void reserve_chunk_space(struct btrfs_trans_handle *trans,
        spin_lock(&info->lock);
        left = info->total_bytes - btrfs_space_info_used(info, true);
        want_system_chunk = info->total_bytes < system_space_target(info);
@@ -207,10 +207,10 @@ index cb5c9c728e8d0..e9d83591baf30 100644
               (bg->flags & BTRFS_BLOCK_GROUP_RAID56_MASK);
  }
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index e9ccf168693a5..13031c46b1f57 100644
+index 7a825b3507033..abfadfec54f5a 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3231,9 +3231,9 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3248,9 +3248,9 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
         * A raid56 metadata group under stripe_meta is covered: its
         * read-modify-writes are partial writes inside one transaction's
         * run, counted by the audit as meta_rmw_cur, and the audit warns
index 0c7b76480455f78ab84513e26d40de795ec458f4..3c990746be3f5b33fc249f295b046bca95ad019b 100644 (file)
@@ -1,4 +1,4 @@
-From b57d7b9fd543eb50dcd6f234944b65cc5cc12eed Mon Sep 17 00:00:00 2001
+From 6c7a6f089b7eacf99d6026721884742426ce0ff3 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 23 Sep 2026 01:47:12 -0400
 Subject: [RFC PATCH 066/116] btrfs: stripe_alloc: close dead nocow stripe runs
@@ -82,7 +82,7 @@ Assisted-by: Claude:claude-opus-5
  5 files changed, 92 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 28e64f7009e88..5c20aadf6985b 100644
+index 60fcfde839ba1..4b821c9af73e9 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -664,6 +664,33 @@ static void run_live_set(struct btrfs_open_stripe_run *run, u64 start, u64 len,
@@ -212,10 +212,10 @@ index 6a09ecc13f0c8..657b37c7f7fe5 100644
                                   u64 run_start, u64 *run_len);
  /*
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 9809c4106f95f..0d5bb057d4f33 100644
+index d01d480609b6a..2c3e32aea935c 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1616,6 +1616,7 @@ int btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1626,6 +1626,7 @@ int btrfs_add_free_space(struct btrfs_block_group *block_group,
  
        stripe_unusable_mark_dirty(block_group);
        stripe_unusable_account_add(block_group, bytenr, size);
@@ -237,7 +237,7 @@ index bce5cc5b09740..50235cf99e1e9 100644
        /* BTRFS_STRIPE_RMW_* masks; see btrfs_stripe_allow_rmw(). */
        u32 stripe_rmw_opt;
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 4a613361d0958..69568759eaaa1 100644
+index 786a6dbb02fe0..f367a0fc707a9 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1179,11 +1179,13 @@ static ssize_t btrfs_stripe_run_stats_show(struct kobject *kobj,
index 8526053eabd36e66e4e1bd56ae37cced5d099d1b..f8b5e4813e1a3a7fb5f9f4fd1aa46affa5230030 100644 (file)
@@ -1,4 +1,4 @@
-From be6877e4568053ef1d4b08e76f14ff5d7514345d Mon Sep 17 00:00:00 2001
+From fa5cdd7e9ffe41c2e15e670e59a8020924f641d5 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 23 Sep 2026 15:30:45 -0400
 Subject: [RFC PATCH 067/116] btrfs: stripe_alloc: do not round a full stripe
@@ -48,7 +48,7 @@ Assisted-by: Claude:claude-opus-5
  1 file changed, 25 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 5c20aadf6985b..d6fc1f165ae5c 100644
+index 4b821c9af73e9..c893d0f299f72 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -584,6 +584,27 @@ static bool open_stripe_run_drained(const struct btrfs_open_stripe_run *run)
index c8eccd9cd134b838737f8ddb0805ede0080b23fe..453baf1b7262b97ed4c256b57c5509c63381f6f9 100644 (file)
@@ -1,4 +1,4 @@
-From 24b8a9adadc5b04e224ff065efde5cde14e3e2a3 Mon Sep 17 00:00:00 2001
+From 378ae1181fb6c49489157587062078b9f8ca5769 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 24 Sep 2026 02:21:12 -0400
 Subject: [RFC PATCH 068/116] btrfs: stripe_alloc: do not wait for stripe runs
@@ -38,7 +38,7 @@ Assisted-by: Claude:claude-fable-5-1
  3 files changed, 42 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index d6fc1f165ae5c..867959fc1b484 100644
+index c893d0f299f72..9fc41fe73cb06 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2610,14 +2610,45 @@ static bool bg_open_stripes_settled(struct btrfs_block_group *bg, u64 seq)
@@ -89,7 +89,7 @@ index d6fc1f165ae5c..867959fc1b484 100644
  }
  
  /*
-@@ -4931,6 +4962,11 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
+@@ -4933,6 +4964,11 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
        LIST_HEAD(retry_list);
        int reclaimed = 0;
  
index 337854f1f544aa0ea8f2783d8db27f656639327c..6a07ba1dab7711736ea67c96d71e0c716cb71f0d 100644 (file)
@@ -1,4 +1,4 @@
-From 22e42d6d532311a8e03edbb8b36a73668ad6e173 Mon Sep 17 00:00:00 2001
+From 40ab3d57819b5a60d8a52de1c2eb33932ddf8f4e Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 24 Sep 2026 07:55:39 -0400
 Subject: [RFC PATCH 069/116] btrfs: stripe_alloc: end the commit-time and log
@@ -34,7 +34,7 @@ Assisted-by: Claude:claude-fable-5-1
  1 file changed, 14 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 867959fc1b484..725c4af39f21e 100644
+index 9fc41fe73cb06..289ec278ac4f8 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2131,7 +2131,8 @@ void btrfs_log_settle_stripes(struct btrfs_inode *inode, u64 file_start,
index c65be9eb953ead73797f62acf8f5ba265b59a760..a92a1a04eeb03710d8525a37f75b3bff0187ff28 100644 (file)
@@ -1,4 +1,4 @@
-From 9997aec01d002fa95fc96f0372fdab6f30f74882 Mon Sep 17 00:00:00 2001
+From bda94d6e75730c4a28cbfcf5004ac9c16c644626 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 070/116] btrfs: stripe_alloc: compact mostly live groups
@@ -74,10 +74,10 @@ Assisted-by: Claude:claude-opus-5-5
  10 files changed, 511 insertions(+), 42 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 725c4af39f21e..3718d69e95955 100644
+index 289ec278ac4f8..e39f266016306 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -4800,6 +4800,7 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -4802,6 +4802,7 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        u64 reserved;
        u64 old_total;
        int ret = 0;
@@ -85,7 +85,7 @@ index 725c4af39f21e..3718d69e95955 100644
  
        /*
         * A stripe_alloc / stripe_meta group's live extents can only move into
-@@ -4813,9 +4814,13 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -4815,9 +4816,13 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
         */
        if (btrfs_is_stripe_alloc_bg(bg) || btrfs_is_stripe_meta_bg(bg)) {
                u64 elsewhere = READ_ONCE(space_info->bytes_stripe_claimable);
@@ -100,7 +100,7 @@ index 725c4af39f21e..3718d69e95955 100644
                        struct btrfs_trans_handle *trans;
  
                        trans = btrfs_join_transaction(fs_info->tree_root);
-@@ -4887,10 +4892,19 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -4889,10 +4894,19 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
         * the first place.
         */
        if (!should_reclaim_block_group(bg, bg->length)) {
@@ -124,7 +124,7 @@ index 725c4af39f21e..3718d69e95955 100644
        }
  
        spin_unlock(&bg->lock);
-@@ -4938,7 +4952,23 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -4940,7 +4954,23 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        spin_unlock(&bg->lock);
  
        trace_btrfs_reclaim_block_group(bg);
@@ -150,10 +150,10 @@ index 725c4af39f21e..3718d69e95955 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 b40f2a19abf3e..a7841e98811be 100644
+index 8c5070a598750..3d3a51cd963d0 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -2786,6 +2786,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
+@@ -2806,6 +2806,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
        INIT_LIST_HEAD(&fs_info->open_stripe_bgs);
        INIT_WORK(&fs_info->stripe_alloc_enable_work, btrfs_stripe_alloc_enable_work);
        fs_info->stripe_park_timeout_ms = BTRFS_RBIO_PARK_TIMEOUT_MS;
@@ -162,10 +162,10 @@ index b40f2a19abf3e..a7841e98811be 100644
        spin_lock_init(&fs_info->open_stripe_lock);
        spin_lock_init(&fs_info->delalloc_root_lock);
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 0d5bb057d4f33..b9768adf48c5d 100644
+index 2c3e32aea935c..f0c3187554deb 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2038,26 +2038,18 @@ static u64 stripe_unusable_nstripes(const struct btrfs_block_group *bg)
+@@ -2048,26 +2048,18 @@ static u64 stripe_unusable_nstripes(const struct btrfs_block_group *bg)
  }
  
  /*
@@ -196,7 +196,7 @@ index 0d5bb057d4f33..b9768adf48c5d 100644
  
        lockdep_assert_held(&ctl->tree_lock);
  
-@@ -2086,6 +2078,29 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
+@@ -2096,6 +2088,29 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
                                    e->offset + e->bytes, &counted);
                }
        }
@@ -226,7 +226,7 @@ index 0d5bb057d4f33..b9768adf48c5d 100644
  
        /* Every free byte was distributed to exactly one stripe (debug check). */
        ASSERT(counted == ctl->free_space,
-@@ -2105,6 +2120,38 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
+@@ -2115,6 +2130,38 @@ static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
        return trapped;
  }
  
@@ -265,7 +265,7 @@ index 0d5bb057d4f33..b9768adf48c5d 100644
  /*
   * The legacy allocator parks a group's free space in an allocation cluster
   * (for a metadata group, its whole initial extent), where the group's own
-@@ -2224,18 +2271,26 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2234,18 +2281,26 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
   * zoned's zone_unusable reclaim: once enough of the group's FREE space is
   * trapped in partially used stripes (zoned compares with the capacity, but a
   * stripe group also holds claimable whole stripes), relocation packs the live
@@ -300,7 +300,7 @@ index 0d5bb057d4f33..b9768adf48c5d 100644
  {
        struct btrfs_space_info *sinfo = bg->space_info;
        const int thresh = READ_ONCE(sinfo->bg_reclaim_threshold);
-@@ -2247,21 +2302,55 @@ bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg)
+@@ -2257,21 +2312,55 @@ bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg)
         * relocating the group would only force that.
         */
        const u64 trapped = unusable - min(unusable, READ_ONCE(bg->stripe_stranded));
@@ -766,7 +766,7 @@ index bb7a86e7dbe3a..e9f95976aae4b 100644
  int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
                            struct btrfs_root *root);
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 69568759eaaa1..34284d504564d 100644
+index f367a0fc707a9..1f14e9a16f5bc 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1180,12 +1180,20 @@ static ssize_t btrfs_stripe_run_stats_show(struct kobject *kobj,
@@ -839,10 +839,10 @@ index 69568759eaaa1..34284d504564d 100644
        NULL,
  };
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index d3e6a9b429dd9..422bd66239239 100644
+index ce78a9441c64f..6e7419b87ddcd 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -3732,7 +3732,8 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
+@@ -3737,7 +3737,8 @@ static int btrfs_relocate_chunk_finish(struct btrfs_fs_info *fs_info,
        return ret;
  }
  
@@ -852,7 +852,7 @@ index d3e6a9b429dd9..422bd66239239 100644
  {
        struct btrfs_block_group *block_group;
        int ret;
-@@ -3759,7 +3760,7 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
+@@ -3764,7 +3765,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);
@@ -861,7 +861,7 @@ index d3e6a9b429dd9..422bd66239239 100644
        btrfs_scrub_continue(fs_info);
        if (ret) {
                /*
-@@ -3771,6 +3772,10 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
+@@ -3776,6 +3777,10 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
                return ret;
        }
  
@@ -872,7 +872,7 @@ index d3e6a9b429dd9..422bd66239239 100644
        block_group = btrfs_lookup_block_group(fs_info, chunk_offset);
        if (!block_group)
                return -ENOENT;
-@@ -3786,6 +3791,25 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
+@@ -3791,6 +3796,25 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset, bool v
        return ret;
  }
  
@@ -899,10 +899,10 @@ index d3e6a9b429dd9..422bd66239239 100644
  {
        struct btrfs_root *chunk_root = fs_info->chunk_root;
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
-index 6eddda2392215..e99caf4e36a1e 100644
+index 75b1179776c80..982d88264ca5a 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -783,6 +783,8 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info);
+@@ -787,6 +787,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 34c74288b423fc12691f99ba75c0107cefa5ba0a..fb5fa324d8830c2d9abc9c058018cb6c69f7bdca 100644 (file)
@@ -1,4 +1,4 @@
-From a4e8a846911c3922128fb10291ebf3a8113e0b09 Mon Sep 17 00:00:00 2001
+From 81b9d74a3c498c8df94b99b9d6c72c68f077ce04 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 071/116] btrfs: stripe_alloc: attribute each data
@@ -49,7 +49,7 @@ Assisted-by: Claude:claude-opus-5-5
  6 files changed, 153 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 3718d69e95955..ebb46e896a278 100644
+index e39f266016306..9c032d762b8f4 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1792,13 +1792,19 @@ bool btrfs_stripe_run_pad_mask(struct btrfs_fs_info *fs_info, u64 stripe_start,
@@ -168,7 +168,7 @@ index aa0cc290a753a..6e8119e073a9e 100644
                /*
                 * Breakdown of what a metadata read-modify-write found in the
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 13031c46b1f57..5ad9c388e5f04 100644
+index abfadfec54f5a..1195f667784ca 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -22,6 +22,7 @@
@@ -189,7 +189,7 @@ index 13031c46b1f57..5ad9c388e5f04 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
-@@ -2854,6 +2858,65 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
+@@ -2871,6 +2875,65 @@ static void submit_write_bios(struct btrfs_raid_bio *rbio,
        }
  }
  
@@ -255,7 +255,7 @@ index 13031c46b1f57..5ad9c388e5f04 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 the
-@@ -2875,6 +2938,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2892,6 +2955,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        bool ok = false;
        int i;
  
@@ -263,7 +263,7 @@ index 13031c46b1f57..5ad9c388e5f04 100644
        if (!btrfs_test_opt(fs_info, STRIPE_ALLOC))
                return false;
  
-@@ -2883,6 +2947,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2900,6 +2964,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                return false;
        if (!btrfs_stripe_run_pad_mask(fs_info, stripe_start, stripe_len, dead,
                                       &info)) {
@@ -271,7 +271,7 @@ index 13031c46b1f57..5ad9c388e5f04 100644
                trace_btrfs_stripe_pad_decline(fs_info, stripe_start,
                                               stripe_len, 0, 0, nsectors,
                                               info.run_start, info.run_end,
-@@ -2912,6 +2977,7 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2929,6 +2994,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;
@@ -279,7 +279,7 @@ index 13031c46b1f57..5ad9c388e5f04 100644
                        trace_btrfs_stripe_pad_decline(fs_info, stripe_start,
                                                       stripe_len, 0, covered,
                                                       nsectors,
-@@ -2929,6 +2995,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -2946,6 +3012,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        if (!ok)
                return false;
  
@@ -288,7 +288,7 @@ index 13031c46b1f57..5ad9c388e5f04 100644
        if (alloc_rbio_data_pages(rbio) < 0)
                return false;
  
-@@ -3298,6 +3366,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -3315,6 +3383,7 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                 * count that should be zero.
                 */
                atomic64_inc(&fs_info->stripe_park_stats.data_rmw);
@@ -297,10 +297,10 @@ index 13031c46b1f57..5ad9c388e5f04 100644
                if (test_bit(RBIO_WAS_PARKED_BIT, &rbio->flags))
                        atomic64_inc(&fs_info->stripe_park_stats.rmw_reads);
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index ca15c45f8f4be..5fcf4ff346bc2 100644
+index 11b843095903e..56e0e9790473a 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -146,6 +146,15 @@ struct btrfs_raid_bio {
+@@ -144,6 +144,15 @@ struct btrfs_raid_bio {
        /* Flags that tell us if it is safe to merge with this bio. */
        unsigned long flags;
  
@@ -317,7 +317,7 @@ index ca15c45f8f4be..5fcf4ff346bc2 100644
         * Set if we're doing a parity rebuild for a read from higher up, which
         * is handled differently from a parity rebuild as part of RMW.
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 34284d504564d..95ea71d1c261c 100644
+index 1f14e9a16f5bc..eefb17551e594 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1139,6 +1139,20 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 72d63c6b50cc4d93b3cb9b8149aa68a4b0a60973..dc7abd75987637c79aec8c1923ddf4895fac5a19 100644 (file)
@@ -1,4 +1,4 @@
-From e463b8e99b116061c0753e4af1e2aa570dec4222 Mon Sep 17 00:00:00 2001
+From db1269b9f63e72b7581f48836f4919c8607d28f3 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 072/116] btrfs: stripe_alloc: optionally audit data
@@ -45,7 +45,7 @@ Assisted-by: Claude:claude-opus-5-5
  6 files changed, 402 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index ebb46e896a278..89827b2e3a777 100644
+index 9c032d762b8f4..e63ca269e6721 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1817,6 +1817,8 @@ bool btrfs_stripe_run_pad_mask(struct btrfs_fs_info *fs_info, u64 stripe_start,
@@ -103,7 +103,7 @@ index 6e8119e073a9e..4ed55f974ea24 100644
         * Stripe run lifecycle observability: lifetime counters exposed
         * through sysfs stripe_run_stats, so a test can show it exercised
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5ad9c388e5f04..73750065ebc85 100644
+index 1195f667784ca..865ecb86b9ead 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -23,6 +23,7 @@
@@ -114,7 +114,7 @@ index 5ad9c388e5f04..73750065ebc85 100644
  
  /* set when additional merges to this rbio are not allowed */
  #define RBIO_RMW_LOCKED_BIT   1
-@@ -2863,6 +2864,13 @@ static void rbio_record_pad(struct btrfs_raid_bio *rbio,
+@@ -2880,6 +2881,13 @@ static void rbio_record_pad(struct btrfs_raid_bio *rbio,
  {
        rbio->pad_reason = info->reason;
        rbio->pad_norun = info->norun;
@@ -128,7 +128,7 @@ index 5ad9c388e5f04..73750065ebc85 100644
  }
  
  static_assert(BTRFS_STRIPE_PAD_NR_REASONS + 1 ==
-@@ -2870,6 +2878,302 @@ static_assert(BTRFS_STRIPE_PAD_NR_REASONS + 1 ==
+@@ -2887,6 +2895,302 @@ 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));
  
@@ -203,7 +203,7 @@ index 5ad9c388e5f04..73750065ebc85 100644
 +      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
 +      const u64 stripe_start = rbio->bioc->full_stripe_logical;
 +      const u64 stripe_end = stripe_start +
-+                             (u64)rbio->nr_data * BTRFS_STRIPE_LEN;
++                             (u64)rbio->nr_data * rbio->bioc->stripe_len;
 +      const u32 bits = fs_info->sectorsize_bits;
 +      struct btrfs_root *extent_root = btrfs_extent_root(fs_info, stripe_start);
 +      struct rmw_audit_ext e = { 0 };
@@ -431,7 +431,7 @@ index 5ad9c388e5f04..73750065ebc85 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
-@@ -2915,6 +3219,8 @@ static void rbio_count_rmw_reason(struct btrfs_raid_bio *rbio)
+@@ -2932,6 +3236,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);
@@ -441,10 +441,10 @@ index 5ad9c388e5f04..73750065ebc85 100644
  
  /*
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 5fcf4ff346bc2..99ba94032dd91 100644
+index 56e0e9790473a..8a618b86a5f18 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -154,6 +154,14 @@ struct btrfs_raid_bio {
+@@ -152,6 +152,14 @@ struct btrfs_raid_bio {
         */
        u8 pad_reason;
        u8 pad_norun;
@@ -460,7 +460,7 @@ index 5fcf4ff346bc2..99ba94032dd91 100644
        /*
         * Set if we're doing a parity rebuild for a read from higher up, which
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 95ea71d1c261c..1ace1fc52cca4 100644
+index eefb17551e594..8895a53668415 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -525,7 +525,70 @@ static const struct attribute *discard_attrs[] = {
index 87bdf8c35e28545ce4f8d08a9898b39a14079d3a..b672455141d8a221a8aec903c518fa755d99830f 100644 (file)
@@ -1,4 +1,4 @@
-From 44a1ac24083c094fe75d4a6f4eb9ed05b13af283 Mon Sep 17 00:00:00 2001
+From f5fc101c0c49bbd2ca341ad13bdf8d495daa2899 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 073/116] btrfs: stripe_alloc: keep relocation's stripe
@@ -40,7 +40,7 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 75 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 89827b2e3a777..b43728684b9c1 100644
+index e63ca269e6721..946102aea2df6 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -508,6 +508,12 @@ struct btrfs_open_stripe_run {
@@ -198,7 +198,7 @@ index 4ed55f974ea24..16fdd69b7f16f 100644
                atomic64_t compact_runs;
                /* compaction plans over the cap, relocated whole instead */
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 1ace1fc52cca4..d7b4dafdc80b6 100644
+index 8895a53668415..5cbff0b128288 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1272,6 +1272,8 @@ static ssize_t btrfs_stripe_run_stats_show(struct kobject *kobj,
index d6c494dc6f956ff33c42b61042bd835496a1935b..ea1bbcdeb841a4896122847345a1aa1ee136580c 100644 (file)
@@ -1,4 +1,4 @@
-From c0886d0274af757dfa3f0be8a04667ea3e62c481 Mon Sep 17 00:00:00 2001
+From 064683b6372aa03e0064c377b0c95b2057c94ad0 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 1 Oct 2026 04:20:09 -0400
 Subject: [RFC PATCH 074/116] btrfs: stripe_alloc: let relocation allocate a
@@ -26,10 +26,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 32 insertions(+)
 
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index e9a6d4df82c7c..5636c4dc60e89 100644
+index a672d1b304cfb..1dcd20f69fcb1 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -2259,6 +2259,28 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
+@@ -2257,6 +2257,28 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
   * This will reserve bytes from the data space info.  If there is not enough
   * space then we will attempt to flush space as specified by flush.
   */
@@ -58,7 +58,7 @@ index e9a6d4df82c7c..5636c4dc60e89 100644
  int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
                             enum btrfs_reserve_flush_enum flush)
  {
-@@ -2290,6 +2312,16 @@ int btrfs_reserve_data_bytes_held(struct btrfs_space_info *space_info, u64 bytes
+@@ -2288,6 +2310,16 @@ int btrfs_reserve_data_bytes_held(struct btrfs_space_info *space_info, u64 bytes
        if (held)
                *held = 0;
        ret = __reserve_bytes(space_info, bytes, flush, held);
index 59108c3a343692d8a1c20189f727b5b89b0d747f..ecb9789f433311d75b0bf16b1f42576e24deb906 100644 (file)
@@ -1,4 +1,4 @@
-From ec70174eab1dd00bf3a251c225b0398b4bd8e490 Mon Sep 17 00:00:00 2001
+From 5487876f6a49d704e821e2911459e8e1541aa408 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 075/116] btrfs: stripe_alloc: keep a stripe in the rbio
@@ -60,7 +60,7 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 290 insertions(+), 12 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index b43728684b9c1..bd985b6c7e7d1 100644
+index 946102aea2df6..beaa80d48291f 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -528,6 +528,13 @@ struct btrfs_open_stripe_run {
@@ -304,7 +304,7 @@ index 16fdd69b7f16f..102892575f7cc 100644
  
  #ifdef CONFIG_BTRFS_DEBUG
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 73750065ebc85..4ac3f43b9b4fc 100644
+index 865ecb86b9ead..c77a26ceab18e 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -78,6 +78,17 @@
@@ -334,7 +334,7 @@ index 73750065ebc85..4ac3f43b9b4fc 100644
        /*
         * Parked partial write rbios (RBIO_PARKED_BIT), in park order.
         * parked_lock nests inside the hash and bio_list locks.
-@@ -559,6 +572,8 @@ static void __remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
+@@ -563,6 +576,8 @@ static void __remove_rbio_from_cache(struct btrfs_raid_bio *rbio)
        if (test_and_clear_bit(RBIO_CACHE_BIT, &rbio->flags)) {
                list_del_init(&rbio->stripe_cache);
                table->cache_size -= 1;
@@ -343,7 +343,7 @@ index 73750065ebc85..4ac3f43b9b4fc 100644
                freeit = true;
  
                /* if the bio list isn't empty, this rbio is
-@@ -637,6 +652,111 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
+@@ -641,6 +656,111 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
        info->stripe_hash_table = NULL;
  }
  
@@ -376,7 +376,7 @@ index 73750065ebc85..4ac3f43b9b4fc 100644
 +              return false;
 +      return btrfs_stripe_run_incomplete(fs_info,
 +                      rbio->bioc->full_stripe_logical,
-+                      (u64)rbio->nr_data * BTRFS_STRIPE_LEN);
++                      (u64)rbio->nr_data * rbio->bioc->stripe_len);
 +}
 +
 +/* Re-checked at every prune: the pin ends when its run has written it all. */
@@ -455,7 +455,7 @@ index 73750065ebc85..4ac3f43b9b4fc 100644
  /*
   * insert an rbio into the stripe cache.  It
   * must have already been prepared by calling
-@@ -651,10 +771,12 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
+@@ -655,10 +775,12 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
  static void cache_rbio(struct btrfs_raid_bio *rbio)
  {
        struct btrfs_stripe_hash_table *table;
@@ -468,7 +468,7 @@ index 73750065ebc85..4ac3f43b9b4fc 100644
        table = rbio->bioc->fs_info->stripe_hash_table;
  
        spin_lock(&table->cache_lock);
-@@ -670,19 +792,11 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
+@@ -674,19 +796,11 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
                list_add(&rbio->stripe_cache, &table->stripe_cache);
                table->cache_size += 1;
        }
@@ -490,7 +490,7 @@ index 73750065ebc85..4ac3f43b9b4fc 100644
  
        spin_unlock(&table->cache_lock);
  }
-@@ -1378,6 +1492,10 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
+@@ -1383,6 +1497,10 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
        rbio->csum_buf = NULL;
        rbio->csum_bitmap = NULL;
  
@@ -502,7 +502,7 @@ index 73750065ebc85..4ac3f43b9b4fc 100644
         * Clear the data bitmap, as the rbio may be cached for later usage.
         * do this before unlock_stripe() so there will be no new bio
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index d7b4dafdc80b6..2d48219198b65 100644
+index 5cbff0b128288..ede9047dd1112 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1222,6 +1222,8 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 8785d913ecf04e90f203ee85cd48f8245978e643..071bf66a2bc0b013f8f738e78d52c5477305b500 100644 (file)
@@ -1,4 +1,4 @@
-From 42d7b94bd97d9a38d48feb9f02a358654e5c4450 Mon Sep 17 00:00:00 2001
+From 3c72edd2884f45c05a461ed4ae62bc790b7f6833 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 076/116] btrfs: stripe_alloc: pad a stripe's allocated
@@ -42,7 +42,7 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 56 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index bd985b6c7e7d1..0e62577efbac2 100644
+index beaa80d48291f..9b164bcac06e5 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1791,10 +1791,25 @@ u64 btrfs_stripe_run_alloc_ceiling(struct btrfs_fs_info *fs_info,
@@ -129,10 +129,10 @@ index 102892575f7cc..6fc0aea024156 100644
                 * Data read-modify-writes on a block group the allocator
                 * covers.  With allow_rmw empty this is the number the
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 4ac3f43b9b4fc..2ffdb4f9f76e3 100644
+index c77a26ceab18e..7619793710679 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3358,7 +3358,9 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3375,7 +3375,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;
@@ -142,7 +142,7 @@ index 4ac3f43b9b4fc..2ffdb4f9f76e3 100644
        bool ok = false;
        int i;
  
-@@ -3367,10 +3369,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3384,10 +3386,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                return false;
  
        dead = bitmap_zalloc(nsectors, GFP_NOFS);
@@ -159,7 +159,7 @@ index 4ac3f43b9b4fc..2ffdb4f9f76e3 100644
                rbio_record_pad(rbio, &info);
                trace_btrfs_stripe_pad_decline(fs_info, stripe_start,
                                               stripe_len, 0, 0, nsectors,
-@@ -3389,11 +3395,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3406,11 +3412,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                        covered++;
  
        /*
@@ -179,7 +179,7 @@ index 4ac3f43b9b4fc..2ffdb4f9f76e3 100644
         */
        for (i = 0; i < nsectors; i++) {
                if (rbio->bio_paddrs[i * rbio->sector_nsteps] != INVALID_PADDR)
-@@ -3412,10 +3421,13 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3429,10 +3438,13 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                                                       info.reason);
                        goto out;
                }
@@ -193,7 +193,7 @@ index 4ac3f43b9b4fc..2ffdb4f9f76e3 100644
        if (!ok)
                return false;
  
-@@ -3446,6 +3458,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3463,6 +3475,8 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        /* The whole stripe goes out: every vertical position is written. */
        bitmap_set(&rbio->dbitmap, 0, rbio->stripe_nsectors);
        atomic64_inc(&fs_info->stripe_park_stats.padded);
@@ -203,7 +203,7 @@ index 4ac3f43b9b4fc..2ffdb4f9f76e3 100644
  }
  
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 2d48219198b65..1ebbd15373586 100644
+index ede9047dd1112..aad4767baad63 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1196,6 +1196,7 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 9d57415bd5fbd93e7aa8b4b1ecbebf54baa92b39..7f09727844f2830410d011da28fdcf1b75741509 100644 (file)
@@ -1,4 +1,4 @@
-From 2cf425545c69f0ec8986ea2d89e4aea793b853f4 Mon Sep 17 00:00:00 2001
+From 0549fac4c074fc636f19a7c0f7e221f1ccd0c477 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 3 Oct 2026 18:57:15 -0400
 Subject: [RFC PATCH 077/116] btrfs: stripe_alloc: apply the property before
@@ -38,7 +38,7 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 61 insertions(+), 4 deletions(-)
 
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index a7841e98811be..da97fe48b55d6 100644
+index 3d3a51cd963d0..d61b2c42fd0a8 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
 @@ -47,6 +47,7 @@
@@ -49,7 +49,7 @@ index a7841e98811be..da97fe48b55d6 100644
  #include "relocation.h"
  #include "scrub.h"
  #include "super.h"
-@@ -3738,6 +3739,8 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
+@@ -3758,6 +3759,8 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
        if (btrfs_super_log_root(disk_super) != 0 &&
            !btrfs_test_opt(fs_info, NOLOGREPLAY)) {
                btrfs_info(fs_info, "start tree-log replay");
@@ -58,7 +58,7 @@ index a7841e98811be..da97fe48b55d6 100644
                ret = btrfs_replay_log(fs_info, fs_devices);
                if (ret)
                        goto fail_qgroup;
-@@ -3756,10 +3759,11 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
+@@ -3776,10 +3779,11 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
         * policy) before anything that can allocate data -- the resumed
         * balance or dev replace kicked off below -- so filesystem-wide
         * policy is in force for every allocation this mount ever makes.
index 6f959ceed6a26e4e121f9d9ceef7b1e385afddfe..cfe83d16bd05c0f9680fa953141599018290a7d6 100644 (file)
@@ -1,4 +1,4 @@
-From 0e3f67ce778d663cc44348ec94ac9ef7962b170c Mon Sep 17 00:00:00 2001
+From 7f542d49c81857af6d107e52a8a7911ed0a0acf1 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 078/116] btrfs: stripe_alloc: count refused rbio pins and
@@ -68,10 +68,10 @@ index 6fc0aea024156..e7845dfea530a 100644
                atomic64_t written_not_live;
        } stripe_park_stats;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 2ffdb4f9f76e3..f2ff814d20e36 100644
+index 7619793710679..dc62d466e2a22 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -718,19 +718,31 @@ static void rbio_mark_written(struct btrfs_raid_bio *rbio)
+@@ -722,19 +722,31 @@ static void rbio_mark_written(struct btrfs_raid_bio *rbio)
        }
  }
  
@@ -106,7 +106,7 @@ index 2ffdb4f9f76e3..f2ff814d20e36 100644
                atomic64_inc(&rbio->bioc->fs_info->stripe_park_stats.rbio_pinned);
        } else if (test_and_clear_bit(RBIO_PINNED_BIT, &rbio->flags)) {
                table->nr_pinned -= 1;
-@@ -755,6 +767,35 @@ static void rbio_cache_prune(struct btrfs_stripe_hash_table *table,
+@@ -759,6 +771,35 @@ static void rbio_cache_prune(struct btrfs_stripe_hash_table *table,
                /* __remove_rbio_from_cache() drops a stale pin's count. */
                __remove_rbio_from_cache(found);
        }
@@ -142,7 +142,7 @@ index 2ffdb4f9f76e3..f2ff814d20e36 100644
  }
  
  /*
-@@ -3804,6 +3845,8 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -3821,6 +3862,8 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
                 * count that should be zero.
                 */
                atomic64_inc(&fs_info->stripe_park_stats.data_rmw);
@@ -152,10 +152,10 @@ index 2ffdb4f9f76e3..f2ff814d20e36 100644
                /* A parked-then-flushed write that still had to read. */
                if (test_bit(RBIO_WAS_PARKED_BIT, &rbio->flags))
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 99ba94032dd91..d71fc847dd9a2 100644
+index 8a618b86a5f18..1b24e19967cad 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -317,5 +317,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
+@@ -312,5 +312,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
  void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
  void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
                              u64 num_bytes, bool force);
@@ -164,7 +164,7 @@ index 99ba94032dd91..d71fc847dd9a2 100644
  
  #endif
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 1ebbd15373586..05845411b6835 100644
+index aad4767baad63..0e14eca2c6367 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -25,6 +25,7 @@
index 30d74d444009d3a8427fb5e04ca0a2d0356ed7ba..c1997fdaf06dfd25b897221a5ce141833a7126d2 100644 (file)
@@ -1,4 +1,4 @@
-From d0d2b845edfcf2bcfc16d4a2562f087f8ee560ce Mon Sep 17 00:00:00 2001
+From 0545e8ac77819e8b6ef84abce5ea6785d4a86d4c Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 4 Oct 2026 12:35:08 -0400
 Subject: [RFC PATCH 079/116] btrfs: stripe_alloc: sweep stale rbio pins, and
@@ -61,7 +61,7 @@ index e7845dfea530a..e9847d879a608 100644
                 * Read-modify-writes of metadata or system stripes that had to
                 * read (data_rmw counts them with the data ones): the fsync log
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index f2ff814d20e36..bec096829c5d8 100644
+index dc62d466e2a22..124236fc91c28 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -86,8 +86,19 @@
@@ -95,7 +95,7 @@ index f2ff814d20e36..bec096829c5d8 100644
        /*
         * Parked partial write rbios (RBIO_PARKED_BIT), in park order.
         * parked_lock nests inside the hash and bio_list locks.
-@@ -772,6 +786,73 @@ static void rbio_cache_prune(struct btrfs_stripe_hash_table *table,
+@@ -776,6 +790,73 @@ static void rbio_cache_prune(struct btrfs_stripe_hash_table *table,
                      table->cache_size);
  }
  
@@ -169,7 +169,7 @@ index f2ff814d20e36..bec096829c5d8 100644
  /*
   * Cached and pinned rbios now, for sysfs stripe_park_stats.  @live re-checks
   * each pin against its run, as the prune does: a pin whose run has finished
-@@ -821,6 +902,9 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
+@@ -825,6 +906,9 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
        table = rbio->bioc->fs_info->stripe_hash_table;
  
        spin_lock(&table->cache_lock);
@@ -180,10 +180,10 @@ index f2ff814d20e36..bec096829c5d8 100644
  
        /* bump our ref if we were not in the list before */
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index d71fc847dd9a2..7f305f15e7e92 100644
+index 1b24e19967cad..957cc2d857b53 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -319,5 +319,6 @@ void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
+@@ -314,5 +314,6 @@ void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
                              u64 num_bytes, bool force);
  void btrfs_rbio_cache_usage(struct btrfs_fs_info *fs_info, int *cached,
                            int *pinned, int *live);
@@ -191,7 +191,7 @@ index d71fc847dd9a2..7f305f15e7e92 100644
  
  #endif
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 05845411b6835..9284165487ecd 100644
+index 0e14eca2c6367..2fce0ffe5856a 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1233,6 +1233,8 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
@@ -213,10 +213,10 @@ index 05845411b6835..9284165487ecd 100644
                atomic64_read(&fs_info->stripe_park_stats.written_not_live),
                atomic_read(&fs_info->stripe_parked_now));
 diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
-index c3cdaf2c6cc41..97c9cecb0830a 100644
+index 6007dce716bf5..aa251b32b1dcf 100644
 --- a/fs/btrfs/transaction.c
 +++ b/fs/btrfs/transaction.c
-@@ -2497,6 +2497,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
+@@ -2481,6 +2481,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 5a0fe33bdc3025332739a51b14877288128ebd73..ffb440f2ac310b23d87b831e5d954edf8162bd08 100644 (file)
@@ -1,4 +1,4 @@
-From d3436b335250591f54e6bd2c2413d7ca419d5071 Mon Sep 17 00:00:00 2001
+From 5c17642cd1a8a7bf3110119ac4d6ae2d675aa1ad 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 080/116] btrfs: stripe_alloc: break rbio pins and open
@@ -29,7 +29,7 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 79 insertions(+), 21 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 0e62577efbac2..fb4ad0c7e0079 100644
+index 9b164bcac06e5..5076e7cdb4ee8 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2516,28 +2516,29 @@ static bool run_unwritten_in(struct btrfs_open_stripe_run *run, u64 start,
@@ -122,10 +122,10 @@ index ccb47edf2b895..6bef68593d947 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 bec096829c5d8..a6db24a9b3b60 100644
+index 124236fc91c28..caa30f222def7 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -860,22 +860,34 @@ void btrfs_rbio_unpin_stale(struct btrfs_fs_info *fs_info)
+@@ -864,22 +864,34 @@ void btrfs_rbio_unpin_stale(struct btrfs_fs_info *fs_info)
   * evicted or cached again.
   */
  void btrfs_rbio_cache_usage(struct btrfs_fs_info *fs_info, int *cached,
@@ -154,7 +154,7 @@ index bec096829c5d8..a6db24a9b3b60 100644
 +                      continue;
 +              class = btrfs_stripe_run_incomplete_class(fs_info,
 +                              rbio->bioc->full_stripe_logical,
-+                              (u64)rbio->nr_data * BTRFS_STRIPE_LEN);
++                              (u64)rbio->nr_data * rbio->bioc->stripe_len);
 +              if (class < 0)
 +                      continue;
 +              *live += 1;
@@ -165,10 +165,10 @@ index bec096829c5d8..a6db24a9b3b60 100644
  }
  
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 7f305f15e7e92..2fc1f05c6e66d 100644
+index 957cc2d857b53..bd3b73f040f9a 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -318,7 +318,7 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
+@@ -313,7 +313,7 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
  void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
                              u64 num_bytes, bool force);
  void btrfs_rbio_cache_usage(struct btrfs_fs_info *fs_info, int *cached,
@@ -178,7 +178,7 @@ index 7f305f15e7e92..2fc1f05c6e66d 100644
  
  #endif
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 9284165487ecd..fbb347148dd6d 100644
+index 2fce0ffe5856a..21892535a3c8c 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1187,10 +1187,19 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 539a38017d07440a0c25a3aeb5a56275ea52f7a0..7cb0cac474f4e7f4bce71a6c0f8b7c99f9e7890b 100644 (file)
@@ -1,4 +1,4 @@
-From 944f4a24fde392601ff2682d2eb6bc17281439f0 Mon Sep 17 00:00:00 2001
+From a44ba1c6dac1fb65b1451712c482c708522070a9 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 081/116] btrfs: stripe_alloc: give each log commit its own
@@ -69,7 +69,7 @@ Assisted-by: Claude:claude-opus-5-5
  7 files changed, 274 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index fb4ad0c7e0079..ff606c8577ee7 100644
+index 5076e7cdb4ee8..7c7ea3a8a02eb 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -536,6 +536,8 @@ struct btrfs_open_stripe_run {
@@ -353,10 +353,10 @@ index 6bef68593d947..6feea39c82427 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 da97fe48b55d6..399fbbdb7ac50 100644
+index d61b2c42fd0a8..24dcb483b96eb 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -2786,6 +2786,11 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
+@@ -2806,6 +2806,11 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
        INIT_LIST_HEAD(&fs_info->caching_block_groups);
        INIT_LIST_HEAD(&fs_info->open_stripe_bgs);
        INIT_WORK(&fs_info->stripe_alloc_enable_work, btrfs_stripe_alloc_enable_work);
@@ -464,7 +464,7 @@ index e9847d879a608..2b9ff81b778bb 100644
        /* BTRFS_STRIPE_RMW_* masks; see btrfs_stripe_allow_rmw(). */
        u32 stripe_rmw_opt;
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index fbb347148dd6d..d18629c7dd080 100644
+index 21892535a3c8c..d3cdc0daa9e98 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1189,7 +1189,7 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index dc10734d8019498d68d2c9896da554a6a1df44f7..c9f8530963c02041b4542cac60bdeb84289aaf51 100644 (file)
@@ -1,4 +1,4 @@
-From 6b52ac73acdfa4e81dc4e827b1b54ce8bc26ce25 Mon Sep 17 00:00:00 2001
+From 77cf7621c923fb0ba6d7b2d0361f1d9fa0f78fe0 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Mon, 5 Oct 2026 21:13:17 -0400
 Subject: [RFC PATCH 082/116] btrfs: stripe_alloc: don't make a parked rbio
@@ -27,7 +27,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 26 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index ff606c8577ee7..00bafb761f829 100644
+index 7c7ea3a8a02eb..6d31001c188a2 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1901,6 +1901,31 @@ bool btrfs_stripe_nocow_writable(struct btrfs_inode *inode, u64 start,
index ee702277875211dc87be5c7c9134cac594be9c44..600347e5a7140c59bafb16a8fb7d023bdfb7eab7 100644 (file)
@@ -1,4 +1,4 @@
-From b0b570899c985d633a47d9dcb1144ccd2fda84e7 Mon Sep 17 00:00:00 2001
+From 0d8508b1518fcd6952849a84af7bf8dc39a62212 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 083/116] btrfs: stripe_alloc: share LOG data runs per log
@@ -62,7 +62,7 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 227 insertions(+), 15 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 00bafb761f829..4f97ccb130342 100644
+index 6d31001c188a2..d9afc2f6d8e4a 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1296,11 +1296,35 @@ int btrfs_alloc_from_log_stripe_run(struct btrfs_block_group *bg, u64 num_bytes,
@@ -308,10 +308,10 @@ index 00bafb761f829..4f97ccb130342 100644
        if (not_live)
                atomic64_add(not_live, &fs_info->stripe_park_stats.written_not_live);
 diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
-index 3fc0d4100f502..947696e84353b 100644
+index 5d319df6524d8..fd69a7d34f60c 100644
 --- a/fs/btrfs/defrag.c
 +++ b/fs/btrfs/defrag.c
-@@ -1390,6 +1390,9 @@ void btrfs_carry_log_tail(struct btrfs_inode *inode)
+@@ -1399,6 +1399,9 @@ void btrfs_carry_log_tail(struct btrfs_inode *inode)
                return;
        if (!READ_ONCE(inode->log_carry))
                return;
@@ -321,7 +321,7 @@ index 3fc0d4100f502..947696e84353b 100644
        copy = kmalloc(sizeof(*copy), GFP_NOFS);
        if (!copy)
                return;
-@@ -1403,6 +1406,9 @@ void btrfs_carry_log_tail(struct btrfs_inode *inode)
+@@ -1412,6 +1415,9 @@ void btrfs_carry_log_tail(struct btrfs_inode *inode)
        inode->log_carry->nr_ranges = 0;
        mutex_unlock(&inode->log_mutex);
  
@@ -332,10 +332,10 @@ index 3fc0d4100f502..947696e84353b 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 399fbbdb7ac50..419a3eb7527cb 100644
+index 24dcb483b96eb..826341066b242 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -2789,8 +2789,12 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
+@@ -2809,8 +2809,12 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
        /*
         * Closing the log-tree fsync write hole is on by default; sysfs can
         * turn it off so the change can be measured against itself on one boot.
@@ -386,7 +386,7 @@ index 2b9ff81b778bb..2734a8404a9b2 100644
        /* BTRFS_STRIPE_RMW_* masks; see btrfs_stripe_allow_rmw(). */
        u32 stripe_rmw_opt;
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index d18629c7dd080..6bd07e15fe707 100644
+index d3cdc0daa9e98..baa3c4e780120 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1321,7 +1321,13 @@ static ssize_t btrfs_stripe_run_stats_show(struct kobject *kobj,
index 5f162c475dc8c58aeada86418871b3e0469f8ba8..576d4fb05e246a1317149ee315997ee02f23404e 100644 (file)
@@ -1,4 +1,4 @@
-From edc9be873c6a389b67257aa21cf32bde2ae54133 Mon Sep 17 00:00:00 2001
+From 3ed13bd4b34d1faa4cad991e4c40a9522432a9e8 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 6 Oct 2026 12:40:29 -0400
 Subject: [RFC PATCH 084/116] btrfs: stripe_alloc: let relocation allocate as
@@ -33,10 +33,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 8 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 5636c4dc60e89..289ba91be6ab2 100644
+index 1dcd20f69fcb1..781abadf24362 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -2318,9 +2318,15 @@ int btrfs_reserve_data_bytes_held(struct btrfs_space_info *space_info, u64 bytes
+@@ -2316,9 +2316,15 @@ int btrfs_reserve_data_bytes_held(struct btrfs_space_info *space_info, u64 bytes
         * a reason to fail while there is unallocated space for a new chunk:
         * that made balance fail with ENOSPC on any filesystem whose data chunks
         * happened to be full.
index 05b045989a73215c34c2d03bf248961f829d10e2..b63e06c438432ead63b460649248f7ed742e000f 100644 (file)
@@ -1,4 +1,4 @@
-From 526336dd1cb564cd03541dc94f64468e79f1b779 Mon Sep 17 00:00:00 2001
+From 9ceaa90468ee8bd38a0f8eba7e07877fd2ed7935 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:17:47 -0400
 Subject: [RFC PATCH 085/116] btrfs: stripe_alloc: key private stripe runs by
@@ -38,7 +38,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 25 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 4f97ccb130342..fe78809c7b410 100644
+index d9afc2f6d8e4a..141ac2b45397b 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -504,7 +504,14 @@ struct btrfs_open_stripe_run {
index 9842965da145d6bc0b1a4eba1e194903673994e9..83a8526172d40187f0adca8123964b5d0876ab2d 100644 (file)
@@ -1,4 +1,4 @@
-From 0249bfbd944033b29a18765023fefb579cba70df Mon Sep 17 00:00:00 2001
+From 7db5408eb960737f39550d1d12576ed34f0f97c5 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:49:17 -0400
 Subject: [RFC PATCH 086/116] btrfs: stripe_alloc: do not treat an allocation
index 01de0347f6e048e30119f328169cb2de297bcb64..741b8895d41a82f7b20b4ba5b5c87e46bde336f6 100644 (file)
@@ -1,4 +1,4 @@
-From f1dcc0c8b7309bba72e1afcf78102c4c3ac2c5cf Mon Sep 17 00:00:00 2001
+From d6d94cf983c906599778dc6bacb036f7c403d8ee Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:50:45 -0400
 Subject: [RFC PATCH 087/116] btrfs: stripe_alloc: mark an ended ordered
@@ -39,7 +39,7 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 19 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index fe78809c7b410..8a6feca2316c4 100644
+index 141ac2b45397b..89c8af4dfc7a5 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -3057,15 +3057,30 @@ struct btrfs_open_stripe_run *btrfs_get_open_stripe_run(
index ed59ff7a9bdd7b2fe5a746839a822e57ac647ef9..aa09422cf18af67be2a5e714eef51e95bc71e67c 100644 (file)
@@ -1,4 +1,4 @@
-From 1453b4c48e63017f615c10544b4235189786cf97 Mon Sep 17 00:00:00 2001
+From 8a2735833465c220be2deb2f68995414b6caa48b Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:51:15 -0400
 Subject: [RFC PATCH 088/116] btrfs: stripe_alloc: read the shared LOG run mode
@@ -24,7 +24,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 8a6feca2316c4..764bcb81ab936 100644
+index 89c8af4dfc7a5..7888f55c34430 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2435,6 +2435,8 @@ void btrfs_log_settle_stripes(struct btrfs_inode *inode, u64 file_start,
index a0bd8fed8eda4cbcebb49f2605992764ab3723fa..4a1c32722d22bc1a5e4d3519b56846897515100c 100644 (file)
@@ -1,4 +1,4 @@
-From 6ca617a49aa15b8ec9b8c7081d1eb2d7507f3f17 Mon Sep 17 00:00:00 2001
+From 11b27450d340cebc88073ef5fbbc188d49cef882 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:54:41 -0400
 Subject: [RFC PATCH 089/116] btrfs: stripe_alloc: remove only the set bits of
@@ -29,10 +29,10 @@ Assisted-by: Claude:claude-opus-5-5
  2 files changed, 39 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index b9768adf48c5d..e4e727456369b 100644
+index f0c3187554deb..c7c55d108486c 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2768,10 +2768,19 @@ static bool claim_stripe_run_pieces(struct btrfs_block_group *block_group,
+@@ -2778,10 +2778,19 @@ static bool claim_stripe_run_pieces(struct btrfs_block_group *block_group,
                        break;
  
                if (info->bitmap) {
index 6b5d86ee7d08b6e0331774fb4ec8cce7dc3ebb98..d4c6c9a50f59f59a83c8973e5620fe0bed7f9c58 100644 (file)
@@ -1,4 +1,4 @@
-From 4601d72544d8953d695c8f433281690b56ef8c80 Mon Sep 17 00:00:00 2001
+From 7d19226b292f654c6f741534c9dbd4e8b8ca2621 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:54:48 -0400
 Subject: [RFC PATCH 090/116] btrfs: stripe_alloc: claim a stripe tail in one
@@ -30,10 +30,10 @@ Assisted-by: Claude:claude-opus-5-5
  2 files changed, 59 insertions(+), 11 deletions(-)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index e4e727456369b..e5c5cf79a355f 100644
+index c7c55d108486c..0489213c4435e 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2519,24 +2519,32 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
+@@ -2529,24 +2529,32 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
   * Returns 0 on success, -ENOSPC if no aligned fully-free stripe is present
   * in this block group, -ENOMEM if the slow path could not allocate.
   */
@@ -73,7 +73,7 @@ index e4e727456369b..e5c5cf79a355f 100644
  
        spin_lock(&ctl->tree_lock);
        for (n = rb_first(&ctl->free_space_offset); n; n = rb_next(n)) {
-@@ -2574,11 +2582,22 @@ int btrfs_claim_stripe_tail(struct btrfs_block_group *block_group,
+@@ -2584,11 +2592,22 @@ int btrfs_claim_stripe_tail(struct btrfs_block_group *block_group,
                        continue;
                found += min(end, e_end) - max(start, e_start);
        }
index a8ab208a889377b994e280578684e2aaedcf21d4..d04ac7151051aede3140fbb604f768ccf9a33d56 100644 (file)
@@ -1,4 +1,4 @@
-From bbaa5b42965f3c3a970b39e326f3b6c1dfe9d04c Mon Sep 17 00:00:00 2001
+From f122420a94a8e61bba581893ecf4cdea0432bbc9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:57:34 -0400
 Subject: [RFC PATCH 091/116] btrfs: stripe_alloc: keep the stripe totals
@@ -43,7 +43,7 @@ Assisted-by: Claude:claude-opus-5-5
  2 files changed, 71 insertions(+), 45 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 764bcb81ab936..b5bcd68965463 100644
+index 7888f55c34430..50d8e6f9ad42e 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -3624,21 +3624,35 @@ void btrfs_scan_stripe_unusable(struct btrfs_fs_info *fs_info, bool force)
@@ -115,10 +115,10 @@ index 764bcb81ab936..b5bcd68965463 100644
  
                        /*
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index e5c5cf79a355f..cb9d3e3bcc804 100644
+index 0489213c4435e..0d006a25295a9 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1514,6 +1514,10 @@ static void stripe_unusable_mark_dirty(struct btrfs_block_group *bg);
+@@ -1524,6 +1524,10 @@ static void stripe_unusable_mark_dirty(struct btrfs_block_group *bg);
   * ENOSPC, corrected upward by the commit rescan), never HIGH: a
   * reservation admitted against phantom supply fails at writeback and
   * drops buffered data.  Caller holds ctl->tree_lock.
@@ -129,7 +129,7 @@ index e5c5cf79a355f..cb9d3e3bcc804 100644
   */
  static void stripe_claimable_mod(struct btrfs_block_group *bg, s64 delta)
  {
-@@ -1521,14 +1525,16 @@ static void stripe_claimable_mod(struct btrfs_block_group *bg, s64 delta)
+@@ -1531,14 +1535,16 @@ static void stripe_claimable_mod(struct btrfs_block_group *bg, s64 delta)
  
        if (!READ_ONCE(bg->stripe_unusable_ready) || !delta)
                return;
@@ -151,7 +151,7 @@ index e5c5cf79a355f..cb9d3e3bcc804 100644
        if (delta < 0 && sinfo->bytes_stripe_claimable < (u64)-delta)
                sinfo->bytes_stripe_claimable = 0;
        else
-@@ -2207,22 +2213,19 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2217,22 +2223,19 @@ void btrfs_block_group_init_stripe_unusable(struct btrfs_block_group *bg)
                return;
        }
        trapped = stripe_unusable_scan(bg, freep, nstripes);
@@ -183,7 +183,7 @@ index e5c5cf79a355f..cb9d3e3bcc804 100644
  }
  
  /*
-@@ -2247,22 +2250,20 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2257,22 +2260,20 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
                spin_unlock(&ctl->tree_lock);
                return;
        }
@@ -215,7 +215,7 @@ index e5c5cf79a355f..cb9d3e3bcc804 100644
  }
  
  
-@@ -2378,10 +2379,9 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2388,10 +2389,9 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
        stripe_return_clusters(bg);
        spin_lock(&ctl->tree_lock);
        if (bg->stripe_unusable_ready) {        /* skip if disarmed (read-only) */
@@ -228,7 +228,7 @@ index e5c5cf79a355f..cb9d3e3bcc804 100644
                /*
                 * The incremental rules may only under-count claimable
                 * supply; counting more than the scan finds means a missed
-@@ -2396,7 +2396,14 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2406,7 +2406,14 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
                WARN_RATELIMIT(bg->stripe_claimable > scanned,
                          "bg %llu incremental stripe_claimable %llu above scanned %llu",
                          bg->start, bg->stripe_claimable, scanned);
index 045de0f149890918f4c1e737a571d51121106a2a..016b41b28284cbb8a8ee56f22451a31431aa1e93 100644 (file)
@@ -1,4 +1,4 @@
-From 3b6b54b00a4ed9c96d123c335c93e3114923d4b4 Mon Sep 17 00:00:00 2001
+From f6c9504e560c3f3123ccbec6931639845e141109 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 00:58:45 -0400
 Subject: [RFC PATCH 092/116] btrfs: stripe_alloc: do not delete an unused
@@ -35,7 +35,7 @@ Assisted-by: Claude:claude-opus-5-5
  2 files changed, 27 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index b5bcd68965463..6b876be5a0b55 100644
+index 50d8e6f9ad42e..f34181d7ce17a 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2278,6 +2278,18 @@ static bool stripe_range_run_free(struct btrfs_block_group *bg, u64 start,
@@ -57,7 +57,7 @@ index b5bcd68965463..6b876be5a0b55 100644
  /*
   * Close every private LOG and NOCOW run owned by @inode: called at
   * inode eviction so a persistent nocow run's claimed tail does not stay
-@@ -5221,6 +5233,20 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
+@@ -5223,6 +5235,20 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
                        goto next;
                }
  
index 3ec23490b90b551c99da2346c341b1bec86bd453..c727c6fe00cc89203f2eeb178e2783c426f914a1 100644 (file)
@@ -1,4 +1,4 @@
-From ca3101c29dcae3ba3d91ba482cf52ec293a12252 Mon Sep 17 00:00:00 2001
+From d800d45ed7969f1fbbd360e9db54a354ac4bc6e9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:00:24 -0400
 Subject: [RFC PATCH 093/116] btrfs: stripe_meta: commit before waiting for
@@ -26,7 +26,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 49 insertions(+), 12 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 6b876be5a0b55..e4f95238c1501 100644
+index f34181d7ce17a..d5fa24cbf43d8 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -547,20 +547,17 @@ struct btrfs_open_stripe_run {
index 90f9b2687b6e584cf562ff6575a07c350b04b33f..bf171ccaec8b92877cd7919af91b9ff8ed5d87e1 100644 (file)
@@ -1,4 +1,4 @@
-From e3dbeeb1a01086b92143ecb56f6c1725a08dbd44 Mon Sep 17 00:00:00 2001
+From 71c8da87174ad11a798adfaf05f2eb099169662d Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:01:51 -0400
 Subject: [RFC PATCH 094/116] btrfs: raid56: do not read tree blocks under the
@@ -44,10 +44,10 @@ index 2734a8404a9b2..aa46009225fa1 100644
                atomic64_t congestion_short;
                /* Frontier stripes pinned in the rbio cache (cache_rbio()). */
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index a6db24a9b3b60..bc6c11b2ad392 100644
+index caa30f222def7..802b0eb7ecc39 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3669,29 +3669,37 @@ static bool rmw_peek_eb_generation(struct btrfs_raid_bio *rbio, u32 i,
+@@ -3686,29 +3686,37 @@ static bool rmw_peek_eb_generation(struct btrfs_raid_bio *rbio, u32 i,
  /*
   * Is @bytenr a tree block the committed extent tree still references?  Read
   * the commit root without locking, as the caching thread does, so this is
@@ -92,7 +92,7 @@ index a6db24a9b3b60..bc6c11b2ad392 100644
        ret = btrfs_search_slot(NULL, extent_root, &key, path, 0, 0);
        if (ret > 0)
                ret = btrfs_previous_extent_item(extent_root, path, bytenr);
-@@ -3716,10 +3724,12 @@ static bool rmw_block_referenced(struct btrfs_fs_info *fs_info, u64 bytenr,
+@@ -3733,10 +3741,12 @@ static bool rmw_block_referenced(struct btrfs_fs_info *fs_info, u64 bytenr,
                         */
                        live = (*refs != 0 && *extent_gen == header_gen);
                } else {
@@ -107,7 +107,7 @@ index a6db24a9b3b60..bc6c11b2ad392 100644
        }
        up_read(&fs_info->commit_root_sem);
        btrfs_free_path(path);
-@@ -3820,9 +3830,15 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3837,9 +3847,15 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
                                (u64)sectornr * fs_info->sectorsize;
                        u64 refs;
                        u64 egen;
@@ -126,7 +126,7 @@ index a6db24a9b3b60..bc6c11b2ad392 100644
                                continue;
                        }
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 6bd07e15fe707..73bd1b7ad1c08 100644
+index baa3c4e780120..486af39185555 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1233,6 +1233,7 @@ static ssize_t btrfs_stripe_park_stats_show(struct kobject *kobj,
index 1af6506cfd39ab236dba62ce3d7ab7f45e2c4d56..53739a1e1fcb96e758b700a0a2ba28f5b7ed3541 100644 (file)
@@ -1,4 +1,4 @@
-From 35ac1b2bd14ce5778f590dbff49320ac7750f1fc Mon Sep 17 00:00:00 2001
+From 8b790906dd5d1c4486ad7852adb9545571cb05e4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:02:29 -0400
 Subject: [RFC PATCH 095/116] btrfs: raid56: stop the park timer before
@@ -26,10 +26,10 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 24 insertions(+)
 
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 419a3eb7527cb..8a2e1103e1f93 100644
+index 826341066b242..f54d82a6c7c6d 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -3849,6 +3849,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
+@@ -3869,6 +3869,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
        invalidate_and_check_btree_folios(fs_info);
  
  fail_sb_buffer:
@@ -37,7 +37,7 @@ index 419a3eb7527cb..8a2e1103e1f93 100644
        btrfs_stop_all_workers(fs_info);
        btrfs_free_open_stripe_runs(fs_info);
        btrfs_free_block_groups(fs_info);
-@@ -4613,6 +4614,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
+@@ -4633,6 +4634,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
         * submit after we stop all workers.
         */
        invalidate_and_check_btree_folios(fs_info);
@@ -46,10 +46,10 @@ index 419a3eb7527cb..8a2e1103e1f93 100644
  
        /*
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index bc6c11b2ad392..f789836e5f424 100644
+index 802b0eb7ecc39..d90843bf98816 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -651,6 +651,27 @@ static void btrfs_clear_rbio_cache(struct btrfs_fs_info *info)
+@@ -655,6 +655,27 @@ static void btrfs_clear_rbio_cache(struct btrfs_fs_info *info)
        spin_unlock(&table->cache_lock);
  }
  
@@ -78,10 +78,10 @@ index bc6c11b2ad392..f789836e5f424 100644
   * remove all cached entries and free the hash table
   * used by unmount
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index 2fc1f05c6e66d..313c19591bf62 100644
+index bd3b73f040f9a..22687b6194f93 100644
 --- a/fs/btrfs/raid56.h
 +++ b/fs/btrfs/raid56.h
-@@ -317,6 +317,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
+@@ -312,6 +312,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
  void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
  void btrfs_flush_parked_rbios(struct btrfs_fs_info *fs_info, u64 start,
                              u64 num_bytes, bool force);
index 3fa63c7fe11f216273b36c75358ad8f964504eec..3754d5931c590259af0e9cf697eb08f3cefbbfbb 100644 (file)
@@ -1,4 +1,4 @@
-From 3bdfa7627870621a7dff695e25079fb4d77f86ca Mon Sep 17 00:00:00 2001
+From 7fbce6419dfccaf276d7e2fe080e7e29fa6f24d0 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:02:46 -0400
 Subject: [RFC PATCH 096/116] btrfs: stripe_alloc: order the filesystem error
@@ -23,7 +23,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 7 insertions(+)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index e4f95238c1501..a2e4af531955b 100644
+index d5fa24cbf43d8..a924d6ff5cc47 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -3323,6 +3323,13 @@ void btrfs_wake_open_stripe_waiters(struct btrfs_fs_info *fs_info)
index 4cde4f3b92e5558f06f84e01e9838bb780a40c26..f50320c03aa52d2b7ef6a9dbaeccf6b09add403f 100644 (file)
@@ -1,4 +1,4 @@
-From 7ff9ffb31eedb49f8c241d91098520668eccd568 Mon Sep 17 00:00:00 2001
+From e7542b1e8cc8eb37a3ca07e3faf4cd3376cdd783 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:03:09 -0400
 Subject: [RFC PATCH 097/116] btrfs: raid56: set a padded rbio's data bitmap
@@ -23,10 +23,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index f789836e5f424..b4c9e419501a2 100644
+index d90843bf98816..9f3647a98f4e2 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3613,8 +3613,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3630,8 +3630,14 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
        }
  
        set_bit(RBIO_PADDED_BIT, &rbio->flags);
index a7a68204434d1100e03d3b28aeb80b644e66d316..7f564ffc6a856a5165c3452fe6488864424f5e80 100644 (file)
@@ -1,4 +1,4 @@
-From 135c4cb527ac0bc0111b37dba64144b2cb73338a Mon Sep 17 00:00:00 2001
+From b12511e299112bd2a3d0b1d758611ecfa3720ca4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:05:05 -0400
 Subject: [RFC PATCH 098/116] btrfs: stripe_alloc: forget the failed-claim
@@ -22,10 +22,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 2 insertions(+)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index cb9d3e3bcc804..97f681773d7f2 100644
+index 0d006a25295a9..aa6103d3a79b6 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1859,6 +1859,8 @@ static void __btrfs_return_cluster_to_free_space(
+@@ -1869,6 +1869,8 @@ static void __btrfs_return_cluster_to_free_space(
        cluster->block_group = NULL;
        cluster->window_start = 0;
        list_del_init(&cluster->block_group_list);
index fcad3448f626632da1dcebcfb88b5df215dab435..f57558008cea4f8135f55a5f2eab3d0b718eb64a 100644 (file)
@@ -1,4 +1,4 @@
-From 298f642fc8d19cf79aa54bc8be36dfd0b9eafa43 Mon Sep 17 00:00:00 2001
+From 05511b2cb911cfb6aec742b3e271986f6c461985 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:05:32 -0400
 Subject: [RFC PATCH 099/116] btrfs: stripe_alloc: do not let a remount revert
@@ -22,7 +22,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 10 insertions(+)
 
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index d329181b98e9e..1f4833952ae6d 100644
+index 903bce51fb1fd..cc88140377e74 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
 @@ -1530,6 +1530,16 @@ static int btrfs_reconfigure(struct fs_context *fc)
index 47b24354c13dc7658752a4d06f94a71bfc3ff5d0..76d513901552a4ab905058f124a5e03207c0d3a1 100644 (file)
@@ -1,4 +1,4 @@
-From 778a1ddcdd8631bd4727f83e0cb42c05db605b62 Mon Sep 17 00:00:00 2001
+From 04e92cdc7e5252ff18b6109cea7e2a49023a3c75 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:06:05 -0400
 Subject: [RFC PATCH 100/116] btrfs: stripe_alloc: do not block a NOWAIT write
@@ -25,7 +25,7 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 8 insertions(+), 5 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index a2e4af531955b..eab4ecf54f01f 100644
+index a924d6ff5cc47..e1a1a65e6d62d 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1869,7 +1869,7 @@ static bool stripe_extents_owned_by(struct btrfs_fs_info *fs_info,
@@ -67,7 +67,7 @@ index c4e043ecacca5..f5c5ed1b04345 100644
  void btrfs_show_stripe_rmw(struct seq_file *seq, u32 mask);
  void btrfs_log_settle_stripes(struct btrfs_inode *inode, u64 file_start,
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index 512d4c579b4e3..cb59591a9cda4 100644
+index d5732d8938f14..52ae8dd17457d 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1888,7 +1888,8 @@ static int can_nocow_file_extent(struct btrfs_path *path,
index 682e8d1f68f888855e5372d57511eca03506af9a..27d7be2474c2c0f99e60589c250a310ca0f53c62 100644 (file)
@@ -1,4 +1,4 @@
-From 5b09cd9ba9aeeafe54ca703dbc86bf8d7631ac1c Mon Sep 17 00:00:00 2001
+From 713b3a800b3e6860fc833e693eab59e5ca13a38f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:06:45 -0400
 Subject: [RFC PATCH 101/116] btrfs: stripe_alloc: keep the head of a claimed
@@ -22,10 +22,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 24 insertions(+), 5 deletions(-)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 97f681773d7f2..dde71181ba6e6 100644
+index aa6103d3a79b6..7026742de2adf 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2878,6 +2878,13 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2888,6 +2888,13 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
        /* Claims are always whole stripes; tolerate an unaligned want_bytes. */
        want_bytes = div64_u64(want_bytes, fsl) * fsl;
  
@@ -39,7 +39,7 @@ index 97f681773d7f2..dde71181ba6e6 100644
        spin_lock(&ctl->tree_lock);
  
        /*
-@@ -2908,11 +2915,14 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2918,11 +2925,14 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                 * for the belt-and-braces case of a run strictly inside
                 * one extent entry, whose removal splits it in two.
                 */
@@ -59,7 +59,7 @@ index 97f681773d7f2..dde71181ba6e6 100644
                if (!find_free_stripe_run_slow(block_group, want_bytes,
                                               &run_start, &run_len)) {
                        /*
-@@ -2957,6 +2967,15 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2967,6 +2977,15 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                } else {
                        kmem_cache_free(btrfs_free_space_cachep, entry);
                }
index 2a4b72e47e38fb2e875302268cb494242b3b9af1..fe77568ec9c521b0ca9d82db280347353d42b65d 100644 (file)
@@ -1,4 +1,4 @@
-From c85af373e485e1318e807ed24e2637e2eeaff7a9 Mon Sep 17 00:00:00 2001
+From 18da8ca4c637ee9ad9385a5b3fecb78120d6727a Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:06:59 -0400
 Subject: [RFC PATCH 102/116] btrfs: stripe_meta: check the block group lookup
index e957884fbfb57431331142f4c9f45e215f027b6c..fcc024a10c98d0c6681202cfea948f8e4cbf8a89 100644 (file)
@@ -1,4 +1,4 @@
-From 5571f78278ce68eb576cb4699b3163c73ee669aa Mon Sep 17 00:00:00 2001
+From 7664407e70b855c087b2534e927da17385523de2 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:07:22 -0400
 Subject: [RFC PATCH 103/116] btrfs: stripe_alloc: remove the unused
index e271ce1b8cd3a56f4bc8e0df02169e8fb8cde0eb..f9ed37841ef244dff3283a2f416413712e852659 100644 (file)
@@ -1,4 +1,4 @@
-From b10ebcd041372e1dcc2caf3f83d25d6507b9af56 Mon Sep 17 00:00:00 2001
+From 1f653944834fd224ccbb4c309f1290acd4b4bc49 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:16:09 -0400
 Subject: [RFC PATCH 104/116] btrfs: stripe_alloc: correct and trim the block
@@ -30,7 +30,7 @@ Assisted-by: Claude:claude-opus-5-5
  2 files changed, 336 insertions(+), 521 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index eab4ecf54f01f..c9711ccd07c4a 100644
+index e1a1a65e6d62d..96f5daaafd4ec 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -449,44 +449,41 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group *bg)
@@ -1181,7 +1181,7 @@ index eab4ecf54f01f..c9711ccd07c4a 100644
   */
  void btrfs_stripe_check_write(struct btrfs_fs_info *fs_info,
                              u64 full_stripe_start, bool sub_stripe)
-@@ -5526,13 +5354,11 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5528,13 +5356,11 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
  
        /*
         * A stripe_alloc / stripe_meta group's live extents can only move into
@@ -1200,7 +1200,7 @@ index eab4ecf54f01f..c9711ccd07c4a 100644
         */
        if (btrfs_is_stripe_alloc_bg(bg) || btrfs_is_stripe_meta_bg(bg)) {
                u64 elsewhere = READ_ONCE(space_info->bytes_stripe_claimable);
-@@ -5726,8 +5552,10 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
+@@ -5728,8 +5554,10 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
        LIST_HEAD(retry_list);
        int reclaimed = 0;
  
index 75707432b2c5dfe2f2980a2c98a3610f814372bc..a0696316707ebc6d92601dac42091ce92d19e11e 100644 (file)
@@ -1,4 +1,4 @@
-From 90f0201fde06e9443c9a760e358581ed631740a5 Mon Sep 17 00:00:00 2001
+From b2f629981ca637a71e9204ba74bc004d6a8a4629 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 01:17:49 -0400
 Subject: [RFC PATCH 105/116] btrfs: stripe_alloc: correct and trim the
@@ -131,10 +131,10 @@ index fc0421de26bf4..8cb09b291597a 100644
        u64 log_run_hint;
  
 diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
-index 947696e84353b..ef776116b8d46 100644
+index fd69a7d34f60c..79defb1cc0a1f 100644
 --- a/fs/btrfs/defrag.c
 +++ b/fs/btrfs/defrag.c
-@@ -1255,15 +1255,14 @@ static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len,
+@@ -1264,15 +1264,14 @@ static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len,
  }
  
  /*
@@ -158,7 +158,7 @@ index 947696e84353b..ef776116b8d46 100644
   */
  static int carry_one_range(struct btrfs_inode *inode, u64 start, u64 len,
                           u64 disk_bytenr)
-@@ -1373,11 +1372,11 @@ static int carry_one_range(struct btrfs_inode *inode, u64 start, u64 len,
+@@ -1382,11 +1381,11 @@ static int carry_one_range(struct btrfs_inode *inode, u64 start, u64 len,
  /*
   * Consume the inode's carry table (see struct btrfs_log_carry): re-dirty
   * every recorded range so the caller's upcoming writeback carries them
@@ -210,10 +210,10 @@ index 4748c90897f5e..f0b1937b4e29f 100644
        if (flush == BTRFS_RESERVE_FLUSH_DATA &&
            btrfs_test_opt(fs_info, STRIPE_ALLOC)) {
 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
-index 8a2e1103e1f93..4fdc6a083692f 100644
+index f54d82a6c7c6d..27faf262898f7 100644
 --- a/fs/btrfs/disk-io.c
 +++ b/fs/btrfs/disk-io.c
-@@ -2787,11 +2787,9 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
+@@ -2807,11 +2807,9 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
        INIT_LIST_HEAD(&fs_info->open_stripe_bgs);
        INIT_WORK(&fs_info->stripe_alloc_enable_work, btrfs_stripe_alloc_enable_work);
        /*
@@ -228,7 +228,7 @@ index 8a2e1103e1f93..4fdc6a083692f 100644
         */
        fs_info->stripe_log_run = true;
        fs_info->stripe_log_data_shared = true;
-@@ -3765,14 +3763,9 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
+@@ -3785,14 +3783,9 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
  
        /*
         * Load the top-level root directory's properties (the stripe_alloc
@@ -465,10 +465,10 @@ index 0a6e59c11b1f1..1af09fbaf2bf9 100644
        btrfs_carry_log_tail(inode);
  
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index dde71181ba6e6..6977160d6d38e 100644
+index 7026742de2adf..b7caca10cb10d 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1415,17 +1415,12 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1425,17 +1425,12 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
                kmem_cache_free(btrfs_free_space_cachep, info);
  out:
        /*
@@ -492,7 +492,7 @@ index dde71181ba6e6..6977160d6d38e 100644
         */
        btrfs_discard_update_discardable(block_group);
        spin_unlock(&ctl->tree_lock);
-@@ -1507,13 +1502,9 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
+@@ -1517,13 +1512,9 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
  static void stripe_unusable_mark_dirty(struct btrfs_block_group *bg);
  
  /*
@@ -509,7 +509,7 @@ index dde71181ba6e6..6977160d6d38e 100644
   *
   * The group's value and the space_info total change in one sinfo->lock
   * section, as everywhere else, so that btrfs_scan_stripe_unusable(), which
-@@ -1561,20 +1552,12 @@ static u64 stripe_touched_bytes(const struct btrfs_block_group *bg,
+@@ -1571,20 +1562,12 @@ static u64 stripe_touched_bytes(const struct btrfs_block_group *bg,
  }
  
  /*
@@ -536,7 +536,7 @@ index dde71181ba6e6..6977160d6d38e 100644
   */
  static void stripe_unusable_account_add(struct btrfs_block_group *bg,
                                        u64 bytenr, u64 size)
-@@ -2090,14 +2073,12 @@ static u64 stripe_free_walk(struct btrfs_block_group *bg, u32 *freep)
+@@ -2100,14 +2083,12 @@ static u64 stripe_free_walk(struct btrfs_block_group *bg, u32 *freep)
  }
  
  /*
@@ -557,7 +557,7 @@ index dde71181ba6e6..6977160d6d38e 100644
   */
  static u64 stripe_unusable_scan(struct btrfs_block_group *bg, u32 *freep,
                                u64 nstripes)
-@@ -2270,21 +2251,14 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2280,21 +2261,14 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
  
  
  /*
@@ -587,7 +587,7 @@ index dde71181ba6e6..6977160d6d38e 100644
   */
  enum stripe_reclaim_kind {
        STRIPE_RECLAIM_NONE,
-@@ -2314,12 +2288,10 @@ static enum stripe_reclaim_kind stripe_bg_reclaim_kind(struct btrfs_block_group
+@@ -2324,12 +2298,10 @@ static enum stripe_reclaim_kind stripe_bg_reclaim_kind(struct btrfs_block_group
                return STRIPE_RECLAIM_NONE;
        if (used >= mult_perc(bg->length, thresh)) {
                /*
@@ -604,7 +604,7 @@ index dde71181ba6e6..6977160d6d38e 100644
                 */
                const u32 pct = READ_ONCE(bg->fs_info->stripe_compact);
  
-@@ -2386,14 +2358,10 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2396,14 +2368,10 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
  
                /*
                 * The incremental rules may only under-count claimable
@@ -623,7 +623,7 @@ index dde71181ba6e6..6977160d6d38e 100644
                 */
                WARN_RATELIMIT(bg->stripe_claimable > scanned,
                          "bg %llu incremental stripe_claimable %llu above scanned %llu",
-@@ -2423,11 +2391,9 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2433,11 +2401,9 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
        kvfree(freep);
        if (reclaim) {
                /*
@@ -638,7 +638,7 @@ index dde71181ba6e6..6977160d6d38e 100644
                 */
                spin_lock(&bg->lock);
                if (btrfs_mark_bg_to_reclaim(bg))
-@@ -2505,29 +2471,6 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
+@@ -2515,29 +2481,6 @@ static bool find_stripe_run_in_bitmap(struct btrfs_free_space_ctl *ctl,
        return false;
  }
  
@@ -668,7 +668,7 @@ index dde71181ba6e6..6977160d6d38e 100644
  static bool claim_stripe_run_pieces(struct btrfs_block_group *block_group,
                                    u64 start, u64 len,
                                    struct btrfs_free_space *spare);
-@@ -2836,8 +2779,10 @@ static bool claim_stripe_run_pieces(struct btrfs_block_group *block_group,
+@@ -2846,8 +2789,10 @@ static bool claim_stripe_run_pieces(struct btrfs_block_group *block_group,
                                ret2 = link_free_space(ctl, info);
                                ASSERT(!ret2); /* -EEXIST; Logic error */
                        } else {
@@ -681,7 +681,7 @@ index dde71181ba6e6..6977160d6d38e 100644
                                ASSERT(!spare_used);
                                spare->offset = off + piece;
                                spare->bytes = e_end - spare->offset;
-@@ -2856,6 +2801,23 @@ static bool claim_stripe_run_pieces(struct btrfs_block_group *block_group,
+@@ -2866,6 +2811,23 @@ static bool claim_stripe_run_pieces(struct btrfs_block_group *block_group,
        return spare_used;
  }
  
@@ -705,7 +705,7 @@ index dde71181ba6e6..6977160d6d38e 100644
  int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
                                u64 want_bytes, u64 *start, u64 *len)
  {
-@@ -2888,16 +2850,11 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
+@@ -2898,16 +2860,11 @@ int btrfs_claim_free_stripe_run(struct btrfs_block_group *block_group,
        spin_lock(&ctl->tree_lock);
  
        /*
@@ -856,7 +856,7 @@ index 096434fa4ff14..aec2ff64f0704 100644
        struct work_struct async_data_reclaim_work;
        struct work_struct preempt_reclaim_work;
 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index cb59591a9cda4..9f5930298a625 100644
+index 52ae8dd17457d..bff140549c744 100644
 --- a/fs/btrfs/inode.c
 +++ b/fs/btrfs/inode.c
 @@ -1877,10 +1877,11 @@ static int can_nocow_file_extent(struct btrfs_path *path,
@@ -927,7 +927,7 @@ index 9058360304270..741ccacb42f84 100644
  void btrfs_load_stripe_alloc_prop_early(struct btrfs_fs_info *fs_info)
  {
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index b4c9e419501a2..b584d8fa86e07 100644
+index 9f3647a98f4e2..60e636821c40a 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -49,11 +49,10 @@
@@ -981,7 +981,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
  /* Scan period of the park timer while anything is parked. */
  #define BTRFS_RBIO_PARK_SCAN_MS               3
  
-@@ -688,25 +681,18 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
+@@ -692,25 +685,18 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
  }
  
  /*
@@ -1018,7 +1018,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
   */
  static bool rbio_needs_pin(const struct btrfs_raid_bio *rbio)
  {
-@@ -841,8 +827,8 @@ static void rbio_pins_low(struct btrfs_stripe_hash_table *table)
+@@ -845,8 +831,8 @@ static void rbio_pins_low(struct btrfs_stripe_hash_table *table)
        u64 gen;
  
        /*
@@ -1029,7 +1029,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
         */
        if (!time_after(jiffies, table->pin_sweep_jiffies + RBIO_PIN_SWEEP_INTERVAL))
                return;
-@@ -877,8 +863,8 @@ void btrfs_rbio_unpin_stale(struct btrfs_fs_info *fs_info)
+@@ -881,8 +867,8 @@ void btrfs_rbio_unpin_stale(struct btrfs_fs_info *fs_info)
  /*
   * Cached and pinned rbios now, for sysfs stripe_park_stats.  @live re-checks
   * each pin against its run, as the prune does: a pin whose run has finished
@@ -1040,7 +1040,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
   */
  void btrfs_rbio_cache_usage(struct btrfs_fs_info *fs_info, int *cached,
                            int *pinned, int *live, int *live_by_class)
-@@ -1118,11 +1104,9 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -1123,11 +1109,9 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
                return false;
  
        /*
@@ -1055,7 +1055,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
         */
        if (class == BTRFS_STRIPE_RUN_NOCOW &&
            timeout_ms == sync_timeout_ms)
-@@ -1141,15 +1125,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -1146,15 +1130,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
                return false;
  
        /*
@@ -1076,7 +1076,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
         */
        {
                unsigned int congestion =
-@@ -1172,18 +1152,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
+@@ -1177,18 +1157,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
        rbio->park_stuck_deadline = jiffies +
                msecs_to_jiffies(timeout_ms * 10);
        /*
@@ -1100,7 +1100,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
         */
        refcount_inc(&rbio->refs);
        list_add_tail(&rbio->parked_node, &table->parked);
-@@ -1650,7 +1623,7 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
+@@ -1655,7 +1628,7 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t status)
        rbio->csum_buf = NULL;
        rbio->csum_bitmap = NULL;
  
@@ -1109,7 +1109,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
        if (rbio->operation == BTRFS_RBIO_WRITE && status == BLK_STS_OK)
                rbio_mark_written(rbio);
  
-@@ -3500,12 +3473,11 @@ static void rbio_count_rmw_reason(struct btrfs_raid_bio *rbio)
+@@ -3517,12 +3490,11 @@ static void rbio_count_rmw_reason(struct btrfs_raid_bio *rbio)
  }
  
  /*
@@ -1127,7 +1127,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
   */
  static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
  {
-@@ -3553,14 +3525,10 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
+@@ -3570,14 +3542,10 @@ static bool rmw_try_pad_full(struct btrfs_raid_bio *rbio)
                        covered++;
  
        /*
@@ -1146,7 +1146,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
         */
        for (i = 0; i < nsectors; i++) {
                if (rbio->bio_paddrs[i * rbio->sector_nsteps] != INVALID_PADDR)
-@@ -3764,28 +3732,21 @@ static int rmw_block_referenced(struct btrfs_fs_info *fs_info, u64 bytenr,
+@@ -3781,28 +3749,21 @@ static int rmw_block_referenced(struct btrfs_fs_info *fs_info, u64 bytenr,
  }
  
  /*
@@ -1188,7 +1188,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
   */
  static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
  {
-@@ -3795,12 +3756,8 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3812,12 +3773,8 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
        u64 write_gen = 0;
  
        /*
@@ -1203,7 +1203,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
         */
        if (rbio->bioc->map_type & BTRFS_BLOCK_GROUP_DATA)
                return;
-@@ -3840,14 +3797,10 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3857,14 +3814,10 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
                        continue;
                }
                /*
@@ -1222,7 +1222,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
                 */
                {
                        const int stripe_nr = i / rbio->stripe_nsectors;
-@@ -3879,20 +3832,9 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3896,20 +3849,9 @@ static void audit_uncovered_rmw(struct btrfs_raid_bio *rbio)
  }
  
  /*
@@ -1246,7 +1246,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
   */
  static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
  {
-@@ -3902,11 +3844,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3919,11 +3861,7 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
  
        if (!btrfs_test_opt(fs_info, STRIPE_ALLOC))
                return;
@@ -1259,7 +1259,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
        if ((rbio->bioc->map_type & BTRFS_BLOCK_GROUP_DATA) &&
            !(rbio->bioc->map_type & BTRFS_BLOCK_GROUP_METADATA))
                return;
-@@ -3914,12 +3852,11 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
+@@ -3931,12 +3869,11 @@ static void report_uncovered_rmw(struct btrfs_raid_bio *rbio)
        atomic64_inc(&fs_info->stripe_park_stats.meta_rmw);
        audit_uncovered_rmw(rbio);
        /*
@@ -1277,7 +1277,7 @@ index b4c9e419501a2..b584d8fa86e07 100644
         */
        bg = btrfs_lookup_block_group(fs_info, rbio->bioc->full_stripe_logical);
        if (bg) {
-@@ -3961,18 +3898,11 @@ static void rmw_rbio(struct btrfs_raid_bio *rbio)
+@@ -3978,18 +3915,11 @@ 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.
         *
@@ -1302,10 +1302,10 @@ index b4c9e419501a2..b584d8fa86e07 100644
        if (!rbio_is_full(rbio) && !rmw_try_pad_full(rbio) &&
            need_read_stripe_sectors(rbio)) {
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index 289ba91be6ab2..d6d4bfffe3fe1 100644
+index 781abadf24362..061f94e4a65ff 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -400,10 +400,9 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
+@@ -399,10 +399,9 @@ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group)
        factor = btrfs_bg_type_to_factor(block_group->flags);
  
        /*
@@ -1319,7 +1319,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
         */
        if ((block_group->flags & BTRFS_BLOCK_GROUP_DATA) &&
            (block_group->flags & BTRFS_BLOCK_GROUP_RAID56_MASK) &&
-@@ -439,23 +438,17 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
+@@ -437,23 +436,17 @@ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group)
  /*
   * stripe_alloc pessimistic reservation margin.
   *
@@ -1353,7 +1353,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
   */
  void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
  {
-@@ -476,7 +469,7 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
+@@ -474,7 +467,7 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
                /* charges and releases both live */
        } else if (mod > 0 || READ_ONCE(sinfo->bytes_stripe_margin) == 0) {
                /*
@@ -1362,7 +1362,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
                 * counter has drained (with no charges it only falls, so
                 * reading zero is stable).
                 */
-@@ -495,25 +488,14 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
+@@ -493,25 +486,14 @@ void btrfs_stripe_margin_mod(struct btrfs_inode *inode, int mod)
  }
  
  /*
@@ -1396,7 +1396,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
   */
  static u64 stripe_hold_locked(struct btrfs_space_info *space_info)
  {
-@@ -720,22 +702,15 @@ static void remove_ticket(struct btrfs_space_info *space_info,
+@@ -718,22 +700,15 @@ static void remove_ticket(struct btrfs_space_info *space_info,
  }
  
  /*
@@ -1428,7 +1428,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
   */
  static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 bytes,
                                   bool reloc)
-@@ -757,49 +732,30 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
+@@ -755,49 +730,30 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
  
                if (reloc) {
                        /*
@@ -1492,7 +1492,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
                 */
                bytes += space_info->bytes_stripe_margin;
                return space_info->bytes_may_use + bytes <= supply;
-@@ -1351,20 +1307,14 @@ static bool steal_from_global_rsv(struct btrfs_space_info *space_info,
+@@ -1349,20 +1305,14 @@ static bool steal_from_global_rsv(struct btrfs_space_info *space_info,
                return false;
  
        /*
@@ -1521,7 +1521,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
         */
        if (space_info->bytes_stripe_reserve && !ticket->mount_cleanup &&
            space_info->bytes_stripe_claimable <
-@@ -2249,21 +2199,11 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
+@@ -2247,21 +2197,11 @@ int btrfs_reserve_metadata_bytes(struct btrfs_space_info *space_info,
        return ret;
  }
  
@@ -1544,7 +1544,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
   */
  static bool reloc_alloc_data_chunk(struct btrfs_space_info *space_info)
  {
-@@ -2281,6 +2221,16 @@ static bool reloc_alloc_data_chunk(struct btrfs_space_info *space_info)
+@@ -2279,6 +2219,16 @@ static bool reloc_alloc_data_chunk(struct btrfs_space_info *space_info)
        return ret > 0;
  }
  
@@ -1561,7 +1561,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
  int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
                             enum btrfs_reserve_flush_enum flush)
  {
-@@ -2313,17 +2263,12 @@ int btrfs_reserve_data_bytes_held(struct btrfs_space_info *space_info, u64 bytes
+@@ -2311,17 +2261,12 @@ int btrfs_reserve_data_bytes_held(struct btrfs_space_info *space_info, u64 bytes
                *held = 0;
        ret = __reserve_bytes(space_info, bytes, flush, held);
        /*
@@ -1586,7 +1586,7 @@ index 289ba91be6ab2..d6d4bfffe3fe1 100644
        while (ret == -ENOSPC && flush == BTRFS_RESERVE_FLUSH_DATA_RELOC &&
               reloc_alloc_data_chunk(space_info))
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 9031719314ec2..ee585b723f0f1 100644
+index 61f942e0141d0..3667af16afb33 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -158,14 +158,12 @@ struct btrfs_space_info {
@@ -1658,7 +1658,7 @@ index 9031719314ec2..ee585b723f0f1 100644
  
        u64 max_extent_size;    /* This will hold the maximum extent size of
 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index 1f4833952ae6d..8e47d5e66c63e 100644
+index cc88140377e74..bce3a12032b6a 100644
 --- a/fs/btrfs/super.c
 +++ b/fs/btrfs/super.c
 @@ -944,13 +944,8 @@ static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objec
@@ -1678,7 +1678,7 @@ index 1f4833952ae6d..8e47d5e66c63e 100644
  static void btrfs_emit_stripe_alloc_state(struct btrfs_fs_info *info)
  {
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 73bd1b7ad1c08..9589d4d7eb270 100644
+index 486af39185555..fe6bbffb1b3be 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -521,11 +521,6 @@ static const struct attribute *discard_attrs[] = {
index 75968bd6483ade4292a07a6db9934f037a910f38..cd961f074350a9e1873ba51901dd01e6ff64f30c 100644 (file)
@@ -1,4 +1,4 @@
-From bbc77261bfccfb82874222569e9b7f647e08ce5f Mon Sep 17 00:00:00 2001
+From 6fa8a30f00c91aba4e3779ea7fb30bc38546a73f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 10:20:03 -0400
 Subject: [RFC PATCH 106/116] btrfs: stripe_meta: keep waiting for metadata
@@ -25,7 +25,7 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 13 insertions(+), 8 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index c9711ccd07c4a..38055b6748033 100644
+index 96f5daaafd4ec..b9206ccce5fb9 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -3272,6 +3272,7 @@ void btrfs_retire_meta_stripes(struct btrfs_fs_info *fs_info, u64 transid)
index ab2a3ba030c71d009d24fd8a4ed66f501499e100..a36354d40496b472de998799530fdbdf9be99bbf 100644 (file)
@@ -1,4 +1,4 @@
-From 1fcae9e2ff2dfbc8b6f2514e9eb6b2fd4f8ef18f Mon Sep 17 00:00:00 2001
+From ea5b896d151b75329a16fb3d1019842f458ab0d7 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 9 Oct 2026 11:19:42 -0400
 Subject: [RFC PATCH 107/116] btrfs: stripe_alloc: remove pad refusal reasons
@@ -87,10 +87,10 @@ index aec2ff64f0704..c277dcc65bd14 100644
                atomic64_t hole_reloc_only;
                atomic64_t hole_reloc_sectors;
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index b584d8fa86e07..dc571489ea25b 100644
+index 60e636821c40a..601cb82895b57 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
-@@ -3124,6 +3124,8 @@ static void rbio_record_pad(struct btrfs_raid_bio *rbio,
+@@ -3141,6 +3141,8 @@ static void rbio_record_pad(struct btrfs_raid_bio *rbio,
  
  static_assert(BTRFS_STRIPE_PAD_NR_REASONS + 1 ==
              ARRAY_SIZE(((struct btrfs_fs_info *)0)->stripe_park_stats.data_rmw_by));
@@ -100,7 +100,7 @@ index b584d8fa86e07..dc571489ea25b 100644
              ARRAY_SIZE(((struct btrfs_fs_info *)0)->stripe_park_stats.data_rmw_norun));
  
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 9589d4d7eb270..71573912bfc08 100644
+index fe6bbffb1b3be..512b556e36326 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -567,12 +567,10 @@ static ssize_t btrfs_stripe_rmw_audit_stats_show(struct kobject *kobj,
index 8aa181ec57755cba8ec1ab9c993b52fcf772c064..0e5aaedd11a6a12d83a5c660ad6fca43745e4d11 100644 (file)
@@ -1,4 +1,4 @@
-From ddcc84d0004077983aec60e5e6cd948b25f58caf Mon Sep 17 00:00:00 2001
+From ba2e08f16cdea789a532d30c88646e3e4f409653 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 108/116] btrfs: stripe_alloc: count and log ordered
@@ -27,7 +27,7 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 48 insertions(+), 10 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 38055b6748033..560197ef42362 100644
+index b9206ccce5fb9..8b1d9e34e6714 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -2947,25 +2947,36 @@ struct btrfs_open_stripe_run *btrfs_get_open_stripe_run(
@@ -140,7 +140,7 @@ index 5bd8ff43f9d52..cb32eff2fddc0 100644
  
  static bool can_finish_ordered_extent(struct btrfs_ordered_extent *ordered,
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 71573912bfc08..9928527c7394c 100644
+index 512b556e36326..d3231cc95f6dc 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1318,7 +1318,9 @@ static ssize_t btrfs_stripe_run_stats_show(struct kobject *kobj,
index 39eb8677239bf78d8293be8fd1f539d103dd2061..f7a2ece853da6f0f22ce8a702362fcf21a77790c 100644 (file)
@@ -1,4 +1,4 @@
-From 2c86e702355125e0779d667a08699cf34da557e9 Mon Sep 17 00:00:00 2001
+From 9254f34ffae08be338d71b0b1f244404eb5b99a6 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 109/116] btrfs: stripe_alloc: skip RAID5/6 groups that are
@@ -33,10 +33,10 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 38 insertions(+), 5 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 560197ef42362..a4eb800c02806 100644
+index 8b1d9e34e6714..48c8d0869edcf 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -5966,6 +5966,8 @@ static struct btrfs_block_group *btrfs_create_block_group(
+@@ -5969,6 +5969,8 @@ static struct btrfs_block_group *btrfs_create_block_group(
  
        cache->fs_info = fs_info;
        cache->full_stripe_len = btrfs_full_stripe_len(fs_info, start);
@@ -107,10 +107,10 @@ index 4178d2541b8ae..379eee5b4aab4 100644
  
  static int do_allocation_stripe(struct btrfs_block_group *block_group,
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
-index 422bd66239239..f8f493eac205f 100644
+index 6e7419b87ddcd..9f689c4c9d7f8 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
-@@ -6604,6 +6604,27 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
+@@ -6617,6 +6617,27 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
        return len;
  }
  
@@ -139,15 +139,15 @@ index 422bd66239239..f8f493eac205f 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 e99caf4e36a1e..c2c8cabe4135f 100644
+index 982d88264ca5a..f57b73ae996bc 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
-@@ -801,6 +801,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev,
+@@ -805,6 +805,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);
 +bool btrfs_chunk_raid56_mirrored(struct btrfs_fs_info *fs_info, u64 logical);
- u64 btrfs_calc_stripe_length(const struct btrfs_chunk_map *map);
+ u64 btrfs_calc_dev_extent_size(const struct btrfs_chunk_map *map);
  int btrfs_nr_parity_stripes(u64 type);
  int btrfs_chunk_alloc_add_chunk_item(struct btrfs_trans_handle *trans,
 -- 
index d8a163edd40f985263c6e4e0a41bff5fa0e308f3..89e63c93eaf29e67c8c6384a01b169ca3e2e944e 100644 (file)
@@ -1,4 +1,4 @@
-From 3a14de399288d7d5aea4e241184b0be04e773a58 Mon Sep 17 00:00:00 2001
+From 116fcc38d534f50f53f3ae98ee8ee5e328e4b98f Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 10 Oct 2026 14:29:22 -0400
 Subject: [RFC PATCH 110/116] btrfs: stripe_alloc: count single-data-stripe
@@ -41,10 +41,10 @@ Assisted-by: Claude:claude-opus-5-5
  6 files changed, 104 insertions(+), 14 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index a4eb800c02806..592d2f9534013 100644
+index 48c8d0869edcf..f31bef3c7afd1 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -4799,17 +4799,26 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -4801,17 +4801,26 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
                 * the bytes already admitted would no longer be placeable:
                 * otherwise their writebacks fail and the data is dropped.
                 */
@@ -74,7 +74,7 @@ index a4eb800c02806..592d2f9534013 100644
  
                        if (sinfo->bytes_may_use + sinfo->bytes_stripe_margin >
                            supply - mine)
-@@ -4861,8 +4870,10 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
+@@ -4863,8 +4872,10 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
         * contribution so it is not subtracted twice.  Idempotent, so repeated
         * ro increments are harmless.
         */
@@ -86,7 +86,7 @@ index a4eb800c02806..592d2f9534013 100644
        if (ret == -ENOSPC && btrfs_test_opt(cache->fs_info, ENOSPC_DEBUG)) {
                btrfs_info(cache->fs_info,
                        "unable to make block group %llu ro", cache->start);
-@@ -6830,8 +6841,10 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
+@@ -6833,8 +6844,10 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
         * the current free space (it may have changed while read-only).  The
         * scan re-adds this group's trapped free space to the space_info total.
         */
@@ -138,10 +138,10 @@ index 678f39315edb5..1a4d5b8b36f75 100644
  {
        lockdep_assert_held(&bg->lock);
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 6977160d6d38e..b9f4f7c49ee44 100644
+index b7caca10cb10d..0d302853bf0a2 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -540,6 +540,19 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
+@@ -550,6 +550,19 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
        return entry;
  }
  
@@ -161,7 +161,7 @@ index 6977160d6d38e..b9f4f7c49ee44 100644
  static inline void unlink_free_space(struct btrfs_free_space_ctl *ctl,
                                     struct btrfs_free_space *info,
                                     bool update_stat)
-@@ -556,7 +569,7 @@ static inline void unlink_free_space(struct btrfs_free_space_ctl *ctl,
+@@ -566,7 +579,7 @@ static inline void unlink_free_space(struct btrfs_free_space_ctl *ctl,
        }
  
        if (update_stat)
@@ -170,7 +170,7 @@ index 6977160d6d38e..b9f4f7c49ee44 100644
  }
  
  static int link_free_space(struct btrfs_free_space_ctl *ctl,
-@@ -578,7 +591,7 @@ static int link_free_space(struct btrfs_free_space_ctl *ctl,
+@@ -588,7 +601,7 @@ static int link_free_space(struct btrfs_free_space_ctl *ctl,
                ctl->discardable_bytes[BTRFS_STAT_CURR] += info->bytes;
        }
  
@@ -179,7 +179,7 @@ index 6977160d6d38e..b9f4f7c49ee44 100644
        ctl->free_extents++;
        return ret;
  }
-@@ -635,7 +648,7 @@ static inline void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,
+@@ -645,7 +658,7 @@ static inline void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,
        }
  
        if (update_stat)
@@ -188,7 +188,7 @@ index 6977160d6d38e..b9f4f7c49ee44 100644
  }
  
  static void btrfs_bitmap_set_bits(struct btrfs_free_space_ctl *ctl,
-@@ -659,7 +672,7 @@ static void btrfs_bitmap_set_bits(struct btrfs_free_space_ctl *ctl,
+@@ -669,7 +682,7 @@ static void btrfs_bitmap_set_bits(struct btrfs_free_space_ctl *ctl,
         */
        info->max_extent_size = 0;
        info->bytes += bytes;
@@ -197,7 +197,7 @@ index 6977160d6d38e..b9f4f7c49ee44 100644
  
        relink_bitmap_entry(ctl, info);
  
-@@ -1469,7 +1482,7 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
+@@ -1479,7 +1492,7 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
        to_unusable = size - to_free;
  
        spin_lock(&ctl->tree_lock);
@@ -206,7 +206,7 @@ index 6977160d6d38e..b9f4f7c49ee44 100644
        spin_unlock(&ctl->tree_lock);
        /*
         * If the block group is read-only, we should account freed space into
-@@ -2166,6 +2179,32 @@ static void stripe_return_clusters(struct btrfs_block_group *bg)
+@@ -2176,6 +2189,32 @@ static void stripe_return_clusters(struct btrfs_block_group *bg)
        spin_unlock(&cluster->refill_lock);
  }
  
@@ -239,7 +239,7 @@ index 6977160d6d38e..b9f4f7c49ee44 100644
  /*
   * Compute a stripe_alloc block group's initial trapped free space once its
   * free space cache is loaded, and enable incremental accounting from here on.
-@@ -3103,7 +3142,7 @@ u64 btrfs_alloc_from_cluster(struct btrfs_block_group *block_group,
+@@ -3113,7 +3152,7 @@ u64 btrfs_alloc_from_cluster(struct btrfs_block_group *block_group,
        if (!btrfs_free_space_trimmed(entry))
                atomic64_add(bytes, &discard_ctl->discard_bytes_saved);
  
@@ -261,10 +261,10 @@ index 09c41eeb48854..ceb933d51a169 100644
  bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg);
  bool btrfs_stripe_bg_wants_compaction(struct btrfs_block_group *bg);
 diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
-index d6d4bfffe3fe1..d56683fa00879 100644
+index 061f94e4a65ff..7859713404ff1 100644
 --- a/fs/btrfs/space-info.c
 +++ b/fs/btrfs/space-info.c
-@@ -433,6 +433,8 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
+@@ -431,6 +431,8 @@ void btrfs_add_bg_to_space_info(struct btrfs_block_group *block_group)
        down_write(&space_info->groups_sem);
        list_add_tail(&block_group->list, &space_info->block_groups[index]);
        up_write(&space_info->groups_sem);
@@ -273,7 +273,7 @@ index d6d4bfffe3fe1..d56683fa00879 100644
  }
  
  /*
-@@ -727,7 +729,14 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
+@@ -725,7 +727,14 @@ static bool stripe_claimable_admit(struct btrfs_space_info *space_info, u64 byte
         * runs can lose at the next commit.
         */
        {
@@ -289,7 +289,7 @@ index d6d4bfffe3fe1..d56683fa00879 100644
                const u64 dedicated = space_info->bytes_stripe_claimable_reloc;
  
                if (reloc) {
-@@ -845,14 +854,15 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
+@@ -843,14 +852,15 @@ static void __btrfs_dump_space_info(const struct btrfs_space_info *info)
                   (s64)(info->total_bytes - btrfs_space_info_used(info, true)),
                   info->full ? "" : "not ");
        btrfs_info(fs_info,
@@ -308,7 +308,7 @@ index d6d4bfffe3fe1..d56683fa00879 100644
  
  void btrfs_dump_space_info(struct btrfs_space_info *info, u64 bytes,
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index ee585b723f0f1..4dea6081d5253 100644
+index 3667af16afb33..43124031e1926 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -178,6 +178,12 @@ struct btrfs_space_info {
index 3721f61c4264393da478b0b863045b0927590442..dce817323d3ed677d994ece268ca5e1005e5c05e 100644 (file)
@@ -1,4 +1,4 @@
-From a1ba776d84f34898257042e6cc7e8426938c3453 Mon Sep 17 00:00:00 2001
+From 57bd7060bee3be492177305469ddf52aec1cf364 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sun, 11 Oct 2026 02:50:36 -0400
 Subject: [RFC PATCH 111/116] btrfs: stripe_alloc: account claimable stripes
@@ -43,7 +43,7 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 146 insertions(+), 14 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 592d2f9534013..65340f18ae7a4 100644
+index f31bef3c7afd1..53602f27a36af 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
 @@ -1583,6 +1583,30 @@ u64 btrfs_stripe_run_stranded_stripes(struct btrfs_block_group *bg, u32 *freep,
@@ -90,10 +90,10 @@ index 1a4d5b8b36f75..202d9f73678de 100644
                                u64 size);
  bool btrfs_stripe_run_range_usable(struct btrfs_block_group *bg,
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index b9f4f7c49ee44..7a0f1efdeb6e9 100644
+index 0d302853bf0a2..c55d80da64924 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1366,10 +1366,12 @@ static void steal_from_bitmap(struct btrfs_free_space_ctl *ctl,
+@@ -1376,10 +1376,12 @@ static void steal_from_bitmap(struct btrfs_free_space_ctl *ctl,
  static void stripe_claimable_mod(struct btrfs_block_group *bg, s64 delta);
  static u64 stripe_touched_bytes(const struct btrfs_block_group *bg,
                                u64 bytenr, u64 size);
@@ -109,7 +109,7 @@ index b9f4f7c49ee44..7a0f1efdeb6e9 100644
  {
        struct btrfs_fs_info *fs_info = block_group->fs_info;
        struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
-@@ -1429,12 +1431,16 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1439,12 +1441,16 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
  out:
        /*
         * Adding free space never credits stripe_claimable: some add paths
@@ -129,7 +129,7 @@ index b9f4f7c49ee44..7a0f1efdeb6e9 100644
        btrfs_discard_update_discardable(block_group);
        spin_unlock(&ctl->tree_lock);
  
-@@ -1451,6 +1457,13 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
+@@ -1461,6 +1467,13 @@ static int __btrfs_add_free_space(struct btrfs_block_group *block_group,
        return ret;
  }
  
@@ -143,7 +143,7 @@ index b9f4f7c49ee44..7a0f1efdeb6e9 100644
  static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group,
                                        u64 bytenr, u64 size, bool used)
  {
-@@ -1516,8 +1529,9 @@ static void stripe_unusable_mark_dirty(struct btrfs_block_group *bg);
+@@ -1526,8 +1539,9 @@ static void stripe_unusable_mark_dirty(struct btrfs_block_group *bg);
  
  /*
   * Debit the claimable whole-stripe supply for claims and removals.  Returned
@@ -155,7 +155,7 @@ index b9f4f7c49ee44..7a0f1efdeb6e9 100644
   *
   * The group's value and the space_info total change in one sinfo->lock
   * section, as everywhere else, so that btrfs_scan_stripe_unusable(), which
-@@ -1564,6 +1578,97 @@ static u64 stripe_touched_bytes(const struct btrfs_block_group *bg,
+@@ -1574,6 +1588,97 @@ static u64 stripe_touched_bytes(const struct btrfs_block_group *bg,
        return aend - astart;
  }
  
@@ -253,7 +253,7 @@ index b9f4f7c49ee44..7a0f1efdeb6e9 100644
  /*
   * Count the sub-stripe head and tail of a returning free range as trapped
   * at once: reservations read bytes_stripe_unusable mid-transaction, and the
-@@ -3529,13 +3634,12 @@ static int do_trimming(struct btrfs_block_group *block_group,
+@@ -3539,13 +3644,12 @@ static int do_trimming(struct btrfs_block_group *block_group,
        }
  
        if (reserved_start < start)
@@ -272,7 +272,7 @@ index b9f4f7c49ee44..7a0f1efdeb6e9 100644
  
        if (!bg_ro) {
                spin_lock(&space_info->lock);
-@@ -3633,6 +3737,8 @@ static int trim_no_bitmap(struct btrfs_block_group *block_group,
+@@ -3643,6 +3747,8 @@ static int trim_no_bitmap(struct btrfs_block_group *block_group,
                        unlink_free_space(ctl, entry, true);
                        kmem_cache_free(btrfs_free_space_cachep, entry);
                }
@@ -281,7 +281,7 @@ index b9f4f7c49ee44..7a0f1efdeb6e9 100644
  
                spin_unlock(&ctl->tree_lock);
  
-@@ -3851,6 +3957,7 @@ static int trim_bitmaps(struct btrfs_block_group *block_group,
+@@ -3861,6 +3967,7 @@ static int trim_bitmaps(struct btrfs_block_group *block_group,
                bitmap_clear_bits(ctl, entry, start, bytes, true);
                if (entry->bytes == 0)
                        free_bitmap(ctl, entry);
index fb3bff517cc833da19dd468dc57cc706e11e81d3..7b60b74e8dd73e8e9c283b76aea1108ef0b3eef3 100644 (file)
@@ -1,4 +1,4 @@
-From 52074eb4d12ef3850757554d6533f24cd258c362 Mon Sep 17 00:00:00 2001
+From 7078a366742e3bbb8e50863428b096c3155e0fe3 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 00:14:58 -0400
 Subject: [RFC PATCH 112/116] btrfs: stripe_alloc: do not miss bitmap free
@@ -50,10 +50,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 9 insertions(+)
 
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 7a0f1efdeb6e9..8303110638dcf 100644
+index c55d80da64924..7f5d17a727587 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -1601,6 +1601,15 @@ static bool stripe_range_free(struct btrfs_free_space_ctl *ctl,
+@@ -1611,6 +1611,15 @@ static bool stripe_range_free(struct btrfs_free_space_ctl *ctl,
                struct btrfs_free_space *e = tree_search_offset(ctl, pos, 0, 0);
                unsigned long bit;
  
index 1745e56aeaaf32690a8c226c623d659d472987ad..fddf4a94c368868cf0a96faeb8df8296f1d330ce 100644 (file)
@@ -1,4 +1,4 @@
-From 0900c2bcd6b290ba88d4bdea5d4f68477ad74aee Mon Sep 17 00:00:00 2001
+From 780cc8af6fc1dd5d42f883ccbf06552a123bfc2e 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 113/116] btrfs: log block group reclaim at debug level
@@ -31,10 +31,10 @@ Assisted-by: Claude:claude-opus-5-5
  1 file changed, 13 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 65340f18ae7a4..dde544f6b3bdd 100644
+index 53602f27a36af..41c717707a440 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -5400,8 +5400,10 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5402,8 +5402,10 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        u64 used;
        u64 reserved;
        u64 old_total;
@@ -45,7 +45,7 @@ index 65340f18ae7a4..dde544f6b3bdd 100644
  
        /*
         * A stripe_alloc / stripe_meta group's live extents can only move into
-@@ -5548,12 +5550,17 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5550,12 +5552,17 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        spin_lock(&bg->lock);
        used = bg->used;
        reserved = bg->reserved;
@@ -65,7 +65,7 @@ index 65340f18ae7a4..dde544f6b3bdd 100644
                ret = btrfs_compact_chunk(fs_info, bg->start, &compacted);
                /*
                 * Compacted, the group stays: drop our read-only hold.  It
-@@ -5590,8 +5597,11 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5592,8 +5599,11 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        if (space_info->total_bytes < old_total)
                btrfs_set_periodic_reclaim_ready(space_info, true);
        spin_unlock(&space_info->lock);
index b2368645be2c7a6fc0b1df054efe6166eb13f71a..dc1540ab0d6fbbde66c287629c8d3a29ae20c838 100644 (file)
@@ -1,4 +1,4 @@
-From bcadbfc8ac020ccc7fddf79e5530322e3fb98747 Mon Sep 17 00:00:00 2001
+From 301e2700905d9ada252870d02e543f9d7a31a1b0 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 114/116] btrfs: stripe_alloc: add stripe_reclaim_now to
@@ -76,10 +76,10 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 249 insertions(+), 15 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index dde544f6b3bdd..da9c005069b59 100644
+index 41c717707a440..bca4df2ab3cd4 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -5402,6 +5402,7 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5404,6 +5404,7 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        u64 old_total;
        u64 trapped;
        int ret = 0;
@@ -87,7 +87,7 @@ index dde544f6b3bdd..da9c005069b59 100644
        bool compact = false;
        bool compacted = false;
  
-@@ -5418,7 +5419,8 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5420,7 +5421,8 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
                u64 need = READ_ONCE(bg->used);
  
                /* Compaction moves at most half of it. */
@@ -97,7 +97,7 @@ index dde544f6b3bdd..da9c005069b59 100644
                        need /= 2;
                elsewhere -= min(elsewhere, READ_ONCE(bg->stripe_claimable));
                if (elsewhere < need) {
-@@ -5440,6 +5442,9 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5442,6 +5444,9 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
  
        spin_lock(&space_info->lock);
        spin_lock(&bg->lock);
@@ -107,7 +107,7 @@ index dde544f6b3bdd..da9c005069b59 100644
        if (bg->ro ||
            ((bg->reserved || bg->pinned) &&
             !btrfs_is_stripe_alloc_bg(bg) &&
-@@ -5492,7 +5497,10 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5494,7 +5499,10 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
         * check, which is more meaningful when adding to the list in
         * the first place.
         */
@@ -119,7 +119,7 @@ index dde544f6b3bdd..da9c005069b59 100644
                /*
                 * Too full to relocate whole.  A stripe_alloc / stripe_meta
                 * group whose free space is trapped in partially used stripes
-@@ -5765,6 +5773,160 @@ bool btrfs_mark_bg_to_reclaim(struct btrfs_block_group *bg)
+@@ -5767,6 +5775,160 @@ bool btrfs_mark_bg_to_reclaim(struct btrfs_block_group *bg)
        return true;
  }
  
@@ -306,10 +306,10 @@ index 202d9f73678de..bc26b9e875506 100644
  struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *trans,
                                                 struct btrfs_space_info *space_info,
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index 8303110638dcf..f3a8381e05de5 100644
+index 7f5d17a727587..d41c672f176b5 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2413,19 +2413,15 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2423,19 +2423,15 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
   * and queueing a group with nowhere to move it only costs writers read-only
   * transitions.  Counters are read unlocked; the worker re-checks.
   */
@@ -335,7 +335,7 @@ index 8303110638dcf..f3a8381e05de5 100644
        /*
         * Stripes stranded behind live runs are trapped for admission but not
         * for reclaim: they come back by themselves when the run is freed, and
-@@ -2437,9 +2433,19 @@ static enum stripe_reclaim_kind stripe_bg_reclaim_kind(struct btrfs_block_group
+@@ -2447,9 +2443,19 @@ static enum stripe_reclaim_kind stripe_bg_reclaim_kind(struct btrfs_block_group
        u64 elsewhere;
        u64 promised;
  
@@ -357,7 +357,7 @@ index 8303110638dcf..f3a8381e05de5 100644
                /*
                 * Too full to move whole: compact once trapped space reaches
                 * stripe_compact percent of the group's length.  (A share of
-@@ -2463,7 +2469,15 @@ static enum stripe_reclaim_kind stripe_bg_reclaim_kind(struct btrfs_block_group
+@@ -2473,7 +2479,15 @@ static enum stripe_reclaim_kind stripe_bg_reclaim_kind(struct btrfs_block_group
                   READ_ONCE(sinfo->bytes_stripe_margin);
        elsewhere -= min(elsewhere, READ_ONCE(bg->stripe_claimable));
        elsewhere -= min(elsewhere, promised);
@@ -374,7 +374,7 @@ index 8303110638dcf..f3a8381e05de5 100644
  }
  
  bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg)
-@@ -2471,6 +2485,19 @@ bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg)
+@@ -2481,6 +2495,19 @@ bool btrfs_stripe_bg_wants_reclaim(struct btrfs_block_group *bg)
        return stripe_bg_reclaim_kind(bg, true) != STRIPE_RECLAIM_NONE;
  }
  
@@ -417,7 +417,7 @@ index ceb933d51a169..94d60f9efece3 100644
                             u64 nstripes);
  void btrfs_dump_free_space(struct btrfs_block_group *block_group,
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 9928527c7394c..32d751fe87161 100644
+index d3231cc95f6dc..c7885e00033a8 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -1464,6 +1464,34 @@ static ssize_t btrfs_stripe_compact_store(struct kobject *kobj,
index 470303afb30af18787523a6b24cedb0fa089cb55..2cf7d15b005a91eece0938255772500ce2fd46d5 100644 (file)
@@ -1,4 +1,4 @@
-From 43d8f35586e64dd7087aaa1c5979dcc993d05cf2 Mon Sep 17 00:00:00 2001
+From 1ebbdb45771f2de406763b7b1e9b0d0a11087a4e 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 115/116] btrfs: stripe_alloc: back off block group reclaim
@@ -66,10 +66,10 @@ Assisted-by: Claude:claude-opus-5-5
  5 files changed, 148 insertions(+), 3 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index da9c005069b59..6368922e72c9d 100644
+index bca4df2ab3cd4..fbd603e5fa416 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -5614,6 +5614,79 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
+@@ -5616,6 +5616,79 @@ static int btrfs_reclaim_block_group(struct btrfs_block_group *bg, int *reclaime
        return ret;
  }
  
@@ -149,7 +149,7 @@ index da9c005069b59..6368922e72c9d 100644
  void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limit)
  {
        struct btrfs_block_group *bg;
-@@ -5653,6 +5726,7 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
+@@ -5655,6 +5728,7 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
         */
        list_sort(NULL, &fs_info->reclaim_bgs, reclaim_bgs_cmp);
        while (!list_empty(&fs_info->reclaim_bgs)) {
@@ -157,7 +157,7 @@ index da9c005069b59..6368922e72c9d 100644
                int ret;
  
                bg = list_first_entry(&fs_info->reclaim_bgs,
-@@ -5662,10 +5736,27 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
+@@ -5664,10 +5738,27 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
  
                space_info = bg->space_info;
                spin_unlock(&fs_info->unused_bgs_lock);
@@ -187,7 +187,7 @@ index da9c005069b59..6368922e72c9d 100644
                        btrfs_link_bg_list(bg, &retry_list);
                btrfs_put_block_group(bg);
  
-@@ -5742,6 +5833,8 @@ static void btrfs_stripe_reclaim_tick(struct btrfs_fs_info *fs_info)
+@@ -5744,6 +5835,8 @@ static void btrfs_stripe_reclaim_tick(struct btrfs_fs_info *fs_info)
                                        continue;
                                if (!btrfs_stripe_bg_wants_reclaim(bg))
                                        continue;
@@ -209,10 +209,10 @@ index bc26b9e875506..115d8fa7369af 100644
  int btrfs_read_block_groups(struct btrfs_fs_info *info);
  struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *trans,
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
-index f3a8381e05de5..414df924fbf8b 100644
+index d41c672f176b5..33ba40faffe22 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
-@@ -2413,6 +2413,33 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2423,6 +2423,33 @@ void btrfs_block_group_disarm_stripe_unusable(struct btrfs_block_group *bg)
   * and queueing a group with nowhere to move it only costs writers read-only
   * transitions.  Counters are read unlocked; the worker re-checks.
   */
@@ -246,7 +246,7 @@ index f3a8381e05de5..414df924fbf8b 100644
  static enum stripe_reclaim_kind __stripe_bg_reclaim_kind(struct btrfs_block_group *bg,
                                                         int thresh, bool force,
                                                         bool check_room,
-@@ -2469,7 +2496,9 @@ static enum stripe_reclaim_kind __stripe_bg_reclaim_kind(struct btrfs_block_grou
+@@ -2479,7 +2506,9 @@ static enum stripe_reclaim_kind __stripe_bg_reclaim_kind(struct btrfs_block_grou
                   READ_ONCE(sinfo->bytes_stripe_margin);
        elsewhere -= min(elsewhere, READ_ONCE(bg->stripe_claimable));
        elsewhere -= min(elsewhere, promised);
@@ -257,7 +257,7 @@ index f3a8381e05de5..414df924fbf8b 100644
  }
  
  static enum stripe_reclaim_kind stripe_bg_reclaim_kind(struct btrfs_block_group *bg,
-@@ -2569,6 +2598,9 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
+@@ -2579,6 +2608,9 @@ void btrfs_block_group_rescan_stripe_unusable(struct btrfs_block_group *bg)
        }
        spin_unlock(&ctl->tree_lock);
        kvfree(freep);
@@ -268,7 +268,7 @@ index f3a8381e05de5..414df924fbf8b 100644
                /*
                 * Stamp the hysteresis only if the mark lands: a group still on
 diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
-index 4dea6081d5253..f959246fa007c 100644
+index 43124031e1926..65a92994e615c 100644
 --- a/fs/btrfs/space-info.h
 +++ b/fs/btrfs/space-info.h
 @@ -282,6 +282,23 @@ struct btrfs_space_info {
@@ -296,7 +296,7 @@ index 4dea6081d5253..f959246fa007c 100644
         * If true, use the dynamic relocation threshold, instead of the
         * fixed bg_reclaim_threshold.
 diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 32d751fe87161..740eff72ee21e 100644
+index c7885e00033a8..c4cf426105afc 100644
 --- a/fs/btrfs/sysfs.c
 +++ b/fs/btrfs/sysfs.c
 @@ -889,6 +889,7 @@ SPACE_INFO_ATTR(disk_total);
index 471d21ef8ddeffb1ade87a7a16351863ce417ffd..5f33a39ba4249bf57d4668d62cf3b10d97a71d2b 100644 (file)
@@ -1,4 +1,4 @@
-From a23064467620f3d39e4cc8c71b5ae12a9bab7572 Mon Sep 17 00:00:00 2001
+From bc8cd9cac405fb573a08f798266215560f19b234 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 04:02:53 -0400
 Subject: [RFC PATCH 116/116] btrfs: stripe_alloc: let queued exclusive
@@ -69,10 +69,10 @@ Assisted-by: Claude:claude-opus-5-5
  3 files changed, 84 insertions(+), 2 deletions(-)
 
 diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
-index 6368922e72c9d..d596cf1b563ea 100644
+index fbd603e5fa416..71488e97f4adc 100644
 --- a/fs/btrfs/block-group.c
 +++ b/fs/btrfs/block-group.c
-@@ -5687,6 +5687,14 @@ static void reclaim_note_result(struct btrfs_block_group *bg, bool enospc, u64 n
+@@ -5689,6 +5689,14 @@ static void reclaim_note_result(struct btrfs_block_group *bg, bool enospc, u64 n
                            streak, bg->start, space_info->flags);
  }
  
@@ -87,7 +87,7 @@ index 6368922e72c9d..d596cf1b563ea 100644
  void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limit)
  {
        struct btrfs_block_group *bg;
-@@ -5704,9 +5712,12 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
+@@ -5706,9 +5714,12 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
        if (!btrfs_should_reclaim(fs_info))
                return;
  
@@ -101,7 +101,7 @@ index 6368922e72c9d..d596cf1b563ea 100644
                return;
  
        /*
-@@ -5761,11 +5772,36 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
+@@ -5763,11 +5774,36 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
                btrfs_put_block_group(bg);
  
                mutex_unlock(&fs_info->reclaim_bgs_lock);
@@ -138,7 +138,7 @@ index 6368922e72c9d..d596cf1b563ea 100644
                /*
                 * If we are interrupted by a balance, we can just bail out. The
                 * cleaner thread restart again if necessary.
-@@ -5779,10 +5815,11 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
+@@ -5781,10 +5817,11 @@ void btrfs_reclaim_block_groups(struct btrfs_fs_info *fs_info, unsigned int limi
        spin_unlock(&fs_info->unused_bgs_lock);
        mutex_unlock(&fs_info->reclaim_bgs_lock);
  end: