|
Coly Li |
b87893 |
From c2968285925adb97b9aa4ede94c1f1ab61ce0925 Mon Sep 17 00:00:00 2001
|
|
Coly Li |
b87893 |
From: Xiao Ni <xni@redhat.com>
|
|
Coly Li |
b87893 |
Date: Thu, 4 Feb 2021 15:50:44 +0800
|
|
Coly Li |
b87893 |
Subject: [PATCH] md/raid10: extend r10bio devs to raid disks
|
|
Coly Li |
b87893 |
Git-commit: c2968285925adb97b9aa4ede94c1f1ab61ce0925
|
|
Coly Li |
b87893 |
Patch-mainline: v5.13-rc1
|
|
Coly Li |
b87893 |
References: bsc#1192320
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
Now it allocs r10bio->devs[conf->copies]. Discard bio needs to submit
|
|
Coly Li |
b87893 |
to all member disks and it needs to use r10bio. So extend to
|
|
Coly Li |
b87893 |
r10bio->devs[geo.raid_disks].
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
Reviewed-by: Coly Li <colyli@suse.de>
|
|
Coly Li |
b87893 |
Tested-by: Adrian Huang <ahuang12@lenovo.com>
|
|
Coly Li |
b87893 |
Signed-off-by: Xiao Ni <xni@redhat.com>
|
|
Coly Li |
b87893 |
Signed-off-by: Song Liu <songliubraving@fb.com>
|
|
Coly Li |
b87893 |
Signed-off-by: Coly Li <colyli@suse.de>
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
---
|
|
Coly Li |
b87893 |
drivers/md/raid10.c | 10 +++++-----
|
|
Coly Li |
b87893 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
|
|
Coly Li |
b87893 |
index a9ae7d113492..5fa390880f85 100644
|
|
Coly Li |
b87893 |
--- a/drivers/md/raid10.c
|
|
Coly Li |
b87893 |
+++ b/drivers/md/raid10.c
|
|
Coly Li |
b87893 |
@@ -91,7 +91,7 @@ static inline struct r10bio *get_resync_r10bio(struct bio *bio)
|
|
Coly Li |
b87893 |
static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
|
|
Coly Li |
b87893 |
{
|
|
Coly Li |
b87893 |
struct r10conf *conf = data;
|
|
Coly Li |
b87893 |
- int size = offsetof(struct r10bio, devs[conf->copies]);
|
|
Coly Li |
b87893 |
+ int size = offsetof(struct r10bio, devs[conf->geo.raid_disks]);
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
/* allocate a r10bio with room for raid_disks entries in the
|
|
Coly Li |
b87893 |
* bios array */
|
|
Coly Li |
b87893 |
@@ -238,7 +238,7 @@ static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio)
|
|
Coly Li |
b87893 |
{
|
|
Coly Li |
b87893 |
int i;
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
- for (i = 0; i < conf->copies; i++) {
|
|
Coly Li |
b87893 |
+ for (i = 0; i < conf->geo.raid_disks; i++) {
|
|
Coly Li |
b87893 |
struct bio **bio = & r10_bio->devs[i].bio;
|
|
Coly Li |
b87893 |
if (!BIO_SPECIAL(*bio))
|
|
Coly Li |
b87893 |
bio_put(*bio);
|
|
Coly Li |
b87893 |
@@ -327,7 +327,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
|
|
Coly Li |
b87893 |
int slot;
|
|
Coly Li |
b87893 |
int repl = 0;
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
- for (slot = 0; slot < conf->copies; slot++) {
|
|
Coly Li |
b87893 |
+ for (slot = 0; slot < conf->geo.raid_disks; slot++) {
|
|
Coly Li |
b87893 |
if (r10_bio->devs[slot].bio == bio)
|
|
Coly Li |
b87893 |
break;
|
|
Coly Li |
b87893 |
if (r10_bio->devs[slot].repl_bio == bio) {
|
|
Coly Li |
b87893 |
@@ -336,7 +336,6 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
|
|
Coly Li |
b87893 |
}
|
|
Coly Li |
b87893 |
}
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
- BUG_ON(slot == conf->copies);
|
|
Coly Li |
b87893 |
update_head_pos(slot, r10_bio);
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
if (slotp)
|
|
Coly Li |
b87893 |
@@ -1492,7 +1491,8 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors)
|
|
Coly Li |
b87893 |
r10_bio->sector = bio->bi_iter.bi_sector;
|
|
Coly Li |
b87893 |
r10_bio->state = 0;
|
|
Coly Li |
b87893 |
r10_bio->read_slot = -1;
|
|
Coly Li |
b87893 |
- memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->copies);
|
|
Coly Li |
b87893 |
+ memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) *
|
|
Coly Li |
b87893 |
+ conf->geo.raid_disks);
|
|
Coly Li |
b87893 |
|
|
Coly Li |
b87893 |
if (bio_data_dir(bio) == READ)
|
|
Coly Li |
b87893 |
raid10_read_request(mddev, bio, r10_bio);
|
|
Coly Li |
b87893 |
--
|
|
Coly Li |
b87893 |
2.31.1
|
|
Coly Li |
b87893 |
|