aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c55
1 files changed, 7 insertions, 48 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 0e34c7024195..e46a1fc6c1fe 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -932,60 +932,18 @@ static int flush_task_priority(int how)
932 return RPC_PRIORITY_NORMAL; 932 return RPC_PRIORITY_NORMAL;
933} 933}
934 934
935int nfs_initiate_write(struct rpc_clnt *clnt, 935static void nfs_initiate_write(struct nfs_pgio_data *data, struct rpc_message *msg,
936 struct nfs_pgio_data *data, 936 struct rpc_task_setup *task_setup_data, int how)
937 const struct rpc_call_ops *call_ops,
938 int how, int flags)
939{ 937{
940 struct inode *inode = data->header->inode; 938 struct inode *inode = data->header->inode;
941 int priority = flush_task_priority(how); 939 int priority = flush_task_priority(how);
942 struct rpc_task *task;
943 struct rpc_message msg = {
944 .rpc_argp = &data->args,
945 .rpc_resp = &data->res,
946 .rpc_cred = data->header->cred,
947 };
948 struct rpc_task_setup task_setup_data = {
949 .rpc_client = clnt,
950 .task = &data->task,
951 .rpc_message = &msg,
952 .callback_ops = call_ops,
953 .callback_data = data,
954 .workqueue = nfsiod_workqueue,
955 .flags = RPC_TASK_ASYNC | flags,
956 .priority = priority,
957 };
958 int ret = 0;
959 940
960 /* Set up the initial task struct. */ 941 task_setup_data->priority = priority;
961 NFS_PROTO(inode)->write_setup(data, &msg); 942 NFS_PROTO(inode)->write_setup(data, msg);
962
963 dprintk("NFS: %5u initiated write call "
964 "(req %s/%llu, %u bytes @ offset %llu)\n",
965 data->task.tk_pid,
966 inode->i_sb->s_id,
967 (unsigned long long)NFS_FILEID(inode),
968 data->args.count,
969 (unsigned long long)data->args.offset);
970 943
971 nfs4_state_protect_write(NFS_SERVER(inode)->nfs_client, 944 nfs4_state_protect_write(NFS_SERVER(inode)->nfs_client,
972 &task_setup_data.rpc_client, &msg, data); 945 &task_setup_data->rpc_client, msg, data);
973
974 task = rpc_run_task(&task_setup_data);
975 if (IS_ERR(task)) {
976 ret = PTR_ERR(task);
977 goto out;
978 }
979 if (how & FLUSH_SYNC) {
980 ret = rpc_wait_for_completion_task(task);
981 if (ret == 0)
982 ret = task->tk_status;
983 }
984 rpc_put_task(task);
985out:
986 return ret;
987} 946}
988EXPORT_SYMBOL_GPL(nfs_initiate_write);
989 947
990static int nfs_do_write(struct nfs_pgio_data *data, 948static int nfs_do_write(struct nfs_pgio_data *data,
991 const struct rpc_call_ops *call_ops, 949 const struct rpc_call_ops *call_ops,
@@ -993,7 +951,7 @@ static int nfs_do_write(struct nfs_pgio_data *data,
993{ 951{
994 struct inode *inode = data->header->inode; 952 struct inode *inode = data->header->inode;
995 953
996 return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how, 0); 954 return nfs_initiate_pgio(NFS_CLIENT(inode), data, call_ops, how, 0);
997} 955}
998 956
999static int nfs_do_multiple_writes(struct list_head *head, 957static int nfs_do_multiple_writes(struct list_head *head,
@@ -1743,4 +1701,5 @@ static const struct nfs_rw_ops nfs_rw_write_ops = {
1743 .rw_release = nfs_writeback_release_common, 1701 .rw_release = nfs_writeback_release_common,
1744 .rw_done = nfs_writeback_done, 1702 .rw_done = nfs_writeback_done,
1745 .rw_result = nfs_writeback_result, 1703 .rw_result = nfs_writeback_result,
1704 .rw_initiate = nfs_initiate_write,
1746}; 1705};