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: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown
2014-12-15 12:56:58 +11:00
parent 5aa61f427e
commit afa0f557cb
9 changed files with 35 additions and 50 deletions

View File

@@ -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);