Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2864226rwb; Mon, 7 Aug 2023 05:00:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF47x0wwKkCrxpGH5gkSjztAOa+kV5xsJ8wFQ9CY1rSmzfOzS6LfO+FsCfgGGD467tga3lV X-Received: by 2002:aca:2201:0:b0:3a3:3a0b:aab8 with SMTP id b1-20020aca2201000000b003a33a0baab8mr9032469oic.48.1691409601689; Mon, 07 Aug 2023 05:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691409601; cv=none; d=google.com; s=arc-20160816; b=N1wcsEm5OE79pcxLsAXjDHj5F63QSuhynPOvp2Pm7TzMNcbffxqZZiAuLANXMYjIEo DkI+ifX1rq/Dq4iZgENhXOxKWXgpuBxHUL6vrVyfTOGREPtziKoBlUSQXU49Hk2+Ixuh 3vNWJzpCn3ro0Cl1PfrdL7INu4U2X60I5uwQhoV4j93japoRG7qb7qlR9ObK+WMgOEaU v3gNX8YaBr0yHTK2t9kepZOFb1iBdPn1Qj7flgO6y/9gtjLcHUzbz5Q1LWicV43wzK9s jJiN+lKdYODmHplXvWgxtSYDju0/jOs+ZjyAm2UoSYQ1rWwWwm/VZZoEGFqJ7iEtUjeL 13fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iXZOOFmuwv6/pQ9jzhgVENlSQpZ5agnqrhquB4Bsoao=; fh=JwrRg0ndXrpURY0vwDVMB2JxbP/kKK+/sa4yghEeBpo=; b=GwHGZ3RCSgzKeVpeq70eee32haPPNHadn2JDF+34CEwSReZSdkjUu4FVfxXb4t6ip4 1le+I6J5JIKcuo0TCdJ91FUHTBHTMT3Dw7puVA6OKUnuqGleHLnXW9weHCpnz7djT2Vn vJzkB1+uRLKo3OodgK4KlzTO+kxOG7jGEKFAQ3aUYR0l5hnmWrDlB0e9APOiYJ92tiId O8GaVVBJFWC2OEa+qN375gTfUa6AU6cJ8/VsXGZ9xGzJ1L3OyezUWCJA51NP64fNA4vl a0ZQzmyhnWr0KqCexkPzSv5xcQJPYjwYKurIAH2V8ZnuAizBfQsRKAm9VITHGSAMeWJ1 1ApA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=EUQfNsCH; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a63f508000000b00564db08413esi2561616pgh.35.2023.08.07.04.59.48; Mon, 07 Aug 2023 05:00:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=EUQfNsCH; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232659AbjHGL01 (ORCPT + 99 others); Mon, 7 Aug 2023 07:26:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232106AbjHGL0H (ORCPT ); Mon, 7 Aug 2023 07:26:07 -0400 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3185270A for ; Mon, 7 Aug 2023 04:22:59 -0700 (PDT) Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-6bca018afe8so758701a34.0 for ; Mon, 07 Aug 2023 04:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691407328; x=1692012128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iXZOOFmuwv6/pQ9jzhgVENlSQpZ5agnqrhquB4Bsoao=; b=EUQfNsCH6UZF/h1lCv8BW5qUAY0F87iXOU1c2h+1PdvyklWoTvgUqtvMdC/LtJ39lr kgQ014dbqLYx+E0ruXBTjbHLd8RhNRCBL8WRFwQqlQREAzBcDcgAY2s7fW+Y1le4rtED oIEQY2nH/L2qFcO1BCrIWenE7eTSVMr3Rp+6glOvJ9EcC4AfT+4Cb2yS4F7aHTKtuh2x NtOd1lMVkN7UfpCJNXQ4/6k18fkfgDN6n2qZZQTcBMuFiQNn4gRFtNk5XW/WmcAwaK4s TakYM0Dr1rzfDCylK2P1O11MxSMJvp8TcFvqTUgVQ54WBYSGoU2XLSt42dE6ys1REN1b 4D3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691407328; x=1692012128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iXZOOFmuwv6/pQ9jzhgVENlSQpZ5agnqrhquB4Bsoao=; b=Wq8WsArdAdIPZyARUdr00HLLrVMWn+F7qI0ym9O/LsV/ORU8Ab49+z3LzaTD23JINR vuABvd/cLKh1OF2fYVqsIrugoV1lLAz1GOXR1tVG2FPCN28dnNil7WUCRAugxZd1MvdF WHWMGn0y1AkNgVEXJRyC2skOxxlpM8wfvr5Im+vmf5TsdqDkn68qiotyaDAqKIXlIQeY VZJmSUUeuqaiDhqbWuKetnvpaAxYphyD+mWmbgJ8P1Rd6OKt9XrhZvqwyond6+6oyKGF nfMrt9LHl/8bsMnjk1fuSUHPJjn2lcaotUr2IdY4+pn+F9XKGpK8nkPrjVXwVl/kkhxh +64Q== X-Gm-Message-State: ABy/qLa9VyWRgssrBcLVV9+OTBX0Vt4SiYYgz6Yf2WZ6hmIlfdmTYVG0 9EwgGiUEgY5wSEVLXKzWk4LClsK47Fw3ewI/3wo= X-Received: by 2002:a17:902:f688:b0:1bb:d7d4:e2b with SMTP id l8-20020a170902f68800b001bbd7d40e2bmr33138766plg.0.1691406778592; Mon, 07 Aug 2023 04:12:58 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id y13-20020a17090aca8d00b0025be7b69d73sm5861191pjt.12.2023.08.07.04.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:12:58 -0700 (PDT) From: Qi Zheng To: akpm@linux-foundation.org, david@fromorbit.com, tkhai@ya.ru, vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org, brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu, steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org, yujie.liu@intel.com, gregkh@linuxfoundation.org, muchun.song@linux.dev, simon.horman@corigine.com, dlemoal@kernel.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, linux-erofs@lists.ozlabs.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, linux-mtd@lists.infradead.org, rcu@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, Qi Zheng , Muchun Song Subject: [PATCH v4 14/48] nfs: dynamically allocate the nfs-acl shrinker Date: Mon, 7 Aug 2023 19:09:02 +0800 Message-Id: <20230807110936.21819-15-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230807110936.21819-1-zhengqi.arch@bytedance.com> References: <20230807110936.21819-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Use new APIs to dynamically allocate the nfs-acl shrinker. Signed-off-by: Qi Zheng Reviewed-by: Muchun Song --- fs/nfs/super.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 2284f749d892..1b5cd0444dda 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -129,11 +129,7 @@ static void nfs_ssc_unregister_ops(void) } #endif /* CONFIG_NFS_V4_2 */ -static struct shrinker acl_shrinker = { - .count_objects = nfs_access_cache_count, - .scan_objects = nfs_access_cache_scan, - .seeks = DEFAULT_SEEKS, -}; +static struct shrinker *acl_shrinker; /* * Register the NFS filesystems @@ -153,9 +149,19 @@ int __init register_nfs_fs(void) ret = nfs_register_sysctl(); if (ret < 0) goto error_2; - ret = register_shrinker(&acl_shrinker, "nfs-acl"); - if (ret < 0) + + acl_shrinker = shrinker_alloc(0, "nfs-acl"); + if (!acl_shrinker) { + ret = -ENOMEM; goto error_3; + } + + acl_shrinker->count_objects = nfs_access_cache_count; + acl_shrinker->scan_objects = nfs_access_cache_scan; + acl_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(acl_shrinker); + #ifdef CONFIG_NFS_V4_2 nfs_ssc_register_ops(); #endif @@ -175,7 +181,7 @@ int __init register_nfs_fs(void) */ void __exit unregister_nfs_fs(void) { - unregister_shrinker(&acl_shrinker); + shrinker_free(acl_shrinker); nfs_unregister_sysctl(); unregister_nfs4_fs(); #ifdef CONFIG_NFS_V4_2 -- 2.30.2