[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOi1vP9UOwDKJG7hkpCxgCxXP6t3FO5z5PMSeZ8gKrf=w+_ddw@mail.gmail.com>
Date: Tue, 22 Mar 2016 17:58:00 +0100
From: Ilya Dryomov <idryomov@...il.com>
To: Geliang Tang <geliangtang@....com>
Cc: "Yan, Zheng" <zyan@...hat.com>, Sage Weil <sage@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Ceph Development <ceph-devel@...r.kernel.org>,
netdev <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] libceph: use KMEM_CACHE macro
On Sun, Mar 13, 2016 at 8:18 AM, Geliang Tang <geliangtang@....com> wrote:
> Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@....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
Powered by blists - more mailing lists