Message ID | 20240229094112.1154644-1-kunwu.chan@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-86458-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp279814dyb; Thu, 29 Feb 2024 01:42:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWAl5iCE8ckCG41FqWACEVF+sfU0q5D1QjVkzPd911GeCl9W7kLLToA6QYLSl5R2QrIqy+eleywQGg05yB/qF0ro6YBiA== X-Google-Smtp-Source: AGHT+IF03KtYF3rCpbhIPi1Jo5+aoXcL8M55cPEiavDqA75jTkKxOJeqOcQGtHovZQT9LNo8OFwl X-Received: by 2002:a05:620a:56d7:b0:785:b3a3:d29c with SMTP id wh23-20020a05620a56d700b00785b3a3d29cmr1742778qkn.38.1709199768486; Thu, 29 Feb 2024 01:42:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709199768; cv=pass; d=google.com; s=arc-20160816; b=nPQrLMimwYeE/sMGlJl171XkkE/GIjqe7XQAZFn1CBfUVlwNR8v+j1DtZmvI4t/Lyq RuLpEPHl7DbUKx8V/JxPBn9N+0IPJFHNrZyYCXxFbibmjSv+mx8WOabJJh8Cxgx0mbq3 HDaaP2ltoNZaG6VbCMvAuijz1XYqHschXWZDNBR9IFtUoTgWxqP2aso6rJAV2Ia8rPCF XJjbSq5CmmG+cSayQOSx+g5hZxyRK9A7ddFNqVl7hQgWGBIdYMkkLazLGYyWuwmJtSpL hTIvJWEvk7IiHXIhvRAAhJsfYLk2q6cwueRvZ4de5vsy197+n0USpgzEO1ULgTApM0nc s2wg== 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:dkim-signature; bh=GegLNLHxIoI8+sAVk+Nsq6tpYyLvBJO09+R/NY+xICI=; fh=FNCKZSf8HWylYhDsL8YP1fwQIqb5QZeJ2aZB8pNs6JM=; b=irdXALZEyjIFDaKAztTVZIi5eRT8VPWr1rlEy5y9ZQ+C/cZVQrProm/drmBJW9hOoQ cRecIMeMP9n0axuYy4crGOrAiGtaVhQpA9ZLT3fRQvPPw3DF9rL9PkqUvAsiiO8pDZgy yPIt8tcOmgyoYP/EV+SJ/n0ki6widBpg3FkwTj0183CukQg/tgVsDU9gMbh1OabXFttm dGN/1Hri4iItLKVsTlwcVzC3eMxEO8VuVWKidWXMYDAxS+mI0B7MdGl6gADz2sjUbOow kHtHLGYFBs8Ku+LdNgDG98NwFO2alGbildlce//PVKmuSsmqsJHSYtjQVlTbxCfoWQOq ebVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=paQ5zlGJ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-86458-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86458-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n21-20020a05620a295500b00787edadf0e2si1076157qkp.735.2024.02.29.01.42.48 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 01:42:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86458-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; dkim=pass header.i=@linux.dev header.s=key1 header.b=paQ5zlGJ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-86458-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86458-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 48D7D1C210A0 for <ouuuleilei@gmail.com>; Thu, 29 Feb 2024 09:42:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2AC160DE7; Thu, 29 Feb 2024 09:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="paQ5zlGJ" Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (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 8619F5EE68 for <linux-kernel@vger.kernel.org>; Thu, 29 Feb 2024 09:41:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709199704; cv=none; b=jE/XE9qtJWhNjVcXNT4pfNi6/n+MR39TGdlpdJaUjdmhJEOqCb9PziXQj+TAZw4OsYzendnaNgY1a3+ODQbiQTJhKKEUajlWQ2hAZvzLt85eg2foi+Cn73c9fanc5VNBrfRwmDHFw4crn7pWDkmuvkZNrTRJX5tdKKddmvOxre0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709199704; c=relaxed/simple; bh=DQqEJFJ7y8jsUuMKERh72VpYIEhpg3pXaFlWwgkrDLk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=RHEafuiigE3mBu+GXdRIxOd06qT7b575GDlDY932b2yyIofTPO6xzcJwry6rcBdYHd5aKQS60jrO3wRW4CZ+bVW0Onj6sudksqKjny08HXGPTeKX0NiV6F5++he5eVOSjuqHQTxie2StnUXnADb85v+E3lH2ao8qIUqcJYpbQIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=paQ5zlGJ; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709199700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GegLNLHxIoI8+sAVk+Nsq6tpYyLvBJO09+R/NY+xICI=; b=paQ5zlGJwdN9jhx5pltEjtzoSYBlz38SJveNEt3lDPc0DI3qizX4k5Oie1Widz4gpN41H+ 8bWyFHIkxf4hRKv3IHfQSMSNyngkZ5TiiVvmTzM400NDwcfv8ivLQ3UsSOfvvW1MMJ5wMN a49mi+7PZM70VuReMkyrFCVU1Fp2qzI= From: kunwu.chan@linux.dev To: trond.myklebust@hammerspace.com, anna@kernel.org Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan <chentao@kylinos.cn> Subject: [PATCH] nfs: use KMEM_CACHE() to create nfs_commit_data cache Date: Thu, 29 Feb 2024 17:41:12 +0800 Message-Id: <20240229094112.1154644-1-kunwu.chan@linux.dev> 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: 8bit X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792225856262866506 X-GMAIL-MSGID: 1792225856262866506 |
Series |
nfs: use KMEM_CACHE() to create nfs_commit_data cache
|
|
Commit Message
kunwu.chan@linux.dev
Feb. 29, 2024, 9:41 a.m. UTC
From: Kunwu Chan <chentao@kylinos.cn> Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify the creation of SLAB caches when the default values are used. Signed-off-by: Kunwu Chan <chentao@kylinos.cn> --- fs/nfs/write.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Comments
On Thu, 2024-02-29 at 17:41 +0800, kunwu.chan@linux.dev wrote: > From: Kunwu Chan <chentao@kylinos.cn> > > Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify > the creation of SLAB caches when the default values are used. > > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> > --- > fs/nfs/write.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/fs/nfs/write.c b/fs/nfs/write.c > index bb79d3a886ae..6a75772d447f 100644 > --- a/fs/nfs/write.c > +++ b/fs/nfs/write.c > @@ -2148,10 +2148,7 @@ int __init nfs_init_writepagecache(void) > if (nfs_wdata_mempool == NULL) > goto out_destroy_write_cache; > > - nfs_cdata_cachep = kmem_cache_create("nfs_commit_data", > - sizeof(struct > nfs_commit_data), > - 0, SLAB_HWCACHE_ALIGN, > - NULL); > + nfs_cdata_cachep = KMEM_CACHE(nfs_commit_data, > SLAB_HWCACHE_ALIGN); > if (nfs_cdata_cachep == NULL) > goto out_destroy_write_mempool; If this were being done as part of an actual functional code change, then I'd be OK with it, but otherwise it is just unnecessary churn that gets in the way of back porting any future fixes. -- Trond Myklebust Linux NFS client maintainer, Hammerspace trond.myklebust@hammerspace.com
Thanks for the reply. On 2024/2/29 21:40, Trond Myklebust wrote: > On Thu, 2024-02-29 at 17:41 +0800, kunwu.chan@linux.dev wrote: >> From: Kunwu Chan <chentao@kylinos.cn> >> >> Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify >> the creation of SLAB caches when the default values are used. >> >> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> >> --- >> fs/nfs/write.c | 5 +---- >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/fs/nfs/write.c b/fs/nfs/write.c >> index bb79d3a886ae..6a75772d447f 100644 >> --- a/fs/nfs/write.c >> +++ b/fs/nfs/write.c >> @@ -2148,10 +2148,7 @@ int __init nfs_init_writepagecache(void) >> if (nfs_wdata_mempool == NULL) >> goto out_destroy_write_cache; >> >> - nfs_cdata_cachep = kmem_cache_create("nfs_commit_data", >> - sizeof(struct >> nfs_commit_data), >> - 0, SLAB_HWCACHE_ALIGN, >> - NULL); >> + nfs_cdata_cachep = KMEM_CACHE(nfs_commit_data, >> SLAB_HWCACHE_ALIGN); >> if (nfs_cdata_cachep == NULL) >> goto out_destroy_write_mempool; > > If this were being done as part of an actual functional code change, > then I'd be OK with it, but otherwise it is just unnecessary churn that > gets in the way of back porting any future fixes. It's just my personal opinion, I meant to do some cleanup. It's not entirely necessary either, as everyone prefers a different style of code. It doesn't matter. > >
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index bb79d3a886ae..6a75772d447f 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -2148,10 +2148,7 @@ int __init nfs_init_writepagecache(void) if (nfs_wdata_mempool == NULL) goto out_destroy_write_cache; - nfs_cdata_cachep = kmem_cache_create("nfs_commit_data", - sizeof(struct nfs_commit_data), - 0, SLAB_HWCACHE_ALIGN, - NULL); + nfs_cdata_cachep = KMEM_CACHE(nfs_commit_data, SLAB_HWCACHE_ALIGN); if (nfs_cdata_cachep == NULL) goto out_destroy_write_mempool;