History

nfs: optimise readdir cache page invalidation

When the directory is large and it's being modified by one client while another client is doing the 'ls -l' on the same directory then the cache page invalidation from nfs_force_use_readdirplus causes the reading client to keep restarting READDIRPLUS from cookie 0 which causes the 'ls -l' to take a very long time to complete, possibly never completing. Currently when nfs_force_use_readdirplus is called to switch from READDIR to READDIRPLUS, it invalidates all the cached pages of the directory. This cache page invalidation causes the next nfs_readdir to re-read the directory content from cookie 0. This patch is to optimise the cache invalidation in nfs_force_use_readdirplus by only truncating the cached pages from last page index accessed to the end the file. It also marks the inode to delay invalidating all the cached page of the directory until the next initial nfs_readdir of the next 'ls' instance.

Dai Ngo committed 6 years ago

Commit 227823d1 parent 93a6ab72 files · +10 −2Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/nfs_fs.h+3−0
@@ -168,6 +168,9 @@ struct nfs_inode { · 167 unmodified lines
168 struct rw_semaphore rmdir_sem;168 struct rw_semaphore rmdir_sem;
169 struct mutex commit_mutex;169 struct mutex commit_mutex;
170 170
171 /* track last access to cached pages */
172 unsigned long page_index;
173
171#if IS_ENABLED(CONFIG_NFS_V4)174#if IS_ENABLED(CONFIG_NFS_V4)
172 struct nfs4_cached_acl *nfs4_acl;175 struct nfs4_cached_acl *nfs4_acl;
173 /* NFSv4 state */176 /* NFSv4 state */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t