From: Steve French <smfrench@gmail.com>
To: linux-cifs@vger.kernel.org
Cc: Shyam Prasad N <sprasad@microsoft.com>
Subject: [PATCH 11/16] cifs: option to set unlimited number of cached dirs
Date: Tue, 23 Jun 2026 15:13:38 -0500 [thread overview]
Message-ID: <20260623201344.2043841-11-stfrench@microsoft.com> (raw)
In-Reply-To: <20260623201344.2043841-1-stfrench@microsoft.com>
From: Shyam Prasad N <sprasad@microsoft.com>
Today we can control the number of cached dirs on the system using
the mount option max_cached_dirs. The default value is 16.
This change allows setting this option to a special value of 0,
which means unlimited number of cached dirs. Shrinker can still
evict the cached dirs.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
fs/smb/client/cached_dir.c | 5 +++--
fs/smb/client/fs_context.c | 10 +++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c
index 921a6f2c3c51..ecdc6907cf6d 100644
--- a/fs/smb/client/cached_dir.c
+++ b/fs/smb/client/cached_dir.c
@@ -1255,9 +1255,10 @@ static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,
if (lookup_only) {
return NULL;
}
- if (cfids->num_entries >= max_cached_dirs) {
+
+ if (max_cached_dirs && cfids->num_entries >= max_cached_dirs)
return NULL;
- }
+
cfid = init_cached_dir(path);
if (cfid == NULL) {
return NULL;
diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index 9bb41114237f..f2cc5530447a 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1523,12 +1523,12 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
ctx->max_channels = result.uint_32;
break;
case Opt_max_cached_dirs:
- if (result.uint_32 < 1) {
- cifs_errorf(fc, "%s: Invalid max_cached_dirs, needs to be 1 or more\n",
- __func__);
- goto cifs_parse_mount_err;
+ if (result.uint_32 > 0) {
+ ctx->max_cached_dirs = result.uint_32;
+ } else {
+ /* 0 means unlimited */
+ ctx->max_cached_dirs = 0;
}
- ctx->max_cached_dirs = result.uint_32;
break;
case Opt_handletimeout:
ctx->handle_timeout = result.uint_32;
--
2.53.0
next prev parent reply other threads:[~2026-06-23 20:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 20:13 [PATCH 01/16] cifs: define variable sized buffer for querydir responses Steve French
2026-06-23 20:13 ` [PATCH 02/16] cifs: optimize readdir for small directories Steve French
2026-06-23 20:13 ` [PATCH 03/16] cifs: optimize readdir for larger directories Steve French
2026-06-23 20:13 ` [PATCH 04/16] cifs: reorganize cached dir helpers Steve French
2026-06-23 20:13 ` [PATCH 05/16] cifs: make cfid locks more granular Steve French
2026-06-23 20:13 ` [PATCH 06/16] cifs: query dir should reuse cfid even if not fully cached Steve French
2026-06-23 20:13 ` [PATCH 07/16] cifs: back cached_dirents with page cache Steve French
2026-06-23 20:13 ` [PATCH 08/16] cifs: in place changes to cached_dirents when dir lease is held Steve French
2026-06-23 20:13 ` [PATCH 09/16] cifs: register a shrinker to manage cached_dirents Steve French
2026-06-23 20:13 ` [PATCH 10/16] cifs: option to disable time-based eviction of cache Steve French
2026-06-23 20:13 ` Steve French [this message]
2026-06-23 20:13 ` [PATCH 12/16] cifs: allow dcache population to happen asynchronously Steve French
2026-06-23 20:13 ` [PATCH 13/16] cifs: trace points for cached_dir operations Steve French
2026-06-23 20:13 ` [PATCH 14/16] cifs: discard functions to ensure that mid callbacks get called Steve French
2026-06-23 20:13 ` [PATCH 15/16] cifs: keep cfids in rbtree for efficient lookups Steve French
2026-06-23 20:13 ` [PATCH 16/16] cifs: invalidate cached_dirents if population aborted Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260623201344.2043841-11-stfrench@microsoft.com \
--to=smfrench@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=sprasad@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox