Skip to content

Commit

Permalink
Revert "md/raid10: extend r10bio devs to raid disks"
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/1907262

This reverts commit 0eac1f8.

Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
  • Loading branch information
Khalid Elmously committed Dec 9, 2020
1 parent 1944235 commit f831102
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static inline struct r10bio *get_resync_r10bio(struct bio *bio)
static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
{
struct r10conf *conf = data;
int size = offsetof(struct r10bio, devs[conf->geo.raid_disks]);
int size = offsetof(struct r10bio, devs[conf->copies]);

/* allocate a r10bio with room for raid_disks entries in the
* bios array */
Expand Down Expand Up @@ -238,7 +238,7 @@ static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio)
{
int i;

for (i = 0; i < conf->geo.raid_disks; i++) {
for (i = 0; i < conf->copies; i++) {
struct bio **bio = & r10_bio->devs[i].bio;
if (!BIO_SPECIAL(*bio))
bio_put(*bio);
Expand Down Expand Up @@ -327,7 +327,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
int slot;
int repl = 0;

for (slot = 0; slot < conf->geo.raid_disks; slot++) {
for (slot = 0; slot < conf->copies; slot++) {
if (r10_bio->devs[slot].bio == bio)
break;
if (r10_bio->devs[slot].repl_bio == bio) {
Expand All @@ -336,6 +336,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
}
}

BUG_ON(slot == conf->copies);
update_head_pos(slot, r10_bio);

if (slotp)
Expand Down Expand Up @@ -1509,7 +1510,7 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors)
r10_bio->mddev = mddev;
r10_bio->sector = bio->bi_iter.bi_sector;
r10_bio->state = 0;
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->geo.raid_disks);
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->copies);

if (bio_data_dir(bio) == READ)
raid10_read_request(mddev, bio, r10_bio);
Expand Down

0 comments on commit f831102

Please sign in to comment.