linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm: zpool: Constify the zpool_ops
@ 2015-07-03  9:40 Krzysztof Kozlowski
  2015-07-03  9:40 ` [PATCH 2/2] mm: zbud: Constify the zbud_ops Krzysztof Kozlowski
  2015-07-15 17:04 ` [PATCH 1/2] mm: zpool: Constify the zpool_ops Dan Streetman
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-03  9:40 UTC (permalink / raw)
  To: Seth Jennings, Dan Streetman, Minchan Kim, Nitin Gupta, linux-mm,
	linux-kernel
  Cc: Andrew Morton, Krzysztof Kozlowski

The structure zpool_ops is not modified so make the pointer to it as
pointer to const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 include/linux/zpool.h | 4 ++--
 mm/zbud.c             | 4 ++--
 mm/zpool.c            | 4 ++--
 mm/zsmalloc.c         | 3 ++-
 mm/zswap.c            | 2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/linux/zpool.h b/include/linux/zpool.h
index d30eff3d84d5..c924a28d9805 100644
--- a/include/linux/zpool.h
+++ b/include/linux/zpool.h
@@ -37,7 +37,7 @@ enum zpool_mapmode {
 };
 
 struct zpool *zpool_create_pool(char *type, char *name,
-			gfp_t gfp, struct zpool_ops *ops);
+			gfp_t gfp, const struct zpool_ops *ops);
 
 char *zpool_get_type(struct zpool *pool);
 
@@ -81,7 +81,7 @@ struct zpool_driver {
 	atomic_t refcount;
 	struct list_head list;
 
-	void *(*create)(char *name, gfp_t gfp, struct zpool_ops *ops,
+	void *(*create)(char *name, gfp_t gfp, const struct zpool_ops *ops,
 			struct zpool *zpool);
 	void (*destroy)(void *pool);
 
diff --git a/mm/zbud.c b/mm/zbud.c
index f3bf6f7627d8..6f8158d64864 100644
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -99,7 +99,7 @@ struct zbud_pool {
 	struct zbud_ops *ops;
 #ifdef CONFIG_ZPOOL
 	struct zpool *zpool;
-	struct zpool_ops *zpool_ops;
+	const struct zpool_ops *zpool_ops;
 #endif
 };
 
@@ -138,7 +138,7 @@ static struct zbud_ops zbud_zpool_ops = {
 };
 
 static void *zbud_zpool_create(char *name, gfp_t gfp,
-			       struct zpool_ops *zpool_ops,
+			       const struct zpool_ops *zpool_ops,
 			       struct zpool *zpool)
 {
 	struct zbud_pool *pool;
diff --git a/mm/zpool.c b/mm/zpool.c
index 722a4f60e90b..951db32b833f 100644
--- a/mm/zpool.c
+++ b/mm/zpool.c
@@ -22,7 +22,7 @@ struct zpool {
 
 	struct zpool_driver *driver;
 	void *pool;
-	struct zpool_ops *ops;
+	const struct zpool_ops *ops;
 
 	struct list_head list;
 };
@@ -115,7 +115,7 @@ static void zpool_put_driver(struct zpool_driver *driver)
  * Returns: New zpool on success, NULL on failure.
  */
 struct zpool *zpool_create_pool(char *type, char *name, gfp_t gfp,
-		struct zpool_ops *ops)
+		const struct zpool_ops *ops)
 {
 	struct zpool_driver *driver;
 	struct zpool *zpool;
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 0a7f81aa2249..6e139d381d80 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -309,7 +309,8 @@ static void record_obj(unsigned long handle, unsigned long obj)
 
 #ifdef CONFIG_ZPOOL
 
-static void *zs_zpool_create(char *name, gfp_t gfp, struct zpool_ops *zpool_ops,
+static void *zs_zpool_create(char *name, gfp_t gfp,
+			     const struct zpool_ops *zpool_ops,
 			     struct zpool *zpool)
 {
 	return zs_create_pool(name, gfp);
diff --git a/mm/zswap.c b/mm/zswap.c
index 2d5727baed59..017a3f50725d 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -816,7 +816,7 @@ static void zswap_frontswap_invalidate_area(unsigned type)
 	zswap_trees[type] = NULL;
 }
 
-static struct zpool_ops zswap_zpool_ops = {
+static const struct zpool_ops zswap_zpool_ops = {
 	.evict = zswap_writeback_entry
 };
 
-- 
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH 2/2] mm: zbud: Constify the zbud_ops
  2015-07-03  9:40 [PATCH 1/2] mm: zpool: Constify the zpool_ops Krzysztof Kozlowski
@ 2015-07-03  9:40 ` Krzysztof Kozlowski
  2015-07-15 17:05   ` Dan Streetman
  2015-07-15 17:04 ` [PATCH 1/2] mm: zpool: Constify the zpool_ops Dan Streetman
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-03  9:40 UTC (permalink / raw)
  To: Seth Jennings, Dan Streetman, Minchan Kim, Nitin Gupta, linux-mm,
	linux-kernel
  Cc: Andrew Morton, Krzysztof Kozlowski

The structure zbud_ops is not modified so make the pointer to it as
pointer to const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 include/linux/zbud.h | 2 +-
 mm/zbud.c            | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/zbud.h b/include/linux/zbud.h
index f9d41a6e361f..e183a0a65ac1 100644
--- a/include/linux/zbud.h
+++ b/include/linux/zbud.h
@@ -9,7 +9,7 @@ struct zbud_ops {
 	int (*evict)(struct zbud_pool *pool, unsigned long handle);
 };
 
-struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
+struct zbud_pool *zbud_create_pool(gfp_t gfp, const struct zbud_ops *ops);
 void zbud_destroy_pool(struct zbud_pool *pool);
 int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp,
 	unsigned long *handle);
diff --git a/mm/zbud.c b/mm/zbud.c
index 6f8158d64864..fa48bcdff9d5 100644
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -96,7 +96,7 @@ struct zbud_pool {
 	struct list_head buddied;
 	struct list_head lru;
 	u64 pages_nr;
-	struct zbud_ops *ops;
+	const struct zbud_ops *ops;
 #ifdef CONFIG_ZPOOL
 	struct zpool *zpool;
 	const struct zpool_ops *zpool_ops;
@@ -133,7 +133,7 @@ static int zbud_zpool_evict(struct zbud_pool *pool, unsigned long handle)
 		return -ENOENT;
 }
 
-static struct zbud_ops zbud_zpool_ops = {
+static const struct zbud_ops zbud_zpool_ops = {
 	.evict =	zbud_zpool_evict
 };
 
@@ -302,7 +302,7 @@ static int num_free_chunks(struct zbud_header *zhdr)
  * Return: pointer to the new zbud pool or NULL if the metadata allocation
  * failed.
  */
-struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops)
+struct zbud_pool *zbud_create_pool(gfp_t gfp, const struct zbud_ops *ops)
 {
 	struct zbud_pool *pool;
 	int i;
-- 
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] mm: zpool: Constify the zpool_ops
  2015-07-03  9:40 [PATCH 1/2] mm: zpool: Constify the zpool_ops Krzysztof Kozlowski
  2015-07-03  9:40 ` [PATCH 2/2] mm: zbud: Constify the zbud_ops Krzysztof Kozlowski
@ 2015-07-15 17:04 ` Dan Streetman
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Streetman @ 2015-07-15 17:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Seth Jennings, Minchan Kim, Nitin Gupta, Linux-MM, linux-kernel,
	Andrew Morton

On Fri, Jul 3, 2015 at 5:40 AM, Krzysztof Kozlowski
<k.kozlowski@samsung.com> wrote:
> The structure zpool_ops is not modified so make the pointer to it as
> pointer to const.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Acked-by: Dan Streetman <ddstreet@ieee.org>

> ---
>  include/linux/zpool.h | 4 ++--
>  mm/zbud.c             | 4 ++--
>  mm/zpool.c            | 4 ++--
>  mm/zsmalloc.c         | 3 ++-
>  mm/zswap.c            | 2 +-
>  5 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/zpool.h b/include/linux/zpool.h
> index d30eff3d84d5..c924a28d9805 100644
> --- a/include/linux/zpool.h
> +++ b/include/linux/zpool.h
> @@ -37,7 +37,7 @@ enum zpool_mapmode {
>  };
>
>  struct zpool *zpool_create_pool(char *type, char *name,
> -                       gfp_t gfp, struct zpool_ops *ops);
> +                       gfp_t gfp, const struct zpool_ops *ops);
>
>  char *zpool_get_type(struct zpool *pool);
>
> @@ -81,7 +81,7 @@ struct zpool_driver {
>         atomic_t refcount;
>         struct list_head list;
>
> -       void *(*create)(char *name, gfp_t gfp, struct zpool_ops *ops,
> +       void *(*create)(char *name, gfp_t gfp, const struct zpool_ops *ops,
>                         struct zpool *zpool);
>         void (*destroy)(void *pool);
>
> diff --git a/mm/zbud.c b/mm/zbud.c
> index f3bf6f7627d8..6f8158d64864 100644
> --- a/mm/zbud.c
> +++ b/mm/zbud.c
> @@ -99,7 +99,7 @@ struct zbud_pool {
>         struct zbud_ops *ops;
>  #ifdef CONFIG_ZPOOL
>         struct zpool *zpool;
> -       struct zpool_ops *zpool_ops;
> +       const struct zpool_ops *zpool_ops;
>  #endif
>  };
>
> @@ -138,7 +138,7 @@ static struct zbud_ops zbud_zpool_ops = {
>  };
>
>  static void *zbud_zpool_create(char *name, gfp_t gfp,
> -                              struct zpool_ops *zpool_ops,
> +                              const struct zpool_ops *zpool_ops,
>                                struct zpool *zpool)
>  {
>         struct zbud_pool *pool;
> diff --git a/mm/zpool.c b/mm/zpool.c
> index 722a4f60e90b..951db32b833f 100644
> --- a/mm/zpool.c
> +++ b/mm/zpool.c
> @@ -22,7 +22,7 @@ struct zpool {
>
>         struct zpool_driver *driver;
>         void *pool;
> -       struct zpool_ops *ops;
> +       const struct zpool_ops *ops;
>
>         struct list_head list;
>  };
> @@ -115,7 +115,7 @@ static void zpool_put_driver(struct zpool_driver *driver)
>   * Returns: New zpool on success, NULL on failure.
>   */
>  struct zpool *zpool_create_pool(char *type, char *name, gfp_t gfp,
> -               struct zpool_ops *ops)
> +               const struct zpool_ops *ops)
>  {
>         struct zpool_driver *driver;
>         struct zpool *zpool;
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 0a7f81aa2249..6e139d381d80 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -309,7 +309,8 @@ static void record_obj(unsigned long handle, unsigned long obj)
>
>  #ifdef CONFIG_ZPOOL
>
> -static void *zs_zpool_create(char *name, gfp_t gfp, struct zpool_ops *zpool_ops,
> +static void *zs_zpool_create(char *name, gfp_t gfp,
> +                            const struct zpool_ops *zpool_ops,
>                              struct zpool *zpool)
>  {
>         return zs_create_pool(name, gfp);
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 2d5727baed59..017a3f50725d 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -816,7 +816,7 @@ static void zswap_frontswap_invalidate_area(unsigned type)
>         zswap_trees[type] = NULL;
>  }
>
> -static struct zpool_ops zswap_zpool_ops = {
> +static const struct zpool_ops zswap_zpool_ops = {
>         .evict = zswap_writeback_entry
>  };
>
> --
> 1.9.1
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 2/2] mm: zbud: Constify the zbud_ops
  2015-07-03  9:40 ` [PATCH 2/2] mm: zbud: Constify the zbud_ops Krzysztof Kozlowski
@ 2015-07-15 17:05   ` Dan Streetman
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Streetman @ 2015-07-15 17:05 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Seth Jennings, Minchan Kim, Nitin Gupta, Linux-MM, linux-kernel,
	Andrew Morton

On Fri, Jul 3, 2015 at 5:40 AM, Krzysztof Kozlowski
<k.kozlowski@samsung.com> wrote:
> The structure zbud_ops is not modified so make the pointer to it as
> pointer to const.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Acked-by: Dan Streetman <ddstreet@ieee.org>

> ---
>  include/linux/zbud.h | 2 +-
>  mm/zbud.c            | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/zbud.h b/include/linux/zbud.h
> index f9d41a6e361f..e183a0a65ac1 100644
> --- a/include/linux/zbud.h
> +++ b/include/linux/zbud.h
> @@ -9,7 +9,7 @@ struct zbud_ops {
>         int (*evict)(struct zbud_pool *pool, unsigned long handle);
>  };
>
> -struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
> +struct zbud_pool *zbud_create_pool(gfp_t gfp, const struct zbud_ops *ops);
>  void zbud_destroy_pool(struct zbud_pool *pool);
>  int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp,
>         unsigned long *handle);
> diff --git a/mm/zbud.c b/mm/zbud.c
> index 6f8158d64864..fa48bcdff9d5 100644
> --- a/mm/zbud.c
> +++ b/mm/zbud.c
> @@ -96,7 +96,7 @@ struct zbud_pool {
>         struct list_head buddied;
>         struct list_head lru;
>         u64 pages_nr;
> -       struct zbud_ops *ops;
> +       const struct zbud_ops *ops;
>  #ifdef CONFIG_ZPOOL
>         struct zpool *zpool;
>         const struct zpool_ops *zpool_ops;
> @@ -133,7 +133,7 @@ static int zbud_zpool_evict(struct zbud_pool *pool, unsigned long handle)
>                 return -ENOENT;
>  }
>
> -static struct zbud_ops zbud_zpool_ops = {
> +static const struct zbud_ops zbud_zpool_ops = {
>         .evict =        zbud_zpool_evict
>  };
>
> @@ -302,7 +302,7 @@ static int num_free_chunks(struct zbud_header *zhdr)
>   * Return: pointer to the new zbud pool or NULL if the metadata allocation
>   * failed.
>   */
> -struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops)
> +struct zbud_pool *zbud_create_pool(gfp_t gfp, const struct zbud_ops *ops)
>  {
>         struct zbud_pool *pool;
>         int i;
> --
> 1.9.1
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2015-07-15 17:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03  9:40 [PATCH 1/2] mm: zpool: Constify the zpool_ops Krzysztof Kozlowski
2015-07-03  9:40 ` [PATCH 2/2] mm: zbud: Constify the zbud_ops Krzysztof Kozlowski
2015-07-15 17:05   ` Dan Streetman
2015-07-15 17:04 ` [PATCH 1/2] mm: zpool: Constify the zpool_ops Dan Streetman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox