md:Add a func 'dm_md_stop' for dm-raid to clear up md resources.
Subsystems (2)
PATCH 1/3 md:Add a func 'dm_md_stop' for dm-raid to clear up md resources.
Because dm-raid used md driver, when stoped dm-raid it only call md_stop. It caused some resources omited, like bitmap, mddev->bio_set. So add a func dm_md_stop to clear up resource.
--- drivers/md/md.c | 9 +++++++++ drivers/md/md.h | 1 + 2 files changed, 10 insertions(+)
drivers/md/md.c +9 -0
@@ -5306,6 +5306,15 @@ void md_stop(struct mddev *mddev) }EXPORT_SYMBOL_GPL (md_stop); +void dm_md_stop (struct mddev *mddev) +{ +md_stop (mddev); +bitmap_destroy (mddev); +if (mddev->bio_set) +bioset_free (mddev->bio_set); +} +EXPORT_SYMBOL_GPL (dm_md_stop); +static int md_set_readonly (struct mddev *mddev,struct block_device *bdev) {int err =0 ;
drivers/md/md.h +1 -0
@@ -621,6 +621,7 @@ extern void md_stop(struct mddev *mddev);extern void md_stop_writes (struct mddev *mddev);extern int md_rdev_init (struct md_rdev *rdev);extern void md_rdev_clear (struct md_rdev *rdev); +extern void dm_md_stop (struct mddev *mddev);extern void mddev_suspend (struct mddev *mddev);extern void mddev_resume (struct mddev *mddev);
Signature · 1 line
1.7.9.5
Alasdair G Kergon
maintainerdrivers/md/md.c void md_stop(struct mddev *mddev) · line 5316
Quoted 12 lines · majianpeng
So add a func
dm_md_stopto clear up resource.+++
b/drivers/md/md.cdrivers/md/md.c +8
-0+void dm_md_stop (struct mddev *mddev) +{ +md_stop (mddev); +bitmap_destroy (mddev); +if (mddev->bio_set) +bioset_free (mddev->bio_set); +} +EXPORT_SYMBOL_GPL (dm_md_stop);
Let's not put a function with a dm_ prefix in an md file?
Alasdair
Quoted 16 lines · majianpeng
drivers/md/md.c void md_stop(struct mddev *mddev) · line 5316
Quoted 12 lines
So add a func
dm_md_stopto clear up resource.+++
b/drivers/md/md.cdrivers/md/md.c +8
-0+void dm_md_stop (struct mddev *mddev) +{ +md_stop (mddev); +bitmap_destroy (mddev); +if (mddev->bio_set) +bioset_free (mddev->bio_set); +} +EXPORT_SYMBOL_GPL (dm_md_stop);Let's not put a function with a
dm_prefix in an md file?
Quoted 2 lines
Alasdair
Can you give me a hint? My thought is this func only by dm to call and there was a md_stop already? I firstly want to add those statements in dm driver like md_stop rather than a func include those. But i think dm don't know to much.
Neil, your suggestion?
Jianpeng
Thanks!
Quoted 16 lines · majianpeng
Quoted 16 lines · majianpeng
drivers/md/md.c void md_stop(struct mddev *mddev) · line 5316
Quoted 12 lines
So add a func
dm_md_stopto clear up resource.+++
b/drivers/md/md.cdrivers/md/md.c +8
-0+void dm_md_stop (struct mddev *mddev) +{ +md_stop (mddev); +bitmap_destroy (mddev); +if (mddev->bio_set) +bioset_free (mddev->bio_set); +} +EXPORT_SYMBOL_GPL (dm_md_stop);Let's not put a function with a
dm_prefix in an md file?
Quoted 5 lines
Quoted 2 lines
Alasdair
Can you give me a hint? My thought is this func only by dm to call and there was a
md_stopalready? I firstly want to add those statements in dm driver likemd_stoprather than a func include those. But i think dm don't know to much.
Nmae it mddev_stop_and_cleanup?