From: louis@waffle.tech
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs: balance RAID1/RAID10 mirror selection
Date: Fri, 16 Oct 2020 05:59:19 +0000 [thread overview]
Message-ID: <8541d6d7a63e470b9f4c22ba95cd64fc@waffle.tech> (raw)
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 ==
next reply other threads:[~2020-10-16 6:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-16 5:59 louis [this message]
2020-10-16 7:15 ` [PATCH] btrfs: balance RAID1/RAID10 mirror selection 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-10-27 14:26 ` Wang Yugui
2020-11-02 19:29 ` louis
2020-11-02 19:36 ` louis
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=8541d6d7a63e470b9f4c22ba95cd64fc@waffle.tech \
--to=louis@waffle.tech \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.