[PATCH v2 09/18] nfsd: allow the file cache expire time to be tunable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is primarily for testing purposes, but this may also be useful
until we have a better idea for a sensible default here.

Signed-off-by: Jeff Layton <jeff.layton@xxxxxxxxxxxxxxx>
---
 fs/nfsd/filecache.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index a3782cf7b352..084e56726318 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -8,6 +8,7 @@
 #include <linux/hash.h>
 #include <linux/file.h>
 #include <linux/sched.h>
+#include <linux/module.h>
 
 #include "vfs.h"
 #include "nfsd.h"
@@ -16,8 +17,10 @@
 
 #define NFSDDBG_FACILITY	NFSDDBG_FH
 
-/* Min time we should keep around a file cache entry */
-#define NFSD_FILE_EXPIRE	(HZ)
+/* Min time we should keep around a file cache entry (in jiffies) */
+static unsigned int			nfsd_file_cache_expiry = HZ;
+module_param(nfsd_file_cache_expiry, uint, 0644);
+MODULE_PARM_DESC(nfsd_file_cache_expiry, "Expire time for open file cache (in jiffies)");
 
 /* We only care about NFSD_MAY_READ/WRITE for this cache */
 #define NFSD_FILE_MAY_MASK	(NFSD_MAY_READ|NFSD_MAY_WRITE)
@@ -40,7 +43,7 @@ nfsd_file_count_inc(void)
 {
 	if (atomic_inc_return(&nfsd_file_count) == 1)
 		queue_delayed_work(nfsd_laundry_wq, &nfsd_file_cache_clean_work,
-					NFSD_FILE_EXPIRE);
+					nfsd_file_cache_expiry);
 }
 
 static void
@@ -169,7 +172,8 @@ nfsd_file_cache_prune(void)
 				continue;
 
 			/* Was this file touched recently? */
-			if (time_before(nf->nf_time + NFSD_FILE_EXPIRE, jiffies))
+			if (time_before(nf->nf_time + nfsd_file_cache_expiry,
+					jiffies))
 				continue;
 
 			/* Ok, it's expired...unhash it */
@@ -193,7 +197,7 @@ nfsd_file_cache_cleaner(struct work_struct *work)
 
 	if (atomic_read(&nfsd_file_count))
 		queue_delayed_work(nfsd_laundry_wq, &nfsd_file_cache_clean_work,
-					NFSD_FILE_EXPIRE);
+					nfsd_file_cache_expiry);
 }
 
 int
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux