Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2696439rwi; Tue, 1 Nov 2022 10:35:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dDLy/ExJg/5CY8WJYZuRNTtACp2fRST4ICDRqPC5t35zukAoNQ7a45P/2Rs04jdjkDCXr X-Received: by 2002:a05:6a00:1941:b0:56c:c987:99c5 with SMTP id s1-20020a056a00194100b0056cc98799c5mr20879059pfk.57.1667324113829; Tue, 01 Nov 2022 10:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667324113; cv=none; d=google.com; s=arc-20160816; b=vNt1BxIakU6t+FmP/Kiakw9QDUadg7mOT1UITHOPUgB/cSxT04zoR09AB8jccMztGz FH3f0NMIaHDGOhQUBYtyw7nAMWYT6WOrQNTV7dp77aGw4/nTcSLQ2tHrqBsj8cjLuwr9 B6amLIFmawqTf6rMkbg0U3wca8BdHNhwy3T0lotqe6w0yE+LJYoCBfAAXOdXds5o3dEO uNQQ1PTaCAiGkg7Zng4Ct2gn3quydj/OZXmhc8Fu0UazTqh7V3yGjmjf+gHI+9RVmzvh ZxNK3az1XguoqJH7g9tjLXdtteEgkHywU/w2j9HMQQqJ7RQNgy3Utg18LV79GW2y4CZ7 boxw== 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 :user-agent:message-id:date:to:from:subject; bh=J4oQLtVFPjVMv1P9pwBICsyRyONuxVLMWEuwg+IQ00M=; b=ll3FGXKsyiEZdDzJ7aU0wxE1rV1lLx1PlfQ5sX++Gw/9GOlDdfbLumfjeSgOYGYCGR Ab0aGTG803RYmMItUrqh+LfWaL2ebS/7ffEtOQ7ygSWSa23C+wgTqw9dhw0s4987o5BU +CMM3Fau7+MN9DVD5NIc0hXGMe1Skb8IIaKJU++5KIwKo14tlxJ/C3EsygZjZmCgskqN tpkg7Vfz28Vhuq3ucQ5YyjV/DPxtGUgns+rfSq/8YRoKC8Wagjtl/xuX+uGjnX6ClV3f zNe4Z9+nIn18fXfxd/oAfRE1G61cHoUlB7z4UHIinIWYQkkcgrI0svRDE/ShRZO4UGoO nTVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r29-20020a63a55d000000b0044b817adee1si14568945pgu.78.2022.11.01.10.35.00; Tue, 01 Nov 2022 10:35:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229770AbiKARau (ORCPT + 99 others); Tue, 1 Nov 2022 13:30:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbiKARat (ORCPT ); Tue, 1 Nov 2022 13:30:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 095841C114 for ; Tue, 1 Nov 2022 10:30:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 98C69616D4 for ; Tue, 1 Nov 2022 17:30:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF786C433C1 for ; Tue, 1 Nov 2022 17:30:47 +0000 (UTC) Subject: [PATCH] NFSD: Flesh out a documenting comment for filecache.c From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Tue, 01 Nov 2022 13:30:46 -0400 Message-ID: <166732362009.147807.16481897041798638515.stgit@klimt.1015granger.net> User-Agent: StGit/1.5.dev3+g9561319 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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-nfs@vger.kernel.org Record what we've learned recently about the NFSD filecache in a documenting comment so our future selves don't forget what all this is for. Signed-off-by: Chuck Lever --- fs/nfsd/filecache.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) Here's what I had in mind for the top-of-file comment. diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 28f91c97e045..02b4871b9ffc 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -2,6 +2,30 @@ * Open file cache. * * (c) 2015 - Jeff Layton + * + * An nfsd_file object is a per-file collection of open state that binds + * together: + * - a struct file * + * - a user credential + * - a network namespace + * - a read-ahead context + * - monitoring for writeback errors + * + * nfsd_file objects are reference-counted. Consumers acquire a new + * object via the nfsd_file_acquire API. They manage their interest in + * the acquired object, and hence the object's reference count, via + * nfsd_file_get and nfsd_file_put. There are two varieties of nfsd_file + * object: + * + * * non-garbage-collected: When a consumer wants to precisely control + * the lifetime of a file's open state, it acquires a non-garbage- + * collected nfsd_file. The final nfsd_file_put releases the open + * state immediately. + * + * * garbage-collected: When a consumer does not control the lifetime + * of open state, it acquires a garbage-collected nfsd_file. The + * final nfsd_file_put allows the open state to linger for a period + * during which it may be re-used. */ #include