Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afa0f557 authored by NeilBrown's avatar NeilBrown
Browse files

md: rename ->stop to ->free



Now that the ->stop function only frees the private data,
rename is accordingly.

Also pass in the private pointer as an arg rather than using
mddev->private.  This flexibility will be useful in level_store().

Finally, don't clear ->private.  It doesn't make sense to clear
it seeing that isn't what we free, and it is no longer necessary
to clear ->private (it was some time ago before  ->to_remove was
introduced).

Setting ->to_remove in ->free() is a bit of a wart, but not a
big problem at the moment.

Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 5aa61f42
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -332,13 +332,11 @@ static int run(struct mddev *mddev)
	return 0;
}

static int stop(struct mddev *mddev)
static void faulty_free(struct mddev *mddev, void *priv)
{
	struct faulty_conf *conf = mddev->private;
	struct faulty_conf *conf = priv;

	kfree(conf);
	mddev->private = NULL;
	return 0;
}

static struct md_personality faulty_personality =
@@ -348,7 +346,7 @@ static struct md_personality faulty_personality =
	.owner		= THIS_MODULE,
	.make_request	= make_request,
	.run		= run,
	.stop		= stop,
	.free		= faulty_free,
	.status		= status,
	.check_reshape	= reshape,
	.size		= faulty_size,
+3 −6
Original line number Diff line number Diff line
@@ -249,14 +249,11 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
	return 0;
}

static int linear_stop (struct mddev *mddev)
static void linear_free(struct mddev *mddev, void *priv)
{
	struct linear_conf *conf = mddev->private;
	struct linear_conf *conf = priv;

	kfree(conf);
	mddev->private = NULL;

	return 0;
}

static void linear_make_request(struct mddev *mddev, struct bio *bio)
@@ -335,7 +332,7 @@ static struct md_personality linear_personality =
	.owner		= THIS_MODULE,
	.make_request	= linear_make_request,
	.run		= linear_run,
	.stop		= linear_stop,
	.free		= linear_free,
	.status		= linear_status,
	.hot_add_disk	= linear_add,
	.size		= linear_size,
+5 −5
Original line number Diff line number Diff line
@@ -293,8 +293,8 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
/* mddev_suspend makes sure no new requests are submitted
 * to the device, and that any requests that have been submitted
 * are completely handled.
 * Once ->stop is called and completes, the module will be completely
 * unused.
 * Once mddev_detach() is called and completes, the module will be
 * completely unused.
 */
void mddev_suspend(struct mddev *mddev)
{
@@ -3374,7 +3374,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
	/* Looks like we have a winner */
	mddev_suspend(mddev);
	mddev_detach(mddev);
	mddev->pers->stop(mddev);
	mddev->pers->free(mddev, mddev->private);

	if (mddev->pers->sync_request == NULL &&
	    pers->sync_request != NULL) {
@@ -4940,7 +4940,7 @@ int md_run(struct mddev *mddev)
	}
	if (err) {
		mddev_detach(mddev);
		mddev->pers->stop(mddev);
		mddev->pers->free(mddev, mddev->private);
		module_put(mddev->pers->owner);
		mddev->pers = NULL;
		bitmap_destroy(mddev);
@@ -5137,7 +5137,7 @@ static void __md_stop(struct mddev *mddev)
{
	mddev->ready = 0;
	mddev_detach(mddev);
	mddev->pers->stop(mddev);
	mddev->pers->free(mddev, mddev->private);
	if (mddev->pers->sync_request && mddev->to_remove == NULL)
		mddev->to_remove = &md_redundancy_group;
	module_put(mddev->pers->owner);
+1 −1
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ struct md_personality
	struct module *owner;
	void (*make_request)(struct mddev *mddev, struct bio *bio);
	int (*run)(struct mddev *mddev);
	int (*stop)(struct mddev *mddev);
	void (*free)(struct mddev *mddev, void *priv);
	void (*status)(struct seq_file *seq, struct mddev *mddev);
	/* error_handler must set ->faulty and clear ->in_sync
	 * if appropriate, and should abort recovery if needed
+4 −6
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ static int multipath_run (struct mddev *mddev)
	/*
	 * copy the already verified devices into our private MULTIPATH
	 * bookkeeping area. [whatever we allocate in multipath_run(),
	 * should be freed in multipath_stop()]
	 * should be freed in multipath_free()]
	 */

	conf = kzalloc(sizeof(struct mpconf), GFP_KERNEL);
@@ -500,15 +500,13 @@ static int multipath_run (struct mddev *mddev)
	return -EIO;
}

static int multipath_stop (struct mddev *mddev)
static void multipath_free(struct mddev *mddev, void *priv)
{
	struct mpconf *conf = mddev->private;
	struct mpconf *conf = priv;

	mempool_destroy(conf->pool);
	kfree(conf->multipaths);
	kfree(conf);
	mddev->private = NULL;
	return 0;
}

static struct md_personality multipath_personality =
@@ -518,7 +516,7 @@ static struct md_personality multipath_personality =
	.owner		= THIS_MODULE,
	.make_request	= multipath_make_request,
	.run		= multipath_run,
	.stop		= multipath_stop,
	.free		= multipath_free,
	.status		= multipath_status,
	.error_handler	= multipath_error,
	.hot_add_disk	= multipath_add_disk,
Loading