From: Wang Yugui <wangyugui@e16-tech.com>
To: louis@waffle.tech, linux-btrfs@vger.kernel.org
Cc: anand.jain@oracle.com
Subject: Re: [PATCH] btrfs: balance RAID1/RAID10 mirror selection
Date: Tue, 27 Oct 2020 22:26:30 +0800 [thread overview]
Message-ID: <20201027222629.16D6.409509F4@e16-tech.com> (raw)
In-Reply-To: <20201023153814.643F.409509F4@e16-tech.com>
Hi, Louis Jencka
Cc: Anand Jain
Maybe we still need BTRFS_READ_POLICY_PID because of readahead.
There are readahead inside OS and readahead inside some disk.
For most SSD/SAS and SSD/SATA, there seems readahead inside the disk.
But for some SSD/NVMe, there seems NO readahead inside the disk.
BTRFS_READ_POLICY_PID cooperates readahead better in some case.
Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2020/10/27
> Hi, Louis Jencka
>
> Can we move 'atomic_t rr_counter' into 'struct btrfs_fs_info' to
> support multiple mounted btrfs filesystem?
>
> Although 'readmirror feature (read_policy sysfs)' is talked about,
> round-robin is a replacement for BTRFS_READ_POLICY_PID in most case,
> we no longer need BTRFS_READ_POLICY_PID ?
>
> Best Regards
> Wang Yugui (wangyugui@e16-tech.com)
> 2020/10/23
>
> > Balance RAID1/RAID10 mirror selection via plain round-robin scheduling. This should roughly double throughput for large reads.
> >
> > Signed-off-by: Louis Jencka <louis@waffle.tech>
> > ---
> > fs/btrfs/volumes.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > index 58b9c419a..45c581d46 100644
> > --- a/fs/btrfs/volumes.c
> > +++ b/fs/btrfs/volumes.c
> > @@ -333,6 +333,9 @@ struct list_head * __attribute_const__ btrfs_get_fs_uuids(void)
> > return &fs_uuids;
> > }
> >
> > +/* Used for round-robin balancing RAID1/RAID10 reads. */
> > +atomic_t rr_counter = ATOMIC_INIT(0);
> > +
> > /*
> > * alloc_fs_devices - allocate struct btrfs_fs_devices
> > * @fsid: if not NULL, copy the UUID to fs_devices::fsid
> > @@ -5482,7 +5485,8 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
> > else
> > num_stripes = map->num_stripes;
> >
> > - preferred_mirror = first + current->pid % num_stripes;
> > + preferred_mirror = first +
> > + (unsigned)atomic_inc_return(&rr_counter) % num_stripes;
> >
> > if (dev_replace_is_ongoing &&
> > fs_info->dev_replace.cont_reading_from_srcdev_mode ==
>
prev parent reply other threads:[~2020-10-27 17:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-16 5:59 [PATCH] btrfs: balance RAID1/RAID10 mirror selection louis
2020-10-16 7:15 ` Nikolay Borisov
2020-10-16 7:29 ` Qu Wenruo
2020-10-16 17:28 ` louis
2020-10-18 8:16 ` Anand Jain
2020-10-16 16:18 ` louis
2020-10-16 17:21 ` waxhead
2020-10-23 7:38 ` Wang Yugui
2020-10-23 7:42 ` Nikolay Borisov
2020-11-02 19:29 ` louis
2020-11-02 19:36 ` louis
2020-10-27 14:26 ` Wang Yugui [this message]
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=20201027222629.16D6.409509F4@e16-tech.com \
--to=wangyugui@e16-tech.com \
--cc=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=louis@waffle.tech \
/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