Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16519
b: refs/heads/master
c: a1a1908
h: refs/heads/master
i:
  16517: 3acd27c
  16515: d799ef0
  16511: b960182
v: v3
  • Loading branch information
Jonathan E Brassow authored and Linus Torvalds committed Jan 6, 2006
1 parent ee484aa commit 280b8e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 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: 2d5fe68987341a59a3fd97c71695efcabb0c6fd5
refs/heads/master: a1a190807074bd6ad8771e00b00752771ae586cb
13 changes: 8 additions & 5 deletions trunk/drivers/md/dm-raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ struct mirror_set {
region_t nr_regions;
int in_sync;

struct mirror *default_mirror; /* Default mirror */

unsigned int nr_mirrors;
struct mirror mirror[0];
};
Expand Down Expand Up @@ -611,7 +613,7 @@ static int recover(struct mirror_set *ms, struct region *reg)
unsigned long flags = 0;

/* fill in the source */
m = ms->mirror + DEFAULT_MIRROR;
m = ms->default_mirror;
from.bdev = m->dev->bdev;
from.sector = m->offset + region_to_sector(reg->rh, reg->key);
if (reg->key == (ms->nr_regions - 1)) {
Expand All @@ -627,7 +629,7 @@ static int recover(struct mirror_set *ms, struct region *reg)

/* fill in the destinations */
for (i = 0, dest = to; i < ms->nr_mirrors; i++) {
if (i == DEFAULT_MIRROR)
if (&ms->mirror[i] == ms->default_mirror)
continue;

m = ms->mirror + i;
Expand Down Expand Up @@ -682,7 +684,7 @@ static void do_recovery(struct mirror_set *ms)
static struct mirror *choose_mirror(struct mirror_set *ms, sector_t sector)
{
/* FIXME: add read balancing */
return ms->mirror + DEFAULT_MIRROR;
return ms->default_mirror;
}

/*
Expand All @@ -709,7 +711,7 @@ static void do_reads(struct mirror_set *ms, struct bio_list *reads)
if (rh_in_sync(&ms->rh, region, 0))
m = choose_mirror(ms, bio->bi_sector);
else
m = ms->mirror + DEFAULT_MIRROR;
m = ms->default_mirror;

map_bio(ms, m, bio);
generic_make_request(bio);
Expand Down Expand Up @@ -833,7 +835,7 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
rh_delay(&ms->rh, bio);

while ((bio = bio_list_pop(&nosync))) {
map_bio(ms, ms->mirror + DEFAULT_MIRROR, bio);
map_bio(ms, ms->default_mirror, bio);
generic_make_request(bio);
}
}
Expand Down Expand Up @@ -900,6 +902,7 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors,
ms->nr_mirrors = nr_mirrors;
ms->nr_regions = dm_sector_div_up(ti->len, region_size);
ms->in_sync = 0;
ms->default_mirror = &ms->mirror[DEFAULT_MIRROR];

if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) {
ti->error = "dm-mirror: Error creating dirty region hash";
Expand Down

0 comments on commit 280b8e4

Please sign in to comment.