From patchwork Thu Feb 1 08:44:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 195203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp10384dyb; Thu, 1 Feb 2024 00:45:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFc9uO0Nu2sjnU9gkYbWoDSgg7cH+JTDyd5iEj2wkF8cWlSrudA5rmBNEJJCd6ZFx3zixCW X-Received: by 2002:a25:949:0:b0:dbd:7383:d155 with SMTP id u9-20020a250949000000b00dbd7383d155mr4236482ybm.0.1706777133728; Thu, 01 Feb 2024 00:45:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706777133; cv=pass; d=google.com; s=arc-20160816; b=setdzfmSvOmtFpXwHvAdkn5i8f2dEK2cFtofkQ3FHWJfyndqMUYYcOugGoKSxHRbrx kOepvr8cx89L0kk6Z5I+B71z8bHyzxfWapeXRN/nZgS3XdiVMe6XxcF2fKAh557CUYPH CJM8DZwl/VLnQRRYMLuxWVMG94mQiHaPPZu9UERJDeqN7pWbUaKajUkRc18kuDJoPVRU IOz4iVK/ZRSBZuT90/ZuAuKbJu9IAAf8pplcB9nhJQ8XXTmsk0AoKyWlIApr/YCitMkj IA89CJjjzZ05mVW0VpNgkSz91OnU0pmtuIi4vh4W30S3R+e+ZTZPfqWomrNmB0yASF0g b4wQ== 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=/mG8RWlGuxNrxBSFMfBB4ky9ihmefS1wqLWGCKVFOsg=; fh=ApVWs4qY2CCqfJIbzQzwhpy7TkS97FY7P5+iFtBl1vM=; b=GvU+mzVDAFwxrtv6EnF1lgLLWWx3TRxOKtpK3Oc/UafZxzjiL9xN4vHbMm7BNwCB6r iSYKe49E21XtG2iKlFqsqsEpwuBeMro6iYdRz6s/UZScDqIigMXzyYLl7rKkgZkDtJHc LblH0cdpLKd4srieSb/CspAIjw6ULRx8a6x/Rzh6yaCmw0KgFvMsBpihz8tQw+mKea5F 4JA+FTE6EMHRd19A9kCq0wQhotqf+7cXtI9ANj4sWVfcJTdpT1cU5HpIFUa+wvsZA/bc 4MnKNs66vxh4PzSzvvsOMM4GFf/u4Anj4DEJ44/wjkM1HljUTSiJVKkjbBCNWSijPxvV ipgg==; 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-47798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47798-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCV4tmqwt/LlDyr7sNsAgr/IfH/3kQEQocaZwpxmbXre+tA9lI9CQiRSipzaQEd2SPFCSHaVBpZS7Sfi/xm9rVNGcRDsHQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t25-20020a635359000000b005dbdfa7a5a6si2440153pgl.454.2024.02.01.00.45.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 00:45:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-47798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47798-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 1D60F290815 for ; Thu, 1 Feb 2024 08:44:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 853AE15AAC2; Thu, 1 Feb 2024 08:44:20 +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 2DA521EEFB; Thu, 1 Feb 2024 08:44:15 +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=1706777058; cv=none; b=oZKt9+PjSBqwAfWzrCjU8sjibeaiEL7knUZiHHRK1Z3G0iDWaZlmyIJYYED9PWlw9+E03MAbwPchhMxpO/CC41t/W5r2bOQlpRxx9MVD47gjsufhu6/bc0ZaEagMKgxwPmgPHnDOljw9wDmyG5XPXNSj0T/xRpyRj9VbjvxFEHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706777058; c=relaxed/simple; bh=LlIlYqRlTw0tojpLRBc/lbB7iBHlg68dwJ1/Jk5CGFA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ifZZEmMoKIcjjf/zQakDAnL++nGrZKGxjfHLOphLM0YCwLDgrGybxbAtOC9Sg3BVXS6i3/XQVflHXYgp0nzkvwzJKREbDoxua66KYpanRVmPK0iUZaD7zpIJmS2uvKKSxBZefVW4oFj2QDN7+5YtGghQEyOdd/WcuQKpC1yS6KQ= 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: 0090f8dc9eec483697318b7e37d3278b-20240201 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:ce19592d-71d8-4082-8c7b-fbb57d2fc382,IP:10, URL:0,TC:0,Content:0,EDM:25,RT:0,SF:-9,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:26 X-CID-INFO: VERSION:1.1.35,REQID:ce19592d-71d8-4082-8c7b-fbb57d2fc382,IP:10,UR L:0,TC:0,Content:0,EDM:25,RT:0,SF:-9,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:26 X-CID-META: VersionHash:5d391d7,CLOUDID:02d80080-4f93-4875-95e7-8c66ea833d57,B ulkID:240201164412W36I5V77,BulkQuantity:0,Recheck:0,SF:66|38|24|17|19|42|7 4|102,TC:nil,Content:0,EDM:5,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_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 0090f8dc9eec483697318b7e37d3278b-20240201 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 475640272; Thu, 01 Feb 2024 16:44:09 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 3A621E000EB9; Thu, 1 Feb 2024 16:44:09 +0800 (CST) X-ns-mid: postfix-65BB59D8-917845955 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 66695E000EB9; Thu, 1 Feb 2024 16:44:08 +0800 (CST) From: Kunwu Chan To: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, Johannes.Thumshirn@wdc.com, dsterba@suse.cz Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH v2] btrfs: Simplify the allocation of slab caches in btrfs_delayed_inode_init Date: Thu, 1 Feb 2024 16:44:06 +0800 Message-Id: <20240201084406.202446-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: 1789585797563387421 X-GMAIL-MSGID: 1789685539707210449 Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. Make the code cleaner and more readable. Signed-off-by: Kunwu Chan --- Changes in v2: - Update commit msg only, no functional changes --- fs/btrfs/delayed-inode.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 08102883f560..8c748c6cdf6d 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -28,11 +28,7 @@ static struct kmem_cache *delayed_node_cache; int __init btrfs_delayed_inode_init(void) { - delayed_node_cache = kmem_cache_create("btrfs_delayed_node", - sizeof(struct btrfs_delayed_node), - 0, - SLAB_MEM_SPREAD, - NULL); + delayed_node_cache = KMEM_CACHE(btrfs_delayed_node, SLAB_MEM_SPREAD); if (!delayed_node_cache) return -ENOMEM; return 0;