diff options
author | Enzo Matsumiya <ematsumiya@suse.de> | 2025-07-08 15:54:31 -0300 |
---|---|---|
committer | Enzo Matsumiya <ematsumiya@suse.de> | 2025-07-09 03:00:14 -0300 |
commit | a70b71978ca38fcd839cf708cae288c442c14141 (patch) | |
tree | 0b0c893fe653e634e3d69291a7a4336c5c0fc1ba /fs/smb/client/smb2ops.c | |
parent | e835f5ff89e9106fe8c8d1fe8ea3917cea67c016 (diff) | |
download | linux-plk.tar.gz linux-plk.tar.bz2 linux-plk.zip |
smb: client: properly invalidate and reuse cached direntsplk
By properly invalidating cache dir entries allows to determine when
we must or not do a remote open of the dir, reducing the number of
network calls while the cached dir is still valid.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Diffstat (limited to 'fs/smb/client/smb2ops.c')
-rw-r--r-- | fs/smb/client/smb2ops.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 02543b0d4473..28e79d2da652 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -2339,6 +2339,14 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, struct TCP_Server_Info *server; int retries = 0, cur_sleep = 1; + pr_err("%s: %s first query\n", __func__, (search_flags & CIFS_SEARCH_CACHED_FID) ? "cached" : "remote"); + if (search_flags & CIFS_SEARCH_CACHED_FID) { + srch_inf->entries_in_buffer = 0; + srch_inf->index_of_last_entry = 2; + + return SMB2_query_directory(xid, tcon, fid->persistent_fid, fid->volatile_fid, 0, srch_inf); + } + replay_again: /* reinitialize for possible replay */ flags = 0; @@ -2463,6 +2471,7 @@ smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *fid, __u16 search_flags, struct cifs_search_info *srch_inf) { + pr_err("%s: %s next query\n", __func__, (search_flags & CIFS_SEARCH_CACHED_FID) ? "cached" : "remote"); return SMB2_query_directory(xid, tcon, fid->persistent_fid, fid->volatile_fid, 0, srch_inf); } |