From patchwork Mon Feb 5 07:51:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 196654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp725904dyb; Sun, 4 Feb 2024 23:52:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkkhRLTIIB8ETcZNZQvXXeRWIuV8g0HkukL4BJXaiztTCGcWww92otiwVRsefTgdAIG3xV X-Received: by 2002:a05:620a:9db:b0:784:a63:6566 with SMTP id y27-20020a05620a09db00b007840a636566mr10122099qky.10.1707119560334; Sun, 04 Feb 2024 23:52:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707119560; cv=pass; d=google.com; s=arc-20160816; b=fb7hJe+FJoTHVZQ4fr8SCc0lheFDiLUt9X05vXnxQN2PNwBM8iMTqj42g15TIFUvvG CiW/vtGckGZOf94eksBeu1/iU1Teidc3HolnS0IRlNWByjBDwSqS7jF98UAn9FNiatrh zogMTvKGw0ZUiHQnH14Qd80kn8HkHG0HkWZiVK3efIE/UlkaZGBTKjkPX+i41CegXKba eNCo9BYO+Tau89F2kY4N6BNXwiqtb4gChKLTl4mkFKKdeCG58NGRzhuA1wAiG1o/mRme knon8yfZpjnTp03viGwCl/NPQMIjwk5fgJTHz0WDRTBnUQGux6TbcuEwZ2ohL5tnNUo1 PL4w== 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=vKO0AKheUwKZpYANq+CnD7bdp7yEv4UeLGRdlLv/HQQ=; fh=nisKh/dmf4ZqNNn8tArbrnEB6leKsd9rJy08X1cKQSE=; b=bzRPEcFkmwUj8eMTTPSHZnGWk8MrDhVO94u/OB8zlW4faAYysec0uOBJ6sx3iqHQeE j7Isv+NC7RnaWb0X+cQG+Ro58Y9eRbg8orRV1g72Wqzhz5lMRWf00rwh5dx/HpTRNAYG cUuO3UDhU1wz2/uCVml1/y08QukIjAJZxng+xSduBFyk+WR9E9BHq3+V9PSrzQImT/B+ byi42WJJz8DueZU2YeCKIdcOxQ+acPowaoLUsbvgl0IpC8ZnAbOerGH58nZtkdTIK/b1 VNHgMAGiJOi/HIZe33HhlaYXl5KpnXZ30QjOHN4zzxi5a3Mo+1A23XVqwJF6Zj34HaFR nwVA==; 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-52167-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52167-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCV7hwlQ07vIDSrPkArRRk8HGi8bEN9namnGqcGcZNm0SwqYwPBwr1nn84OSOBnH4k3JWohXWbLRs8MFl2887ruwfLtCtQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id qs20-20020a05620a395400b0078408ca18c4si8565459qkn.341.2024.02.04.23.52.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 23:52:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52167-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-52167-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52167-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 24BAA1C21D83 for ; Mon, 5 Feb 2024 07:52:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC4C1125A2; Mon, 5 Feb 2024 07:52:08 +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 06B2811188 for ; Mon, 5 Feb 2024 07:52:02 +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=1707119527; cv=none; b=kBMUNtRkdTvguXFgIRYhW4jpOQRYB81Wr6xgJ56ZXj4dW6ggGRQpy5W3cGYhFBN/tqib8njw6adVLDKwCkxXqVfJ99kV7gPXjc7TJKYhtB/gR1O2lzcfMsZBJAmnvWH9+HkGDQ5WZj5UTmcJ/W8j1DOqdu+/AwtUUqI1U52A3Xs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707119527; c=relaxed/simple; bh=mhvQyuJsctI1f+B/SMGnKItaoPt1JLY75GynnViuBks=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=mDcjzLqfo4oqRwzM3fmOyxgcwvplHT5vnA8tYyINh4LSiTG7dZAIeC8Vn7DXyRK6EFG9WE1J5+sh35jwaSwd/fLWGTO7m1cB/aPa6fs/iIPWvTaWP8nGkPhPJ4JcTx3wZWkaviY/jw/sFwh0g3nRp/aV/JLt4/pAyduCEpdF0SE= 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: f919dcbcbb4b43f9abf1b544be7db836-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:d3ad5f33-cdb8-4c57-a427-73bda7883833,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:-5 X-CID-INFO: VERSION:1.1.35,REQID:d3ad5f33-cdb8-4c57-a427-73bda7883833,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:5d391d7,CLOUDID:442c2180-4f93-4875-95e7-8c66ea833d57,B ulkID:2402051551570XL61VY3,BulkQuantity:0,Recheck:0,SF:44|66|38|24|17|19|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,CO L: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: f919dcbcbb4b43f9abf1b544be7db836-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1038818982; Mon, 05 Feb 2024 15:51:56 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 4A4E1E000EBC; Mon, 5 Feb 2024 15:51:56 +0800 (CST) X-ns-mid: postfix-65C0939C-2060462 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 80BCAE000EBC; Mon, 5 Feb 2024 15:51:53 +0800 (CST) From: Kunwu Chan To: dwmw2@infradead.org, richard@nod.at Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH] jffs2: Simplify the allocation of slab caches Date: Mon, 5 Feb 2024 15:51:44 +0800 Message-Id: <20240205075144.431567-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790044600415420321 X-GMAIL-MSGID: 1790044600415420321 Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. And change cache name from 'jffs2_tmp_dnode' to 'jffs2_tmp_dnode_info'. Signed-off-by: Kunwu Chan Reviewed-by: Zhihao Cheng --- fs/jffs2/malloc.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c index ce1189793288..411de8b361b2 100644 --- a/fs/jffs2/malloc.c +++ b/fs/jffs2/malloc.c @@ -33,27 +33,19 @@ static struct kmem_cache *xattr_ref_cache; int __init jffs2_create_slab_caches(void) { - full_dnode_slab = kmem_cache_create("jffs2_full_dnode", - sizeof(struct jffs2_full_dnode), - 0, 0, NULL); + full_dnode_slab = KMEM_CACHE(jffs2_full_dnode, 0); if (!full_dnode_slab) goto err; - raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent", - sizeof(struct jffs2_raw_dirent), - 0, SLAB_HWCACHE_ALIGN, NULL); + raw_dirent_slab = KMEM_CACHE(jffs2_raw_dirent, SLAB_HWCACHE_ALIGN); if (!raw_dirent_slab) goto err; - raw_inode_slab = kmem_cache_create("jffs2_raw_inode", - sizeof(struct jffs2_raw_inode), - 0, SLAB_HWCACHE_ALIGN, NULL); + raw_inode_slab = KMEM_CACHE(jffs2_raw_inode, SLAB_HWCACHE_ALIGN); if (!raw_inode_slab) goto err; - tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode", - sizeof(struct jffs2_tmp_dnode_info), - 0, 0, NULL); + tmp_dnode_info_slab = KMEM_CACHE(jffs2_tmp_dnode_info, 0); if (!tmp_dnode_info_slab) goto err; @@ -63,28 +55,20 @@ int __init jffs2_create_slab_caches(void) if (!raw_node_ref_slab) goto err; - node_frag_slab = kmem_cache_create("jffs2_node_frag", - sizeof(struct jffs2_node_frag), - 0, 0, NULL); + node_frag_slab = KMEM_CACHE(jffs2_node_frag, 0); if (!node_frag_slab) goto err; - inode_cache_slab = kmem_cache_create("jffs2_inode_cache", - sizeof(struct jffs2_inode_cache), - 0, 0, NULL); + inode_cache_slab = KMEM_CACHE(jffs2_inode_cache, 0); if (!inode_cache_slab) goto err; #ifdef CONFIG_JFFS2_FS_XATTR - xattr_datum_cache = kmem_cache_create("jffs2_xattr_datum", - sizeof(struct jffs2_xattr_datum), - 0, 0, NULL); + xattr_datum_cache = KMEM_CACHE(jffs2_xattr_datum, 0); if (!xattr_datum_cache) goto err; - xattr_ref_cache = kmem_cache_create("jffs2_xattr_ref", - sizeof(struct jffs2_xattr_ref), - 0, 0, NULL); + xattr_ref_cache = KMEM_CACHE(jffs2_xattr_ref, 0); if (!xattr_ref_cache) goto err; #endif