From: Chuck Lever Date: Tue, 1 Nov 2022 17:30:46 +0000 (-0400) Subject: NFSD: Flesh out a documenting comment for filecache.c X-Git-Tag: microblaze-v6.6~1206^2~48 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=b3276c1f5b268ff56622e9e125b792b4c3dc03ac;p=linux-2.6-microblaze.git NFSD: Flesh out a documenting comment for filecache.c 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 Reviewed-by: Jeff Layton --- diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index cee44405cf7d..897dd47ffb0a 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