read_policy type heuristic
cover read_policy type heuristic
POC patch proposes a read_policy type Heuristic to solve the problem of poor read performance for the mirrored stripes on mixed device types. Read_policy Heuristic has benefits of both pid and has no dependency on block layer iostats. Instead, it uses statically defined device_type and its latency.
This patch is a POC patch that has no performance analysis yet. I am sending this to get some early feedback.
For the read_policy type Latency, please refer here [1]. The read_policy type Latency works better overall, and it is self-tuning based on the IO.
Anand Jain (1):
btrfs: add read_policy heuristic
fs/btrfs/sysfs.c | 2 +- fs/btrfs/volumes.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/volumes.h | 2 ++ 3 files changed, 55 insertions(+), 1 deletion(-)
Signature · 1 line
2.33.1
RFC PATCH 1/1 btrfs: add read_policy heuristic
Read_policy type Heuristic provides the low latency device-type if read_policy type PID fails. The read policy heuristic retains the advantages of the PID-based read_policy and has no dependency on block layer iostats. This policy can be a default policy.
This patch depends on the patches[1], which provides device types in the order of their latency.
[1]
btrfs: create chunk device type aware
btrfs: keep device type in the struct btrfs_device
Usage:
$ echo heuristic > /sys/fs/btrfs/4b74dc57-526c-42c0-882a-8be30e1b8933/read_policy
--- fs/btrfs/sysfs.c | 2 +- fs/btrfs/volumes.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/volumes.h | 2 ++ 3 files changed, 55 insertions(+), 1 deletion(-)
fs/btrfs/sysfs.c +1 -1
@@ -1169,7 +1169,7 @@ static bool strmatch(const char *buffer, const char *string)return false; } -static const char *const btrfs_read_policy_name[] = {"pid" }; +static const char *const btrfs_read_policy_name[] = {"pid" ,"heuristic" };static ssize_t btrfs_read_policy_show (struct kobject *kobj,struct kobj_attribute *a,char *buf)
fs/btrfs/volumes.c +52 -0
64 lines not on this page · raw message
fs/btrfs/volumes.h +2 -0
@@ -277,6 +277,8 @@ enum btrfs_chunk_allocation_policy {enum btrfs_read_policy {/* Use process PID to choose the stripe */ BTRFS_READ_POLICY_PID , +/* Find and use device with the lowest latency */ +BTRFS_READ_POLICY_HEURISTIC ,BTRFS_NR_READ_POLICY , };
Signature · 1 line
2.33.1