aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-12-14 20:56:58 -0500
committerNeilBrown <neilb@suse.de>2015-02-03 16:35:52 -0500
commitafa0f557cb15176570a18fb2a093e348a793afd4 (patch)
tree7ae3f6a37ae3e6bcfbea51faadad924df8020095 /drivers/md/raid1.c
parent5aa61f427e4979be733e4847b9199ff9cc48a47e (diff)
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>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index fccea0b39808..5dd0c2e59ab9 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2872,7 +2872,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
2872 return ERR_PTR(err); 2872 return ERR_PTR(err);
2873} 2873}
2874 2874
2875static int stop(struct mddev *mddev); 2875static void raid1_free(struct mddev *mddev, void *priv);
2876static int run(struct mddev *mddev) 2876static int run(struct mddev *mddev)
2877{ 2877{
2878 struct r1conf *conf; 2878 struct r1conf *conf;
@@ -2894,7 +2894,7 @@ static int run(struct mddev *mddev)
2894 /* 2894 /*
2895 * copy the already verified devices into our private RAID1 2895 * copy the already verified devices into our private RAID1
2896 * bookkeeping area. [whatever we allocate in run(), 2896 * bookkeeping area. [whatever we allocate in run(),
2897 * should be freed in stop()] 2897 * should be freed in raid1_free()]
2898 */ 2898 */
2899 if (mddev->private == NULL) 2899 if (mddev->private == NULL)
2900 conf = setup_conf(mddev); 2900 conf = setup_conf(mddev);
@@ -2956,14 +2956,14 @@ static int run(struct mddev *mddev)
2956 ret = md_integrity_register(mddev); 2956 ret = md_integrity_register(mddev);
2957 if (ret) { 2957 if (ret) {
2958 md_unregister_thread(&mddev->thread); 2958 md_unregister_thread(&mddev->thread);
2959 stop(mddev); 2959 raid1_free(mddev, conf);
2960 } 2960 }
2961 return ret; 2961 return ret;
2962} 2962}
2963 2963
2964static int stop(struct mddev *mddev) 2964static void raid1_free(struct mddev *mddev, void *priv)
2965{ 2965{
2966 struct r1conf *conf = mddev->private; 2966 struct r1conf *conf = priv;
2967 2967
2968 if (conf->r1bio_pool) 2968 if (conf->r1bio_pool)
2969 mempool_destroy(conf->r1bio_pool); 2969 mempool_destroy(conf->r1bio_pool);
@@ -2971,8 +2971,6 @@ static int stop(struct mddev *mddev)
2971 safe_put_page(conf->tmppage); 2971 safe_put_page(conf->tmppage);
2972 kfree(conf->poolinfo); 2972 kfree(conf->poolinfo);
2973 kfree(conf); 2973 kfree(conf);
2974 mddev->private = NULL;
2975 return 0;
2976} 2974}
2977 2975
2978static int raid1_resize(struct mddev *mddev, sector_t sectors) 2976static int raid1_resize(struct mddev *mddev, sector_t sectors)
@@ -3155,7 +3153,7 @@ static struct md_personality raid1_personality =
3155 .owner = THIS_MODULE, 3153 .owner = THIS_MODULE,
3156 .make_request = make_request, 3154 .make_request = make_request,
3157 .run = run, 3155 .run = run,
3158 .stop = stop, 3156 .free = raid1_free,
3159 .status = status, 3157 .status = status,
3160 .error_handler = error, 3158 .error_handler = error,
3161 .hot_add_disk = raid1_add_disk, 3159 .hot_add_disk = raid1_add_disk,