aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-07-15 17:58:14 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-10-07 17:23:57 -0400
commit7973c1f15a0687f47ed70e591e4642d6fc4334d0 (patch)
tree543ea6ca6b2217bf873c4a891aec9eab5dd50fab /fs
parentff3525a539f5cc81970d08304bdedb4ffba984da (diff)
NFS: Add mount options for controlling the lookup cache
Add the following NFS-specific mount options to the parser. -o lookupcache=all /* Default: cache positive & negative dentries */ -o lookupcache=pos[itive] /* Don't cache negative dentries */ -o lookupcache=none /* Strict revalidation of all dentries */ Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/super.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 81686aeb1b5d..1e3558697219 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -91,6 +91,7 @@ enum {
91 /* Mount options that take string arguments */ 91 /* Mount options that take string arguments */
92 Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost, 92 Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost,
93 Opt_addr, Opt_mountaddr, Opt_clientaddr, 93 Opt_addr, Opt_mountaddr, Opt_clientaddr,
94 Opt_lookupcache,
94 95
95 /* Special mount options */ 96 /* Special mount options */
96 Opt_userspace, Opt_deprecated, Opt_sloppy, 97 Opt_userspace, Opt_deprecated, Opt_sloppy,
@@ -154,6 +155,8 @@ static match_table_t nfs_mount_option_tokens = {
154 { Opt_mounthost, "mounthost=%s" }, 155 { Opt_mounthost, "mounthost=%s" },
155 { Opt_mountaddr, "mountaddr=%s" }, 156 { Opt_mountaddr, "mountaddr=%s" },
156 157
158 { Opt_lookupcache, "lookupcache=%s" },
159
157 { Opt_err, NULL } 160 { Opt_err, NULL }
158}; 161};
159 162
@@ -200,6 +203,22 @@ static match_table_t nfs_secflavor_tokens = {
200 { Opt_sec_err, NULL } 203 { Opt_sec_err, NULL }
201}; 204};
202 205
206enum {
207 Opt_lookupcache_all, Opt_lookupcache_positive,
208 Opt_lookupcache_none,
209
210 Opt_lookupcache_err
211};
212
213static match_table_t nfs_lookupcache_tokens = {
214 { Opt_lookupcache_all, "all" },
215 { Opt_lookupcache_positive, "pos" },
216 { Opt_lookupcache_positive, "positive" },
217 { Opt_lookupcache_none, "none" },
218
219 { Opt_lookupcache_err, NULL }
220};
221
203 222
204static void nfs_umount_begin(struct super_block *); 223static void nfs_umount_begin(struct super_block *);
205static int nfs_statfs(struct dentry *, struct kstatfs *); 224static int nfs_statfs(struct dentry *, struct kstatfs *);
@@ -1250,6 +1269,30 @@ static int nfs_parse_mount_options(char *raw,
1250 &mnt->mount_server.addrlen); 1269 &mnt->mount_server.addrlen);
1251 kfree(string); 1270 kfree(string);
1252 break; 1271 break;
1272 case Opt_lookupcache:
1273 string = match_strdup(args);
1274 if (string == NULL)
1275 goto out_nomem;
1276 token = match_token(string,
1277 nfs_lookupcache_tokens, args);
1278 kfree(string);
1279 switch (token) {
1280 case Opt_lookupcache_all:
1281 mnt->flags &= ~(NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE);
1282 break;
1283 case Opt_lookupcache_positive:
1284 mnt->flags &= ~NFS_MOUNT_LOOKUP_CACHE_NONE;
1285 mnt->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG;
1286 break;
1287 case Opt_lookupcache_none:
1288 mnt->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE;
1289 break;
1290 default:
1291 errors++;
1292 dfprintk(MOUNT, "NFS: invalid "
1293 "lookupcache argument\n");
1294 };
1295 break;
1253 1296
1254 /* 1297 /*
1255 * Special options 1298 * Special options