diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-14 15:39:59 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:05:30 -0500 |
commit | 84115e1cd4a3614c4e566d4cce31381dce3dbef9 (patch) | |
tree | 01b2de7163deb6b3a789811183d8b8c1329b900c /fs/nfs/write.c | |
parent | e8914c65f7f8d4e8701b8e78a12b714872ea0402 (diff) |
SUNRPC: Cleanup of rpc_task initialisation
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r-- | fs/nfs/write.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 092e79c6d962..c4376606f106 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -773,8 +773,14 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
773 | unsigned int count, unsigned int offset, | 773 | unsigned int count, unsigned int offset, |
774 | int how) | 774 | int how) |
775 | { | 775 | { |
776 | struct inode *inode; | 776 | struct inode *inode = req->wb_context->path.dentry->d_inode; |
777 | int flags; | 777 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
778 | struct rpc_task_setup task_setup_data = { | ||
779 | .rpc_client = NFS_CLIENT(inode), | ||
780 | .callback_ops = call_ops, | ||
781 | .callback_data = data, | ||
782 | .flags = flags, | ||
783 | }; | ||
778 | 784 | ||
779 | /* Set up the RPC argument and reply structs | 785 | /* Set up the RPC argument and reply structs |
780 | * NB: take care not to mess about with data->commit et al. */ | 786 | * NB: take care not to mess about with data->commit et al. */ |
@@ -796,8 +802,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
796 | nfs_fattr_init(&data->fattr); | 802 | nfs_fattr_init(&data->fattr); |
797 | 803 | ||
798 | /* Set up the initial task struct. */ | 804 | /* Set up the initial task struct. */ |
799 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 805 | rpc_init_task(&data->task, &task_setup_data); |
800 | rpc_init_task(&data->task, NFS_CLIENT(inode), flags, call_ops, data); | ||
801 | NFS_PROTO(inode)->write_setup(data, how); | 806 | NFS_PROTO(inode)->write_setup(data, how); |
802 | 807 | ||
803 | data->task.tk_priority = flush_task_priority(how); | 808 | data->task.tk_priority = flush_task_priority(how); |
@@ -1144,16 +1149,20 @@ static void nfs_commit_rpcsetup(struct list_head *head, | |||
1144 | struct nfs_write_data *data, | 1149 | struct nfs_write_data *data, |
1145 | int how) | 1150 | int how) |
1146 | { | 1151 | { |
1147 | struct nfs_page *first; | 1152 | struct nfs_page *first = nfs_list_entry(head->next); |
1148 | struct inode *inode; | 1153 | struct inode *inode = first->wb_context->path.dentry->d_inode; |
1149 | int flags; | 1154 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; |
1155 | struct rpc_task_setup task_setup_data = { | ||
1156 | .rpc_client = NFS_CLIENT(inode), | ||
1157 | .callback_ops = &nfs_commit_ops, | ||
1158 | .callback_data = data, | ||
1159 | .flags = flags, | ||
1160 | }; | ||
1150 | 1161 | ||
1151 | /* Set up the RPC argument and reply structs | 1162 | /* Set up the RPC argument and reply structs |
1152 | * NB: take care not to mess about with data->commit et al. */ | 1163 | * NB: take care not to mess about with data->commit et al. */ |
1153 | 1164 | ||
1154 | list_splice_init(head, &data->pages); | 1165 | list_splice_init(head, &data->pages); |
1155 | first = nfs_list_entry(data->pages.next); | ||
1156 | inode = first->wb_context->path.dentry->d_inode; | ||
1157 | 1166 | ||
1158 | data->inode = inode; | 1167 | data->inode = inode; |
1159 | data->cred = first->wb_context->cred; | 1168 | data->cred = first->wb_context->cred; |
@@ -1168,8 +1177,7 @@ static void nfs_commit_rpcsetup(struct list_head *head, | |||
1168 | nfs_fattr_init(&data->fattr); | 1177 | nfs_fattr_init(&data->fattr); |
1169 | 1178 | ||
1170 | /* Set up the initial task struct. */ | 1179 | /* Set up the initial task struct. */ |
1171 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | 1180 | rpc_init_task(&data->task, &task_setup_data); |
1172 | rpc_init_task(&data->task, NFS_CLIENT(inode), flags, &nfs_commit_ops, data); | ||
1173 | NFS_PROTO(inode)->commit_setup(data, how); | 1181 | NFS_PROTO(inode)->commit_setup(data, how); |
1174 | 1182 | ||
1175 | data->task.tk_priority = flush_task_priority(how); | 1183 | data->task.tk_priority = flush_task_priority(how); |