Message ID | 20240205081022.433945-1-chentao@kylinos.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-52189-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp733460dyb; Mon, 5 Feb 2024 00:11:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUlLicsWr266fSPFLCV4XP8qEGeSYJT7DCrQeang8SJbKCNVKYDpUKz8UnlhDrzcDCA2vx X-Received: by 2002:a05:6e02:1baa:b0:363:b8fb:fcb7 with SMTP id n10-20020a056e021baa00b00363b8fbfcb7mr9415388ili.16.1707120714068; Mon, 05 Feb 2024 00:11:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707120714; cv=pass; d=google.com; s=arc-20160816; b=vsFA69FKqEk7Xgy3qk6JZIGC3HzKSY0pLenl3brKaAYITQm3r0nA7pn3i5cMcnbEGo uJyCdkwBb5WAoMNnELifGUu17di1RN5lDecfsC4TcBCw+xNykxafMb6EPDDKb0UdbqK3 dvY2ZsUtHZlTur3UrgfiRTOZknqp+4VHSaqIETWfYuVEMOaDPI8x6mrwTBI9TJ1SNag6 bExbjtxTKuN0iJJIHeQ4RdEOnIvgGD6McDhpW5QTX0G7s194aSx1suULtFktdu3vZdFo /8CCAXAzW8zoTOHG0CpQa2kqZA/JYRuDzK5zkKY8ub54SEkto36KkU9VVrcHUtPODyTb IDqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Kdi/jvxoiAbAYmGb7/J2K0q0mKvOnkwzdOJT5YxLff4=; fh=KCXcleYMt0kE9hb7+ML7VyxMYvnz3ts5WciXSfYznL4=; b=vyrioTl174v/GoopISKeAHYJRmCXcQuDpaokDFqmc818XSCKHjmj6raPvowzBjuACs 0z7L/7GoeFPGJG69dc67o9x2pez/iRaZqzOdYSmx1FkcTjX2cmiObPk01RyAFwW56hih oxmwR0KX5kWkHffyPpbUl34PAyskYkH3tFN4GAMQU5Rs1wH8PzsZcSPuxIOTabAT1l7R 4m6/6kKM/0YrZvJ3JXu4iYAUxyi4qdS7YFXHsr4A1mhpdGg1pJKOuDxEmKdTAsrxYwL0 3pGh7ToRlqJJF1h/ERsC/jf5ZzymaV4bOPAskmpZp8RG4tV2QaGFC/5VRGvY+iAh87Ya 2/Lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-52189-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52189-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVPbuq8wup0UydHXVFWyRfwaWD1x43xRE8e1fI07vSMXZlh5V/oVBbspJYd4lzHIWMIyDce66ehcVi/V3vql2vlsqzCTg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n9-20020a635909000000b005ce0160641fsi5559173pgb.551.2024.02.05.00.11.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 00:11:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52189-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-52189-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52189-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F369E2879FA for <ouuuleilei@gmail.com>; Mon, 5 Feb 2024 08:10:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 819D611729; Mon, 5 Feb 2024 08:10:38 +0000 (UTC) Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 751F811184; Mon, 5 Feb 2024 08:10:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707120636; cv=none; b=ZnsWOHe32bSq3YcbRiEasmnAgO2KWuOWwyLuBVZcmRB2RZrWjPKXEM1ujh9aDh2rNYYEgeu/yZ9MFn+EN1OvagDIC2i79hWNZszlmlEULRiY+OrGbtRIasb9HI+8yhh8F99i3e5AudWBojmuprmuN/T5C+CFyjUnGg8CMvcQWVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707120636; c=relaxed/simple; bh=lJfLls5gfxNink17J4VWmEfa8CGJgcmPdq9FvLEAIgA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EY1e67ffKQn5ZFR5wJc1R/LmZwyMIWd/YDiMCjoA65P1fQEjdQt2YjNKBuGzX0kIL2rdqGtBgYKJFpU8OqsjeInVRYJq/+7hbgDFf8rMQ62tQ+db+5ejdU8aCUns3GXb/81DUaydEayZbiFfBFv2rzhhhR74lQH+qHUYuTF5oZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 1d47c6aa2b3747909181acbb0103231e-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:e90204c5-e0b1-407d-855a-d1d3f5b1baaf,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-9,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:1 X-CID-INFO: VERSION:1.1.35,REQID:e90204c5-e0b1-407d-855a-d1d3f5b1baaf,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-9,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:1 X-CID-META: VersionHash:5d391d7,CLOUDID:23702180-4f93-4875-95e7-8c66ea833d57,B ulkID:240205161028035G384B,BulkQuantity:0,Recheck:0,SF:17|19|42|74|66|38|2 4|102,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil ,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-UUID: 1d47c6aa2b3747909181acbb0103231e-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from <chentao@kylinos.cn>) (Generic MTA) with ESMTP id 968780155; Mon, 05 Feb 2024 16:10:25 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 1BE1FE000EBC; Mon, 5 Feb 2024 16:10:25 +0800 (CST) X-ns-mid: postfix-65C097F0-91013334 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 539BFE000EBC; Mon, 5 Feb 2024 16:10:24 +0800 (CST) From: Kunwu Chan <chentao@kylinos.cn> To: dlemoal@kernel.org, naohiro.aota@wdc.com, jth@kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan <chentao@kylinos.cn> Subject: [PATCH] zonefs: Simplify the allocation of slab caches in zonefs_init_inodecache Date: Mon, 5 Feb 2024 16:10:22 +0800 Message-Id: <20240205081022.433945-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790045809974824583 X-GMAIL-MSGID: 1790045809974824583 |
Series |
zonefs: Simplify the allocation of slab caches in zonefs_init_inodecache
|
|
Commit Message
Kunwu Chan
Feb. 5, 2024, 8:10 a.m. UTC
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(-)
Comments
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".
Thanks for the reply. On 2024/2/9 12:06, Damien Le Moal wrote: > 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() The main reason is 'it hides all the 0 or NULL parameters'. > directly is not *that* complicated... Also, this changes the name of the cache > from "zonefs_inode_cache" to "zonefs_inode_info". Cache name is used in /proc/slabinfo to identify this cache. > Thank again for taking the time to review and reply.
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;