mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
md/raid10: extend r10bio devs to raid disks
Now it allocs r10bio->devs[conf->copies]. Discard bio needs to submit to all member disks and it needs to use r10bio. So extend to r10bio->devs[geo.raid_disks]. Reviewed-by: Coly Li <colyli@suse.de> Tested-by: Adrian Huang <ahuang12@lenovo.com> Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Song Liu <songliubraving@fb.com>
This commit is contained in:
parent
cf78408f93
commit
c296828592
@ -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)
|
static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
|
||||||
{
|
{
|
||||||
struct r10conf *conf = data;
|
struct r10conf *conf = data;
|
||||||
int size = offsetof(struct r10bio, devs[conf->copies]);
|
int size = offsetof(struct r10bio, devs[conf->geo.raid_disks]);
|
||||||
|
|
||||||
/* allocate a r10bio with room for raid_disks entries in the
|
/* allocate a r10bio with room for raid_disks entries in the
|
||||||
* bios array */
|
* bios array */
|
||||||
@ -238,7 +238,7 @@ static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < conf->copies; i++) {
|
for (i = 0; i < conf->geo.raid_disks; i++) {
|
||||||
struct bio **bio = & r10_bio->devs[i].bio;
|
struct bio **bio = & r10_bio->devs[i].bio;
|
||||||
if (!BIO_SPECIAL(*bio))
|
if (!BIO_SPECIAL(*bio))
|
||||||
bio_put(*bio);
|
bio_put(*bio);
|
||||||
@ -327,7 +327,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
|
|||||||
int slot;
|
int slot;
|
||||||
int repl = 0;
|
int repl = 0;
|
||||||
|
|
||||||
for (slot = 0; slot < conf->copies; slot++) {
|
for (slot = 0; slot < conf->geo.raid_disks; slot++) {
|
||||||
if (r10_bio->devs[slot].bio == bio)
|
if (r10_bio->devs[slot].bio == bio)
|
||||||
break;
|
break;
|
||||||
if (r10_bio->devs[slot].repl_bio == bio) {
|
if (r10_bio->devs[slot].repl_bio == bio) {
|
||||||
@ -336,7 +336,6 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BUG_ON(slot == conf->copies);
|
|
||||||
update_head_pos(slot, r10_bio);
|
update_head_pos(slot, r10_bio);
|
||||||
|
|
||||||
if (slotp)
|
if (slotp)
|
||||||
@ -1492,7 +1491,8 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors)
|
|||||||
r10_bio->sector = bio->bi_iter.bi_sector;
|
r10_bio->sector = bio->bi_iter.bi_sector;
|
||||||
r10_bio->state = 0;
|
r10_bio->state = 0;
|
||||||
r10_bio->read_slot = -1;
|
r10_bio->read_slot = -1;
|
||||||
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->copies);
|
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) *
|
||||||
|
conf->geo.raid_disks);
|
||||||
|
|
||||||
if (bio_data_dir(bio) == READ)
|
if (bio_data_dir(bio) == READ)
|
||||||
raid10_read_request(mddev, bio, r10_bio);
|
raid10_read_request(mddev, bio, r10_bio);
|
||||||
|
Loading…
Reference in New Issue
Block a user