Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 260969
b: refs/heads/master
c: 778ca01
h: refs/heads/master
i:
  260967: 0bc323a
v: v3
  • Loading branch information
Namhyung Kim authored and NeilBrown committed Jul 18, 2011
1 parent fa012d4 commit fcd47f4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 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: 2c4193df379bb89114ff60d4b0fa66131abe6a75
refs/heads/master: 778ca01852e6cc9ff335119b37a1938a978df384
44 changes: 23 additions & 21 deletions trunk/drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,23 @@ static inline void update_head_pos(int slot, r10bio_t *r10_bio)
r10_bio->devs[slot].addr + (r10_bio->sectors);
}

/*
* Find the disk number which triggered given bio
*/
static int find_bio_disk(conf_t *conf, r10bio_t *r10_bio, struct bio *bio)
{
int slot;

for (slot = 0; slot < conf->copies; slot++)
if (r10_bio->devs[slot].bio == bio)
break;

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

return r10_bio->devs[slot].devnum;
}

static void raid10_end_read_request(struct bio *bio, int error)
{
int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
Expand Down Expand Up @@ -289,13 +306,10 @@ static void raid10_end_write_request(struct bio *bio, int error)
{
int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
r10bio_t *r10_bio = bio->bi_private;
int slot, dev;
int dev;
conf_t *conf = r10_bio->mddev->private;

for (slot = 0; slot < conf->copies; slot++)
if (r10_bio->devs[slot].bio == bio)
break;
dev = r10_bio->devs[slot].devnum;
dev = find_bio_disk(conf, r10_bio, bio);

/*
* this branch is our 'one mirror IO has finished' event handler:
Expand All @@ -316,8 +330,6 @@ static void raid10_end_write_request(struct bio *bio, int error)
*/
set_bit(R10BIO_Uptodate, &r10_bio->state);

update_head_pos(slot, r10_bio);

/*
*
* Let's see if all mirrored write operations have finished
Expand Down Expand Up @@ -1173,14 +1185,9 @@ static void end_sync_read(struct bio *bio, int error)
{
r10bio_t *r10_bio = bio->bi_private;
conf_t *conf = r10_bio->mddev->private;
int i,d;
int d;

for (i=0; i<conf->copies; i++)
if (r10_bio->devs[i].bio == bio)
break;
BUG_ON(i == conf->copies);
update_head_pos(i, r10_bio);
d = r10_bio->devs[i].devnum;
d = find_bio_disk(conf, r10_bio, bio);

if (test_bit(BIO_UPTODATE, &bio->bi_flags))
set_bit(R10BIO_Uptodate, &r10_bio->state);
Expand Down Expand Up @@ -1211,18 +1218,13 @@ static void end_sync_write(struct bio *bio, int error)
r10bio_t *r10_bio = bio->bi_private;
mddev_t *mddev = r10_bio->mddev;
conf_t *conf = mddev->private;
int i,d;
int d;

for (i = 0; i < conf->copies; i++)
if (r10_bio->devs[i].bio == bio)
break;
d = r10_bio->devs[i].devnum;
d = find_bio_disk(conf, r10_bio, bio);

if (!uptodate)
md_error(mddev, conf->mirrors[d].rdev);

update_head_pos(i, r10_bio);

rdev_dec_pending(conf->mirrors[d].rdev, mddev);
while (atomic_dec_and_test(&r10_bio->remaining)) {
if (r10_bio->master_bio == NULL) {
Expand Down

0 comments on commit fcd47f4

Please sign in to comment.