From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 006 of 9] md: Remove the working_disks and failed_disks from raid5 state data.
Date: Mon, 31 Jul 2006 17:32:27 +1000 [thread overview]
Message-ID: <1060731073227.24494@suse.de> (raw)
In-Reply-To: 20060731172842.24323.patches@notabene
They are not needed.
conf->failed_disks is the same as mddev->degraded
and
conf->working_disks is conf->raid_disks - mddev->degraded.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/raid5.c | 20 ++++++++------------
./include/linux/raid/raid5.h | 2 +-
2 files changed, 9 insertions(+), 13 deletions(-)
diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
--- .prev/drivers/md/raid5.c 2006-07-31 17:24:34.000000000 +1000
+++ ./drivers/md/raid5.c 2006-07-31 17:24:35.000000000 +1000
@@ -698,9 +698,7 @@ static void error(mddev_t *mddev, mdk_rd
if (!test_bit(Faulty, &rdev->flags)) {
set_bit(MD_CHANGE_DEVS, &mddev->flags);
if (test_bit(In_sync, &rdev->flags)) {
- conf->working_disks--;
mddev->degraded++;
- conf->failed_disks++;
clear_bit(In_sync, &rdev->flags);
/*
* if recovery was running, make sure it aborts.
@@ -711,7 +709,7 @@ static void error(mddev_t *mddev, mdk_rd
printk (KERN_ALERT
"raid5: Disk failure on %s, disabling device."
" Operation continuing on %d devices\n",
- bdevname(rdev->bdev,b), conf->working_disks);
+ bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded);
}
}
@@ -3074,6 +3072,7 @@ static int run(mddev_t *mddev)
mdk_rdev_t *rdev;
struct disk_info *disk;
struct list_head *tmp;
+ int working_disks = 0;
if (mddev->level != 5 && mddev->level != 4 && mddev->level != 6) {
printk(KERN_ERR "raid5: %s: raid level not set to 4/5/6 (%d)\n",
@@ -3176,14 +3175,14 @@ static int run(mddev_t *mddev)
printk(KERN_INFO "raid5: device %s operational as raid"
" disk %d\n", bdevname(rdev->bdev,b),
raid_disk);
- conf->working_disks++;
+ working_disks++;
}
}
/*
* 0 for a fully functional array, 1 or 2 for a degraded array.
*/
- mddev->degraded = conf->failed_disks = conf->raid_disks - conf->working_disks;
+ mddev->degraded = conf->raid_disks - working_disks;
conf->mddev = mddev;
conf->chunk_size = mddev->chunk_size;
conf->level = mddev->level;
@@ -3218,7 +3217,7 @@ static int run(mddev_t *mddev)
if (mddev->degraded > conf->max_degraded) {
printk(KERN_ERR "raid5: not enough operational devices for %s"
" (%d/%d failed)\n",
- mdname(mddev), conf->failed_disks, conf->raid_disks);
+ mdname(mddev), mddev->degraded, conf->raid_disks);
goto abort;
}
@@ -3375,7 +3374,7 @@ static void status (struct seq_file *seq
int i;
seq_printf (seq, " level %d, %dk chunk, algorithm %d", mddev->level, mddev->chunk_size >> 10, mddev->layout);
- seq_printf (seq, " [%d/%d] [", conf->raid_disks, conf->working_disks);
+ seq_printf (seq, " [%d/%d] [", conf->raid_disks, conf->raid_disks - mddev->degraded);
for (i = 0; i < conf->raid_disks; i++)
seq_printf (seq, "%s",
conf->disks[i].rdev &&
@@ -3397,8 +3396,8 @@ static void print_raid5_conf (raid5_conf
printk("(conf==NULL)\n");
return;
}
- printk(" --- rd:%d wd:%d fd:%d\n", conf->raid_disks,
- conf->working_disks, conf->failed_disks);
+ printk(" --- rd:%d wd:%d\n", conf->raid_disks,
+ conf->raid_disks - conf->mddev->degraded);
for (i = 0; i < conf->raid_disks; i++) {
char b[BDEVNAME_SIZE];
@@ -3422,8 +3421,6 @@ static int raid5_spare_active(mddev_t *m
&& !test_bit(Faulty, &tmp->rdev->flags)
&& !test_bit(In_sync, &tmp->rdev->flags)) {
mddev->degraded--;
- conf->failed_disks--;
- conf->working_disks++;
set_bit(In_sync, &tmp->rdev->flags);
}
}
@@ -3593,7 +3590,6 @@ static int raid5_start_reshape(mddev_t *
if (raid5_add_disk(mddev, rdev)) {
char nm[20];
set_bit(In_sync, &rdev->flags);
- conf->working_disks++;
added_devices++;
rdev->recovery_offset = 0;
sprintf(nm, "rd%d", rdev->raid_disk);
diff .prev/include/linux/raid/raid5.h ./include/linux/raid/raid5.h
--- .prev/include/linux/raid/raid5.h 2006-07-31 17:23:56.000000000 +1000
+++ ./include/linux/raid/raid5.h 2006-07-31 17:24:35.000000000 +1000
@@ -214,7 +214,7 @@ struct raid5_private_data {
struct disk_info *spare;
int chunk_size, level, algorithm;
int max_degraded;
- int raid_disks, working_disks, failed_disks;
+ int raid_disks;
int max_nr_stripes;
/* used during an expand */
next prev parent reply other threads:[~2006-07-31 7:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-31 7:31 [PATCH 000 of 9] md: Introduction - assorted cleanup and minor fixes NeilBrown
2006-07-31 7:31 ` [PATCH 001 of 9] md: The scheduled removal of the START_ARRAY ioctl for md NeilBrown
2006-07-31 7:31 ` [PATCH 002 of 9] md: Fix a comment that is wrong in raid5.h NeilBrown
2006-07-31 7:32 ` [PATCH 003 of 9] md: Factor out part of raid1d into a separate function NeilBrown
2006-07-31 7:32 ` [PATCH 004 of 9] md: Factor out part of raid10d " NeilBrown
2006-08-01 17:15 ` Bill Davidsen
2006-08-01 20:27 ` Neil Brown
2006-07-31 7:32 ` [PATCH 005 of 9] md: Replace magic numbers in sb_dirty with well defined bit flags NeilBrown
2006-07-31 15:33 ` Ingo Oeser
2006-08-01 17:12 ` Bill Davidsen
2006-08-02 22:52 ` Doug Ledford
2006-07-31 7:32 ` NeilBrown [this message]
2006-07-31 7:43 ` [PATCH 006 of 9] md: Remove the working_disks and failed_disks from raid5 state data Michael Tokarev
2006-07-31 7:32 ` [PATCH 007 of 9] md: Remove 'working_disks' from raid10 state NeilBrown
2006-07-31 7:32 ` [PATCH 008 of 9] md: Remove working_disks from raid1 state data NeilBrown
2006-07-31 7:32 ` [PATCH 009 of 9] md: Improve locking around error handling NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1060731073227.24494@suse.de \
--to=neilb@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).