aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-06-16 09:52:26 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-06-22 13:24:02 -0400
commit97dc135947181a6670949a480da56c3ebf8d3715 (patch)
tree2e5a766941516f8bbcec3b816901a76a45fc78c5 /fs
parenta2118c33aad6c447ad5e0a60cfaea3939b52ce0a (diff)
NFSv41: Clean up the NFSv4.1 minor version specific operations
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/client.c14
-rw-r--r--fs/nfs/nfs4_fs.h11
-rw-r--r--fs/nfs/nfs4proc.c21
3 files changed, 37 insertions, 9 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index d25b5257b7a1..1df708fd4205 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -150,6 +150,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
150 clp->cl_boot_time = CURRENT_TIME; 150 clp->cl_boot_time = CURRENT_TIME;
151 clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; 151 clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
152 clp->cl_minorversion = cl_init->minorversion; 152 clp->cl_minorversion = cl_init->minorversion;
153 clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
153#endif 154#endif
154 cred = rpc_lookup_machine_cred(); 155 cred = rpc_lookup_machine_cred();
155 if (!IS_ERR(cred)) 156 if (!IS_ERR(cred))
@@ -178,7 +179,7 @@ static void nfs4_clear_client_minor_version(struct nfs_client *clp)
178 clp->cl_session = NULL; 179 clp->cl_session = NULL;
179 } 180 }
180 181
181 clp->cl_call_sync = _nfs4_call_sync; 182 clp->cl_mvops = nfs_v4_minor_ops[0];
182#endif /* CONFIG_NFS_V4_1 */ 183#endif /* CONFIG_NFS_V4_1 */
183} 184}
184 185
@@ -188,7 +189,7 @@ static void nfs4_clear_client_minor_version(struct nfs_client *clp)
188static void nfs4_destroy_callback(struct nfs_client *clp) 189static void nfs4_destroy_callback(struct nfs_client *clp)
189{ 190{
190 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) 191 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
191 nfs_callback_down(clp->cl_minorversion); 192 nfs_callback_down(clp->cl_mvops->minor_version);
192} 193}
193 194
194static void nfs4_shutdown_client(struct nfs_client *clp) 195static void nfs4_shutdown_client(struct nfs_client *clp)
@@ -1126,7 +1127,7 @@ static int nfs4_init_callback(struct nfs_client *clp)
1126 return error; 1127 return error;
1127 } 1128 }
1128 1129
1129 error = nfs_callback_up(clp->cl_minorversion, 1130 error = nfs_callback_up(clp->cl_mvops->minor_version,
1130 clp->cl_rpcclient->cl_xprt); 1131 clp->cl_rpcclient->cl_xprt);
1131 if (error < 0) { 1132 if (error < 0) {
1132 dprintk("%s: failed to start callback. Error = %d\n", 1133 dprintk("%s: failed to start callback. Error = %d\n",
@@ -1143,10 +1144,8 @@ static int nfs4_init_callback(struct nfs_client *clp)
1143 */ 1144 */
1144static int nfs4_init_client_minor_version(struct nfs_client *clp) 1145static int nfs4_init_client_minor_version(struct nfs_client *clp)
1145{ 1146{
1146 clp->cl_call_sync = _nfs4_call_sync;
1147
1148#if defined(CONFIG_NFS_V4_1) 1147#if defined(CONFIG_NFS_V4_1)
1149 if (clp->cl_minorversion) { 1148 if (clp->cl_mvops->minor_version) {
1150 struct nfs4_session *session = NULL; 1149 struct nfs4_session *session = NULL;
1151 /* 1150 /*
1152 * Create the session and mark it expired. 1151 * Create the session and mark it expired.
@@ -1158,7 +1157,6 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp)
1158 return -ENOMEM; 1157 return -ENOMEM;
1159 1158
1160 clp->cl_session = session; 1159 clp->cl_session = session;
1161 clp->cl_call_sync = _nfs4_call_sync_session;
1162 } 1160 }
1163#endif /* CONFIG_NFS_V4_1 */ 1161#endif /* CONFIG_NFS_V4_1 */
1164 1162
@@ -1454,7 +1452,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1454 data->authflavor, 1452 data->authflavor,
1455 parent_server->client->cl_xprt->prot, 1453 parent_server->client->cl_xprt->prot,
1456 parent_server->client->cl_timeout, 1454 parent_server->client->cl_timeout,
1457 parent_client->cl_minorversion); 1455 parent_client->cl_mvops->minor_version);
1458 if (error < 0) 1456 if (error < 0)
1459 goto error; 1457 goto error;
1460 1458
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index bb1e95530699..5b01705e30f9 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -52,6 +52,16 @@ enum nfs4_session_state {
52 NFS4_SESSION_DRAINING, 52 NFS4_SESSION_DRAINING,
53}; 53};
54 54
55struct nfs4_minor_version_ops {
56 u32 minor_version;
57
58 int (*call_sync)(struct nfs_server *server,
59 struct rpc_message *msg,
60 struct nfs4_sequence_args *args,
61 struct nfs4_sequence_res *res,
62 int cache_reply);
63};
64
55/* 65/*
56 * struct rpc_sequence ensures that RPC calls are sent in the exact 66 * struct rpc_sequence ensures that RPC calls are sent in the exact
57 * order that they appear on the list. 67 * order that they appear on the list.
@@ -260,6 +270,7 @@ static inline int nfs4_init_session(struct nfs_server *server)
260} 270}
261#endif /* CONFIG_NFS_V4_1 */ 271#endif /* CONFIG_NFS_V4_1 */
262 272
273extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[];
263extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[]; 274extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[];
264 275
265extern const u32 nfs4_fattr_bitmap[2]; 276extern const u32 nfs4_fattr_bitmap[2];
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index fc972c6f1ce9..a938daf333da 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -667,7 +667,7 @@ int _nfs4_call_sync(struct nfs_server *server,
667} 667}
668 668
669#define nfs4_call_sync(server, msg, args, res, cache_reply) \ 669#define nfs4_call_sync(server, msg, args, res, cache_reply) \
670 (server)->nfs_client->cl_call_sync((server), (msg), &(args)->seq_args, \ 670 (server)->nfs_client->cl_mvops->call_sync((server), (msg), &(args)->seq_args, \
671 &(res)->seq_res, (cache_reply)) 671 &(res)->seq_res, (cache_reply))
672 672
673static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 673static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
@@ -5353,6 +5353,18 @@ struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = {
5353}; 5353};
5354#endif 5354#endif
5355 5355
5356static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = {
5357 .minor_version = 0,
5358 .call_sync = _nfs4_call_sync,
5359};
5360
5361#if defined(CONFIG_NFS_V4_1)
5362static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
5363 .minor_version = 1,
5364 .call_sync = _nfs4_call_sync_session,
5365};
5366#endif
5367
5356/* 5368/*
5357 * Per minor version reboot and network partition recovery ops 5369 * Per minor version reboot and network partition recovery ops
5358 */ 5370 */
@@ -5378,6 +5390,13 @@ struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[] = {
5378#endif 5390#endif
5379}; 5391};
5380 5392
5393const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {
5394 [0] = &nfs_v4_0_minor_ops,
5395#if defined(CONFIG_NFS_V4_1)
5396 [1] = &nfs_v4_1_minor_ops,
5397#endif
5398};
5399
5381static const struct inode_operations nfs4_file_inode_operations = { 5400static const struct inode_operations nfs4_file_inode_operations = {
5382 .permission = nfs_permission, 5401 .permission = nfs_permission,
5383 .getattr = nfs_getattr, 5402 .getattr = nfs_getattr,