Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280511
b: refs/heads/master
c: 96c3fd1
h: refs/heads/master
i:
  280509: 8d5ecde
  280507: d6a0b73
  280503: 37ac794
  280495: ccac33f
  280479: 459fd37
  280447: 5ac51c9
v: v3
  • Loading branch information
NeilBrown committed Dec 22, 2011
1 parent 525c64c commit 980febf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 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: 69335ef3bc5b766f34db2d688be1d35313138bca
refs/heads/master: 96c3fd1f3802371610c620cff03f9d825707e80e
27 changes: 13 additions & 14 deletions trunk/drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ static int raid10_mergeable_bvec(struct request_queue *q,
* FIXME: possibly should rethink readbalancing and do it differently
* depending on near_copies / far_copies geometry.
*/
static int read_balance(struct r10conf *conf, struct r10bio *r10_bio, int *max_sectors)
static struct md_rdev *read_balance(struct r10conf *conf,
struct r10bio *r10_bio,
int *max_sectors)
{
const sector_t this_sector = r10_bio->sector;
int disk, slot;
Expand Down Expand Up @@ -703,11 +705,11 @@ static int read_balance(struct r10conf *conf, struct r10bio *r10_bio, int *max_s
}
r10_bio->read_slot = slot;
} else
disk = -1;
rdev = NULL;
rcu_read_unlock();
*max_sectors = best_good_sectors;

return disk;
return rdev;
}

static int raid10_congested(void *data, int bits)
Expand Down Expand Up @@ -874,7 +876,6 @@ static void unfreeze_array(struct r10conf *conf)
static void make_request(struct mddev *mddev, struct bio * bio)
{
struct r10conf *conf = mddev->private;
struct mirror_info *mirror;
struct r10bio *r10_bio;
struct bio *read_bio;
int i;
Expand Down Expand Up @@ -973,17 +974,16 @@ static void make_request(struct mddev *mddev, struct bio * bio)
/*
* read balancing logic:
*/
int disk;
struct md_rdev *rdev;
int slot;

read_again:
disk = read_balance(conf, r10_bio, &max_sectors);
slot = r10_bio->read_slot;
if (disk < 0) {
rdev = read_balance(conf, r10_bio, &max_sectors);
if (!rdev) {
raid_end_bio_io(r10_bio);
return;
}
mirror = conf->mirrors + disk;
slot = r10_bio->read_slot;

read_bio = bio_clone_mddev(bio, GFP_NOIO, mddev);
md_trim_bio(read_bio, r10_bio->sector - bio->bi_sector,
Expand All @@ -992,8 +992,8 @@ static void make_request(struct mddev *mddev, struct bio * bio)
r10_bio->devs[slot].bio = read_bio;

read_bio->bi_sector = r10_bio->devs[slot].addr +
mirror->rdev->data_offset;
read_bio->bi_bdev = mirror->rdev->bdev;
rdev->data_offset;
read_bio->bi_bdev = rdev->bdev;
read_bio->bi_end_io = raid10_end_read_request;
read_bio->bi_rw = READ | do_sync;
read_bio->bi_private = r10_bio;
Expand Down Expand Up @@ -2116,8 +2116,8 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
r10_bio->devs[slot].bio =
mddev->ro ? IO_BLOCKED : NULL;
read_more:
mirror = read_balance(conf, r10_bio, &max_sectors);
if (mirror == -1) {
rdev = read_balance(conf, r10_bio, &max_sectors);
if (rdev == NULL) {
printk(KERN_ALERT "md/raid10:%s: %s: unrecoverable I/O"
" read error for block %llu\n",
mdname(mddev), b,
Expand All @@ -2131,7 +2131,6 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
if (bio)
bio_put(bio);
slot = r10_bio->read_slot;
rdev = conf->mirrors[mirror].rdev;
printk_ratelimited(
KERN_ERR
"md/raid10:%s: %s: redirecting"
Expand Down

0 comments on commit 980febf

Please sign in to comment.