Received: by 2002:ac8:45c5:0:b0:405:464a:c27a with SMTP id e5csp996955qto; Thu, 27 Jul 2023 01:22:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlHFsdjCTtj9ocvO6JgeeuwlWUadUd1/RH4aQXQpMPp5pSkCHYoBom1WuMumiXM9vS9OiD9F X-Received: by 2002:a05:6a20:9698:b0:138:834:5dc7 with SMTP id hp24-20020a056a20969800b0013808345dc7mr4526134pzc.30.1690446125203; Thu, 27 Jul 2023 01:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690446125; cv=none; d=google.com; s=arc-20160816; b=amDJX4x6+mF8kmPjAabANJ6b03xIlAjIXVA6QnbKl9pg7KOwSTn2013/Fh4JW6iG6c XdPlwKN9Vn5uip22Ts/7KIR4JqBhBQGCmMgj5NaFvpc/qt37Ha744u2PMYNuBTxDDq42 ucpKxsmH7m7cs/WLiGpxsMPFkZeZ9526OG58e3CxwamG4m4Zafxy9q26C4+T/XN2C/T/ zzXyYmuRLs0tJv+nn6kos5b8N0G0YxmRReL6tP/8J6dnuh9H4q6Bs+ATNjMjKxrhCHHs FNo8xjtFHM4NfaxsohRFDV07+bHpD+90/Ys4AlKjl0GZSfRWkvjlgqia7xKBKHo/O/4V u/Sw== 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=9TzzNXWnGUC4v0Im6lZC1fetjV0NX81rj7dQA53Eb1w=; fh=NxkGAd430gburLVd9IjvP+jLcLBa8IzZa5IqPWgCN1g=; b=Rz1SoYktX+y4NAmN218FwPuRmoVa//g1qKEUx5x/xtDvS/SUv7mn1oaomE8JipSwgR AuA+lF9IHmI9mKJ/aLI3exiARmdalnh6a/UGW0BvBMlNPAwn7Yr5X7pSTTNgVR7G7xaZ HJjFK9j08nMfIXEm7NKI8Sy7yFB1eO5dhJ0wsmR3f9EsqHPocQ1evwv8sO1dcO6Xa3Xc baX+ZmdSInziNNZAQWoyNCBPb1NRW+Lg49jLQCtICAX0tT3Dq3kqMhxZbS5dY3RfuAEB P6DIWFbFi//uWZlc7DgguFbUKEpCHuEEjcIKPgpSCzgfOaF5UmROdsyZDFJf956S1Qky yoUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=fVbo4B1S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 q79-20020a632a52000000b0055fe651e9cesi898143pgq.796.2023.07.27.01.21.52; Thu, 27 Jul 2023 01:22:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=fVbo4B1S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S232552AbjG0IPX (ORCPT + 99 others); Thu, 27 Jul 2023 04:15:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233689AbjG0IOS (ORCPT ); Thu, 27 Jul 2023 04:14:18 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2716159CC for ; Thu, 27 Jul 2023 01:09:42 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-66d6a9851f3so167834b3a.0 for ; Thu, 27 Jul 2023 01:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445332; x=1691050132; 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=9TzzNXWnGUC4v0Im6lZC1fetjV0NX81rj7dQA53Eb1w=; b=fVbo4B1Sn0AGX1nNJK0Eo1gukSsful8PC6Tpi9R2ay4P+tk9frdioPsIm2s6rPxi46 ++BpYvSQrpfhaqWc0rmuBFjQPz0zzH5N+AGXb67rsChsvEkjfu687Mjmoln0lCJnbS1t S6gxfZ/pYInNuKorknrCkgDtrsNJQ+5b+KQpVkQdCPQpNRB6D3agySMM3uM99/xhPotu rAoYyPnK20sDnc7vY5XomSSW5p6ngHpl0qbTjtgeFdhf5V6H8EL0+GE/5QBEhSY2aRe8 CqIfoMbQ3ZACqieIYGVBf+Lq9zLueZGm5ISvf4EF/2FFF37Zi67sB1q+1Y4ZesHEzWZS zb1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445332; x=1691050132; 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=9TzzNXWnGUC4v0Im6lZC1fetjV0NX81rj7dQA53Eb1w=; b=XlzFjwDR5fwM25IHN/RGaGkOvUZHE5j67RXZDt5VjSm0e4mojXU3a7DhzqW/QtRBwq bhEMcxyCCJSAZFauGQEwX0O6ZkwHSxNvkAd618719CV1OhgZywNx6fWIm7i0tdUCoVZM 9cjKJNy3+Kow6XTfSBOnnvrtG4qo99FPIVXyT5NjE3iTdyhoManiljgogoFy67JZioRd I6eenwcRwO2DTasrYYj2OD97nCOxIO/9R1ufb2iGVXkC7v3jT++dhv6XoFvIwlHtMybU hIZ5NaxvuQeqO4tzAJDTcm4ZaQmoKX34o7P4WnLvphQxYYkZNKmY2GpZOyiNE83NzPvH 3PDw== X-Gm-Message-State: ABy/qLYd/H4RoijlHE0SfHInL9O2fsJ4JskE3lk1Fc/TdOB1L4icfSiU EP/0OXDRrc7wT2VeZ0KYw/T4uQ== X-Received: by 2002:a05:6a00:488e:b0:677:bb4c:c321 with SMTP id dk14-20020a056a00488e00b00677bb4cc321mr4639246pfb.0.1690445332713; Thu, 27 Jul 2023 01:08:52 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id j8-20020aa78d08000000b006828e49c04csm885872pfe.75.2023.07.27.01.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:08:52 -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 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 v3 15/49] nfs: dynamically allocate the nfs-acl shrinker Date: Thu, 27 Jul 2023 16:04:28 +0800 Message-Id: <20230727080502.77895-16-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230727080502.77895-1-zhengqi.arch@bytedance.com> References: <20230727080502.77895-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_NONE,T_SCC_BODY_TEXT_LINE 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-kernel@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 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 2284f749d892..072d82e1be06 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,17 @@ 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) 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 +179,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