Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321788
b: refs/heads/master
c: e0ee778
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown committed Aug 17, 2012
1 parent 608dc27 commit 77e61ed
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 667a5313ecd7308d79629c0738b0db588b0b0a4e
refs/heads/master: e0ee778528bbaad28a5c69d2e219269a3a096607
30 changes: 19 additions & 11 deletions trunk/drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,26 +659,30 @@ static int raid10_mergeable_bvec(struct request_queue *q,
max = biovec->bv_len;

if (mddev->merge_check_needed) {
struct r10bio r10_bio;
struct {
struct r10bio r10_bio;
struct r10dev devs[conf->copies];
} on_stack;
struct r10bio *r10_bio = &on_stack.r10_bio;
int s;
if (conf->reshape_progress != MaxSector) {
/* Cannot give any guidance during reshape */
if (max <= biovec->bv_len && bio_sectors == 0)
return biovec->bv_len;
return 0;
}
r10_bio.sector = sector;
raid10_find_phys(conf, &r10_bio);
r10_bio->sector = sector;
raid10_find_phys(conf, r10_bio);
rcu_read_lock();
for (s = 0; s < conf->copies; s++) {
int disk = r10_bio.devs[s].devnum;
int disk = r10_bio->devs[s].devnum;
struct md_rdev *rdev = rcu_dereference(
conf->mirrors[disk].rdev);
if (rdev && !test_bit(Faulty, &rdev->flags)) {
struct request_queue *q =
bdev_get_queue(rdev->bdev);
if (q->merge_bvec_fn) {
bvm->bi_sector = r10_bio.devs[s].addr
bvm->bi_sector = r10_bio->devs[s].addr
+ rdev->data_offset;
bvm->bi_bdev = rdev->bdev;
max = min(max, q->merge_bvec_fn(
Expand All @@ -690,7 +694,7 @@ static int raid10_mergeable_bvec(struct request_queue *q,
struct request_queue *q =
bdev_get_queue(rdev->bdev);
if (q->merge_bvec_fn) {
bvm->bi_sector = r10_bio.devs[s].addr
bvm->bi_sector = r10_bio->devs[s].addr
+ rdev->data_offset;
bvm->bi_bdev = rdev->bdev;
max = min(max, q->merge_bvec_fn(
Expand Down Expand Up @@ -4414,14 +4418,18 @@ 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 r10bio r10b;
struct r10conf *conf = mddev->private;
struct {
struct r10bio r10_bio;
struct r10dev devs[conf->copies];
} on_stack;
struct r10bio *r10b = &on_stack.r10_bio;
int slot = 0;
int idx = 0;
struct bio_vec *bvec = r10_bio->master_bio->bi_io_vec;

r10b.sector = r10_bio->sector;
__raid10_find_phys(&conf->prev, &r10b);
r10b->sector = r10_bio->sector;
__raid10_find_phys(&conf->prev, r10b);

while (sectors) {
int s = sectors;
Expand All @@ -4432,15 +4440,15 @@ static int handle_reshape_read_error(struct mddev *mddev,
s = PAGE_SIZE >> 9;

while (!success) {
int d = r10b.devs[slot].devnum;
int d = r10b->devs[slot].devnum;
struct md_rdev *rdev = conf->mirrors[d].rdev;
sector_t addr;
if (rdev == NULL ||
test_bit(Faulty, &rdev->flags) ||
!test_bit(In_sync, &rdev->flags))
goto failed;

addr = r10b.devs[slot].addr + idx * PAGE_SIZE;
addr = r10b->devs[slot].addr + idx * PAGE_SIZE;
success = sync_page_io(rdev,
addr,
s << 9,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/md/raid10.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct r10bio {
* We choose the number when they are allocated.
* We sometimes need an extra bio to write to the replacement.
*/
struct {
struct r10dev {
struct bio *bio;
union {
struct bio *repl_bio; /* used for resync and
Expand Down

0 comments on commit 77e61ed

Please sign in to comment.