The hunks of "btrfs: stripe_alloc: count whole stripes stranded behind
live runs as trapped" (earlier in this series) that need code from
"btrfs: stripe_alloc: hand groups full of trapped free space to the
reclaim worker", which comes after it in this series: they are applied
here, once "btrfs: stripe_alloc: hand groups full of trapped free space
to the reclaim worker" is in, instead of with the rest of "btrfs:
stripe_alloc: count whole stripes stranded behind live runs as trapped".
Assisted-by: Claude:claude-fable-5
Assisted-by: Claude:claude-opus-5-5
struct btrfs_space_info *sinfo = bg->space_info;
const int thresh = READ_ONCE(sinfo->bg_reclaim_threshold);
const u64 used = READ_ONCE(bg->used);
- const u64 trapped = READ_ONCE(bg->stripe_unusable);
+ const u64 unusable = READ_ONCE(bg->stripe_unusable);
+ /*
+ * Stripes stranded behind live runs are trapped for admission but not
+ * for reclaim: they come back by themselves when the run is freed, and
+ * relocating the group would only force that.
+ */
+ const u64 trapped = unusable - min(unusable, READ_ONCE(bg->stripe_stranded));
u64 elsewhere;
u64 promised;