diff options
author | Andrey Konovalov <andrey.konovalov@linaro.org> | 2015-04-30 18:57:00 +0300 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2015-04-30 18:57:00 +0300 |
commit | eecc87b23d1c5388c8fb7a183ef1e6f60d3cde8a (patch) | |
tree | 3a2b96613c237f904ea5e1bba98b2db7d115b0c0 /drivers/md/raid10.c | |
parent | a02ae6c69680b4a30f58cb1741d3f2f1e671885f (diff) | |
parent | 230b22d72454f0b9ed2cf1410771bbba7830f89e (diff) |
Automatically merging tracking-llvm into merge-linux-linaro
Conflicting files:
arch/arm/kernel/psci.c
arch/mips/include/asm/thread_info.h
arch/mips/math-emu/dp_add.c
arch/mips/math-emu/dp_sub.c
arch/mips/math-emu/sp_add.c
arch/mips/math-emu/sp_sub.c
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index e793ab6b3570..ba244d28e740 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -711,11 +711,7 @@ static int raid10_mergeable_bvec(struct mddev *mddev, max = biovec->bv_len; if (mddev->merge_check_needed) { - struct { - struct r10bio r10_bio; - struct r10dev devs[conf->copies]; - } on_stack; - struct r10bio *r10_bio = &on_stack.r10_bio; + struct r10bio *r10_bio; int s; if (conf->reshape_progress != MaxSector) { /* Cannot give any guidance during reshape */ @@ -723,6 +719,10 @@ static int raid10_mergeable_bvec(struct mddev *mddev, return biovec->bv_len; return 0; } + r10_bio = kmalloc(sizeof *r10_bio + + conf->copies * sizeof(struct r10dev), GFP_NOIO); + if (!r10_bio) + return 0; r10_bio->sector = sector; raid10_find_phys(conf, r10_bio); rcu_read_lock(); @@ -755,6 +755,7 @@ static int raid10_mergeable_bvec(struct mddev *mddev, } } rcu_read_unlock(); + kfree(r10_bio); } return max; } @@ -4554,15 +4555,16 @@ static int handle_reshape_read_error(struct mddev *mddev, /* Use sync reads to get the blocks from somewhere else */ int sectors = r10_bio->sectors; struct r10conf *conf = mddev->private; - struct { - struct r10bio r10_bio; - struct r10dev devs[conf->copies]; - } on_stack; - struct r10bio *r10b = &on_stack.r10_bio; + struct r10bio *r10b; + int slot = 0; int idx = 0; struct bio_vec *bvec = r10_bio->master_bio->bi_io_vec; + r10b = kmalloc(sizeof *r10b + conf->copies * sizeof(struct r10dev), + GFP_NOIO); + if (!r10b) + return -ENOMEM; r10b->sector = r10_bio->sector; __raid10_find_phys(&conf->prev, r10b); @@ -4602,11 +4604,13 @@ static int handle_reshape_read_error(struct mddev *mddev, /* couldn't read this block, must give up */ set_bit(MD_RECOVERY_INTR, &mddev->recovery); + kfree(r10b); return -EIO; } sectors -= s; idx++; } + kfree(r10b); return 0; } |