aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-01-04 13:19:55 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-01-04 13:19:55 -0500
commit942e3d72a62dcfe5bf1569b179174718bbbcfbc3 (patch)
treeb13189dfe2f9a86123aee14ef365d9e9729d46cb /fs/nfs/direct.c
parent58baac0ac7cc13a690f6f7cea23accaf84e843a0 (diff)
parent506c0d68269e90d354b3cbfc7523611b026c88d0 (diff)
Merge branch 'pnfs_generic'
* pnfs_generic: NFSv4.1/pNFS: Cleanup constify struct pnfs_layout_range arguments NFSv4.1/pnfs: Cleanup copying of pnfs_layout_range structures NFSv4.1/pNFS: Cleanup pnfs_mark_matching_lsegs_invalid() NFSv4.1/pNFS: Fix a race in initiate_file_draining() NFSv4.1/pNFS: pnfs_error_mark_layout_for_return() must always return layout NFSv4.1/pNFS: pnfs_mark_matching_lsegs_return() should set the iomode NFSv4.1/pNFS: Use nfs4_stateid_copy for copying stateids NFSv4.1/pNFS: Don't pass stateids by value to pnfs_send_layoutreturn() NFS: Relax requirements in nfs_flush_incompatible NFSv4.1/pNFS: Don't queue up a new commit if the layout segment is invalid NFS: Allow multiple commit requests in flight per file NFS/pNFS: Fix up pNFS write reschedule layering violations and bugs NFSv4: List stateid information in the callback tracepoints NFSv4.1/pNFS: Don't return NFS4ERR_DELAY unnecessarily in CB_LAYOUTRECALL NFSv4.1/pNFS: Ensure we enforce RFC5661 Section 12.5.5.2.1 pNFS: If we have to delay the layout callback, mark the layout for return NFSv4.1/pNFS: Add a helper to mark the layout as returned pNFS: Ensure nfs4_layoutget_prepare returns the correct error
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 2e7142bcb4c8..7ab7ec9f4eed 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -117,12 +117,6 @@ static inline int put_dreq(struct nfs_direct_req *dreq)
117 return atomic_dec_and_test(&dreq->io_count); 117 return atomic_dec_and_test(&dreq->io_count);
118} 118}
119 119
120void nfs_direct_set_resched_writes(struct nfs_direct_req *dreq)
121{
122 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
123}
124EXPORT_SYMBOL_GPL(nfs_direct_set_resched_writes);
125
126static void 120static void
127nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr) 121nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr)
128{ 122{
@@ -735,14 +729,20 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
735 nfs_direct_write_complete(dreq, data->inode); 729 nfs_direct_write_complete(dreq, data->inode);
736} 730}
737 731
738static void nfs_direct_error_cleanup(struct nfs_inode *nfsi) 732static void nfs_direct_resched_write(struct nfs_commit_info *cinfo,
733 struct nfs_page *req)
739{ 734{
740 /* There is no lock to clear */ 735 struct nfs_direct_req *dreq = cinfo->dreq;
736
737 spin_lock(&dreq->lock);
738 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
739 spin_unlock(&dreq->lock);
740 nfs_mark_request_commit(req, NULL, cinfo, 0);
741} 741}
742 742
743static const struct nfs_commit_completion_ops nfs_direct_commit_completion_ops = { 743static const struct nfs_commit_completion_ops nfs_direct_commit_completion_ops = {
744 .completion = nfs_direct_commit_complete, 744 .completion = nfs_direct_commit_complete,
745 .error_cleanup = nfs_direct_error_cleanup, 745 .resched_write = nfs_direct_resched_write,
746}; 746};
747 747
748static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) 748static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
@@ -847,10 +847,25 @@ static void nfs_write_sync_pgio_error(struct list_head *head)
847 } 847 }
848} 848}
849 849
850static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr)
851{
852 struct nfs_direct_req *dreq = hdr->dreq;
853
854 spin_lock(&dreq->lock);
855 if (dreq->error == 0) {
856 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
857 /* fake unstable write to let common nfs resend pages */
858 hdr->verf.committed = NFS_UNSTABLE;
859 hdr->good_bytes = hdr->args.count;
860 }
861 spin_unlock(&dreq->lock);
862}
863
850static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = { 864static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = {
851 .error_cleanup = nfs_write_sync_pgio_error, 865 .error_cleanup = nfs_write_sync_pgio_error,
852 .init_hdr = nfs_direct_pgio_init, 866 .init_hdr = nfs_direct_pgio_init,
853 .completion = nfs_direct_write_completion, 867 .completion = nfs_direct_write_completion,
868 .reschedule_io = nfs_direct_write_reschedule_io,
854}; 869};
855 870
856 871