Question (Zygo): the proposed "drop cached rbios when their stripes' extents are freed" patch makes the next sub-stripe write into a reused stripe re-read the full stripe. How often does that actually happen, with true numbers, on stock behavior?
Instrumented stock kernel (branch bench/rbio-cache-stats, stock
fc02acf6ac0c + zygo: raid56: instrument rbio cache steal/stale statistics, kernel 7.2.0-rc5+ #2): at unpin, cached rbios
overlapping freed extents are MARKED (identical walk and overlap test
to the proposed patch) instead of dropped; steal_rbio() propagates
the mark with the stolen pages; a sub-stripe RMW that skips its
full-stripe read thanks to stale-marked pages counts as exactly one
full-stripe read (data + P/Q -- rmw_read_wait_recover() reads
everything) the patch would have added. The mark clears once
counted, because the patched world would have re-read and re-cached
fresh pages at that point, making descendants legitimate. Counters
in /sys/fs/btrfs//rbio_cache_stats; benchmark
rbio-cache-bench.sh.
Setup is a deliberate worst case for the patch: 5-dev raid5 for both data AND metadata (metadata RMW is the cache's sweet spot), small sub-stripe files, constant delete/overwrite churn so frees overlap cached stripes as often as possible. 90s phases.
phase steals/s skips/s stale-skips/s patch cost stale share churn_sync 0.92 0.91 0.13 0.041 MB/s 14.6% churn_fsync 42.66 42.66 0.15 0.046 MB/s 0.3% odirect_rw 20.51 20.51 0.37 0.116 MB/s 1.8%
Cumulative: 7347 inserts, 6431 steals, 6430 RMW read-skips, 64 stale-enabled skips (1.0%), 20 MiB total would-be extra reads over ~5 minutes.
Internal consistency (true-numbers checks): rmw_partial - rmw_reads = rmw_skips exactly (7358 - 928 = 6430); steals == skips to within 1; stale_marked (928) vs stale steals (65): 93% of stale-marked entries die in the LRU without ever being stolen -- the patch's drops mostly hit entries that would never have been reused anyway.
Numbers ready for the upstream patch's cover text.