diff options
author | Trond Myklebust <trondmy@gmail.com> | 2019-09-30 14:02:57 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2019-10-09 11:45:59 -0400 |
commit | 0b5748477924d2fb37f6b77d1a7eef600a96d722 (patch) | |
tree | 2df465caec5c90d38bc864a31e77b5dedee2f021 /fs/nfs/direct.c | |
parent | 031d73ed768a40684f3ca21992265ffdb6a270bf (diff) |
NFS: Remove redundant mirror tracking in O_DIRECT
We no longer need the extra mirror length tracking in the O_DIRECT code,
as we are able to track the maximum contiguous length in dreq->max_count.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r-- | fs/nfs/direct.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 98a9a0bcdf38..040a50fd9bf3 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -64,13 +64,6 @@ | |||
64 | 64 | ||
65 | static struct kmem_cache *nfs_direct_cachep; | 65 | static struct kmem_cache *nfs_direct_cachep; |
66 | 66 | ||
67 | /* | ||
68 | * This represents a set of asynchronous requests that we're waiting on | ||
69 | */ | ||
70 | struct nfs_direct_mirror { | ||
71 | ssize_t count; | ||
72 | }; | ||
73 | |||
74 | struct nfs_direct_req { | 67 | struct nfs_direct_req { |
75 | struct kref kref; /* release manager */ | 68 | struct kref kref; /* release manager */ |
76 | 69 | ||
@@ -84,9 +77,6 @@ struct nfs_direct_req { | |||
84 | atomic_t io_count; /* i/os we're waiting for */ | 77 | atomic_t io_count; /* i/os we're waiting for */ |
85 | spinlock_t lock; /* protect completion state */ | 78 | spinlock_t lock; /* protect completion state */ |
86 | 79 | ||
87 | struct nfs_direct_mirror mirrors[NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX]; | ||
88 | int mirror_count; | ||
89 | |||
90 | loff_t io_start; /* Start offset for I/O */ | 80 | loff_t io_start; /* Start offset for I/O */ |
91 | ssize_t count, /* bytes actually processed */ | 81 | ssize_t count, /* bytes actually processed */ |
92 | max_count, /* max expected count */ | 82 | max_count, /* max expected count */ |
@@ -127,8 +117,6 @@ nfs_direct_handle_truncated(struct nfs_direct_req *dreq, | |||
127 | const struct nfs_pgio_header *hdr, | 117 | const struct nfs_pgio_header *hdr, |
128 | ssize_t dreq_len) | 118 | ssize_t dreq_len) |
129 | { | 119 | { |
130 | struct nfs_direct_mirror *mirror = &dreq->mirrors[hdr->pgio_mirror_idx]; | ||
131 | |||
132 | if (!(test_bit(NFS_IOHDR_ERROR, &hdr->flags) || | 120 | if (!(test_bit(NFS_IOHDR_ERROR, &hdr->flags) || |
133 | test_bit(NFS_IOHDR_EOF, &hdr->flags))) | 121 | test_bit(NFS_IOHDR_EOF, &hdr->flags))) |
134 | return; | 122 | return; |
@@ -142,15 +130,12 @@ nfs_direct_handle_truncated(struct nfs_direct_req *dreq, | |||
142 | else /* Clear outstanding error if this is EOF */ | 130 | else /* Clear outstanding error if this is EOF */ |
143 | dreq->error = 0; | 131 | dreq->error = 0; |
144 | } | 132 | } |
145 | if (mirror->count > dreq_len) | ||
146 | mirror->count = dreq_len; | ||
147 | } | 133 | } |
148 | 134 | ||
149 | static void | 135 | static void |
150 | nfs_direct_count_bytes(struct nfs_direct_req *dreq, | 136 | nfs_direct_count_bytes(struct nfs_direct_req *dreq, |
151 | const struct nfs_pgio_header *hdr) | 137 | const struct nfs_pgio_header *hdr) |
152 | { | 138 | { |
153 | struct nfs_direct_mirror *mirror = &dreq->mirrors[hdr->pgio_mirror_idx]; | ||
154 | loff_t hdr_end = hdr->io_start + hdr->good_bytes; | 139 | loff_t hdr_end = hdr->io_start + hdr->good_bytes; |
155 | ssize_t dreq_len = 0; | 140 | ssize_t dreq_len = 0; |
156 | 141 | ||
@@ -162,8 +147,6 @@ nfs_direct_count_bytes(struct nfs_direct_req *dreq, | |||
162 | if (dreq_len > dreq->max_count) | 147 | if (dreq_len > dreq->max_count) |
163 | dreq_len = dreq->max_count; | 148 | dreq_len = dreq->max_count; |
164 | 149 | ||
165 | if (mirror->count < dreq_len) | ||
166 | mirror->count = dreq_len; | ||
167 | if (dreq->count < dreq_len) | 150 | if (dreq->count < dreq_len) |
168 | dreq->count = dreq_len; | 151 | dreq->count = dreq_len; |
169 | } | 152 | } |
@@ -310,18 +293,6 @@ void nfs_init_cinfo_from_dreq(struct nfs_commit_info *cinfo, | |||
310 | cinfo->completion_ops = &nfs_direct_commit_completion_ops; | 293 | cinfo->completion_ops = &nfs_direct_commit_completion_ops; |
311 | } | 294 | } |
312 | 295 | ||
313 | static inline void nfs_direct_setup_mirroring(struct nfs_direct_req *dreq, | ||
314 | struct nfs_pageio_descriptor *pgio, | ||
315 | struct nfs_page *req) | ||
316 | { | ||
317 | int mirror_count = 1; | ||
318 | |||
319 | if (pgio->pg_ops->pg_get_mirror_count) | ||
320 | mirror_count = pgio->pg_ops->pg_get_mirror_count(pgio, req); | ||
321 | |||
322 | dreq->mirror_count = mirror_count; | ||
323 | } | ||
324 | |||
325 | static inline struct nfs_direct_req *nfs_direct_req_alloc(void) | 296 | static inline struct nfs_direct_req *nfs_direct_req_alloc(void) |
326 | { | 297 | { |
327 | struct nfs_direct_req *dreq; | 298 | struct nfs_direct_req *dreq; |
@@ -336,7 +307,6 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void) | |||
336 | INIT_LIST_HEAD(&dreq->mds_cinfo.list); | 307 | INIT_LIST_HEAD(&dreq->mds_cinfo.list); |
337 | dreq->verf.committed = NFS_INVALID_STABLE_HOW; /* not set yet */ | 308 | dreq->verf.committed = NFS_INVALID_STABLE_HOW; /* not set yet */ |
338 | INIT_WORK(&dreq->work, nfs_direct_write_schedule_work); | 309 | INIT_WORK(&dreq->work, nfs_direct_write_schedule_work); |
339 | dreq->mirror_count = 1; | ||
340 | spin_lock_init(&dreq->lock); | 310 | spin_lock_init(&dreq->lock); |
341 | 311 | ||
342 | return dreq; | 312 | return dreq; |
@@ -655,7 +625,6 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) | |||
655 | LIST_HEAD(reqs); | 625 | LIST_HEAD(reqs); |
656 | struct nfs_commit_info cinfo; | 626 | struct nfs_commit_info cinfo; |
657 | LIST_HEAD(failed); | 627 | LIST_HEAD(failed); |
658 | int i; | ||
659 | 628 | ||
660 | nfs_init_cinfo_from_dreq(&cinfo, dreq); | 629 | nfs_init_cinfo_from_dreq(&cinfo, dreq); |
661 | nfs_direct_write_scan_commit_list(dreq->inode, &reqs, &cinfo); | 630 | nfs_direct_write_scan_commit_list(dreq->inode, &reqs, &cinfo); |
@@ -666,21 +635,12 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) | |||
666 | dreq->max_count += req->wb_bytes; | 635 | dreq->max_count += req->wb_bytes; |
667 | dreq->verf.committed = NFS_INVALID_STABLE_HOW; | 636 | dreq->verf.committed = NFS_INVALID_STABLE_HOW; |
668 | nfs_clear_pnfs_ds_commit_verifiers(&dreq->ds_cinfo); | 637 | nfs_clear_pnfs_ds_commit_verifiers(&dreq->ds_cinfo); |
669 | for (i = 0; i < dreq->mirror_count; i++) | ||
670 | dreq->mirrors[i].count = 0; | ||
671 | get_dreq(dreq); | 638 | get_dreq(dreq); |
672 | 639 | ||
673 | nfs_pageio_init_write(&desc, dreq->inode, FLUSH_STABLE, false, | 640 | nfs_pageio_init_write(&desc, dreq->inode, FLUSH_STABLE, false, |
674 | &nfs_direct_write_completion_ops); | 641 | &nfs_direct_write_completion_ops); |
675 | desc.pg_dreq = dreq; | 642 | desc.pg_dreq = dreq; |
676 | 643 | ||
677 | req = nfs_list_entry(reqs.next); | ||
678 | nfs_direct_setup_mirroring(dreq, &desc, req); | ||
679 | if (desc.pg_error < 0) { | ||
680 | list_splice_init(&reqs, &failed); | ||
681 | goto out_failed; | ||
682 | } | ||
683 | |||
684 | list_for_each_entry_safe(req, tmp, &reqs, wb_list) { | 644 | list_for_each_entry_safe(req, tmp, &reqs, wb_list) { |
685 | /* Bump the transmission count */ | 645 | /* Bump the transmission count */ |
686 | req->wb_nio++; | 646 | req->wb_nio++; |
@@ -698,7 +658,6 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) | |||
698 | } | 658 | } |
699 | nfs_pageio_complete(&desc); | 659 | nfs_pageio_complete(&desc); |
700 | 660 | ||
701 | out_failed: | ||
702 | while (!list_empty(&failed)) { | 661 | while (!list_empty(&failed)) { |
703 | req = nfs_list_entry(failed.next); | 662 | req = nfs_list_entry(failed.next); |
704 | nfs_list_remove_request(req); | 663 | nfs_list_remove_request(req); |
@@ -931,7 +890,6 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | |||
931 | break; | 890 | break; |
932 | } | 891 | } |
933 | 892 | ||
934 | nfs_direct_setup_mirroring(dreq, &desc, req); | ||
935 | if (desc.pg_error < 0) { | 893 | if (desc.pg_error < 0) { |
936 | nfs_free_request(req); | 894 | nfs_free_request(req); |
937 | result = desc.pg_error; | 895 | result = desc.pg_error; |