aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-03-24 13:12:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-03-24 13:52:41 -0400
commite73b83f270828630a9ce33728f6ef61c37a82340 (patch)
tree2a2c707b7248ad1bca741a96ec736852776d2822 /fs
parent4bbba111d94781d34081c37856bbc5eb33f6c72a (diff)
NFS: convert call_sync() to a function
This patch changes nfs4_call_sync() from a macro into a static inline function. As a macro, the call_sync() function will not do any type checking and depends on the sequence arguments always having the same name. As a function, we get to have type checking and can rename the arguments if we so choose. 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/nfs4proc.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1d84e7088af9..e403d7a84466 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -719,9 +719,16 @@ int _nfs4_call_sync(struct nfs_server *server,
719 return rpc_call_sync(server->client, msg, 0); 719 return rpc_call_sync(server->client, msg, 0);
720} 720}
721 721
722#define nfs4_call_sync(server, msg, args, res, cache_reply) \ 722static inline
723 (server)->nfs_client->cl_mvops->call_sync((server), (msg), &(args)->seq_args, \ 723int nfs4_call_sync(struct nfs_server *server,
724 &(res)->seq_res, (cache_reply)) 724 struct rpc_message *msg,
725 struct nfs4_sequence_args *args,
726 struct nfs4_sequence_res *res,
727 int cache_reply)
728{
729 return server->nfs_client->cl_mvops->call_sync(server, msg, args,
730 res, cache_reply);
731}
725 732
726static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 733static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
727{ 734{
@@ -1831,7 +1838,7 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
1831 } else 1838 } else
1832 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid)); 1839 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid));
1833 1840
1834 status = nfs4_call_sync(server, &msg, &arg, &res, 1); 1841 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1);
1835 if (status == 0 && state != NULL) 1842 if (status == 0 && state != NULL)
1836 renew_lease(server, timestamp); 1843 renew_lease(server, timestamp);
1837 return status; 1844 return status;
@@ -2090,7 +2097,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
2090 }; 2097 };
2091 int status; 2098 int status;
2092 2099
2093 status = nfs4_call_sync(server, &msg, &args, &res, 0); 2100 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
2094 if (status == 0) { 2101 if (status == 0) {
2095 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); 2102 memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask));
2096 server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS| 2103 server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS|
@@ -2160,7 +2167,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
2160 }; 2167 };
2161 2168
2162 nfs_fattr_init(info->fattr); 2169 nfs_fattr_init(info->fattr);
2163 return nfs4_call_sync(server, &msg, &args, &res, 0); 2170 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
2164} 2171}
2165 2172
2166static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, 2173static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -2249,7 +2256,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
2249 }; 2256 };
2250 2257
2251 nfs_fattr_init(fattr); 2258 nfs_fattr_init(fattr);
2252 return nfs4_call_sync(server, &msg, &args, &res, 0); 2259 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
2253} 2260}
2254 2261
2255static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) 2262static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
@@ -2333,7 +2340,7 @@ static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *d
2333 nfs_fattr_init(fattr); 2340 nfs_fattr_init(fattr);
2334 2341
2335 dprintk("NFS call lookupfh %s\n", name->name); 2342 dprintk("NFS call lookupfh %s\n", name->name);
2336 status = nfs4_call_sync(server, &msg, &args, &res, 0); 2343 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
2337 dprintk("NFS reply lookupfh: %d\n", status); 2344 dprintk("NFS reply lookupfh: %d\n", status);
2338 return status; 2345 return status;
2339} 2346}
@@ -2421,7 +2428,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry
2421 if (res.fattr == NULL) 2428 if (res.fattr == NULL)
2422 return -ENOMEM; 2429 return -ENOMEM;
2423 2430
2424 status = nfs4_call_sync(server, &msg, &args, &res, 0); 2431 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
2425 if (!status) { 2432 if (!status) {
2426 entry->mask = 0; 2433 entry->mask = 0;
2427 if (res.access & NFS4_ACCESS_READ) 2434 if (res.access & NFS4_ACCESS_READ)
@@ -2488,7 +2495,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page,
2488 .rpc_resp = &res, 2495 .rpc_resp = &res,
2489 }; 2496 };
2490 2497
2491 return nfs4_call_sync(NFS_SERVER(inode), &msg, &args, &res, 0); 2498 return nfs4_call_sync(NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0);
2492} 2499}
2493 2500
2494static int nfs4_proc_readlink(struct inode *inode, struct page *page, 2501static int nfs4_proc_readlink(struct inode *inode, struct page *page,
@@ -2577,7 +2584,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name)
2577 if (res.dir_attr == NULL) 2584 if (res.dir_attr == NULL)
2578 goto out; 2585 goto out;
2579 2586
2580 status = nfs4_call_sync(server, &msg, &args, &res, 1); 2587 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 1);
2581 if (status == 0) { 2588 if (status == 0) {
2582 update_changeattr(dir, &res.cinfo); 2589 update_changeattr(dir, &res.cinfo);
2583 nfs_post_op_update_inode(dir, res.dir_attr); 2590 nfs_post_op_update_inode(dir, res.dir_attr);
@@ -2678,7 +2685,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
2678 if (res.old_fattr == NULL || res.new_fattr == NULL) 2685 if (res.old_fattr == NULL || res.new_fattr == NULL)
2679 goto out; 2686 goto out;
2680 2687
2681 status = nfs4_call_sync(server, &msg, &arg, &res, 1); 2688 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1);
2682 if (!status) { 2689 if (!status) {
2683 update_changeattr(old_dir, &res.old_cinfo); 2690 update_changeattr(old_dir, &res.old_cinfo);
2684 nfs_post_op_update_inode(old_dir, res.old_fattr); 2691 nfs_post_op_update_inode(old_dir, res.old_fattr);
@@ -2729,7 +2736,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *
2729 if (res.fattr == NULL || res.dir_attr == NULL) 2736 if (res.fattr == NULL || res.dir_attr == NULL)
2730 goto out; 2737 goto out;
2731 2738
2732 status = nfs4_call_sync(server, &msg, &arg, &res, 1); 2739 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1);
2733 if (!status) { 2740 if (!status) {
2734 update_changeattr(dir, &res.cinfo); 2741 update_changeattr(dir, &res.cinfo);
2735 nfs_post_op_update_inode(dir, res.dir_attr); 2742 nfs_post_op_update_inode(dir, res.dir_attr);
@@ -2793,7 +2800,7 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
2793static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data) 2800static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data)
2794{ 2801{
2795 int status = nfs4_call_sync(NFS_SERVER(dir), &data->msg, 2802 int status = nfs4_call_sync(NFS_SERVER(dir), &data->msg,
2796 &data->arg, &data->res, 1); 2803 &data->arg.seq_args, &data->res.seq_res, 1);
2797 if (status == 0) { 2804 if (status == 0) {
2798 update_changeattr(dir, &data->res.dir_cinfo); 2805 update_changeattr(dir, &data->res.dir_cinfo);
2799 nfs_post_op_update_inode(dir, data->res.dir_fattr); 2806 nfs_post_op_update_inode(dir, data->res.dir_fattr);
@@ -2905,7 +2912,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2905 (unsigned long long)cookie); 2912 (unsigned long long)cookie);
2906 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); 2913 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
2907 res.pgbase = args.pgbase; 2914 res.pgbase = args.pgbase;
2908 status = nfs4_call_sync(NFS_SERVER(dir), &msg, &args, &res, 0); 2915 status = nfs4_call_sync(NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
2909 if (status >= 0) { 2916 if (status >= 0) {
2910 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 2917 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
2911 status += args.pgbase; 2918 status += args.pgbase;
@@ -2997,7 +3004,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
2997 }; 3004 };
2998 3005
2999 nfs_fattr_init(fsstat->fattr); 3006 nfs_fattr_init(fsstat->fattr);
3000 return nfs4_call_sync(server, &msg, &args, &res, 0); 3007 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
3001} 3008}
3002 3009
3003static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat) 3010static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat)
@@ -3028,7 +3035,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
3028 .rpc_resp = &res, 3035 .rpc_resp = &res,
3029 }; 3036 };
3030 3037
3031 return nfs4_call_sync(server, &msg, &args, &res, 0); 3038 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
3032} 3039}
3033 3040
3034static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) 3041static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
@@ -3073,7 +3080,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle
3073 } 3080 }
3074 3081
3075 nfs_fattr_init(pathconf->fattr); 3082 nfs_fattr_init(pathconf->fattr);
3076 return nfs4_call_sync(server, &msg, &args, &res, 0); 3083 return nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
3077} 3084}
3078 3085
3079static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, 3086static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -3452,7 +3459,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
3452 resp_buf = buf; 3459 resp_buf = buf;
3453 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase); 3460 buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase);
3454 } 3461 }
3455 ret = nfs4_call_sync(NFS_SERVER(inode), &msg, &args, &res, 0); 3462 ret = nfs4_call_sync(NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0);
3456 if (ret) 3463 if (ret)
3457 goto out_free; 3464 goto out_free;
3458 if (res.acl_len > args.acl_len) 3465 if (res.acl_len > args.acl_len)
@@ -3527,7 +3534,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
3527 if (i < 0) 3534 if (i < 0)
3528 return i; 3535 return i;
3529 nfs_inode_return_delegation(inode); 3536 nfs_inode_return_delegation(inode);
3530 ret = nfs4_call_sync(server, &msg, &arg, &res, 1); 3537 ret = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1);
3531 3538
3532 /* 3539 /*
3533 * Free each page after tx, so the only ref left is 3540 * Free each page after tx, so the only ref left is
@@ -3890,7 +3897,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
3890 lsp = request->fl_u.nfs4_fl.owner; 3897 lsp = request->fl_u.nfs4_fl.owner;
3891 arg.lock_owner.id = lsp->ls_id.id; 3898 arg.lock_owner.id = lsp->ls_id.id;
3892 arg.lock_owner.s_dev = server->s_dev; 3899 arg.lock_owner.s_dev = server->s_dev;
3893 status = nfs4_call_sync(server, &msg, &arg, &res, 1); 3900 status = nfs4_call_sync(server, &msg, &arg.seq_args, &res.seq_res, 1);
3894 switch (status) { 3901 switch (status) {
3895 case 0: 3902 case 0:
3896 request->fl_type = F_UNLCK; 3903 request->fl_type = F_UNLCK;
@@ -4618,7 +4625,7 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
4618 nfs_fattr_init(&fs_locations->fattr); 4625 nfs_fattr_init(&fs_locations->fattr);
4619 fs_locations->server = server; 4626 fs_locations->server = server;
4620 fs_locations->nlocations = 0; 4627 fs_locations->nlocations = 0;
4621 status = nfs4_call_sync(server, &msg, &args, &res, 0); 4628 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
4622 nfs_fixup_referral_attributes(&fs_locations->fattr); 4629 nfs_fixup_referral_attributes(&fs_locations->fattr);
4623 dprintk("%s: returned status = %d\n", __func__, status); 4630 dprintk("%s: returned status = %d\n", __func__, status);
4624 return status; 4631 return status;
@@ -5586,7 +5593,7 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev)
5586 int status; 5593 int status;
5587 5594
5588 dprintk("--> %s\n", __func__); 5595 dprintk("--> %s\n", __func__);
5589 status = nfs4_call_sync(server, &msg, &args, &res, 0); 5596 status = nfs4_call_sync(server, &msg, &args.seq_args, &res.seq_res, 0);
5590 dprintk("<-- %s status=%d\n", __func__, status); 5597 dprintk("<-- %s status=%d\n", __func__, status);
5591 5598
5592 return status; 5599 return status;