[3/3] libceph: use KMEM_CACHE macro
diff mbox

Message ID a9c3e96ba6bf321ca13d9445d2770781fb7033cd.1457853190.git.geliangtang@163.com
State New
Headers show

Commit Message

Geliang Tang March 13, 2016, 7:18 a.m. UTC
Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 net/ceph/messenger.c  | 10 ++--------
 net/ceph/osd_client.c |  5 +----
 2 files changed, 3 insertions(+), 12 deletions(-)

Comments

Ilya Dryomov March 22, 2016, 4:58 p.m. UTC | #1
On Sun, Mar 13, 2016 at 8:18 AM, Geliang Tang <geliangtang@163.com> wrote:
> Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  net/ceph/messenger.c  | 10 ++--------
>  net/ceph/osd_client.c |  5 +----
>  2 files changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index 9382619..32c997e 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -235,18 +235,12 @@ static struct workqueue_struct *ceph_msgr_wq;
>  static int ceph_msgr_slab_init(void)
>  {
>         BUG_ON(ceph_msg_cache);
> -       ceph_msg_cache = kmem_cache_create("ceph_msg",
> -                                       sizeof (struct ceph_msg),
> -                                       __alignof__(struct ceph_msg), 0, NULL);
> -
> +       ceph_msg_cache = KMEM_CACHE(ceph_msg, 0);
>         if (!ceph_msg_cache)
>                 return -ENOMEM;
>
>         BUG_ON(ceph_msg_data_cache);
> -       ceph_msg_data_cache = kmem_cache_create("ceph_msg_data",
> -                                       sizeof (struct ceph_msg_data),
> -                                       __alignof__(struct ceph_msg_data),
> -                                       0, NULL);
> +       ceph_msg_data_cache = KMEM_CACHE(ceph_msg_data, 0);
>         if (ceph_msg_data_cache)
>                 return 0;
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 5bc0537..7558855 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -2783,10 +2783,7 @@ EXPORT_SYMBOL(ceph_osdc_writepages);
>  int ceph_osdc_setup(void)
>  {
>         BUG_ON(ceph_osd_request_cache);
> -       ceph_osd_request_cache = kmem_cache_create("ceph_osd_request",
> -                                       sizeof (struct ceph_osd_request),
> -                                       __alignof__(struct ceph_osd_request),
> -                                       0, NULL);
> +       ceph_osd_request_cache = KMEM_CACHE(ceph_osd_request, 0);
>
>         return ceph_osd_request_cache ? 0 : -ENOMEM;
>  }

Applied, with osd_client.c hunk dropped.  ceph_osd_request cache
objects are not longer sizeof(struct ceph_osd_request).

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 9382619..32c997e 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -235,18 +235,12 @@  static struct workqueue_struct *ceph_msgr_wq;
 static int ceph_msgr_slab_init(void)
 {
 	BUG_ON(ceph_msg_cache);
-	ceph_msg_cache = kmem_cache_create("ceph_msg",
-					sizeof (struct ceph_msg),
-					__alignof__(struct ceph_msg), 0, NULL);
-
+	ceph_msg_cache = KMEM_CACHE(ceph_msg, 0);
 	if (!ceph_msg_cache)
 		return -ENOMEM;
 
 	BUG_ON(ceph_msg_data_cache);
-	ceph_msg_data_cache = kmem_cache_create("ceph_msg_data",
-					sizeof (struct ceph_msg_data),
-					__alignof__(struct ceph_msg_data),
-					0, NULL);
+	ceph_msg_data_cache = KMEM_CACHE(ceph_msg_data, 0);
 	if (ceph_msg_data_cache)
 		return 0;
 
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 5bc0537..7558855 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -2783,10 +2783,7 @@  EXPORT_SYMBOL(ceph_osdc_writepages);
 int ceph_osdc_setup(void)
 {
 	BUG_ON(ceph_osd_request_cache);
-	ceph_osd_request_cache = kmem_cache_create("ceph_osd_request",
-					sizeof (struct ceph_osd_request),
-					__alignof__(struct ceph_osd_request),
-					0, NULL);
+	ceph_osd_request_cache = KMEM_CACHE(ceph_osd_request, 0);
 
 	return ceph_osd_request_cache ? 0 : -ENOMEM;
 }