diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-05-10 15:07:32 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-14 20:30:26 -0400 |
commit | 2311b9439ce8c525f3f8f821fc2ca9a541f673a5 (patch) | |
tree | 6306764554cc50faf435297e190d3b38f1a39044 /fs | |
parent | bae36241be7fab16b2e987d31b6e6bd4456ac188 (diff) |
NFS: Don't pass mount data to nfs_fscache_get_super_cookie()
I intend on creating a single nfs_fs_mount() function used by all our
mount paths. To avoid checking between new mounts and clone mounts, I
instead pass both structures to a new function in super.c that finds the
cache key and then looks up the super cookie.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/fscache.c | 15 | ||||
-rw-r--r-- | fs/nfs/fscache.h | 4 | ||||
-rw-r--r-- | fs/nfs/super.c | 31 |
3 files changed, 29 insertions, 21 deletions
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index ae65c16b3670..c817787fbdb4 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c | |||
@@ -64,23 +64,12 @@ void nfs_fscache_release_client_cookie(struct nfs_client *clp) | |||
64 | * either by the 'fsc=xxx' option to mount, or by inheriting it from the parent | 64 | * either by the 'fsc=xxx' option to mount, or by inheriting it from the parent |
65 | * superblock across an automount point of some nature. | 65 | * superblock across an automount point of some nature. |
66 | */ | 66 | */ |
67 | void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, | 67 | void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int ulen) |
68 | struct nfs_clone_mount *mntdata) | ||
69 | { | 68 | { |
70 | struct nfs_fscache_key *key, *xkey; | 69 | struct nfs_fscache_key *key, *xkey; |
71 | struct nfs_server *nfss = NFS_SB(sb); | 70 | struct nfs_server *nfss = NFS_SB(sb); |
72 | struct rb_node **p, *parent; | 71 | struct rb_node **p, *parent; |
73 | int diff, ulen; | 72 | int diff; |
74 | |||
75 | if (uniq) { | ||
76 | ulen = strlen(uniq); | ||
77 | } else if (mntdata) { | ||
78 | struct nfs_server *mnt_s = NFS_SB(mntdata->sb); | ||
79 | if (mnt_s->fscache_key) { | ||
80 | uniq = mnt_s->fscache_key->key.uniquifier; | ||
81 | ulen = mnt_s->fscache_key->key.uniq_len; | ||
82 | } | ||
83 | } | ||
84 | 73 | ||
85 | if (!uniq) { | 74 | if (!uniq) { |
86 | uniq = ""; | 75 | uniq = ""; |
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index b9c572d0679f..2a08b9130ec1 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h | |||
@@ -73,9 +73,7 @@ extern void nfs_fscache_unregister(void); | |||
73 | extern void nfs_fscache_get_client_cookie(struct nfs_client *); | 73 | extern void nfs_fscache_get_client_cookie(struct nfs_client *); |
74 | extern void nfs_fscache_release_client_cookie(struct nfs_client *); | 74 | extern void nfs_fscache_release_client_cookie(struct nfs_client *); |
75 | 75 | ||
76 | extern void nfs_fscache_get_super_cookie(struct super_block *, | 76 | extern void nfs_fscache_get_super_cookie(struct super_block *, const char *, int); |
77 | const char *, | ||
78 | struct nfs_clone_mount *); | ||
79 | extern void nfs_fscache_release_super_cookie(struct super_block *); | 77 | extern void nfs_fscache_release_super_cookie(struct super_block *); |
80 | 78 | ||
81 | extern void nfs_fscache_init_inode_cookie(struct inode *); | 79 | extern void nfs_fscache_init_inode_cookie(struct inode *); |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 75b1717e91dd..f56fb357ddb3 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -2278,6 +2278,27 @@ static int nfs_compare_super(struct super_block *sb, void *data) | |||
2278 | return nfs_compare_mount_options(sb, server, mntflags); | 2278 | return nfs_compare_mount_options(sb, server, mntflags); |
2279 | } | 2279 | } |
2280 | 2280 | ||
2281 | static void nfs_get_cache_cookie(struct super_block *sb, | ||
2282 | struct nfs_parsed_mount_data *parsed, | ||
2283 | struct nfs_clone_mount *cloned) | ||
2284 | { | ||
2285 | char *uniq = NULL; | ||
2286 | int ulen = 0; | ||
2287 | |||
2288 | if (parsed && parsed->fscache_uniq) { | ||
2289 | uniq = parsed->fscache_uniq; | ||
2290 | ulen = strlen(parsed->fscache_uniq); | ||
2291 | } else if (cloned) { | ||
2292 | struct nfs_server *mnt_s = NFS_SB(cloned->sb); | ||
2293 | if (mnt_s->fscache_key) { | ||
2294 | uniq = mnt_s->fscache_key->key.uniquifier; | ||
2295 | ulen = mnt_s->fscache_key->key.uniq_len; | ||
2296 | }; | ||
2297 | } | ||
2298 | |||
2299 | nfs_fscache_get_super_cookie(sb, uniq, ulen); | ||
2300 | } | ||
2301 | |||
2281 | static int nfs_bdi_register(struct nfs_server *server) | 2302 | static int nfs_bdi_register(struct nfs_server *server) |
2282 | { | 2303 | { |
2283 | return bdi_register_dev(&server->backing_dev_info, server->s_dev); | 2304 | return bdi_register_dev(&server->backing_dev_info, server->s_dev); |
@@ -2352,7 +2373,7 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type, | |||
2352 | if (!s->s_root) { | 2373 | if (!s->s_root) { |
2353 | /* initial superblock/root creation */ | 2374 | /* initial superblock/root creation */ |
2354 | nfs_fill_super(s, data); | 2375 | nfs_fill_super(s, data); |
2355 | nfs_fscache_get_super_cookie(s, data->fscache_uniq, NULL); | 2376 | nfs_get_cache_cookie(s, data, NULL); |
2356 | } | 2377 | } |
2357 | 2378 | ||
2358 | mntroot = nfs_get_root(s, mntfh, dev_name); | 2379 | mntroot = nfs_get_root(s, mntfh, dev_name); |
@@ -2461,7 +2482,7 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags, | |||
2461 | if (!s->s_root) { | 2482 | if (!s->s_root) { |
2462 | /* initial superblock/root creation */ | 2483 | /* initial superblock/root creation */ |
2463 | nfs_clone_super(s, data->sb); | 2484 | nfs_clone_super(s, data->sb); |
2464 | nfs_fscache_get_super_cookie(s, NULL, data); | 2485 | nfs_get_cache_cookie(s, NULL, data); |
2465 | } | 2486 | } |
2466 | 2487 | ||
2467 | mntroot = nfs_get_root(s, data->fh, dev_name); | 2488 | mntroot = nfs_get_root(s, data->fh, dev_name); |
@@ -2724,7 +2745,7 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags, | |||
2724 | if (!s->s_root) { | 2745 | if (!s->s_root) { |
2725 | /* initial superblock/root creation */ | 2746 | /* initial superblock/root creation */ |
2726 | nfs4_fill_super(s); | 2747 | nfs4_fill_super(s); |
2727 | nfs_fscache_get_super_cookie(s, data->fscache_uniq, NULL); | 2748 | nfs_get_cache_cookie(s, data, NULL); |
2728 | } | 2749 | } |
2729 | 2750 | ||
2730 | mntroot = nfs_get_root(s, mntfh, dev_name); | 2751 | mntroot = nfs_get_root(s, mntfh, dev_name); |
@@ -2988,7 +3009,7 @@ nfs4_xdev_mount(struct file_system_type *fs_type, int flags, | |||
2988 | if (!s->s_root) { | 3009 | if (!s->s_root) { |
2989 | /* initial superblock/root creation */ | 3010 | /* initial superblock/root creation */ |
2990 | nfs4_clone_super(s, data->sb); | 3011 | nfs4_clone_super(s, data->sb); |
2991 | nfs_fscache_get_super_cookie(s, NULL, data); | 3012 | nfs_get_cache_cookie(s, NULL, data); |
2992 | } | 3013 | } |
2993 | 3014 | ||
2994 | mntroot = nfs_get_root(s, data->fh, dev_name); | 3015 | mntroot = nfs_get_root(s, data->fh, dev_name); |
@@ -3079,7 +3100,7 @@ nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags, | |||
3079 | if (!s->s_root) { | 3100 | if (!s->s_root) { |
3080 | /* initial superblock/root creation */ | 3101 | /* initial superblock/root creation */ |
3081 | nfs4_fill_super(s); | 3102 | nfs4_fill_super(s); |
3082 | nfs_fscache_get_super_cookie(s, NULL, data); | 3103 | nfs_get_cache_cookie(s, NULL, data); |
3083 | } | 3104 | } |
3084 | 3105 | ||
3085 | mntroot = nfs_get_root(s, mntfh, dev_name); | 3106 | mntroot = nfs_get_root(s, mntfh, dev_name); |