LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 000 of 3] md: bug fixes for md for 2.6.21
@ 2007-03-23  1:10 NeilBrown
  2007-03-23  1:10 ` [PATCH 001 of 3] md: Allow raid4 arrays to be reshaped NeilBrown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: NeilBrown @ 2007-03-23  1:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel

A minor new feature and 2 bug fixes for md suitable for 2.6.21

The minor feature is to make reshape (adding a drive to an array and
restriping it) work for raid4.  The code is all ready, it just wasn't
used.

Thanks,
NeilBrown


 [PATCH 001 of 3] md: Allow raid4 arrays to be reshaped.
 [PATCH 002 of 3] md: Clear the congested_fn when stopping a raid5
 [PATCH 003 of 3] md: Convert compile time warnings into runtime warnings.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 001 of 3] md: Allow raid4 arrays to be reshaped.
  2007-03-23  1:10 [PATCH 000 of 3] md: bug fixes for md for 2.6.21 NeilBrown
@ 2007-03-23  1:10 ` NeilBrown
  2007-03-23  1:10 ` [PATCH 002 of 3] md: Clear the congested_fn when stopping a raid5 NeilBrown
  2007-03-23  1:10 ` [PATCH 003 of 3] md: Convert compile time warnings into runtime warnings NeilBrown
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2007-03-23  1:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel


All that is missing the the function pointers in raid4_pers.


Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/raid5.c |    4 ++++
 1 file changed, 4 insertions(+)

diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
--- .prev/drivers/md/raid5.c	2007-03-23 11:13:29.000000000 +1100
+++ ./drivers/md/raid5.c	2007-03-23 11:13:29.000000000 +1100
@@ -4727,6 +4727,10 @@ static struct mdk_personality raid4_pers
 	.spare_active	= raid5_spare_active,
 	.sync_request	= sync_request,
 	.resize		= raid5_resize,
+#ifdef CONFIG_MD_RAID5_RESHAPE
+	.check_reshape	= raid5_check_reshape,
+	.start_reshape  = raid5_start_reshape,
+#endif
 	.quiesce	= raid5_quiesce,
 };
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 002 of 3] md: Clear the congested_fn when stopping a raid5
  2007-03-23  1:10 [PATCH 000 of 3] md: bug fixes for md for 2.6.21 NeilBrown
  2007-03-23  1:10 ` [PATCH 001 of 3] md: Allow raid4 arrays to be reshaped NeilBrown
@ 2007-03-23  1:10 ` NeilBrown
  2007-03-23  1:10 ` [PATCH 003 of 3] md: Convert compile time warnings into runtime warnings NeilBrown
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2007-03-23  1:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel


If this mddev and queue got reused for another array that doesn't
register a congested_fn, this function would get called incorretly.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/md.c    |    1 +
 ./drivers/md/raid5.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c	2007-03-23 11:13:41.000000000 +1100
+++ ./drivers/md/md.c	2007-03-23 11:13:41.000000000 +1100
@@ -3325,6 +3325,7 @@ static int do_md_stop(mddev_t * mddev, i
 			mddev->queue->merge_bvec_fn = NULL;
 			mddev->queue->unplug_fn = NULL;
 			mddev->queue->issue_flush_fn = NULL;
+			mddev->queue->backing_dev_info.congested_fn = NULL;
 			if (mddev->pers->sync_request)
 				sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
 

diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
--- .prev/drivers/md/raid5.c	2007-03-23 11:13:29.000000000 +1100
+++ ./drivers/md/raid5.c	2007-03-23 11:13:41.000000000 +1100
@@ -4269,8 +4269,8 @@ static int run(mddev_t *mddev)
 
 	mddev->queue->unplug_fn = raid5_unplug_device;
 	mddev->queue->issue_flush_fn = raid5_issue_flush;
-	mddev->queue->backing_dev_info.congested_fn = raid5_congested;
 	mddev->queue->backing_dev_info.congested_data = mddev;
+	mddev->queue->backing_dev_info.congested_fn = raid5_congested;
 
 	mddev->array_size =  mddev->size * (conf->previous_raid_disks -
 					    conf->max_degraded);
@@ -4301,6 +4301,7 @@ static int stop(mddev_t *mddev)
 	mddev->thread = NULL;
 	shrink_stripes(conf);
 	kfree(conf->stripe_hashtbl);
+	mddev->queue->backing_dev_info.congested_fn = NULL;
 	blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
 	sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
 	kfree(conf->disks);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 003 of 3] md: Convert compile time warnings into runtime warnings.
  2007-03-23  1:10 [PATCH 000 of 3] md: bug fixes for md for 2.6.21 NeilBrown
  2007-03-23  1:10 ` [PATCH 001 of 3] md: Allow raid4 arrays to be reshaped NeilBrown
  2007-03-23  1:10 ` [PATCH 002 of 3] md: Clear the congested_fn when stopping a raid5 NeilBrown
@ 2007-03-23  1:10 ` NeilBrown
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2007-03-23  1:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel


... still not sure why we need this ....

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/md.c    |   41 +++++++++++++++++++++++++++++++----------
 ./drivers/md/raid5.c |   12 ++++++++++--
 2 files changed, 41 insertions(+), 12 deletions(-)

diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c	2007-03-23 11:13:41.000000000 +1100
+++ ./drivers/md/md.c	2007-03-23 12:06:34.000000000 +1100
@@ -1319,6 +1319,7 @@ static int bind_rdev_to_array(mdk_rdev_t
 	char b[BDEVNAME_SIZE];
 	struct kobject *ko;
 	char *s;
+	int err;
 
 	if (rdev->mddev) {
 		MD_BUG();
@@ -1353,20 +1354,29 @@ static int bind_rdev_to_array(mdk_rdev_t
 	while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
 		*s = '!';
 			
-	list_add(&rdev->same_set, &mddev->disks);
 	rdev->mddev = mddev;
 	printk(KERN_INFO "md: bind<%s>\n", b);
 
 	rdev->kobj.parent = &mddev->kobj;
-	kobject_add(&rdev->kobj);
+	if ((err = kobject_add(&rdev->kobj)))
+		goto fail;
 
 	if (rdev->bdev->bd_part)
 		ko = &rdev->bdev->bd_part->kobj;
 	else
 		ko = &rdev->bdev->bd_disk->kobj;
-	sysfs_create_link(&rdev->kobj, ko, "block");
+	if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
+		kobject_del(&rdev->kobj);
+		goto fail;
+	}
+	list_add(&rdev->same_set, &mddev->disks);
 	bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk);
 	return 0;
+
+ fail:
+	printk(KERN_WARNING "md: failed to register dev-%s for %s\n",
+	       b, mdname(mddev));
+	return err;
 }
 
 static void unbind_rdev_from_array(mdk_rdev_t * rdev)
@@ -2966,7 +2976,9 @@ static struct kobject *md_probe(dev_t de
 	mddev->kobj.k_name = NULL;
 	snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
 	mddev->kobj.ktype = &md_ktype;
-	kobject_register(&mddev->kobj);
+	if (kobject_register(&mddev->kobj))
+		printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
+		       disk->disk_name);
 	return NULL;
 }
 
@@ -3144,9 +3156,12 @@ static int do_md_run(mddev_t * mddev)
 		bitmap_destroy(mddev);
 		return err;
 	}
-	if (mddev->pers->sync_request)
-		sysfs_create_group(&mddev->kobj, &md_redundancy_group);
-	else if (mddev->ro == 2) /* auto-readonly not meaningful */
+	if (mddev->pers->sync_request) {
+		if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
+			printk(KERN_WARNING
+			       "md: cannot register extra attributes for %s\n",
+			       mdname(mddev));
+	} else if (mddev->ro == 2) /* auto-readonly not meaningful */
 		mddev->ro = 0;
 
  	atomic_set(&mddev->writes_pending,0);
@@ -3160,7 +3175,9 @@ static int do_md_run(mddev_t * mddev)
 		if (rdev->raid_disk >= 0) {
 			char nm[20];
 			sprintf(nm, "rd%d", rdev->raid_disk);
-			sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
+			if (sysfs_create_link(&mddev->kobj, &rdev->kobj, nm))
+				printk("md: cannot register %s for %s\n",
+				       nm, mdname(mddev));
 		}
 	
 	set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -5388,8 +5405,12 @@ static int remove_and_add_spares(mddev_t
 				if (mddev->pers->hot_add_disk(mddev,rdev)) {
 					char nm[20];
 					sprintf(nm, "rd%d", rdev->raid_disk);
-					sysfs_create_link(&mddev->kobj,
-							  &rdev->kobj, nm);
+					if (sysfs_create_link(&mddev->kobj,
+							      &rdev->kobj, nm))
+						printk(KERN_WARNING
+						       "md: cannot register "
+						       "%s for %s\n",
+						       nm, mdname(mddev));
 					spares++;
 					md_new_event(mddev);
 				} else

diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
--- .prev/drivers/md/raid5.c	2007-03-23 11:13:41.000000000 +1100
+++ ./drivers/md/raid5.c	2007-03-23 12:06:00.000000000 +1100
@@ -4265,7 +4265,10 @@ static int run(mddev_t *mddev)
 	}
 
 	/* Ok, everything is just fine now */
-	sysfs_create_group(&mddev->kobj, &raid5_attrs_group);
+	if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
+		printk(KERN_WARNING
+		       "raid5: failed to create sysfs attributes for %s\n",
+		       mdname(mddev));
 
 	mddev->queue->unplug_fn = raid5_unplug_device;
 	mddev->queue->issue_flush_fn = raid5_issue_flush;
@@ -4574,7 +4577,12 @@ static int raid5_start_reshape(mddev_t *
 				added_devices++;
 				rdev->recovery_offset = 0;
 				sprintf(nm, "rd%d", rdev->raid_disk);
-				sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
+				if (sysfs_create_link(&mddev->kobj,
+						      &rdev->kobj, nm))
+					printk(KERN_WARNING
+					       "raid5: failed to create "
+					       " link %s for %s\n",
+					       nm, mdname(mddev));
 			} else
 				break;
 		}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-23  1:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-23  1:10 [PATCH 000 of 3] md: bug fixes for md for 2.6.21 NeilBrown
2007-03-23  1:10 ` [PATCH 001 of 3] md: Allow raid4 arrays to be reshaped NeilBrown
2007-03-23  1:10 ` [PATCH 002 of 3] md: Clear the congested_fn when stopping a raid5 NeilBrown
2007-03-23  1:10 ` [PATCH 003 of 3] md: Convert compile time warnings into runtime warnings NeilBrown

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).