v4: Add rb from Josef in patch 1 and 3. In patch 1/3, use fs_info instead of device->fs_devices->fs_info. Drop round-robin policy because my workload (fio random) shows no performance gains due to fewer merges at the block layer.
v3: The block layer commit 0d02129e76ed (block: merge struct block_device and struct hd_struct) has changed the first argument in the function part_stat_read_all() in 5.11-rc1. So trickle down its changes in the patch 1/4. v2: Fixes as per review comments, as in the individual patches. rfc->v1: Drop the tracing patch. Drop the factor associated with the inflight commands (because there were too many unnecessary switches). Few C styles fix. ----- This patchset adds read policy types latency, device, and round-robin, for the mirrored raid profiles such as raid1, raid1c3, raid1c4, and raid10. The default read policy remains as PID, as of now. Read policy types: Latency: Latency policy routes the read IO based on the historical average wait time experienced by the read IOs on the individual device. Device: With the device policy along with the read_preferred flag, you can set the device for reading manually. Useful to test mirrors in a deterministic way and helps advance system administrations. Round-robin (RFC patch): Alternates striped device in a round-robin loop for reading. To achieve this first we put the stripes in an array, sort it by devid and pick the next device. Test scripts: ============= I have included a few scripts which were useful for testing. -------------------8<-------------------------------- Set latency policy on the btrfs mounted at /mnt Usage example: $ readpolicyset /mnt latency Anand Jain (3): btrfs: add read_policy latency btrfs: introduce new device-state read_preferred btrfs: introduce new read_policy device fs/btrfs/sysfs.c | 57 ++++++++++++++++++++++++++++++++++++++++++- fs/btrfs/volumes.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/volumes.h | 5 ++++ 3 files changed, 121 insertions(+), 1 deletion(-) -- 2.28.0