From: Josef Bacik <josef@toxicpanda.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Cc: dsterba@suse.com
Subject: Re: [PATCH v3 3/4] btrfs: introduce new read_policy device
Date: Tue, 19 Jan 2021 14:44:54 -0500 [thread overview]
Message-ID: <4d6003c1-527f-b29b-49fb-d6aa9dccac0e@toxicpanda.com> (raw)
In-Reply-To: <3c90d2b8e03dcd9ba9db00c4283a5e73f543a13f.1610324448.git.anand.jain@oracle.com>
On 1/11/21 4:41 AM, Anand Jain wrote:
> Read-policy type 'device' and device flag 'read-preferred':
>
> The read-policy type device picks the device(s) flagged as
> read-preferred for reading stripes of type raid1, raid10,
> raid1c3 and raid1c4.
>
> A system might contain SSD, nvme, iscsi, or san lun, and which are all
> a non-rotational device, so it is not a good idea to set the read-preferred
> automatically. Instead, device read-policy along with the read-preferred
> flag provides an ability to do it manually. This advanced tuning is useful
> in more than one situation, for example,
> - In heterogeneous-disk volume, it provides an ability to manually choose
> the low latency disks for reading.
> - Useful for more accurate testing.
> - Avoid known problematic device from reading the chunk until it is
> replaced (by marking the other good devices as read-preferred).
>
> Note:
>
> If the read-policy type is set to 'device', but there isn't any device
> which is flagged as read-preferred, then stripe 0 is used for reading.
>
> The device replacement won't migrate the read-preferred flag to the new
> replace the target device.
>
> As of now, this is an in-memory only feature.
>
> It's pointless to set the read-preferred flag on the missing device, as
> IOs aren't submitted to the missing device.
>
> If there is more than one read-preferred device in a chunk, the read IO
> shall go to the stripe 0 as of now.
>
> Usage example:
>
> Consider a typical two disks raid1.
>
> Configure devid1 for reading.
>
> $ echo 1 > devinfo/1/read_preferred
> $ cat devinfo/1/read_preferred
> 1
> $ cat devinfo/2/read_preferred
> 0
>
> $ pwd
> /sys/fs/btrfs/12345678-1234-1234-1234-123456789abc
>
> $ cat read_policy
> [pid] device
> $ echo device > ./read_policy
> $ cat read_policy
> pid [device]
>
> Now read IOs are sent to devid 1 (sdb).
>
> $ echo 3 > /proc/sys/vm/drop_caches
> $ md5sum /btrfs/YkZI
>
> $ iostat -zy 1 | egrep 'sdb|sdc' (from another terminal)
> sdb 50.00 40048.00 0.00 40048 0
>
> Change the read-preferred device from devid 1 to devid 2 (sdc).
>
> $ echo 0 > ./devinfo/1/read_preferred
>
> [ 3343.918658] BTRFS info (device sdb): reset read preferred on devid 1 (1334)
>
> $ echo 1 > ./devinfo/2/read_preferred
>
> [ 3343.919876] BTRFS info (device sdb): set read preferred on devid 2 (1334)
>
> $ echo 3 > /proc/sys/vm/drop_caches
> $ md5sum /btrfs/YkZI
>
> Further read ios are sent to devid 2 (sdc).
>
> $ iostat -zy 1 | egrep 'sdb|sdc' (from another terminal)
> sdc 49.00 40048.00 0.00 40048 0
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
next prev parent reply other threads:[~2021-01-19 19:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 9:41 [PATCH v3 0/4] btrfs: read_policy types latency, device and round-robin Anand Jain
2021-01-11 9:41 ` [PATCH v3 1/4] btrfs: add read_policy latency Anand Jain
2021-01-19 19:36 ` Josef Bacik
2021-01-20 2:43 ` Anand Jain
2021-01-20 10:27 ` Michal Rostecki
2021-01-20 12:30 ` Anand Jain
2021-01-20 13:54 ` Michal Rostecki
2021-01-21 10:45 ` Anand Jain
2021-01-11 9:41 ` [PATCH v3 2/4] btrfs: introduce new device-state read_preferred Anand Jain
2021-01-19 19:44 ` Josef Bacik
2021-01-11 9:41 ` [PATCH v3 3/4] btrfs: introduce new read_policy device Anand Jain
2021-01-19 19:44 ` Josef Bacik [this message]
2021-01-11 9:41 ` [PATCH RFC 4/4] btrfs: introduce new read_policy round-robin Anand Jain
2021-01-19 19:41 ` Josef Bacik
2021-01-20 2:40 ` Anand Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d6003c1-527f-b29b-49fb-d6aa9dccac0e@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).