Commit 7973c1f1 authored by Trond Myklebust's avatar Trond Myklebust

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent ff3525a5
...@@ -91,6 +91,7 @@ enum { ...@@ -91,6 +91,7 @@ enum {
/* Mount options that take string arguments */ /* Mount options that take string arguments */
Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost, Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost,
Opt_addr, Opt_mountaddr, Opt_clientaddr, Opt_addr, Opt_mountaddr, Opt_clientaddr,
Opt_lookupcache,
/* Special mount options */ /* Special mount options */
Opt_userspace, Opt_deprecated, Opt_sloppy, Opt_userspace, Opt_deprecated, Opt_sloppy,
...@@ -154,6 +155,8 @@ static match_table_t nfs_mount_option_tokens = { ...@@ -154,6 +155,8 @@ static match_table_t nfs_mount_option_tokens = {
{ Opt_mounthost, "mounthost=%s" }, { Opt_mounthost, "mounthost=%s" },
{ Opt_mountaddr, "mountaddr=%s" }, { Opt_mountaddr, "mountaddr=%s" },
{ Opt_lookupcache, "lookupcache=%s" },
{ Opt_err, NULL } { Opt_err, NULL }
}; };
...@@ -200,6 +203,22 @@ static match_table_t nfs_secflavor_tokens = { ...@@ -200,6 +203,22 @@ static match_table_t nfs_secflavor_tokens = {
{ Opt_sec_err, NULL } { Opt_sec_err, NULL }
}; };
enum {
Opt_lookupcache_all, Opt_lookupcache_positive,
Opt_lookupcache_none,
Opt_lookupcache_err
};
static match_table_t nfs_lookupcache_tokens = {
{ Opt_lookupcache_all, "all" },
{ Opt_lookupcache_positive, "pos" },
{ Opt_lookupcache_positive, "positive" },
{ Opt_lookupcache_none, "none" },
{ Opt_lookupcache_err, NULL }
};
static void nfs_umount_begin(struct super_block *); static void nfs_umount_begin(struct super_block *);
static int nfs_statfs(struct dentry *, struct kstatfs *); static int nfs_statfs(struct dentry *, struct kstatfs *);
...@@ -1250,6 +1269,30 @@ static int nfs_parse_mount_options(char *raw, ...@@ -1250,6 +1269,30 @@ static int nfs_parse_mount_options(char *raw,
&mnt->mount_server.addrlen); &mnt->mount_server.addrlen);
kfree(string); kfree(string);
break; break;
case Opt_lookupcache:
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
token = match_token(string,
nfs_lookupcache_tokens, args);
kfree(string);
switch (token) {
case Opt_lookupcache_all:
mnt->flags &= ~(NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE);
break;
case Opt_lookupcache_positive:
mnt->flags &= ~NFS_MOUNT_LOOKUP_CACHE_NONE;
mnt->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG;
break;
case Opt_lookupcache_none:
mnt->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE;
break;
default:
errors++;
dfprintk(MOUNT, "NFS: invalid "
"lookupcache argument\n");
};
break;
/* /*
* Special options * Special options
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment