diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-07-30 16:05:20 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-07-30 19:06:05 -0400 |
commit | 6a74490dca897471a994a542fc7c5a469b48b46b (patch) | |
tree | d1ae8565c3e51bff590858b2f681b2c35700f55f /fs/nfs | |
parent | 1179acc6a3e260bc4edc74fa94f6c7908290eaec (diff) |
NFS: Pass super operations and xattr handlers in the nfs_subversion
I can set all variables in the nfs_fill_super() function, allowing me to
remove the nfs4_fill_super() function.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/internal.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs.h | 2 | ||||
-rw-r--r-- | fs/nfs/nfs2super.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs3super.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4super.c | 24 | ||||
-rw-r--r-- | fs/nfs/super.c | 9 |
6 files changed, 13 insertions, 25 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 2151bafd55b4..17d14709e750 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -327,6 +327,7 @@ void nfs_zap_acl_cache(struct inode *inode); | |||
327 | extern int nfs_wait_bit_killable(void *word); | 327 | extern int nfs_wait_bit_killable(void *word); |
328 | 328 | ||
329 | /* super.c */ | 329 | /* super.c */ |
330 | extern const struct super_operations nfs_sops; | ||
330 | extern struct file_system_type nfs_fs_type; | 331 | extern struct file_system_type nfs_fs_type; |
331 | extern struct file_system_type nfs_xdev_fs_type; | 332 | extern struct file_system_type nfs_xdev_fs_type; |
332 | #ifdef CONFIG_NFS_V4 | 333 | #ifdef CONFIG_NFS_V4 |
diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h index ac10b9e6c920..9f502a0c1e59 100644 --- a/fs/nfs/nfs.h +++ b/fs/nfs/nfs.h | |||
@@ -16,6 +16,8 @@ struct nfs_subversion { | |||
16 | struct file_system_type *nfs_fs; /* NFS filesystem type */ | 16 | struct file_system_type *nfs_fs; /* NFS filesystem type */ |
17 | const struct rpc_version *rpc_vers; /* NFS version information */ | 17 | const struct rpc_version *rpc_vers; /* NFS version information */ |
18 | const struct nfs_rpc_ops *rpc_ops; /* NFS operations */ | 18 | const struct nfs_rpc_ops *rpc_ops; /* NFS operations */ |
19 | const struct super_operations *sops; /* NFS Super operations */ | ||
20 | const struct xattr_handler **xattr; /* NFS xattr handlers */ | ||
19 | struct list_head list; /* List of NFS versions */ | 21 | struct list_head list; /* List of NFS versions */ |
20 | }; | 22 | }; |
21 | 23 | ||
diff --git a/fs/nfs/nfs2super.c b/fs/nfs/nfs2super.c index cef06d42334a..a9fb69d72816 100644 --- a/fs/nfs/nfs2super.c +++ b/fs/nfs/nfs2super.c | |||
@@ -11,6 +11,7 @@ static struct nfs_subversion nfs_v2 = { | |||
11 | .nfs_fs = &nfs_fs_type, | 11 | .nfs_fs = &nfs_fs_type, |
12 | .rpc_vers = &nfs_version2, | 12 | .rpc_vers = &nfs_version2, |
13 | .rpc_ops = &nfs_v2_clientops, | 13 | .rpc_ops = &nfs_v2_clientops, |
14 | .sops = &nfs_sops, | ||
14 | }; | 15 | }; |
15 | 16 | ||
16 | int __init init_nfs_v2(void) | 17 | int __init init_nfs_v2(void) |
diff --git a/fs/nfs/nfs3super.c b/fs/nfs/nfs3super.c index f815cf359d97..8378090b8104 100644 --- a/fs/nfs/nfs3super.c +++ b/fs/nfs/nfs3super.c | |||
@@ -11,6 +11,7 @@ static struct nfs_subversion nfs_v3 = { | |||
11 | .nfs_fs = &nfs_fs_type, | 11 | .nfs_fs = &nfs_fs_type, |
12 | .rpc_vers = &nfs_version3, | 12 | .rpc_vers = &nfs_version3, |
13 | .rpc_ops = &nfs_v3_clientops, | 13 | .rpc_ops = &nfs_v3_clientops, |
14 | .sops = &nfs_sops, | ||
14 | }; | 15 | }; |
15 | 16 | ||
16 | int __init init_nfs_v3(void) | 17 | int __init init_nfs_v3(void) |
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index a62836256665..c70e1730755c 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
@@ -71,26 +71,11 @@ struct nfs_subversion nfs_v4 = { | |||
71 | .nfs_fs = &nfs4_fs_type, | 71 | .nfs_fs = &nfs4_fs_type, |
72 | .rpc_vers = &nfs_version4, | 72 | .rpc_vers = &nfs_version4, |
73 | .rpc_ops = &nfs_v4_clientops, | 73 | .rpc_ops = &nfs_v4_clientops, |
74 | .sops = &nfs4_sops, | ||
75 | .xattr = nfs4_xattr_handlers, | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | /* | 78 | /* |
77 | * Set up an NFS4 superblock | ||
78 | */ | ||
79 | static void nfs4_fill_super(struct super_block *sb, | ||
80 | struct nfs_mount_info *mount_info) | ||
81 | { | ||
82 | sb->s_time_gran = 1; | ||
83 | sb->s_op = &nfs4_sops; | ||
84 | /* | ||
85 | * The VFS shouldn't apply the umask to mode bits. We will do | ||
86 | * so ourselves when necessary. | ||
87 | */ | ||
88 | sb->s_flags |= MS_POSIXACL; | ||
89 | sb->s_xattr = nfs4_xattr_handlers; | ||
90 | nfs_initialise_sb(sb); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Get the superblock for the NFS4 root partition | 79 | * Get the superblock for the NFS4 root partition |
95 | */ | 80 | */ |
96 | static struct dentry * | 81 | static struct dentry * |
@@ -101,7 +86,6 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags, | |||
101 | struct nfs_server *server; | 86 | struct nfs_server *server; |
102 | struct dentry *mntroot = ERR_PTR(-ENOMEM); | 87 | struct dentry *mntroot = ERR_PTR(-ENOMEM); |
103 | 88 | ||
104 | mount_info->fill_super = nfs4_fill_super; | ||
105 | mount_info->set_security = nfs_set_sb_security; | 89 | mount_info->set_security = nfs_set_sb_security; |
106 | 90 | ||
107 | /* Get a volume representation */ | 91 | /* Get a volume representation */ |
@@ -236,8 +220,6 @@ struct dentry *nfs4_try_mount(int flags, const char *dev_name, | |||
236 | 220 | ||
237 | dfprintk(MOUNT, "--> nfs4_try_mount()\n"); | 221 | dfprintk(MOUNT, "--> nfs4_try_mount()\n"); |
238 | 222 | ||
239 | mount_info->fill_super = nfs4_fill_super; | ||
240 | |||
241 | export_path = data->nfs_server.export_path; | 223 | export_path = data->nfs_server.export_path; |
242 | data->nfs_server.export_path = "/"; | 224 | data->nfs_server.export_path = "/"; |
243 | root_mnt = nfs_do_root_mount(&nfs4_remote_fs_type, flags, mount_info, | 225 | root_mnt = nfs_do_root_mount(&nfs4_remote_fs_type, flags, mount_info, |
@@ -257,7 +239,7 @@ nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags, | |||
257 | const char *dev_name, void *raw_data) | 239 | const char *dev_name, void *raw_data) |
258 | { | 240 | { |
259 | struct nfs_mount_info mount_info = { | 241 | struct nfs_mount_info mount_info = { |
260 | .fill_super = nfs4_fill_super, | 242 | .fill_super = nfs_fill_super, |
261 | .set_security = nfs_clone_sb_security, | 243 | .set_security = nfs_clone_sb_security, |
262 | .cloned = raw_data, | 244 | .cloned = raw_data, |
263 | }; | 245 | }; |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index a5f9fb3bfdcc..a275d19ae512 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -298,7 +298,7 @@ struct file_system_type nfs_xdev_fs_type = { | |||
298 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 298 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, |
299 | }; | 299 | }; |
300 | 300 | ||
301 | static const struct super_operations nfs_sops = { | 301 | const struct super_operations nfs_sops = { |
302 | .alloc_inode = nfs_alloc_inode, | 302 | .alloc_inode = nfs_alloc_inode, |
303 | .destroy_inode = nfs_destroy_inode, | 303 | .destroy_inode = nfs_destroy_inode, |
304 | .write_inode = nfs_write_inode, | 304 | .write_inode = nfs_write_inode, |
@@ -2105,10 +2105,12 @@ void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info) | |||
2105 | 2105 | ||
2106 | sb->s_blocksize_bits = 0; | 2106 | sb->s_blocksize_bits = 0; |
2107 | sb->s_blocksize = 0; | 2107 | sb->s_blocksize = 0; |
2108 | if (data->bsize) | 2108 | sb->s_xattr = server->nfs_client->cl_nfs_mod->xattr; |
2109 | sb->s_op = server->nfs_client->cl_nfs_mod->sops; | ||
2110 | if (data && data->bsize) | ||
2109 | sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits); | 2111 | sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits); |
2110 | 2112 | ||
2111 | if (server->nfs_client->rpc_ops->version == 3) { | 2113 | if (server->nfs_client->rpc_ops->version != 2) { |
2112 | /* The VFS shouldn't apply the umask to mode bits. We will do | 2114 | /* The VFS shouldn't apply the umask to mode bits. We will do |
2113 | * so ourselves when necessary. | 2115 | * so ourselves when necessary. |
2114 | */ | 2116 | */ |
@@ -2116,7 +2118,6 @@ void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info) | |||
2116 | sb->s_time_gran = 1; | 2118 | sb->s_time_gran = 1; |
2117 | } | 2119 | } |
2118 | 2120 | ||
2119 | sb->s_op = &nfs_sops; | ||
2120 | nfs_initialise_sb(sb); | 2121 | nfs_initialise_sb(sb); |
2121 | } | 2122 | } |
2122 | 2123 | ||