mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Kunwu Chan <chentao@kylinos.cn>, naohiro.aota@wdc.com, jth@kernel.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zonefs: Simplify the allocation of slab caches in zonefs_init_inodecache
Date: Fri, 9 Feb 2024 13:06:27 +0900	[thread overview]
Message-ID: <4af4be6e-2c58-4c14-ad2d-eb3f8101a0c1@kernel.org> (raw)
In-Reply-To: <20240205081022.433945-1-chentao@kylinos.cn>

On 2/5/24 17:10, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
> 
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
>  fs/zonefs/super.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index 93971742613a..9b578e7007e9 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -1387,10 +1387,8 @@ static struct file_system_type zonefs_type = {
>  
>  static int __init zonefs_init_inodecache(void)
>  {
> -	zonefs_inode_cachep = kmem_cache_create("zonefs_inode_cache",
> -			sizeof(struct zonefs_inode_info), 0,
> -			(SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD | SLAB_ACCOUNT),
> -			NULL);
> +	zonefs_inode_cachep = KMEM_CACHE(zonefs_inode_info,
> +			SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD | SLAB_ACCOUNT);
>  	if (zonefs_inode_cachep == NULL)
>  		return -ENOMEM;
>  	return 0;

I do not really see a meaningful simplification here. Using kmem_cache_create()
directly is not *that* complicated... Also, this changes the name of the cache
from "zonefs_inode_cache" to "zonefs_inode_info".

-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2024-02-09  4:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  8:10 Kunwu Chan
2024-02-09  4:06 ` Damien Le Moal [this message]
2024-02-19  8:52   ` Kunwu Chan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4af4be6e-2c58-4c14-ad2d-eb3f8101a0c1@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=chentao@kylinos.cn \
    --cc=jth@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®