linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm: move dm_table_destroy() to same header as dm_table_create()
@ 2017-03-28 18:31 Brian Norris
  2017-03-28 19:31 ` Mike Snitzer
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Norris @ 2017-03-28 18:31 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, dm-devel
  Cc: linux-kernel, linux-raid, Brian Norris

If anyone is going to use dm_table_create(), they probably should be
able to use dm_table_destroy() too. Move the dm_table_destroy()
definition outside the private header, near dm_table_create()

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 drivers/md/dm.h               | 1 -
 include/linux/device-mapper.h | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index f298b01f7ab3..c54d2f1934ce 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -48,7 +48,6 @@ struct dm_md_mempools;
 /*-----------------------------------------------------------------
  * Internal table functions.
  *---------------------------------------------------------------*/
-void dm_table_destroy(struct dm_table *t);
 void dm_table_event_callback(struct dm_table *t,
 			     void (*fn)(void *), void *context);
 struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index a7e6903866fd..70cb6af56f67 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -472,6 +472,11 @@ void dm_table_set_type(struct dm_table *t, unsigned type);
 int dm_table_complete(struct dm_table *t);
 
 /*
+ * Destroy the table when finished.
+ */
+void dm_table_destroy(struct dm_table *t);
+
+/*
  * Target may require that it is never sent I/O larger than len.
  */
 int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len);
-- 
2.12.2.564.g063fe858b8-goog

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

* Re: dm: move dm_table_destroy() to same header as dm_table_create()
  2017-03-28 18:31 [PATCH] dm: move dm_table_destroy() to same header as dm_table_create() Brian Norris
@ 2017-03-28 19:31 ` Mike Snitzer
  2017-04-04 22:35   ` Brian Norris
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Snitzer @ 2017-03-28 19:31 UTC (permalink / raw)
  To: Brian Norris; +Cc: Alasdair Kergon, dm-devel, linux-kernel

On Tue, Mar 28 2017 at  2:31pm -0400,
Brian Norris <briannorris@chromium.org> wrote:

> If anyone is going to use dm_table_create(), they probably should be
> able to use dm_table_destroy() too. Move the dm_table_destroy()
> definition outside the private header, near dm_table_create()
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>

Not seeing why we need dm_table_create() exposed.  So I think you went
the wrong way with this.  Unless you have an actual need, I'd prefer to
see dm_table_create() moved from include/linux/device-mapper.h to
drivers/md/dm.h

Mike


> ---
>  drivers/md/dm.h               | 1 -
>  include/linux/device-mapper.h | 5 +++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm.h b/drivers/md/dm.h
> index f298b01f7ab3..c54d2f1934ce 100644
> --- a/drivers/md/dm.h
> +++ b/drivers/md/dm.h
> @@ -48,7 +48,6 @@ struct dm_md_mempools;
>  /*-----------------------------------------------------------------
>   * Internal table functions.
>   *---------------------------------------------------------------*/
> -void dm_table_destroy(struct dm_table *t);
>  void dm_table_event_callback(struct dm_table *t,
>  			     void (*fn)(void *), void *context);
>  struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index);
> diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
> index a7e6903866fd..70cb6af56f67 100644
> --- a/include/linux/device-mapper.h
> +++ b/include/linux/device-mapper.h
> @@ -472,6 +472,11 @@ void dm_table_set_type(struct dm_table *t, unsigned type);
>  int dm_table_complete(struct dm_table *t);
>  
>  /*
> + * Destroy the table when finished.
> + */
> +void dm_table_destroy(struct dm_table *t);
> +
> +/*
>   * Target may require that it is never sent I/O larger than len.
>   */
>  int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len);
> -- 
> 2.12.2.564.g063fe858b8-goog
> 

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

* Re: dm: move dm_table_destroy() to same header as dm_table_create()
  2017-03-28 19:31 ` Mike Snitzer
@ 2017-04-04 22:35   ` Brian Norris
  2017-04-05  8:04     ` Enric Balletbo i Serra
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Norris @ 2017-04-04 22:35 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Alasdair Kergon, dm-devel, linux-kernel, Enric Balletbo i Serra

On Tue, Mar 28, 2017 at 03:31:51PM -0400, Mike Snitzer wrote:
> On Tue, Mar 28 2017 at  2:31pm -0400,
> Brian Norris <briannorris@chromium.org> wrote:
> 
> > If anyone is going to use dm_table_create(), they probably should be
> > able to use dm_table_destroy() too. Move the dm_table_destroy()
> > definition outside the private header, near dm_table_create()
> > 
> > Signed-off-by: Brian Norris <briannorris@chromium.org>
> 
> Not seeing why we need dm_table_create() exposed.  So I think you went
> the wrong way with this.  Unless you have an actual need, I'd prefer to
> see dm_table_create() moved from include/linux/device-mapper.h to
> drivers/md/dm.h

We've been carrying code in our ChromeOS kernel to parse a cmdline arg
for setting up early DM maps -- e.g., a dm-verity rootfs without using
an initramfs. We currently use dm_table_create() from init/*.c (and we
*should* be using dm_table_destroy() in the error paths). So I'm
certainly not going to send the patch to do the reverse :)

Enric is working on cleaning up this work to send here, so if you don't
want to see this patch now, you may well see it later.

Brian

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

* Re: dm: move dm_table_destroy() to same header as dm_table_create()
  2017-04-04 22:35   ` Brian Norris
@ 2017-04-05  8:04     ` Enric Balletbo i Serra
  0 siblings, 0 replies; 4+ messages in thread
From: Enric Balletbo i Serra @ 2017-04-05  8:04 UTC (permalink / raw)
  To: Brian Norris, Mike Snitzer; +Cc: Alasdair Kergon, dm-devel, linux-kernel

Hi,

On 05/04/17 00:35, Brian Norris wrote:
> On Tue, Mar 28, 2017 at 03:31:51PM -0400, Mike Snitzer wrote:
>> On Tue, Mar 28 2017 at  2:31pm -0400,
>> Brian Norris <briannorris@chromium.org> wrote:
>>
>>> If anyone is going to use dm_table_create(), they probably should be
>>> able to use dm_table_destroy() too. Move the dm_table_destroy()
>>> definition outside the private header, near dm_table_create()
>>>
>>> Signed-off-by: Brian Norris <briannorris@chromium.org>
>>
>> Not seeing why we need dm_table_create() exposed.  So I think you went
>> the wrong way with this.  Unless you have an actual need, I'd prefer to
>> see dm_table_create() moved from include/linux/device-mapper.h to
>> drivers/md/dm.h
> 
> We've been carrying code in our ChromeOS kernel to parse a cmdline arg
> for setting up early DM maps -- e.g., a dm-verity rootfs without using
> an initramfs. We currently use dm_table_create() from init/*.c (and we
> *should* be using dm_table_destroy() in the error paths). So I'm
> certainly not going to send the patch to do the reverse :)
> 
> Enric is working on cleaning up this work to send here, so if you don't
> want to see this patch now, you may well see it later.
> 

As Brian told you we have a use case that uses the dm_table_create and others
from init/*.c, I expect have a first patches during this week, if it's ok I'll
include this patch in my patchset so you have the overall of what we are talking
about.

Cheers,
 Enric

> Brian
> 

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

end of thread, other threads:[~2017-04-05  8:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 18:31 [PATCH] dm: move dm_table_destroy() to same header as dm_table_create() Brian Norris
2017-03-28 19:31 ` Mike Snitzer
2017-04-04 22:35   ` Brian Norris
2017-04-05  8:04     ` Enric Balletbo i Serra

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