* [PATCH 001 of 5] md: Fix a bug in some never-used code.
2007-10-15 4:34 [PATCH 000 of 5] md: Five minor md patch, some for 2.6.24 NeilBrown
@ 2007-10-15 4:34 ` NeilBrown
2007-10-15 4:34 ` [PATCH 002 of 5] md: 'sync_action' in sysfs returns wrong value for readonly arrays NeilBrown
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: NeilBrown @ 2007-10-15 4:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
http://bugzilla.kernel.org/show_bug.cgi?id=3277
There is a seq_printf here that isn't being passed a 'seq'.
Howeve as the code is inside #ifdef MD_DEBUG, nobody noticed.
Also remove some extra spaces.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/raid0.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff .prev/drivers/md/raid0.c ./drivers/md/raid0.c
--- .prev/drivers/md/raid0.c 2007-10-15 14:05:58.000000000 +1000
+++ ./drivers/md/raid0.c 2007-10-15 14:06:05.000000000 +1000
@@ -472,7 +472,7 @@ bad_map:
bio_io_error(bio);
return 0;
}
-
+
static void raid0_status (struct seq_file *seq, mddev_t *mddev)
{
#undef MD_DEBUG
@@ -480,18 +480,18 @@ static void raid0_status (struct seq_fil
int j, k, h;
char b[BDEVNAME_SIZE];
raid0_conf_t *conf = mddev_to_conf(mddev);
-
+
h = 0;
for (j = 0; j < conf->nr_strip_zones; j++) {
seq_printf(seq, " z%d", j);
if (conf->hash_table[h] == conf->strip_zone+j)
- seq_printf("(h%d)", h++);
+ seq_printf(seq, "(h%d)", h++);
seq_printf(seq, "=[");
for (k = 0; k < conf->strip_zone[j].nb_dev; k++)
- seq_printf (seq, "%s/", bdevname(
+ seq_printf(seq, "%s/", bdevname(
conf->strip_zone[j].dev[k]->bdev,b));
- seq_printf (seq, "] zo=%d do=%d s=%d\n",
+ seq_printf(seq, "] zo=%d do=%d s=%d\n",
conf->strip_zone[j].zone_offset,
conf->strip_zone[j].dev_offset,
conf->strip_zone[j].size);
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 002 of 5] md: 'sync_action' in sysfs returns wrong value for readonly arrays
2007-10-15 4:34 [PATCH 000 of 5] md: Five minor md patch, some for 2.6.24 NeilBrown
2007-10-15 4:34 ` [PATCH 001 of 5] md: Fix a bug in some never-used code NeilBrown
@ 2007-10-15 4:34 ` NeilBrown
2007-10-15 4:34 ` [PATCH 003 of 5] md: Expose the degraded status of an assembled array through sysfs NeilBrown
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: NeilBrown @ 2007-10-15 4:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
When an array is started read-only, MD_RECOVERY_NEEDED can be set but
no recovery will be running. This causes 'sync_action' to report the
wrong value.
We could remove the test for MD_RECOVERY_NEEDED, but doing so would
leave a small gap after requesting a sync action, where 'sync_action'
would still report the old value.
So make sure that for a read-only array, 'sync_action' always returns 'idle'.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c 2007-10-15 14:06:32.000000000 +1000
+++ ./drivers/md/md.c 2007-10-15 14:06:32.000000000 +1000
@@ -2714,7 +2714,7 @@ action_show(mddev_t *mddev, char *page)
{
char *type = "idle";
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
- test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) {
+ (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) {
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
type = "reshape";
else if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 003 of 5] md: Expose the degraded status of an assembled array through sysfs
2007-10-15 4:34 [PATCH 000 of 5] md: Five minor md patch, some for 2.6.24 NeilBrown
2007-10-15 4:34 ` [PATCH 001 of 5] md: Fix a bug in some never-used code NeilBrown
2007-10-15 4:34 ` [PATCH 002 of 5] md: 'sync_action' in sysfs returns wrong value for readonly arrays NeilBrown
@ 2007-10-15 4:34 ` NeilBrown
2007-10-15 4:34 ` [PATCH 004 of 5] md: Make sure read errors are auto-corrected during a 'check' resync in raid1 NeilBrown
2007-10-15 4:34 ` [PATCH 005 of 5] md: Fix type that is stopping raid5 grow from working NeilBrown
4 siblings, 0 replies; 6+ messages in thread
From: NeilBrown @ 2007-10-15 4:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel, Iustin Pop
From: Iustin Pop <iusty@k1024.org>
The 'degraded' attribute is useful to quickly determine if the array is
degraded, instead of parsing 'mdadm -D' output or relying on the other
techniques (number of working devices against number of defined devices, etc.).
The md code already keeps track of this attribute, so it's useful to export it.
Signed-off-by: Iustin Pop <iusty@k1024.org>
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/md.c | 7 +++++++
1 file changed, 7 insertions(+)
diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c 2007-10-15 14:06:32.000000000 +1000
+++ ./drivers/md/md.c 2007-10-15 14:06:52.000000000 +1000
@@ -2833,6 +2833,12 @@ sync_max_store(mddev_t *mddev, const cha
static struct md_sysfs_entry md_sync_max =
__ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store);
+static ssize_t
+degraded_show(mddev_t *mddev, char *page)
+{
+ return sprintf(page, "%d\n", mddev->degraded);
+}
+static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
static ssize_t
sync_speed_show(mddev_t *mddev, char *page)
@@ -2976,6 +2982,7 @@ static struct attribute *md_redundancy_a
&md_suspend_lo.attr,
&md_suspend_hi.attr,
&md_bitmap.attr,
+ &md_degraded.attr,
NULL,
};
static struct attribute_group md_redundancy_group = {
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 004 of 5] md: Make sure read errors are auto-corrected during a 'check' resync in raid1
2007-10-15 4:34 [PATCH 000 of 5] md: Five minor md patch, some for 2.6.24 NeilBrown
` (2 preceding siblings ...)
2007-10-15 4:34 ` [PATCH 003 of 5] md: Expose the degraded status of an assembled array through sysfs NeilBrown
@ 2007-10-15 4:34 ` NeilBrown
2007-10-15 4:34 ` [PATCH 005 of 5] md: Fix type that is stopping raid5 grow from working NeilBrown
4 siblings, 0 replies; 6+ messages in thread
From: NeilBrown @ 2007-10-15 4:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
Whenever a read error is found, we should attempt to overwrite with
correct data to 'fix' it.
However when do a 'check' pass (which compares data blocks that are
successfully read, but doesn't normally overwrite) we don't do that.
We should.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/raid1.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff .prev/drivers/md/raid1.c ./drivers/md/raid1.c
--- .prev/drivers/md/raid1.c 2007-10-15 14:07:17.000000000 +1000
+++ ./drivers/md/raid1.c 2007-10-15 14:08:55.000000000 +1000
@@ -1214,7 +1214,8 @@ static void sync_request_write(mddev_t *
j = 0;
if (j >= 0)
mddev->resync_mismatches += r1_bio->sectors;
- if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
+ if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)
+ && test_bit(BIO_UPTODATE, &sbio->bi_flags))) {
sbio->bi_end_io = NULL;
rdev_dec_pending(conf->mirrors[i].rdev, mddev);
} else {
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 005 of 5] md: Fix type that is stopping raid5 grow from working.
2007-10-15 4:34 [PATCH 000 of 5] md: Five minor md patch, some for 2.6.24 NeilBrown
` (3 preceding siblings ...)
2007-10-15 4:34 ` [PATCH 004 of 5] md: Make sure read errors are auto-corrected during a 'check' resync in raid1 NeilBrown
@ 2007-10-15 4:34 ` NeilBrown
4 siblings, 0 replies; 6+ messages in thread
From: NeilBrown @ 2007-10-15 4:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel, Dan Williams
This kmem_cache_create is creating a cache that already exists. We
could us the alternate name, just like we do a few lines up.
Signed-off-by: Neil Brown <neilb@suse.de>
Cc: "Dan Williams" <dan.j.williams@intel.com>
### Diffstat output
./drivers/md/raid5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
--- .prev/drivers/md/raid5.c 2007-10-15 14:12:03.000000000 +1000
+++ ./drivers/md/raid5.c 2007-10-15 14:12:06.000000000 +1000
@@ -1380,7 +1380,7 @@ static int resize_stripes(raid5_conf_t *
if (!sc)
return -ENOMEM;
- sc_q = kmem_cache_create(conf->sq_cache_name[conf->active_name],
+ sc_q = kmem_cache_create(conf->sq_cache_name[1-conf->active_name],
(sizeof(struct stripe_queue)+(newsize-1) *
sizeof(struct r5_queue_dev)) +
r5_io_weight_size(newsize) +
^ permalink raw reply [flat|nested] 6+ messages in thread