From patchwork Fri Jan 26 15:39:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532835 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D31D1CFA9 for ; Fri, 26 Jan 2024 15:40:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283634; cv=none; b=irsuJft5D13wAUgKBtP/FKlDvAmEi8v9hSevrnvRCkw6b5GpO6T7pfg7YALn7UOazHmwBnDesyqJbMgYmQs4XM+ehy99A4uSBlZxPQf0Vn3r8nvPC1CtjdCpjQghLQJRvRHSQQ2qOxrNcqWjv4T+Zot23vSjv3553ptfx7n/i4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283634; c=relaxed/simple; bh=gj6BN5Ryi90FiGCGRLD4HyYT25snhN7XpbObeUR/VfU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=asxaqwCP6CkPP00cCp7IPuv7fWzjcByFwYa+RvXzYg6w9/N5J4rJs4bJUmkE57KMMeq7iHf5zngJpT41Ox5KZRmM210Zw263M6kFlT14Rz+6UJ1FrnT2hiz75sP8UMi42To6vg6dW4z9zWtUoEdQeZeU4Ik1Oc2ttVwxhidov00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=DQUt5ix7; arc=none smtp.client-ip=209.85.128.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="DQUt5ix7" Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-5ff7dc53ce0so3891367b3.1 for ; Fri, 26 Jan 2024 07:40:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283630; x=1706888430; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hDFJ4ofz5JnRdgl61rMW+8vTooiJNkqwX2WXWFw/o7A=; b=DQUt5ix7WCx07vMPsRGrGBAu1fe+RZb6X5T4FS2AJXRiYnyASob1ykax1hekCEEZXx eZnlgaVL+ep8LKVqv2L8wKilqKJaO0DCb+CClloOqvWiHLbofQlTR0AkS3ZStq6xVUpe q88W+6HvZH8IAsI0eAiDlWki5k74opMH55YYfbwrC8WejHEsWhACSwlGlIySbkAzOniI MkB0CYoyxZPA2Ab9jrb6i5JhPNcwVv0mqyo6ITjbSKR/EZS5pSO2YU8Q4uqFsYkaH+EF yIx+YmcXHfaCsb4+8QJH9RfWP7lUhVackzwrx8SQ4QNbS+z6jje2jPAdt+JHpI4FchMa FGzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283630; x=1706888430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hDFJ4ofz5JnRdgl61rMW+8vTooiJNkqwX2WXWFw/o7A=; b=sHpuzy5Gu4h1Hc9FKyCexHMoCMoa3k4ai8PbS7T9qOzbj5S7PfvbiHtJVZl6IKA/RY VUAgd9j/QbqmH5R4cCQNt3AWZ5QPy3DO7SD6+2TwJaoOtTiX9Bl46VF6Z0ovUVvCWxzp W1Gjodknx0ljdyVEpjdUcQn8jZGcNZNABwht1LYVy4DEca/58m20jtqPV03Hp+a9qyo7 /b+U0KV5HL+s5DgRT+tBjMGWU8K2rek6Js0n43HFYgDZAVMKgVWpstU4KiWx9Qry9MyG U2+OQAtD+UAICJ8n1IHiAAGz8EUW0ScDvBgffwx8MGPdO/A2SFB/diDGbRLQ+geV8Wx2 MEAQ== X-Gm-Message-State: AOJu0YwaZsH3IX/94OSiEjo21k40Y/zUXDProfHSBeg5qFkO+iewC3Gy iEzJExaPSRzOKW7Vxoltk61Un9kX8upUAaeS7BPlmMk9QoZvtNDSQu4e9plYOAM= X-Google-Smtp-Source: AGHT+IFRYjtMG6YZIDONmyRsiSQ1ncogzoR7jMfPkHa2xC9dBqUIwkr5vUhihjqSgTHzZT8TZr02kA== X-Received: by 2002:a0d:d40c:0:b0:600:228e:15cf with SMTP id w12-20020a0dd40c000000b00600228e15cfmr1168936ywd.92.1706283629946; Fri, 26 Jan 2024 07:40:29 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id q206-20020a815cd7000000b005ff846d1f1dsm450775ywb.134.2024.01.26.07.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:27 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 01/10] sunrpc: don't change ->sv_stats if it doesn't exist Date: Fri, 26 Jan 2024 10:39:40 -0500 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We check for the existence of ->sv_stats elsewhere except in the core processing code. It appears that only nfsd actual exports these values anywhere, everybody else just has a write only copy of sv_stats in their svc_program. Add a check for ->sv_stats before every adjustment to allow us to eliminate the stats struct from all the users who don't report the stats. Signed-off-by: Josef Bacik --- net/sunrpc/svc.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index f60c93e5a25d..d2e6f3d59218 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -1375,7 +1375,8 @@ svc_process_common(struct svc_rqst *rqstp) goto err_bad_proc; /* Syntactic check complete */ - serv->sv_stats->rpccnt++; + if (serv->sv_stats) + serv->sv_stats->rpccnt++; trace_svc_process(rqstp, progp->pg_name); aoffset = xdr_stream_pos(xdr); @@ -1427,7 +1428,8 @@ svc_process_common(struct svc_rqst *rqstp) goto close_xprt; err_bad_rpc: - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; xdr_stream_encode_u32(xdr, RPC_MSG_DENIED); xdr_stream_encode_u32(xdr, RPC_MISMATCH); /* Only RPCv2 supported */ @@ -1438,7 +1440,8 @@ svc_process_common(struct svc_rqst *rqstp) err_bad_auth: dprintk("svc: authentication failed (%d)\n", be32_to_cpu(rqstp->rq_auth_stat)); - serv->sv_stats->rpcbadauth++; + if (serv->sv_stats) + serv->sv_stats->rpcbadauth++; /* Restore write pointer to location of reply status: */ xdr_truncate_encode(xdr, XDR_UNIT * 2); xdr_stream_encode_u32(xdr, RPC_MSG_DENIED); @@ -1448,7 +1451,8 @@ svc_process_common(struct svc_rqst *rqstp) err_bad_prog: dprintk("svc: unknown program %d\n", rqstp->rq_prog); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; *rqstp->rq_accept_statp = rpc_prog_unavail; goto sendit; @@ -1456,7 +1460,8 @@ svc_process_common(struct svc_rqst *rqstp) svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n", rqstp->rq_vers, rqstp->rq_prog, progp->pg_name); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; *rqstp->rq_accept_statp = rpc_prog_mismatch; /* @@ -1470,19 +1475,22 @@ svc_process_common(struct svc_rqst *rqstp) err_bad_proc: svc_printk(rqstp, "unknown procedure (%d)\n", rqstp->rq_proc); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; *rqstp->rq_accept_statp = rpc_proc_unavail; goto sendit; err_garbage_args: svc_printk(rqstp, "failed to decode RPC header\n"); - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; *rqstp->rq_accept_statp = rpc_garbage_args; goto sendit; err_system_err: - serv->sv_stats->rpcbadfmt++; + if (serv->sv_stats) + serv->sv_stats->rpcbadfmt++; *rqstp->rq_accept_statp = rpc_system_err; goto sendit; } @@ -1534,7 +1542,8 @@ void svc_process(struct svc_rqst *rqstp) out_baddir: svc_printk(rqstp, "bad direction 0x%08x, dropping request\n", be32_to_cpu(*p)); - rqstp->rq_server->sv_stats->rpcbadfmt++; + if (rqstp->rq_server->sv_stats) + rqstp->rq_server->sv_stats->rpcbadfmt++; out_drop: svc_drop(rqstp); } From patchwork Fri Jan 26 15:39:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532836 Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28EA81CFBF for ; Fri, 26 Jan 2024 15:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283635; cv=none; b=H3kiYDqudk9s5O3IpCEL3jZG2y+6Q1Ctt7elkUK7dLtzbNMiewMbQfd4cutyD7RnaA36hvqNTh2ygKcdb6N+/3xMrpDtzwuTX9BHqEZhbAjY/bH67IBxX7Wb6PFT0DgIuAvOOxyG2m904nvachUKK+HpvW26Gr45tz7Pcg5uf7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283635; c=relaxed/simple; bh=5JQ1/M6bbxJsfyHx012U0mDRp/eH8t9frg0weJDiN9M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G27PJuGUrjYUKaeT+M6XV9e6IT1DPj/26g+UviJg39CyxYoWjtH2w5lUsueEIrKVAcfQpC3rzVTvqY3zysMlP2/gE/dMfl0KhkzqMsbb6RQbAWPtZ5D95/fbdhKbuydce6emApgZivQk8Y6ZtHFi71WRUPsSBQRjJrgRdS8pcn0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=pXWZSLR4; arc=none smtp.client-ip=209.85.128.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="pXWZSLR4" Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-5ff7a8b5e61so4719007b3.2 for ; Fri, 26 Jan 2024 07:40:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283633; x=1706888433; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TN9NkdmlW/r4hsktKj1asTsOnKMChQLhJUHVox7Fcng=; b=pXWZSLR4o/BRLbshZO0a/OEfOkjMfa9aKyba3gm7jNe2nEqi9FmA7sZI2mmcUNsePb zMR1DgY3kbOn2MYHNDzoTg/q/kAOK9TMhaYgYr+/CHmh8iV2NaDixfvMSygmAu+CGM4e ZGA15+KwjZKtELYIzi4kr11AsXTeIRZh8OiaeS2yJHpTLIWZrgNVWu2zk1LBef5zkdOI 0xN0mA+egZeSYNtC1GR77Yc7ReD+L5UMwvZr75K53IPZoPFDGDhSiniCmqnSjSC7hkSR nBoWUSYGtBQcP2n8UvRtdu9tu90LZCxv1uvY6Jv1H+UFz+GDJ3dUvERKDd7JrLposOVr KUhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283633; x=1706888433; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TN9NkdmlW/r4hsktKj1asTsOnKMChQLhJUHVox7Fcng=; b=nTLcuOKPb7CPr3dGNyA7UdopdvxyLNGuqjJAQfDQBMWCCyZPtUjXCe013Y//jWK18t s+k7oGtPgSUbU9P0tp5NILjids7jCFntwL7qo6SacJzGy15v268fsSAKZW80S//5EZYl Nb+6QxvNSYJ8NbvpxKRbR2Ld869lKOH8yPWat6ltJ59VYCjRUi+RmS8xEDSYT4CB4V7+ ILXOU1hokImKwOOxVg3Vgm18Zz5Dt3yG3VjXIKCyzK4Cnd3Vd2//mzfaz07PgguP0vnx sUi8DAeL56p8PmTn0Yt5WFtw0OrA8wH6PzHXWEedMnfTpRSpnjLYKto/LeZeGmbFZ/8Q vuCA== X-Gm-Message-State: AOJu0YzFSS0zCzVelrbdJyI9teJMmYWW+aa2IQu9tZgD0sK6oEn4PUvw qAypQfoIwDan/CEMoJTwThDkOKtMOzLpkOIOPb3Fw8g21bUhEyM28/icyb3obMIDrKljIyhpxJX a X-Google-Smtp-Source: AGHT+IGRVvmTgeKxjilveA9+aQtvyBZJN+MPS0gCUwM/nw1U7/40fKzSJMJ87XNG7jsHM2tWO+MZOQ== X-Received: by 2002:a81:e703:0:b0:5ff:5220:4450 with SMTP id x3-20020a81e703000000b005ff52204450mr1375757ywl.42.1706283632970; Fri, 26 Jan 2024 07:40:32 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id fp3-20020a05690c34c300b005ff9b3e6dd4sm450111ywb.116.2024.01.26.07.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:30 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 02/10] nfs: stop setting ->pg_stats for unused stats Date: Fri, 26 Jan 2024 10:39:41 -0500 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A lot of places are setting a blank svc_stats in ->pg_stats and never utilizing these stats. Remove all of these extra structs as we're not reporting these stats anywhere. Signed-off-by: Josef Bacik --- fs/lockd/svc.c | 3 --- fs/nfs/callback.c | 3 --- fs/nfsd/nfssvc.c | 5 ----- 3 files changed, 11 deletions(-) diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index ce5862482097..ab8042a5b895 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -710,8 +710,6 @@ static const struct svc_version *nlmsvc_version[] = { #endif }; -static struct svc_stat nlmsvc_stats; - #define NLM_NRVERS ARRAY_SIZE(nlmsvc_version) static struct svc_program nlmsvc_program = { .pg_prog = NLM_PROGRAM, /* program number */ @@ -719,7 +717,6 @@ static struct svc_program nlmsvc_program = { .pg_vers = nlmsvc_version, /* version table */ .pg_name = "lockd", /* service name */ .pg_class = "nfsd", /* share authentication with nfsd */ - .pg_stats = &nlmsvc_stats, /* stats table */ .pg_authenticate = &lockd_authenticate, /* export authentication */ .pg_init_request = svc_generic_init_request, .pg_rpcbind_set = svc_generic_rpcbind_set, diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 760d27dd7225..8adfcd4c8c1a 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -356,15 +356,12 @@ static const struct svc_version *nfs4_callback_version[] = { [4] = &nfs4_callback_version4, }; -static struct svc_stat nfs4_callback_stats; - static struct svc_program nfs4_callback_program = { .pg_prog = NFS4_CALLBACK, /* RPC service number */ .pg_nvers = ARRAY_SIZE(nfs4_callback_version), /* Number of entries */ .pg_vers = nfs4_callback_version, /* version table */ .pg_name = "NFSv4 callback", /* service name */ .pg_class = "nfs", /* authentication class */ - .pg_stats = &nfs4_callback_stats, .pg_authenticate = nfs_callback_authenticate, .pg_init_request = svc_generic_init_request, .pg_rpcbind_set = svc_generic_rpcbind_set, diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 9a894c3511ba..a0b117107e86 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -80,7 +80,6 @@ unsigned long nfsd_drc_max_mem; unsigned long nfsd_drc_mem_used; #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) -static struct svc_stat nfsd_acl_svcstats; static const struct svc_version *nfsd_acl_version[] = { # if defined(CONFIG_NFSD_V2_ACL) [2] = &nfsd_acl_version2, @@ -99,15 +98,11 @@ static struct svc_program nfsd_acl_program = { .pg_vers = nfsd_acl_version, .pg_name = "nfsacl", .pg_class = "nfsd", - .pg_stats = &nfsd_acl_svcstats, .pg_authenticate = &svc_set_client, .pg_init_request = nfsd_acl_init_request, .pg_rpcbind_set = nfsd_acl_rpcbind_set, }; -static struct svc_stat nfsd_acl_svcstats = { - .program = &nfsd_acl_program, -}; #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ static const struct svc_version *nfsd_version[] = { From patchwork Fri Jan 26 15:39:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532837 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 335011CFBE for ; Fri, 26 Jan 2024 15:40:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283638; cv=none; b=jhGY/kS1RCbylqJWwOy4kCwrOwt5ufX8hkbPbp81ZCSx7qCCofGyRu+9cfct8O/8z+CuVbTq9JTOYdnqFmAo+6xr6MZgb6YDbMUNsaD/6mlc6J/cus2zxsSTKhm9DAL4TPQeylcnE7OZrEj/vi2ep15HtYsSR7H98wI5TwjT57o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283638; c=relaxed/simple; bh=KJIKto7Fz2Gi+znP7ibG0eIpzlAnJPgiINw1yO0eONQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F3iwSx9JaMjTBc5BJgxy/Sx3lpSeXTwS5Vfw6i2r1yfLFHfi3WZso2/PjtWuKoQHIg3qpB4KR9kzWdj2/r+xPiyZk92TVHjgTT0Pvu/nVnBCYEAHAAZXUMnZPh1kxevZB0MCcptK91Jk5gBKOzvwijkV77Oz5ZgRgkVMWTyV41w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=nQ+kbOD0; arc=none smtp.client-ip=209.85.219.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="nQ+kbOD0" Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-db3a09e96daso440545276.3 for ; Fri, 26 Jan 2024 07:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283636; x=1706888436; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bpjFrW50KS9kn4Kls/cPsYIDVuWXE6SJcryyojCjdYQ=; b=nQ+kbOD0u20j+7u7mNsGOWIgHpCtb0Cn095N/+KY//1Lrjvu3SoBjYWQb5Sc9C4LlJ CmMSSeT9Ydb48L9eINBHH+2V1F26ofAtVi0at6b2alKoo61sPXhoD0Wv55YrpvnfV1vT O8YqL49OKs9DPy1jQhBYAjOSy8cU7Mc25NB7pBL7RdWP9U7DYgPCA31bDbLLzIgkUb2L ahBJ7+eQNYkwkTewi8QbcL4OzTZf1q7dgCzeGio672SxgDztl98asgKVpucLvK4bZ2Hs EXRLwsryX130mPCfRwVFNeAbanC/ypyRH2weqC3l0BjikN/Z3ktNZ8/L1XD8+l076k58 iTOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283636; x=1706888436; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bpjFrW50KS9kn4Kls/cPsYIDVuWXE6SJcryyojCjdYQ=; b=vMe0vYrOAmNCXXB7KoBVNhxVeTpsHiUSZLk+dQLfrNqCOdLHyhTvPmspsgEJQ0lu7U bTk/z0sbnmprhPLA0GGNWIs008k7Aq2Vm6nNCP2/BrTnMJHB1P9VFonjjmag0eRh+Ruo +tl/EJoHboOTfv8Dtvti0qAhibW8PyHoA3chtuiaHmGhuSZuV0XrvnKnTyzpNlKorUdy sgG7K+pQJubiYO35SbJM2LphVQuv+F1W0iohoxrdiY7C7jU+n0TzO4n8Lj3Wk20Km5J+ ZCqwtYJOgBbYL8BCYnalHFYpTAeskvSPab799NpZEtvGhDWu4DRtMrEWq6Z12JGva0xg 3uCA== X-Gm-Message-State: AOJu0YxIFq8y8gt1cUCsYB/noPKzW3dnaSWkJsuWA+x1kkIxKPk7V5RZ TP4QqmMe88DIXFq9m13teqgojMgcEfY13YI6ZsjFizhHTC1WYLyPBl6/+QXSvfg= X-Google-Smtp-Source: AGHT+IGqYIV0e8NBQ2jljvsGlmsS8mxCP8qj5MG6fzdLgIjPpsrio9XUqA4it45HSGNmI0OeStg5XA== X-Received: by 2002:a25:8384:0:b0:dbf:23cd:c05c with SMTP id t4-20020a258384000000b00dbf23cdc05cmr20115ybk.13.1706283636086; Fri, 26 Jan 2024 07:40:36 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id u100-20020a25ab6d000000b00dc22fa579c5sm449632ybi.45.2024.01.26.07.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:33 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 03/10] sunrpc: pass in the sv_stats struct through svc_create_pooled Date: Fri, 26 Jan 2024 10:39:42 -0500 Message-ID: <46981944b88a5ac4b69b3e6664c4bef7fbb5b6ab.1706283433.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since only one service actually reports the rpc stats there's not much of a reason to have a pointer to it in the svc_program struct. Adjust the svc_create_pooled function to take the sv_stats as an argument and pass the struct through there as desired instead of getting it from the svc_program->pg_stats. Signed-off-by: Josef Bacik --- fs/nfsd/nfssvc.c | 3 ++- include/linux/sunrpc/svc.h | 4 ++-- net/sunrpc/svc.c | 12 +++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index a0b117107e86..d640f893021a 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -661,7 +661,8 @@ int nfsd_create_serv(struct net *net) if (nfsd_max_blksize == 0) nfsd_max_blksize = nfsd_get_default_max_blksize(); nfsd_reset_versions(nn); - serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize, nfsd); + serv = svc_create_pooled(&nfsd_program, &nfsd_svcstats, + nfsd_max_blksize, nfsd); if (serv == NULL) return -ENOMEM; diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 67cf1c9efd80..c8ba4f62264b 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -411,8 +411,8 @@ bool svc_rqst_replace_page(struct svc_rqst *rqstp, void svc_rqst_release_pages(struct svc_rqst *rqstp); void svc_rqst_free(struct svc_rqst *); void svc_exit_thread(struct svc_rqst *); -struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, - int (*threadfn)(void *data)); +struct svc_serv * svc_create_pooled(struct svc_program *, struct svc_stat *, + unsigned int, int (*threadfn)(void *data)); int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); int svc_pool_stats_open(struct svc_info *si, struct file *file); void svc_process(struct svc_rqst *rqstp); diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index d2e6f3d59218..9bd8a868c1a7 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -451,8 +451,8 @@ __svc_init_bc(struct svc_serv *serv) * Create an RPC service */ static struct svc_serv * -__svc_create(struct svc_program *prog, unsigned int bufsize, int npools, - int (*threadfn)(void *data)) +__svc_create(struct svc_program *prog, struct svc_stat *stats, + unsigned int bufsize, int npools, int (*threadfn)(void *data)) { struct svc_serv *serv; unsigned int vers; @@ -463,7 +463,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, return NULL; serv->sv_name = prog->pg_name; serv->sv_program = prog; - serv->sv_stats = prog->pg_stats; + serv->sv_stats = stats; if (bufsize > RPCSVC_MAXPAYLOAD) bufsize = RPCSVC_MAXPAYLOAD; serv->sv_max_payload = bufsize? bufsize : 4096; @@ -529,26 +529,28 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, struct svc_serv *svc_create(struct svc_program *prog, unsigned int bufsize, int (*threadfn)(void *data)) { - return __svc_create(prog, bufsize, 1, threadfn); + return __svc_create(prog, NULL, bufsize, 1, threadfn); } EXPORT_SYMBOL_GPL(svc_create); /** * svc_create_pooled - Create an RPC service with pooled threads * @prog: the RPC program the new service will handle + * @stats: the stats struct if desired * @bufsize: maximum message size for @prog * @threadfn: a function to service RPC requests for @prog * * Returns an instantiated struct svc_serv object or NULL. */ struct svc_serv *svc_create_pooled(struct svc_program *prog, + struct svc_stat *stats, unsigned int bufsize, int (*threadfn)(void *data)) { struct svc_serv *serv; unsigned int npools = svc_pool_map_get(); - serv = __svc_create(prog, bufsize, npools, threadfn); + serv = __svc_create(prog, stats, bufsize, npools, threadfn); if (!serv) goto out_err; return serv; From patchwork Fri Jan 26 15:39:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532838 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 261021CFB6 for ; Fri, 26 Jan 2024 15:40:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283641; cv=none; b=UEdbiiLtpO+3xmGb3Zfaqf/9X4bjmVMzv8s4qKfpi/WEVvCeEAXt6rkiBODYw9rYeusDKKH8ouzS9OmHukIJXHaEWz6yMhf6/wWFpZ0NhsiyZvjV959Wz4Y3y9PsQdGLxO5pJ4ZKvPBP1BW8h0bTy3mAzmIn5IbxX3owcXA6U9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283641; c=relaxed/simple; bh=cfGQYTEcOcYOsimoAP02J8VpT6Q0N1JoH1qCVeYrfgc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MRdisF9Suhq2vLo/l1m41MAf++04GEY3WlYbCJLvZr6hgSrn0h1TOmSXjhRNsimEmLC53pJxaL0QfDgT7MzdlWa2hs55cSfPAQ1SdkVKW74L7CITwBuCOJRmRs294SrQ6DWAjIKG80tsIpO+z6LIpiLl6KoAniTa6CRFdz+i3i0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=nP6Sa+EF; arc=none smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="nP6Sa+EF" Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-5ff9adbf216so3808377b3.1 for ; Fri, 26 Jan 2024 07:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283639; x=1706888439; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2MAcHvDL6/f4i0aRHxTU11GRORw8UkogLnsw3Sqy1e0=; b=nP6Sa+EFSy/y0lGIoJ+2f3FIbdCdgNNFjD7abj4iwpB0vRozvdGF34/A+fksVzUL7y 0yDDd3dVUiF/V9rNGx2K1U9h53PDQetMSfx1qMzSQ1JX8tLrZ14dS5+N1uiTdl14bOOX cbTj2kgw4TxsC/EA9gIhEuWUL0KEP2tvI8rmPOedQYqDtl/HTH98wUrUFA5nPo9yJYWM evQR3pHva+rtMqL/EpAar2V37FGfCS8aE24Rv6BDHzNno8Bjpx3tOoPUWwYPTY83EpiQ Q/Cx75ndtU+hxhwnBR/l0bbYyHa2VsTul0p/8ZE/LlfRPmbZjVb6avmgiwe0NoLzGyQi nNTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283639; x=1706888439; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2MAcHvDL6/f4i0aRHxTU11GRORw8UkogLnsw3Sqy1e0=; b=rqREnZi2M9TMyBx1mRNEho8kCsbpppV3dWZ+yuidzNJjNp1+lvR3Nt6lkPaUl5X5Po zy9D4T1MULe/VxKoFWjcPqBAi5wvsgBIfLO1B9nItFAEEWQ4YOrRqxa49ztRFkkV+jz4 izU1PdFvESE6hs7YzPLijqLls0MZ0kbr3iwvKfkSNdEurqc2roNmUnM+2hlzthY6rrkX OWzq/XTdXFPD5xeoJVpx/SVpIO28F0m6jkTMiftWN6ohFPIF8UIQ7If23CfNvye/GMny lNmC0Wg9Ox6iF9NDKqACB2xhBiDvjH2Hzq5DUOSrvuiLbsOpXOKDRSFyOvOsQ55zmOUY /pig== X-Gm-Message-State: AOJu0YwNIOIBOSbUcbVU8DbriCYTXmbFG5vyoOUm2FjlGm/TGJWhC24u TwKv9ct7JZYsX7ITMXQcKVFlp6KaKrBAjARpB26onkBN1k5rTXZFQsJv0+0s7r0= X-Google-Smtp-Source: AGHT+IEtfy72XnvA8FLZ1Sb9ZCo/XHsOL9e4mz3IMTkEI4U8Javag2z7c87kGYfzNLsLJDgHTaUtAQ== X-Received: by 2002:a81:8d0a:0:b0:5ff:d4c1:48f9 with SMTP id d10-20020a818d0a000000b005ffd4c148f9mr1711826ywg.0.1706283639128; Fri, 26 Jan 2024 07:40:39 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id cp29-20020a05690c0e1d00b005ff9dac3ff0sm449925ywb.56.2024.01.26.07.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:36 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 04/10] sunrpc: remove ->pg_stats from svc_program Date: Fri, 26 Jan 2024 10:39:43 -0500 Message-ID: <50a46da5d8ad5f9fc055864c17f90d6b14f4147d.1706283433.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that this isn't used anywhere, remove it. Signed-off-by: Josef Bacik --- fs/nfsd/nfssvc.c | 1 - include/linux/sunrpc/svc.h | 1 - 2 files changed, 2 deletions(-) diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index d640f893021a..d98a6abad990 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -127,7 +127,6 @@ struct svc_program nfsd_program = { .pg_vers = nfsd_version, /* version table */ .pg_name = "nfsd", /* program name */ .pg_class = "nfsd", /* authentication class */ - .pg_stats = &nfsd_svcstats, /* version table */ .pg_authenticate = &svc_set_client, /* export authentication */ .pg_init_request = nfsd_init_request, .pg_rpcbind_set = nfsd_rpcbind_set, diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index c8ba4f62264b..cb5950fe1435 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -339,7 +339,6 @@ struct svc_program { const struct svc_version **pg_vers; /* version array */ char * pg_name; /* service name */ char * pg_class; /* class name: services sharing authentication */ - struct svc_stat * pg_stats; /* rpc statistics */ enum svc_auth_status (*pg_authenticate)(struct svc_rqst *rqstp); __be32 (*pg_init_request)(struct svc_rqst *, const struct svc_program *, From patchwork Fri Jan 26 15:39:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532839 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78B9E1CFB6 for ; Fri, 26 Jan 2024 15:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283644; cv=none; b=ATBmHkcnt3j+ZQe9DRpcy2Q1PMWs0nhv6YE/7OqBczXzNqfQ+HIll1aeh0LenpN2Auf4ADS/7XxiLEDOulLF/QBd5sxWCLvwRpkkcF12uXUMCX/825xhO5kBCHFeQ0bXIE7Xk5WtVv2qC8hzx6pJedYQrNiFzFGFa2iKHnuYfYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283644; c=relaxed/simple; bh=oPo2HSHbqQg92hg+sIJI4A54+JArwH/DlZtupCaGy64=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZCAeZqmc52rr+YjvIKuYQl2jYjaBcVUWIsEV1SzijyzCXaeqJ0CidjWZOsVUjTnO4Ttu0WSxf9bNp6SH5YFRSEJrugk2hvsRRJ0I78/Mkd8a9PemOWwAKelzWsh8iUFWe4/cwVKzo35LXYOnnFdhPogpNW3VZZ3gR4k5GsFx+90= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=BMf3FeF8; arc=none smtp.client-ip=209.85.219.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="BMf3FeF8" Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-dbe344a6cf4so873043276.0 for ; Fri, 26 Jan 2024 07:40:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283642; x=1706888442; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=3IiehwB2G+Nt2uBxPih15JoYIXyWwYzVUYGRXkPDnck=; b=BMf3FeF8BIRTF8cC9Xi/RKcJMH0Ccr3borivlUMdk7slHVMqsA9MRom/t7chJkSBMn UqsPzuFGTlm+HeLc/veSLGdo4JOvIDaXaawQQ9nV1twwl79yjJdfH1O7+xyse5rbMZb+ tdam0a5lU1Ruc8GAqm8emLhEGbBzjvVo6gvspKZmxYuIkQbuCensNguV+oMEzzcJ9bl5 i8rmlGH8CIheBpz+sYXw8SyK6pr+y9zncWMhH+ncvRG5mjr2PhfxvD5wcGeG+8QD5JB1 boEuI7vj5b1WxOBGB1Hl0kLeKeYxQYY0uTUt41v/knxbEHrb2sXiihBEEsUFQEJwTa6N /4bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283642; x=1706888442; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3IiehwB2G+Nt2uBxPih15JoYIXyWwYzVUYGRXkPDnck=; b=qMZJdQX9GF+hAMjJbU71NQsjJY1ZCYp2dxi1uFIcdWmRL7nBbajmqjqDK9z+rqa+RN CdLyDsO7dMl2fKSAmiIoFrn8X5Y0mhZpec8E7BY/hZ4ikIc29uP4gSAogLc2yDobf1mz X2v+uZZuD9TEbe2Y/XoBc8OqiY6lyu3VhZs4EmKC3kqV8Izjnmki1IjfSjrAAu1O2opr PZO1HC/bEJFFOJ5d3/Wv96sRMxq+1Chd3Ch4KWnVZjmhgd5tv0mbPO851Z/g3nItsCUC BNZSBEzUjbIrMPpVLo47srcOXK2H+ImIS0xFHHOb3ZjpINylV/ZY7EWv/Vp4vpjBFaVJ yeHA== X-Gm-Message-State: AOJu0Ywwj7HxeD30dnVPIgBHH5UPpFICbnA1UyKCsCzU0aoPB9ARS3Z9 DfX6ohsoW0WVtGE9CBdmMAkUq99ZJCGdg/ru/eOH9Nw3/nE0evROiJpATsLlcFH2TafqTjUNIeU N X-Google-Smtp-Source: AGHT+IFarNr7Fk2rEromuik2neFZrPKx8pkWY4h9O5dOduaJ4P+k8LGNH0k8iu/cZOigYf7I98aehA== X-Received: by 2002:a25:ae8f:0:b0:dc2:4771:1521 with SMTP id b15-20020a25ae8f000000b00dc247711521mr18358ybj.111.1706283642538; Fri, 26 Jan 2024 07:40:42 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id t4-20020a25c304000000b00dc24f777255sm461252ybf.0.2024.01.26.07.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:40 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 05/10] sunrpc: use the struct net as the svc proc private Date: Fri, 26 Jan 2024 10:39:44 -0500 Message-ID: <85b93734ad64521b5543c4d0bf55d03f1983e6a9.1706283433.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 nfsd is the only thing using this helper, and it doesn't use the private currently. When we switch to per-network namespace stats we will need the struct net * in order to get to the nfsd_net. Use the net as the proc private so we can utilize this when we make the switch over. Signed-off-by: Josef Bacik --- net/sunrpc/stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 65fc1297c6df..383860cb1d5b 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -314,7 +314,7 @@ EXPORT_SYMBOL_GPL(rpc_proc_unregister); struct proc_dir_entry * svc_proc_register(struct net *net, struct svc_stat *statp, const struct proc_ops *proc_ops) { - return do_register(net, statp->program->pg_name, statp, proc_ops); + return do_register(net, statp->program->pg_name, net, proc_ops); } EXPORT_SYMBOL_GPL(svc_proc_register); From patchwork Fri Jan 26 15:39:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532840 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 800EA1CFAB for ; Fri, 26 Jan 2024 15:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283647; cv=none; b=HG96Qt8NJcrho0zTKMcTI7Yd+EJL+jx5EG46/sjJU2bh8oxa1e9xajY19uEWLCsamIlFnrTZG99N90DwQad9nJvjr2/KldPoa0C9Ih3UFqUQ84r4TSbMNan92SeZGiYEKarQBU50tU/GYKrvlY1VkU4iM5wjXZuZ9l5aSWNqSt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283647; c=relaxed/simple; bh=HYw7RJrKrn30ygP9WEHGLl9B1l9lIWNNnnl8a6T35kE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=enLxWVPI/D5AVLimB5igYw4/qb6Zm7YeHnVWlIfFaerFU//FkhsQyoNK34OlHFG+qblKIWxkSZ57Vhx/SZdTHGlilcc3iIejjHIlfMrAl7siz98QaV/wGC92colGDko5h3uh2/uFXzKADIyIiFLtAtQohIfF27qb/oamAZsFu1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=LdsqhbBR; arc=none smtp.client-ip=209.85.128.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="LdsqhbBR" Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-6000bbdbeceso5227827b3.2 for ; Fri, 26 Jan 2024 07:40:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283645; x=1706888445; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qhcT4LxscUNgYkzme87+B08aKhu2LGoP/3IfHmoLGzc=; b=LdsqhbBRNn1oom0KX5v/C/cdj83xBAkZT2z+d6vbiEq/03/twH95UyX/VrGlxDpejq ut1eln4qLrTDTeUOjE2l4Xzv+FirihGtoNcB2nsXjU8BNjT00lxVtFlqFxDnT7Zi0I0Y Foe5KDMylDOGNjmm8mqj5uFXCSedNSWMq3z8fICvAy/kcQOgahCqWVS2PySYmN3Knw27 iXllUSYSeVlr3niiNIsvmTvVoTfCMlR8naFsg661N69mSZJw2ypCoiCauLcoP52h4r1z iejgGflSGEOu/d1fxLnAtSJAwMNTiXrjyFbnYMfw4cugC766m+0GsuzqwYp5ipGUl7+A 1GnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283645; x=1706888445; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qhcT4LxscUNgYkzme87+B08aKhu2LGoP/3IfHmoLGzc=; b=AMiCLzaVpVhZJ+u5TELDyumNeSq6NPf1qM7U0zbYZzigGJv4izumt+8B0LaoB4feJY 59hBRcnIxvPK8EAybnJ45j2FsX7oIreoHUB72ryP0d8SW9hgavCQ3PQmQqrKXtBAmvm6 LuNTHyD8P2QHKwFn+gWz3hSR2DneJ5ns0HDcnkFG5V2geACLc692jkPBpG0oAuScPxvn 8oVTTEMddZnUcZ8uRX5pFgLYYI1BcGVCEj1qGBHsPimd+W7rwVTkp7lMLO4SKIxD/eXY Wk1Hpvrpx45qKxaqhK0YwbcyLMDMcBOwUUmAHn9haAgtZuZMij7Kny46ahEWEAHl8Lgo DEyw== X-Gm-Message-State: AOJu0Yztfgqx2VzW3r3A8JR+diJdrsARIxaqMKNWQNLdukJpYDcsB4+s JsqF68LyIbMWNETghXnPdn0KT4wB5gs91gCC/rGqDLY4lcSJq4hQyAVtD24iS4dnL8za3QF2wHA f X-Google-Smtp-Source: AGHT+IEOHWIu2u87Dod7bFY23DJfaz6Mw/6CqrJObtIP3GjL/qigOUdIX7UmUKCDDRaZrcvvvU9sMg== X-Received: by 2002:a81:af21:0:b0:5ff:73d8:216f with SMTP id n33-20020a81af21000000b005ff73d8216fmr1421887ywh.17.1706283645541; Fri, 26 Jan 2024 07:40:45 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id t16-20020a818310000000b005ff9b0ab578sm451630ywf.117.2024.01.26.07.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:43 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 06/10] nfsd: rename NFSD_NET_* to NFSD_STATS_* Date: Fri, 26 Jan 2024 10:39:45 -0500 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We're going to merge the stats all into per network namespace in subsequent patches, rename these nn counters to be consistent with the rest of the stats. Signed-off-by: Josef Bacik --- fs/nfsd/netns.h | 4 ++-- fs/nfsd/nfscache.c | 4 ++-- fs/nfsd/stats.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 74b4360779a1..e3605cb5f044 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -26,9 +26,9 @@ struct nfsd4_client_tracking_ops; enum { /* cache misses due only to checksum comparison failures */ - NFSD_NET_PAYLOAD_MISSES, + NFSD_STATS_PAYLOAD_MISSES, /* amount of memory (in bytes) currently consumed by the DRC */ - NFSD_NET_DRC_MEM_USAGE, + NFSD_STATS_DRC_MEM_USAGE, NFSD_NET_COUNTERS_NUM }; diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 5c1a4a0aa605..3d4a9d181c43 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -687,7 +687,7 @@ int nfsd_reply_cache_stats_show(struct seq_file *m, void *v) atomic_read(&nn->num_drc_entries)); seq_printf(m, "hash buckets: %u\n", 1 << nn->maskbits); seq_printf(m, "mem usage: %lld\n", - percpu_counter_sum_positive(&nn->counter[NFSD_NET_DRC_MEM_USAGE])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_DRC_MEM_USAGE])); seq_printf(m, "cache hits: %lld\n", percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_HITS])); seq_printf(m, "cache misses: %lld\n", @@ -695,7 +695,7 @@ int nfsd_reply_cache_stats_show(struct seq_file *m, void *v) seq_printf(m, "not cached: %lld\n", percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_NOCACHE])); seq_printf(m, "payload misses: %lld\n", - percpu_counter_sum_positive(&nn->counter[NFSD_NET_PAYLOAD_MISSES])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_PAYLOAD_MISSES])); seq_printf(m, "longest chain len: %u\n", nn->longest_chain); seq_printf(m, "cachesize at longest: %u\n", nn->longest_chain_cachesize); return 0; diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h index 14f50c660b61..7ed4325ac691 100644 --- a/fs/nfsd/stats.h +++ b/fs/nfsd/stats.h @@ -81,17 +81,17 @@ static inline void nfsd_stats_io_write_add(struct svc_export *exp, s64 amount) static inline void nfsd_stats_payload_misses_inc(struct nfsd_net *nn) { - percpu_counter_inc(&nn->counter[NFSD_NET_PAYLOAD_MISSES]); + percpu_counter_inc(&nn->counter[NFSD_STATS_PAYLOAD_MISSES]); } static inline void nfsd_stats_drc_mem_usage_add(struct nfsd_net *nn, s64 amount) { - percpu_counter_add(&nn->counter[NFSD_NET_DRC_MEM_USAGE], amount); + percpu_counter_add(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount); } static inline void nfsd_stats_drc_mem_usage_sub(struct nfsd_net *nn, s64 amount) { - percpu_counter_sub(&nn->counter[NFSD_NET_DRC_MEM_USAGE], amount); + percpu_counter_sub(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount); } #ifdef CONFIG_NFSD_V4 From patchwork Fri Jan 26 15:39:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532841 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84C3D1D540 for ; Fri, 26 Jan 2024 15:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283651; cv=none; b=bQ7qJVSa0Gb05hUnV0TQ7oRSu2ebV+25LsvXuNqTLnUkr70GNNapf9lPRY8rXEbEaWWPUUQk89OxA1eo4O364qdND7hSvlSsmsXBiQQcv7eyMFkz940Hzh07rWWI2JFLTrl0jYUj7j7U8aG6UD1qRemhT/Jj3AZ/0subHWuTFEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283651; c=relaxed/simple; bh=oIVFoPMvY5SGkisb2sELX+f9WkOpaBpUfRMWGj42rI0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YmYsv3J1Z3uu4meNaV5WfEndLtwxsJYhoEJe6Y+9/z6oLMy+341fajyClc/TQ+lZPLrUFURR7Cts0a7uTHYRL5jDYFR43BoYGa2SLHuoYl3pCngZDnRzOJN1PvgQFrckk15EyHmcJUpyAMvwdzOpoNiOiHLP/NfI6QZfx7hTPIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=J/C5iniv; arc=none smtp.client-ip=209.85.128.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="J/C5iniv" Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-5ffb07bed9bso4322727b3.0 for ; Fri, 26 Jan 2024 07:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283648; x=1706888448; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Lbwexu1bLugmUgDGM5YUyVtPA9AXcJlbApt7mNBJh0E=; b=J/C5inivo00YFjUosIbTiAG7VZqwls3PYHdZWsRWmr0AMfUJBd4tHWdMZuKwA9cH0g geNFQQMsK+OUSpStVw2znx3Wr3lPM13KDNt4E6HT7FfT4GaSSKPo/9JP4b9kSxbc9POK 6ikTNvLKYIrYfbDEPRe9Mtbngez+W3lVivBH7D0/psN+vwutCwEOHt0TZ67zM8uPm3oL UYZBC7cIFyEX62yR6WxtCkgJX7xaJYrTkfgIs29wtV2FLCmDse+Q30r8UNlIKVfiTIjT o7yNQ0+gmFh6iGEoGnEnkhBL5Q4JTSJBOUipTvF6M9lXpNuqySBiCQRfiqBT0ZUWf83l GyVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283648; x=1706888448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lbwexu1bLugmUgDGM5YUyVtPA9AXcJlbApt7mNBJh0E=; b=Wtv8MQB8sw0vpAGPEmfivaCCFXt8qRFdcoRhsnscKL3/oT5O/agQNUMHF5mV9vp+3s uiCIUBkRQAIklWd5+VXaTHZHAhloOwD4WjCWXa5EGhagsZ7hp9YJaudy/0HEkn6M6bUn 3vorDJnXhEi5YD8ZTLfbHGVFL0AJfKVnPyv3aggkQCUuOzEsz27pHBOijTT1X/C06c94 6j6WzjTUBR7AALdw56tlv7o6zQIjl6cXa8MtlUbleB87dlQB2+mlsp6oSelK1aAnLDAo R6Dc1YQTsYqznvIf5yVL5iF72GXzwDyx8OzFIg2TaKIl42YLvPuYOv8WQZzwC3S+y2mK CgBQ== X-Gm-Message-State: AOJu0YwmF2dIxsh0DAFWKiPP/XSxW9BAldNi++gcOs01tlDl3gOHVhlK OcGV5yGBc3GZxYM4I8gk/z1L/eQXvoi7olbgmKQq1et3Uws9hWvmigBCwPgEc1dbxHY5EpF8Cg8 f X-Google-Smtp-Source: AGHT+IGDu4xwCKMiV1ANSst2cbnHwe+SwEryEXv5okihV508/hDo0dizDeSRT4pLao24X0xsOR3f2w== X-Received: by 2002:a81:a888:0:b0:5ff:8484:9ceb with SMTP id f130-20020a81a888000000b005ff84849cebmr1190820ywh.0.1706283648540; Fri, 26 Jan 2024 07:40:48 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id fp3-20020a05690c34c300b005a7d46770f2sm445741ywb.83.2024.01.26.07.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:46 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 07/10] nfsd: expose /proc/net/sunrpc/nfsd in net namespaces Date: Fri, 26 Jan 2024 10:39:46 -0500 Message-ID: <61a1e6f96fe04204c5c9475f140d2d75b3251a77.1706283433.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We are running nfsd servers inside of containers with their own network namespace, and we want to monitor these services using the stats found in /proc. However these are not exposed in the proc inside of the container, so we have to bind mount the host /proc into our containers to get at this information. Separate out the stat counters init and the proc registration, and move the proc registration into the pernet operations entry and exit points so that these stats can be exposed inside of network namespaces. This is an intermediate step, this just exposes the global counters in the network namespace. Subsequent patches will move these counters into the per-network namespace container. Signed-off-by: Josef Bacik --- fs/nfsd/nfsctl.c | 8 +++++--- fs/nfsd/stats.c | 21 ++++++--------------- fs/nfsd/stats.h | 6 ++++-- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index f206ca32e7f5..b57480b50e35 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1679,6 +1679,7 @@ static __net_init int nfsd_net_init(struct net *net) nfsd4_init_leases_net(nn); get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key)); seqlock_init(&nn->writeverf_lock); + nfsd_proc_stat_init(net); return 0; @@ -1699,6 +1700,7 @@ static __net_exit void nfsd_net_exit(struct net *net) { struct nfsd_net *nn = net_generic(net, nfsd_net_id); + nfsd_proc_stat_shutdown(net); nfsd_net_reply_cache_destroy(nn); nfsd_idmap_shutdown(net); nfsd_export_shutdown(net); @@ -1722,7 +1724,7 @@ static int __init init_nfsd(void) retval = nfsd4_init_pnfs(); if (retval) goto out_free_slabs; - retval = nfsd_stat_init(); /* Statistics */ + retval = nfsd_stat_counters_init(); /* Statistics */ if (retval) goto out_free_pnfs; retval = nfsd_drc_slab_create(); @@ -1762,7 +1764,7 @@ static int __init init_nfsd(void) nfsd_lockd_shutdown(); nfsd_drc_slab_free(); out_free_stat: - nfsd_stat_shutdown(); + nfsd_stat_counters_destroy(); out_free_pnfs: nfsd4_exit_pnfs(); out_free_slabs: @@ -1780,7 +1782,7 @@ static void __exit exit_nfsd(void) nfsd_drc_slab_free(); remove_proc_entry("fs/nfs/exports", NULL); remove_proc_entry("fs/nfs", NULL); - nfsd_stat_shutdown(); + nfsd_stat_counters_destroy(); nfsd_lockd_shutdown(); nfsd4_free_slabs(); nfsd4_exit_pnfs(); diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index 12d79f5d4eb1..394a65a33942 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c @@ -108,31 +108,22 @@ void nfsd_percpu_counters_destroy(struct percpu_counter counters[], int num) percpu_counter_destroy(&counters[i]); } -static int nfsd_stat_counters_init(void) +int nfsd_stat_counters_init(void) { return nfsd_percpu_counters_init(nfsdstats.counter, NFSD_STATS_COUNTERS_NUM); } -static void nfsd_stat_counters_destroy(void) +void nfsd_stat_counters_destroy(void) { nfsd_percpu_counters_destroy(nfsdstats.counter, NFSD_STATS_COUNTERS_NUM); } -int nfsd_stat_init(void) +void nfsd_proc_stat_init(struct net *net) { - int err; - - err = nfsd_stat_counters_init(); - if (err) - return err; - - svc_proc_register(&init_net, &nfsd_svcstats, &nfsd_proc_ops); - - return 0; + svc_proc_register(net, &nfsd_svcstats, &nfsd_proc_ops); } -void nfsd_stat_shutdown(void) +void nfsd_proc_stat_shutdown(struct net *net) { - nfsd_stat_counters_destroy(); - svc_proc_unregister(&init_net, "nfsd"); + svc_proc_unregister(net, "nfsd"); } diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h index 7ed4325ac691..38811aa7d13e 100644 --- a/fs/nfsd/stats.h +++ b/fs/nfsd/stats.h @@ -40,8 +40,10 @@ extern struct svc_stat nfsd_svcstats; int nfsd_percpu_counters_init(struct percpu_counter *counters, int num); void nfsd_percpu_counters_reset(struct percpu_counter *counters, int num); void nfsd_percpu_counters_destroy(struct percpu_counter *counters, int num); -int nfsd_stat_init(void); -void nfsd_stat_shutdown(void); +int nfsd_stat_counters_init(void); +void nfsd_stat_counters_destroy(void); +void nfsd_proc_stat_init(struct net *net); +void nfsd_proc_stat_shutdown(struct net *net); static inline void nfsd_stats_rc_hits_inc(void) { From patchwork Fri Jan 26 15:39:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532842 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C63D61CFB5 for ; Fri, 26 Jan 2024 15:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283654; cv=none; b=tMCoKb4R0/+nt2Mox0wXd2h/Pdx6AKheYeg568KG/5tE2kDJLyR8O2vIN1aE8jceUqBWRFtBVExZVWCTfAv4Wg+IR3CUm3FIPF5C0s46X1InnoYBPccJaZAUFLiDKXH5Pw6S4XyLM3XEaC3Gw9u1ud4D2TX+OOjqx42QTRL+qJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283654; c=relaxed/simple; bh=kH4C69gXhYzpUQZNXdH8fdQsSdqyLfCEoP54BXBFA0U=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mCT9V53aXuO78FjBBcJgDkvPCcSI9/xesXXyOGXfaXfth+mazOz3ITmGO+2Id+hG1Wosnn2dOwh04xlm7D+fvQs4Hk4G+FNB8cAyrLx8ytYGhqTrVlkckkVA3XxG1SEoTnHhOyfXehUXu1X8pTpM5JTuPpgeqfWe1v2LpvRQDZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=KVbJ2xHd; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="KVbJ2xHd" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-6029e069e08so11121207b3.0 for ; Fri, 26 Jan 2024 07:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283652; x=1706888452; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pPYWgezIyTTIaXhRwEKknhgUQv07nyNgQ9eiW6X1xO4=; b=KVbJ2xHdIR0fAVAZf0caCn4xVDxd020DJa/3wNdzwdbyw54rSmoq3SL1Ud0/CN1pPJ vpTOk1sr26FWloL7OIJu1gJFUmjhiNulxnPALJjvNaRa2UUWWEXXZcIyF/U5RTAXszuG F6VAj7Oua/+6gkQ2MdleLSpEMIrtFGwwFKG/yZrSSMr0a/mJgDoV0DxDuquPy/Hqy7Y/ +Vec+NjIvRwird4G9JWob8yP5az8fDIROZ2UqtD5JYzExaGbWkmLB7vuZX8yR3+iUZ0Q LKMguO27JP6L/OuoKzyY7z/+zX1dWnfsVzjavcKpxg+4c4fZ5j1y4AJlx7bD6F50gQ0k kPOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283652; x=1706888452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pPYWgezIyTTIaXhRwEKknhgUQv07nyNgQ9eiW6X1xO4=; b=wNrqYSo+oHtyLdoMzkpFup67RkQVevMB/+ke59dKmHHkUPsUkmcdRl6RJT91J/3ieF IrBOFMddpkImNK3IxC/kSywAdxQPuBKg425NYHGaVGjmC159JeMS3LemciFK/8kjdJvF SSsduyRFIE2Nr3kvkcbLEBqSt/hZE0YSUZUzyes47QQt2sN+0y6S1/dXZ/kKN+WJ1bmM veA53Mn/Kdboh5LTBXzS3KZbWc8YKdHVr2iP2t0CrhElr1UiuRekr6ys/Mfw+ww+1/RJ ob8WCaOWuh0qp65FRNddq4ELNdxKM/L6OYY5GZoXDUe6i0D+DCPaZZjEgeZRzufott7U a0ug== X-Gm-Message-State: AOJu0YxTWXVV51CuGdPgr5dYwnNFo/GycKslXltZVc8xf4BakeJNWkBD 9apRYXfvVVSQstjukZtL4z6MPlHil/JoO1yK1UmeicOEkWQ4LxWwVp7XsbYn0kjqvZwOS7smgpU v X-Google-Smtp-Source: AGHT+IFdjQh+x5O2qdxhv9puWZ2c1OM64KYT75MJA5Q8ezSTh6e+mrk8UdAJ9cmNaJg1GlSi83DoUQ== X-Received: by 2002:a0d:dd93:0:b0:5ed:7d36:7963 with SMTP id g141-20020a0ddd93000000b005ed7d367963mr1502532ywe.6.1706283651646; Fri, 26 Jan 2024 07:40:51 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id fq5-20020a05690c350500b005ff7e023754sm448747ywb.55.2024.01.26.07.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:49 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 08/10] nfsd: make all of the nfsd stats per-network namespace Date: Fri, 26 Jan 2024 10:39:47 -0500 Message-ID: <5aa4d36f6993637bff99a0c487521a00a9048243.1706283433.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We have a global set of counters that we modify for all of the nfsd operations, but now that we're exposing these stats across all network namespaces we need to make the stats also be per-network namespace. We already have some caching stats that are per-network namespace, so move these definitions into the same counter and then adjust all the helpers and users of these stats to provide the appropriate nfsd_net struct so that the stats are maintained for the per-network namespace objects. Signed-off-by: Josef Bacik --- fs/nfsd/cache.h | 2 -- fs/nfsd/netns.h | 17 ++++++++++++-- fs/nfsd/nfs4proc.c | 6 ++--- fs/nfsd/nfs4state.c | 3 ++- fs/nfsd/nfscache.c | 36 ++++++------------------------ fs/nfsd/nfsctl.c | 12 +++------- fs/nfsd/nfsfh.c | 3 ++- fs/nfsd/stats.c | 26 ++++++++++++---------- fs/nfsd/stats.h | 54 ++++++++++++++++----------------------------- fs/nfsd/vfs.c | 5 +++-- 10 files changed, 68 insertions(+), 96 deletions(-) diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h index 4cbe0434cbb8..66a05fefae98 100644 --- a/fs/nfsd/cache.h +++ b/fs/nfsd/cache.h @@ -80,8 +80,6 @@ enum { int nfsd_drc_slab_create(void); void nfsd_drc_slab_free(void); -int nfsd_net_reply_cache_init(struct nfsd_net *nn); -void nfsd_net_reply_cache_destroy(struct nfsd_net *nn); int nfsd_reply_cache_init(struct nfsd_net *); void nfsd_reply_cache_shutdown(struct nfsd_net *); int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index e3605cb5f044..0cef4bb407a9 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,19 @@ enum { NFSD_STATS_PAYLOAD_MISSES, /* amount of memory (in bytes) currently consumed by the DRC */ NFSD_STATS_DRC_MEM_USAGE, - NFSD_NET_COUNTERS_NUM + NFSD_STATS_RC_HITS, /* repcache hits */ + NFSD_STATS_RC_MISSES, /* repcache misses */ + NFSD_STATS_RC_NOCACHE, /* uncached reqs */ + NFSD_STATS_FH_STALE, /* FH stale error */ + NFSD_STATS_IO_READ, /* bytes returned to read requests */ + NFSD_STATS_IO_WRITE, /* bytes passed in write requests */ +#ifdef CONFIG_NFSD_V4 + NFSD_STATS_FIRST_NFS4_OP, /* count of individual nfsv4 operations */ + NFSD_STATS_LAST_NFS4_OP = NFSD_STATS_FIRST_NFS4_OP + LAST_NFS4_OP, +#define NFSD_STATS_NFS4_OP(op) (NFSD_STATS_FIRST_NFS4_OP + (op)) + NFSD_STATS_WDELEG_GETATTR, /* count of getattr conflict with wdeleg */ +#endif + NFSD_STATS_COUNTERS_NUM }; /* @@ -164,7 +177,7 @@ struct nfsd_net { atomic_t num_drc_entries; /* Per-netns stats counters */ - struct percpu_counter counter[NFSD_NET_COUNTERS_NUM]; + struct percpu_counter counter[NFSD_STATS_COUNTERS_NUM]; /* longest hash chain seen */ unsigned int longest_chain; diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 14712fa08f76..648ff427005e 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -2490,10 +2490,10 @@ nfsd4_proc_null(struct svc_rqst *rqstp) return rpc_success; } -static inline void nfsd4_increment_op_stats(u32 opnum) +static inline void nfsd4_increment_op_stats(struct nfsd_net *nn, u32 opnum) { if (opnum >= FIRST_NFS4_OP && opnum <= LAST_NFS4_OP) - percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_NFS4_OP(opnum)]); + percpu_counter_inc(&nn->counter[NFSD_STATS_NFS4_OP(opnum)]); } static const struct nfsd4_operation nfsd4_ops[]; @@ -2768,7 +2768,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) status, nfsd4_op_name(op->opnum)); nfsd4_cstate_clear_replay(cstate); - nfsd4_increment_op_stats(op->opnum); + nfsd4_increment_op_stats(nn, op->opnum); } fh_put(current_fh); diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index fbf8b426950e..83c260ab485d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -8457,6 +8457,7 @@ __be32 nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode) { __be32 status; + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); struct file_lock_context *ctx; struct file_lock *fl; struct nfs4_delegation *dp; @@ -8486,7 +8487,7 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode) } break_lease: spin_unlock(&ctx->flc_lock); - nfsd_stats_wdeleg_getattr_inc(); + nfsd_stats_wdeleg_getattr_inc(nn); status = nfserrno(nfsd_open_break_lease(inode, NFSD_MAY_READ)); if (status != nfserr_jukebox || !nfsd_wait_for_delegreturn(rqstp, inode)) diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 3d4a9d181c43..cfcc6ac8f255 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -176,27 +176,6 @@ void nfsd_drc_slab_free(void) kmem_cache_destroy(drc_slab); } -/** - * nfsd_net_reply_cache_init - per net namespace reply cache set-up - * @nn: nfsd_net being initialized - * - * Returns zero on succes; otherwise a negative errno is returned. - */ -int nfsd_net_reply_cache_init(struct nfsd_net *nn) -{ - return nfsd_percpu_counters_init(nn->counter, NFSD_NET_COUNTERS_NUM); -} - -/** - * nfsd_net_reply_cache_destroy - per net namespace reply cache tear-down - * @nn: nfsd_net being freed - * - */ -void nfsd_net_reply_cache_destroy(struct nfsd_net *nn) -{ - nfsd_percpu_counters_destroy(nn->counter, NFSD_NET_COUNTERS_NUM); -} - int nfsd_reply_cache_init(struct nfsd_net *nn) { unsigned int hashsize; @@ -501,7 +480,7 @@ nfsd_cache_insert(struct nfsd_drc_bucket *b, struct nfsd_cacherep *key, int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, unsigned int len, struct nfsd_cacherep **cacherep) { - struct nfsd_net *nn; + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); struct nfsd_cacherep *rp, *found; __wsum csum; struct nfsd_drc_bucket *b; @@ -510,7 +489,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, int rtn = RC_DOIT; if (type == RC_NOCACHE) { - nfsd_stats_rc_nocache_inc(); + nfsd_stats_rc_nocache_inc(nn); goto out; } @@ -520,7 +499,6 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, * Since the common case is a cache miss followed by an insert, * preallocate an entry. */ - nn = net_generic(SVC_NET(rqstp), nfsd_net_id); rp = nfsd_cacherep_alloc(rqstp, csum, nn); if (!rp) goto out; @@ -537,7 +515,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, nfsd_cacherep_dispose(&dispose); - nfsd_stats_rc_misses_inc(); + nfsd_stats_rc_misses_inc(nn); atomic_inc(&nn->num_drc_entries); nfsd_stats_drc_mem_usage_add(nn, sizeof(*rp)); goto out; @@ -545,7 +523,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, found_entry: /* We found a matching entry which is either in progress or done. */ nfsd_reply_cache_free_locked(NULL, rp, nn); - nfsd_stats_rc_hits_inc(); + nfsd_stats_rc_hits_inc(nn); rtn = RC_DROPIT; rp = found; @@ -689,11 +667,11 @@ int nfsd_reply_cache_stats_show(struct seq_file *m, void *v) seq_printf(m, "mem usage: %lld\n", percpu_counter_sum_positive(&nn->counter[NFSD_STATS_DRC_MEM_USAGE])); seq_printf(m, "cache hits: %lld\n", - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_HITS])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_HITS])); seq_printf(m, "cache misses: %lld\n", - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_MISSES])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_MISSES])); seq_printf(m, "not cached: %lld\n", - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_NOCACHE])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_NOCACHE])); seq_printf(m, "payload misses: %lld\n", percpu_counter_sum_positive(&nn->counter[NFSD_STATS_PAYLOAD_MISSES])); seq_printf(m, "longest chain len: %u\n", nn->longest_chain); diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index b57480b50e35..ea3c8114245c 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1671,7 +1671,7 @@ static __net_init int nfsd_net_init(struct net *net) retval = nfsd_idmap_init(net); if (retval) goto out_idmap_error; - retval = nfsd_net_reply_cache_init(nn); + retval = nfsd_stat_counters_init(nn); if (retval) goto out_repcache_error; nn->nfsd_versions = NULL; @@ -1701,7 +1701,7 @@ static __net_exit void nfsd_net_exit(struct net *net) struct nfsd_net *nn = net_generic(net, nfsd_net_id); nfsd_proc_stat_shutdown(net); - nfsd_net_reply_cache_destroy(nn); + nfsd_stat_counters_destroy(nn); nfsd_idmap_shutdown(net); nfsd_export_shutdown(net); nfsd_netns_free_versions(nn); @@ -1724,12 +1724,9 @@ static int __init init_nfsd(void) retval = nfsd4_init_pnfs(); if (retval) goto out_free_slabs; - retval = nfsd_stat_counters_init(); /* Statistics */ - if (retval) - goto out_free_pnfs; retval = nfsd_drc_slab_create(); if (retval) - goto out_free_stat; + goto out_free_pnfs; nfsd_lockd_init(); /* lockd->nfsd callbacks */ retval = create_proc_exports_entry(); if (retval) @@ -1763,8 +1760,6 @@ static int __init init_nfsd(void) out_free_lockd: nfsd_lockd_shutdown(); nfsd_drc_slab_free(); -out_free_stat: - nfsd_stat_counters_destroy(); out_free_pnfs: nfsd4_exit_pnfs(); out_free_slabs: @@ -1782,7 +1777,6 @@ static void __exit exit_nfsd(void) nfsd_drc_slab_free(); remove_proc_entry("fs/nfs/exports", NULL); remove_proc_entry("fs/nfs", NULL); - nfsd_stat_counters_destroy(); nfsd_lockd_shutdown(); nfsd4_free_slabs(); nfsd4_exit_pnfs(); diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index dbfa0ac13564..40fecf7b224f 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -327,6 +327,7 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp) __be32 fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access) { + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); struct svc_export *exp = NULL; struct dentry *dentry; __be32 error; @@ -395,7 +396,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access) out: trace_nfsd_fh_verify_err(rqstp, fhp, type, access, error); if (error == nfserr_stale) - nfsd_stats_fh_stale_inc(exp); + nfsd_stats_fh_stale_inc(nn, exp); return error; } diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index 394a65a33942..44e275324b06 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c @@ -34,15 +34,17 @@ struct svc_stat nfsd_svcstats = { static int nfsd_show(struct seq_file *seq, void *v) { + struct net *net = pde_data(file_inode(seq->file)); + struct nfsd_net *nn = net_generic(net, nfsd_net_id); int i; seq_printf(seq, "rc %lld %lld %lld\nfh %lld 0 0 0 0\nio %lld %lld\n", - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_HITS]), - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_MISSES]), - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_NOCACHE]), - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_FH_STALE]), - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_IO_READ]), - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_IO_WRITE])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_HITS]), + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_MISSES]), + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_NOCACHE]), + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_FH_STALE]), + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_READ]), + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_WRITE])); /* thread usage: */ seq_printf(seq, "th %u 0", atomic_read(&nfsdstats.th_cnt)); @@ -63,10 +65,10 @@ static int nfsd_show(struct seq_file *seq, void *v) seq_printf(seq, "proc4ops %u", LAST_NFS4_OP + 1); for (i = 0; i <= LAST_NFS4_OP; i++) { seq_printf(seq, " %lld", - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_NFS4_OP(i)])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_NFS4_OP(i)])); } seq_printf(seq, "\nwdeleg_getattr %lld", - percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_WDELEG_GETATTR])); + percpu_counter_sum_positive(&nn->counter[NFSD_STATS_WDELEG_GETATTR])); seq_putc(seq, '\n'); #endif @@ -108,14 +110,14 @@ void nfsd_percpu_counters_destroy(struct percpu_counter counters[], int num) percpu_counter_destroy(&counters[i]); } -int nfsd_stat_counters_init(void) +int nfsd_stat_counters_init(struct nfsd_net *nn) { - return nfsd_percpu_counters_init(nfsdstats.counter, NFSD_STATS_COUNTERS_NUM); + return nfsd_percpu_counters_init(nn->counter, NFSD_STATS_COUNTERS_NUM); } -void nfsd_stat_counters_destroy(void) +void nfsd_stat_counters_destroy(struct nfsd_net *nn) { - nfsd_percpu_counters_destroy(nfsdstats.counter, NFSD_STATS_COUNTERS_NUM); + nfsd_percpu_counters_destroy(nn->counter, NFSD_STATS_COUNTERS_NUM); } void nfsd_proc_stat_init(struct net *net) diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h index 38811aa7d13e..c24be4ddbe7d 100644 --- a/fs/nfsd/stats.h +++ b/fs/nfsd/stats.h @@ -10,26 +10,7 @@ #include #include - -enum { - NFSD_STATS_RC_HITS, /* repcache hits */ - NFSD_STATS_RC_MISSES, /* repcache misses */ - NFSD_STATS_RC_NOCACHE, /* uncached reqs */ - NFSD_STATS_FH_STALE, /* FH stale error */ - NFSD_STATS_IO_READ, /* bytes returned to read requests */ - NFSD_STATS_IO_WRITE, /* bytes passed in write requests */ -#ifdef CONFIG_NFSD_V4 - NFSD_STATS_FIRST_NFS4_OP, /* count of individual nfsv4 operations */ - NFSD_STATS_LAST_NFS4_OP = NFSD_STATS_FIRST_NFS4_OP + LAST_NFS4_OP, -#define NFSD_STATS_NFS4_OP(op) (NFSD_STATS_FIRST_NFS4_OP + (op)) - NFSD_STATS_WDELEG_GETATTR, /* count of getattr conflict with wdeleg */ -#endif - NFSD_STATS_COUNTERS_NUM -}; - struct nfsd_stats { - struct percpu_counter counter[NFSD_STATS_COUNTERS_NUM]; - atomic_t th_cnt; /* number of available threads */ }; @@ -40,43 +21,46 @@ extern struct svc_stat nfsd_svcstats; int nfsd_percpu_counters_init(struct percpu_counter *counters, int num); void nfsd_percpu_counters_reset(struct percpu_counter *counters, int num); void nfsd_percpu_counters_destroy(struct percpu_counter *counters, int num); -int nfsd_stat_counters_init(void); -void nfsd_stat_counters_destroy(void); +int nfsd_stat_counters_init(struct nfsd_net *nn); +void nfsd_stat_counters_destroy(struct nfsd_net *nn); void nfsd_proc_stat_init(struct net *net); void nfsd_proc_stat_shutdown(struct net *net); -static inline void nfsd_stats_rc_hits_inc(void) +static inline void nfsd_stats_rc_hits_inc(struct nfsd_net *nn) { - percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_RC_HITS]); + percpu_counter_inc(&nn->counter[NFSD_STATS_RC_HITS]); } -static inline void nfsd_stats_rc_misses_inc(void) +static inline void nfsd_stats_rc_misses_inc(struct nfsd_net *nn) { - percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_RC_MISSES]); + percpu_counter_inc(&nn->counter[NFSD_STATS_RC_MISSES]); } -static inline void nfsd_stats_rc_nocache_inc(void) +static inline void nfsd_stats_rc_nocache_inc(struct nfsd_net *nn) { - percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_RC_NOCACHE]); + percpu_counter_inc(&nn->counter[NFSD_STATS_RC_NOCACHE]); } -static inline void nfsd_stats_fh_stale_inc(struct svc_export *exp) +static inline void nfsd_stats_fh_stale_inc(struct nfsd_net *nn, + struct svc_export *exp) { - percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_FH_STALE]); + percpu_counter_inc(&nn->counter[NFSD_STATS_FH_STALE]); if (exp && exp->ex_stats) percpu_counter_inc(&exp->ex_stats->counter[EXP_STATS_FH_STALE]); } -static inline void nfsd_stats_io_read_add(struct svc_export *exp, s64 amount) +static inline void nfsd_stats_io_read_add(struct nfsd_net *nn, + struct svc_export *exp, s64 amount) { - percpu_counter_add(&nfsdstats.counter[NFSD_STATS_IO_READ], amount); + percpu_counter_add(&nn->counter[NFSD_STATS_IO_READ], amount); if (exp && exp->ex_stats) percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_READ], amount); } -static inline void nfsd_stats_io_write_add(struct svc_export *exp, s64 amount) +static inline void nfsd_stats_io_write_add(struct nfsd_net *nn, + struct svc_export *exp, s64 amount) { - percpu_counter_add(&nfsdstats.counter[NFSD_STATS_IO_WRITE], amount); + percpu_counter_add(&nn->counter[NFSD_STATS_IO_WRITE], amount); if (exp && exp->ex_stats) percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_WRITE], amount); } @@ -97,9 +81,9 @@ static inline void nfsd_stats_drc_mem_usage_sub(struct nfsd_net *nn, s64 amount) } #ifdef CONFIG_NFSD_V4 -static inline void nfsd_stats_wdeleg_getattr_inc(void) +static inline void nfsd_stats_wdeleg_getattr_inc(struct nfsd_net *nn) { - percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_WDELEG_GETATTR]); + percpu_counter_inc(&nn->counter[NFSD_STATS_WDELEG_GETATTR]); } #endif #endif /* _NFSD_STATS_H */ diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index f57749cd6f0b..33af4bc7f423 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1002,7 +1002,8 @@ static __be32 nfsd_finish_read(struct svc_rqst *rqstp, struct svc_fh *fhp, unsigned long *count, u32 *eof, ssize_t host_err) { if (host_err >= 0) { - nfsd_stats_io_read_add(fhp->fh_export, host_err); + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); + nfsd_stats_io_read_add(nn, fhp->fh_export, host_err); *eof = nfsd_eof_on_read(file, offset, host_err, *count); *count = host_err; fsnotify_access(file); @@ -1185,7 +1186,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf, goto out_nfserr; } *cnt = host_err; - nfsd_stats_io_write_add(exp, *cnt); + nfsd_stats_io_write_add(nn, exp, *cnt); fsnotify_modify(file); host_err = filemap_check_wb_err(file->f_mapping, since); if (host_err < 0) From patchwork Fri Jan 26 15:39:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532844 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FDA91D524 for ; Fri, 26 Jan 2024 15:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283662; cv=none; b=etnbAQco57w/BlKjK3Nyjhoa1wc6Kex4CK0SccQhgPs4Uo7hR+F9WubfrVC3t8UtDua6us9UJ7Kpx3hF7giBsRSyOyCmI3imp4Zm7uQ3NHrZaliWcrDZKeuQA9ETit0cK+g6pBPePSTMspMMSIWrzsRE3B1kNAjDLXn5qNRtFb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283662; c=relaxed/simple; bh=XVUiwQC+0YilvbaR+oiwWjwFj6Pyk15nYvK4RhtdrCU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GAxoKcdY5FtPzT+kufTJwnKPIBTIS/Y1t3JWKJcQQM+Hk79FCXqGvmbCLwCICP92ErKDYZxaCW0eHKCPLv2R8V7afbblVlufsc2SpcrIkzTdDAJvi+NGW4DsnSXms2gGUogmmI9bqaAXKS0fbCOTMmyLnlGSeiJbPBKIoPr0lD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=i5cTa61D; arc=none smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="i5cTa61D" Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-6029e069e08so11122957b3.0 for ; Fri, 26 Jan 2024 07:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283659; x=1706888459; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ma8D8+vSeMOLIk2YLj9dZoxswjw1aUIA8yxKLapIACg=; b=i5cTa61DXYAed7BgMmdFRB1DXwj/rG7qSRUpnsZKw8uCdzcTM2EbkPzGupEnYcNBTK Sm7VO7eVYXzrVsULkoJBFj9h75C2B3CGNo2Np9gVA0k89IT6gDBakVs8+xTqeSI1mNG2 ZVjF79yasGcAXpQxLZ1a0AmvFfygVc/TUQg6qy2VA1c8FUrRaHJQvEDxCPIIIV2J85Cz QDsVpyNddp0KbDVECkyE23Ky+j3YdIq/UMQZvlcFwF7haagT71prFSH/FxbpEbttrATO VUDsw9+yVgHqOwvOBvlzPshn6pRrY9H3JzLKGmtGAJWbivTJMggZTtVwJaKpt7cOQAGD bjSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283659; x=1706888459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ma8D8+vSeMOLIk2YLj9dZoxswjw1aUIA8yxKLapIACg=; b=Cp3/pDyc4qpO33a9PEhjhX0yukmo+9KJBHP/GmSnbCNh+uWkzQepAjz6TRNVcrxfO7 lzEMAq5itPnwAjMPL1fbagSTewSINkbtXEkG0qpuyna63obK5qRJpOUct0s/esI6WJND jztJa0KFEqcZvEetWi7pYg5OBOC40TlXB9AZ8g9JpQ/IcrxDgmsQFA9gegqMxN6t/z14 Uj6q8ciMJtoXDzVhXw8GLlvF9v+jIZFZfOBVlHGUttGzIepYLKeR/OR+1BJLoZkLDDgZ 83CTuKgk/hVUbmU7N0+nA4OZt8NnxNC5F2Ng/Q/3fLOV9PjhrTb5TTy3vAB+H3TARTXy rUVA== X-Gm-Message-State: AOJu0YxPYOGz3U9c0cFlZ1owVtbZ2zONRARUGITsv1gH4nzX36742U9D nFqt5QTRI8Y2ChQHXGhR4ggdeuFq0IgpBFPRgpuT7o5EW2mOR+xIHMksTMl0rIs= X-Google-Smtp-Source: AGHT+IHbG4jjEAhM9YPHNuTXTmG7pBvkCuYhVy0aQ8q481jiRSn2kxIZ7asgvNJaZ1LNdmVMAbStGA== X-Received: by 2002:a0d:ca8f:0:b0:5ff:afe5:2515 with SMTP id m137-20020a0dca8f000000b005ffafe52515mr1388025ywd.82.1706283654680; Fri, 26 Jan 2024 07:40:54 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id g81-20020a0ddd54000000b005ff7cda85c5sm451946ywe.69.2024.01.26.07.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:52 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 09/10] nfsd: remove nfsd_stats, make th_cnt a global counter Date: Fri, 26 Jan 2024 10:39:48 -0500 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is the last global stat, take it out of the nfsd_stats struct and make it a global part of nfsd, report it the same as always. Signed-off-by: Josef Bacik --- fs/nfsd/nfsd.h | 1 + fs/nfsd/nfssvc.c | 5 +++-- fs/nfsd/stats.c | 3 +-- fs/nfsd/stats.h | 6 ------ 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 304e9728b929..be2ea3d6d2a2 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -86,6 +86,7 @@ extern struct mutex nfsd_mutex; extern spinlock_t nfsd_drc_lock; extern unsigned long nfsd_drc_max_mem; extern unsigned long nfsd_drc_mem_used; +extern atomic_t nfsd_th_cnt; /* number of available threads */ extern const struct seq_operations nfs_exports_op; diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index d98a6abad990..fdb591896430 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -34,6 +34,7 @@ #define NFSDDBG_FACILITY NFSDDBG_SVC +atomic_t nfsd_th_cnt = ATOMIC_INIT(0); extern struct svc_program nfsd_program; static int nfsd(void *vrqstp); #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) @@ -924,7 +925,7 @@ nfsd(void *vrqstp) current->fs->umask = 0; - atomic_inc(&nfsdstats.th_cnt); + atomic_inc(&nfsd_th_cnt); set_freezable(); @@ -940,7 +941,7 @@ nfsd(void *vrqstp) nfsd_file_net_dispose(nn); } - atomic_dec(&nfsdstats.th_cnt); + atomic_dec(&nfsd_th_cnt); out: /* Release the thread */ diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index 44e275324b06..3a7f791c3052 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c @@ -27,7 +27,6 @@ #include "nfsd.h" -struct nfsd_stats nfsdstats; struct svc_stat nfsd_svcstats = { .program = &nfsd_program, }; @@ -47,7 +46,7 @@ static int nfsd_show(struct seq_file *seq, void *v) percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_WRITE])); /* thread usage: */ - seq_printf(seq, "th %u 0", atomic_read(&nfsdstats.th_cnt)); + seq_printf(seq, "th %u 0", atomic_read(&nfsd_th_cnt)); /* deprecated thread usage histogram stats */ for (i = 0; i < 10; i++) diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h index c24be4ddbe7d..5675d283a537 100644 --- a/fs/nfsd/stats.h +++ b/fs/nfsd/stats.h @@ -10,12 +10,6 @@ #include #include -struct nfsd_stats { - atomic_t th_cnt; /* number of available threads */ -}; - -extern struct nfsd_stats nfsdstats; - extern struct svc_stat nfsd_svcstats; int nfsd_percpu_counters_init(struct percpu_counter *counters, int num); From patchwork Fri Jan 26 15:39:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13532843 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C80111CFBF for ; Fri, 26 Jan 2024 15:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283660; cv=none; b=ouYMg+q3aQJOvm2Fy56DxJpAyjghkLi/GV0RpUbg67EGT6yDKS86bFW43HkEEpZV5D1LJN/kZu9PaR9J6N6a/R5WbkWDZhS0DA3hme1CYmE2061XpkyxA4zC8FVjYbpkJceNojS3q8kYLUEdMmN9LLODiPtwkuw2/+Nksf3mnc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706283660; c=relaxed/simple; bh=35jsdxf8lwzU36VgGl//nJgt1RwsHszFXySzzFXvlUk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HlPb82bMorV6fqYE6hooNDLMlDA7JjoeydKatpnVaWptE1PwbZX3eztw8H1lIijYDfKIcGSMdIYvdVMwivQbIMhAYyOByE5qwmC3Rd51gQ1XV/Gd0csu7PXEM0mHK90LMUgaoqcdo8VvdFC/MzVrVqQC8i30nAcVYGK+vG/+jbA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=HPnCP5NH; arc=none smtp.client-ip=209.85.128.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="HPnCP5NH" Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-602d222c078so4488247b3.0 for ; Fri, 26 Jan 2024 07:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1706283658; x=1706888458; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=L9HH43wDjRvJ0WXW6QamUAjH4CWIkZZgYv2Lp+qh0h0=; b=HPnCP5NHtzHPRCR1bNiGq0IsU3o1PQOr2QstE8G9/37j8YkMLzujk1pe7jRqQvR/LO QjY8sArTYhzffL5Z/ocvtD9DGYutJqXKF1hSGh0sZz5g6+1ayd5+fMS0O6PLdEo5vIF1 QPSx0dtxoS7SFIUy7vevIxPEs8Cu5UdFk+tcd3FUKdUbBWdyP0UZ4iR8k2XRg4KMOuOc ecSEZNLxMk2L5vn/2joEGWw7GRVjaKwUn+GEpK/TkpwXIzQL9qAEvI+AvqqtlRU9zRz+ MSRJ4s1CJLljlDlv8VsS6UKRqbb0V1jCOmN4rJCXuy02zvHj2I1kGrO6KeM4F7ynyAOF Zvpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706283658; x=1706888458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L9HH43wDjRvJ0WXW6QamUAjH4CWIkZZgYv2Lp+qh0h0=; b=FqWYavGxHf1Wyd+TN0YMF5eEsltjFrHJft2f5L7/mCiemyMJ46+SpfoEU1+L2qvwOY 0WIsgOyx1577iKVX4pfZ41UBBk3YFGSTnHGU06Nqqc5rr4kVN7rsUFC/y6VOn12roWI0 lVoZax1jJkZmOmvj39Zvxj+R7i1kERMxQ50jpG5biP6sdFiV8pfI/VHkTxPB6ZIE2f5N NWM4RyLh+5K7i9kyCenUz5YC2hVFf/WtVHdPN4oiftqWJxdifs/dUPBSwdSYi/6Kymoo +qD+ROycWj28ItLzHV8FZWYrrHJnPiz4r9TSb82kBiPixyUFOi3xOLEKD7zkurctw+Hv WkWQ== X-Gm-Message-State: AOJu0YxijiaEzfxi/0F91W7fOPo4b98amcdaXOrDMcaMUwVsCfgoLNF/ UA0uW1f6UR7Xnswv2WjHLl5qrnS8jROMzlTPPBPmMzC2dZePcnsYo9prZqXJEeU= X-Google-Smtp-Source: AGHT+IEQNYP3HwnFO0fiptekPvQ75rJkFQLmTzRzslE6AvL0SYO3kee72dCCzOJoRfAwdwz3cPsAGA== X-Received: by 2002:a81:4053:0:b0:5ff:7c9a:8385 with SMTP id m19-20020a814053000000b005ff7c9a8385mr1416923ywn.67.1706283657721; Fri, 26 Jan 2024 07:40:57 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id bd3-20020a05690c010300b005ff952f0073sm453512ywb.11.2024.01.26.07.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:40:55 -0800 (PST) From: Josef Bacik To: chuck.lever@oracle.com, jlayton@kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v3 10/10] nfsd: make svc_stat per-network namespace instead of global Date: Fri, 26 Jan 2024 10:39:49 -0500 Message-ID: <256921ebcb66d444fba600fbf478dc8d556e22ea.1706283433.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The final bit of stats that is global is the rpc svc_stat. Move this into the nfsd_net struct and use that everywhere instead of the global struct. Remove the unused global struct. Signed-off-by: Josef Bacik --- fs/nfsd/netns.h | 4 ++++ fs/nfsd/nfsctl.c | 2 ++ fs/nfsd/nfssvc.c | 2 +- fs/nfsd/stats.c | 10 ++++------ fs/nfsd/stats.h | 2 -- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 0cef4bb407a9..afc16ee4da74 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -14,6 +14,7 @@ #include #include #include +#include /* Hash tables for nfs4_clientid state */ #define CLIENT_HASH_BITS 4 @@ -179,6 +180,9 @@ struct nfsd_net { /* Per-netns stats counters */ struct percpu_counter counter[NFSD_STATS_COUNTERS_NUM]; + /* sunrpc svc stats */ + struct svc_stat nfsd_svcstats; + /* longest hash chain seen */ unsigned int longest_chain; diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index ea3c8114245c..5a5547bd6ecf 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1674,6 +1674,8 @@ static __net_init int nfsd_net_init(struct net *net) retval = nfsd_stat_counters_init(nn); if (retval) goto out_repcache_error; + memset(&nn->nfsd_svcstats, 0, sizeof(nn->nfsd_svcstats)); + nn->nfsd_svcstats.program = &nfsd_program; nn->nfsd_versions = NULL; nn->nfsd4_minorversions = NULL; nfsd4_init_leases_net(nn); diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index fdb591896430..c0d17b92b249 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -661,7 +661,7 @@ int nfsd_create_serv(struct net *net) if (nfsd_max_blksize == 0) nfsd_max_blksize = nfsd_get_default_max_blksize(); nfsd_reset_versions(nn); - serv = svc_create_pooled(&nfsd_program, &nfsd_svcstats, + serv = svc_create_pooled(&nfsd_program, &nn->nfsd_svcstats, nfsd_max_blksize, nfsd); if (serv == NULL) return -ENOMEM; diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index 3a7f791c3052..be52fb1e928e 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c @@ -27,10 +27,6 @@ #include "nfsd.h" -struct svc_stat nfsd_svcstats = { - .program = &nfsd_program, -}; - static int nfsd_show(struct seq_file *seq, void *v) { struct net *net = pde_data(file_inode(seq->file)); @@ -56,7 +52,7 @@ static int nfsd_show(struct seq_file *seq, void *v) seq_puts(seq, "\nra 0 0 0 0 0 0 0 0 0 0 0 0\n"); /* show my rpc info */ - svc_seq_show(seq, &nfsd_svcstats); + svc_seq_show(seq, &nn->nfsd_svcstats); #ifdef CONFIG_NFSD_V4 /* Show count for individual nfsv4 operations */ @@ -121,7 +117,9 @@ void nfsd_stat_counters_destroy(struct nfsd_net *nn) void nfsd_proc_stat_init(struct net *net) { - svc_proc_register(net, &nfsd_svcstats, &nfsd_proc_ops); + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + + svc_proc_register(net, &nn->nfsd_svcstats, &nfsd_proc_ops); } void nfsd_proc_stat_shutdown(struct net *net) diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h index 5675d283a537..d2753e975dfd 100644 --- a/fs/nfsd/stats.h +++ b/fs/nfsd/stats.h @@ -10,8 +10,6 @@ #include #include -extern struct svc_stat nfsd_svcstats; - int nfsd_percpu_counters_init(struct percpu_counter *counters, int num); void nfsd_percpu_counters_reset(struct percpu_counter *counters, int num); void nfsd_percpu_counters_destroy(struct percpu_counter *counters, int num);