linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] md:Add a func 'dm_md_stop' for dm-raid to clear up md resources.
@ 2012-11-15  8:46 majianpeng
  2012-11-15 11:45 ` Alasdair G Kergon
  0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-11-15  8:46 UTC (permalink / raw)
  To: NeilBrown, agk; +Cc: linux-raid, dm-devel

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.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 drivers/md/md.c |    9 +++++++++
 drivers/md/md.h |    1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9ab768a..574b0a8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -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;
diff --git a/drivers/md/md.h b/drivers/md/md.h
index af443ab..a370ece 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -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);
-- 
1.7.9.5

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

* Re: [PATCH 1/3] md:Add a func 'dm_md_stop' for dm-raid to clear up md resources.
  2012-11-15  8:46 [PATCH 1/3] md:Add a func 'dm_md_stop' for dm-raid to clear up md resources majianpeng
@ 2012-11-15 11:45 ` Alasdair G Kergon
  2012-11-15 11:51   ` majianpeng
  0 siblings, 1 reply; 4+ messages in thread
From: Alasdair G Kergon @ 2012-11-15 11:45 UTC (permalink / raw)
  To: majianpeng; +Cc: NeilBrown, agk, linux-raid, dm-devel

On Thu, Nov 15, 2012 at 04:46:59PM +0800, majianpeng wrote:
> So add a func dm_md_stop to clear up resource.
 
> +++ b/drivers/md/md.c

> +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


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

* Re: Re: [PATCH 1/3] md:Add a func 'dm_md_stop' for dm-raid to clear up md resources.
  2012-11-15 11:45 ` Alasdair G Kergon
@ 2012-11-15 11:51   ` majianpeng
  2012-11-15 13:52     ` Mike Snitzer
  0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-11-15 11:51 UTC (permalink / raw)
  Cc: NeilBrown, agk, linux-raid, dm-devel

>On Thu, Nov 15, 2012 at 04:46:59PM +0800, majianpeng wrote:
>> So add a func dm_md_stop to clear up resource.
> 
>> +++ b/drivers/md/md.c
>
>> +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
>
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!

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

* Re: [PATCH 1/3] md:Add a func 'dm_md_stop' for dm-raid to clear up md resources.
  2012-11-15 11:51   ` majianpeng
@ 2012-11-15 13:52     ` Mike Snitzer
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Snitzer @ 2012-11-15 13:52 UTC (permalink / raw)
  To: majianpeng; +Cc: agk, linux-raid, dm-devel

On Thu, Nov 15 2012 at  6:51am -0500,
majianpeng <majianpeng@gmail.com> wrote:

> >On Thu, Nov 15, 2012 at 04:46:59PM +0800, majianpeng wrote:
> >> So add a func dm_md_stop to clear up resource.
> > 
> >> +++ b/drivers/md/md.c
> >
> >> +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
> >
> 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.

Nmae it mddev_stop_and_cleanup?

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

end of thread, other threads:[~2012-11-15 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-15  8:46 [PATCH 1/3] md:Add a func 'dm_md_stop' for dm-raid to clear up md resources majianpeng
2012-11-15 11:45 ` Alasdair G Kergon
2012-11-15 11:51   ` majianpeng
2012-11-15 13:52     ` Mike Snitzer

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