btrfs: honor allocator hints for fixed-width mirrors
gather_device_info() admits complete allocation-hint groups until it
has at least devs_min devices. It then clears the hints and sorts the
admitted devices globally by max_avail. For a fixed-width mirrored
profile, that second sort can move preferred devices past the later
devs_max cutoff.
RAID1, RAID1C3 and RAID1C4 currently use exactly devs_min devices.
Limit the hint-ordered prefix to that fixed count before clearing the
hints. Devices within each hint group are already ordered by max_avail,
so this keeps the best devices needed from the final group.
The existing second sort then restores the max_avail ordering expected
by stripe-size calculation over the selected devices only.
Check that devs_min and devs_max match instead of relying on the
current RAID1 profile definitions implicitly. If a future RAID1 profile
becomes variable-width, it will retain the existing whole-group
behavior.
Leave all other profiles unchanged, in particular the wide striped
profiles that need the complete final candidate group.
A preferred device remains eligible while it has at least
dev_extent_min free. It can therefore constrain stripe_size and produce
a small block group. This behavior already exists when the preferred
tier alone satisfies the profile; this change intentionally extends it
to fixed-width mirrors assembled from multiple hint tiers.
v2:
- Document the possible chunk-size constraint from a nearly full
preferred device.