Skip to content

nfsd: filecache: change garbage collect lists

NeilBrown linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4nfsd: filecache: use nfsd_file_dispose_list() in nfsd_file_close_inode_sync()fs/nfsd/filecache.c+1 -61 reply
2/4nfsd: filecache: move globals nfsd_file_lru and nfsd_file_shrinker to be per-netfs/nfsd/filecache.c+68 -577 replies
3/4nfsd: filecache: change garbage collection list management.fs/nfsd/filecache.c fs/nfsd/filecache.h fs/nfsd/trace.h+108 -1153 replies
4/4nfsd: filecache: change garbage collection to a timer.fs/nfsd/filecache.c+28 -234 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchJeff Layton
1/4R-b
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] nfsd: filecache: change garbage collect lists

The nfsd filecache currently uses list_lru for tracking files recently used in NFSv3 requests which need to be "garbage collected" when they have becoming idle - unused for 2-4 seconds.

I do not believe list_lru is a good tool for this. It does no allow the timeout which filecache requires so we have to add a timeout mechanism which holds the list_lru for while the whole list is scanned looking for entries that haven't been recently accessed. When the list is largish (even a few hundred) this can block new requests which need the lock to remove a file to access it.

This patch removes the list_lru and instead uses 2 simple linked lists. When a file is accessed it is removed from whichever list it is one, then added to the tail of the first list. Every 2 seconds the second list is moved to the "freeme" list and the first list is moved to the second list. This avoids any need to walk a list to find old entries.

These lists are per-netns rather than global as the freeme list is per-netns as the actual freeing is done in nfsd threads which are per-netns.

This should not be applied until we resolve how to handle the race-detection code in nfsd_file_put(). However I'm posting it now to get any feedback so that a final version can be posted as soon as that issue is resolved.

Thanks,
NeilBrown

[PATCH 1/4] nfsd: filecache: use nfsd_file_dispose_list() in [PATCH 2/4] nfsd: filecache: move globals nfsd_file_lru and [PATCH 3/4] nfsd: filecache: change garbage collection list [PATCH 4/4] nfsd: filecache: change garbage collection to a timer.