Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38119
b: refs/heads/master
c: 11ce99e
h: refs/heads/master
i:
  38117: 67581be
  38115: f5b6534
  38111: 94a77fe
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Oct 3, 2006
1 parent 0aa4007 commit d6cace3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 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: 867868fb557eb2a2120b80779468fa372584ddb0
refs/heads/master: 11ce99e625fe2718ad2682bfdd99070b337e6252
28 changes: 12 additions & 16 deletions trunk/drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static int raid1_end_read_request(struct bio *bio, unsigned int bytes_done, int
*/
update_head_pos(mirror, r1_bio);

if (uptodate || conf->working_disks <= 1) {
if (uptodate || (conf->raid_disks - conf->mddev->degraded) <= 1) {
/*
* Set R1BIO_Uptodate in our master bio, so that
* we will return a good error code for to the higher
Expand Down Expand Up @@ -929,7 +929,7 @@ static void status(struct seq_file *seq, mddev_t *mddev)
int i;

seq_printf(seq, " [%d/%d] [", conf->raid_disks,
conf->working_disks);
conf->raid_disks - mddev->degraded);
rcu_read_lock();
for (i = 0; i < conf->raid_disks; i++) {
mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
Expand All @@ -953,15 +953,14 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
* else mark the drive as failed
*/
if (test_bit(In_sync, &rdev->flags)
&& conf->working_disks == 1)
&& (conf->raid_disks - mddev->degraded) == 1)
/*
* Don't fail the drive, act as though we were just a
* normal single drive
*/
return;
if (test_bit(In_sync, &rdev->flags)) {
mddev->degraded++;
conf->working_disks--;
/*
* if recovery is running, make sure it aborts.
*/
Expand All @@ -972,7 +971,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
set_bit(MD_CHANGE_DEVS, &mddev->flags);
printk(KERN_ALERT "raid1: Disk failure on %s, disabling device. \n"
" Operation continuing on %d devices\n",
bdevname(rdev->bdev,b), conf->working_disks);
bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded);
}

static void print_conf(conf_t *conf)
Expand All @@ -984,7 +983,7 @@ static void print_conf(conf_t *conf)
printk("(!conf)\n");
return;
}
printk(" --- wd:%d rd:%d\n", conf->working_disks,
printk(" --- wd:%d rd:%d\n", conf->raid_disks - conf->mddev->degraded,
conf->raid_disks);

rcu_read_lock();
Expand Down Expand Up @@ -1024,7 +1023,6 @@ static int raid1_spare_active(mddev_t *mddev)
if (rdev
&& !test_bit(Faulty, &rdev->flags)
&& !test_bit(In_sync, &rdev->flags)) {
conf->working_disks++;
mddev->degraded--;
set_bit(In_sync, &rdev->flags);
}
Expand Down Expand Up @@ -1901,27 +1899,18 @@ static int run(mddev_t *mddev)
blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);

disk->head_position = 0;
if (!test_bit(Faulty, &rdev->flags) && test_bit(In_sync, &rdev->flags))
conf->working_disks++;
}
conf->raid_disks = mddev->raid_disks;
conf->mddev = mddev;
spin_lock_init(&conf->device_lock);
INIT_LIST_HEAD(&conf->retry_list);
if (conf->working_disks == 1)
mddev->recovery_cp = MaxSector;

spin_lock_init(&conf->resync_lock);
init_waitqueue_head(&conf->wait_barrier);

bio_list_init(&conf->pending_bio_list);
bio_list_init(&conf->flushing_bio_list);

if (!conf->working_disks) {
printk(KERN_ERR "raid1: no operational mirrors for %s\n",
mdname(mddev));
goto out_free_conf;
}

mddev->degraded = 0;
for (i = 0; i < conf->raid_disks; i++) {
Expand All @@ -1934,6 +1923,13 @@ static int run(mddev_t *mddev)
mddev->degraded++;
}
}
if (mddev->degraded == conf->raid_disks) {
printk(KERN_ERR "raid1: no operational mirrors for %s\n",
mdname(mddev));
goto out_free_conf;
}
if (conf->raid_disks - mddev->degraded == 1)
mddev->recovery_cp = MaxSector;

/*
* find the first working one and use it as a starting point
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/raid/raid1.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ struct r1_private_data_s {
mddev_t *mddev;
mirror_info_t *mirrors;
int raid_disks;
int working_disks;
int last_used;
sector_t next_seq_sect;
spinlock_t device_lock;
Expand Down

0 comments on commit d6cace3

Please sign in to comment.