diff options
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r-- | fs/nfs/direct.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 018a06a062bd..e97a67e40b48 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -131,20 +131,25 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr) | |||
131 | 131 | ||
132 | WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count); | 132 | WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count); |
133 | 133 | ||
134 | count = dreq->mirrors[hdr->pgio_mirror_idx].count; | 134 | if (dreq->mirror_count == 1) { |
135 | if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) { | 135 | dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes; |
136 | count = hdr->io_start + hdr->good_bytes - dreq->io_start; | 136 | dreq->count += hdr->good_bytes; |
137 | dreq->mirrors[hdr->pgio_mirror_idx].count = count; | 137 | } else { |
138 | } | 138 | /* mirrored writes */ |
139 | 139 | count = dreq->mirrors[hdr->pgio_mirror_idx].count; | |
140 | /* update the dreq->count by finding the minimum agreed count from all | 140 | if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) { |
141 | * mirrors */ | 141 | count = hdr->io_start + hdr->good_bytes - dreq->io_start; |
142 | count = dreq->mirrors[0].count; | 142 | dreq->mirrors[hdr->pgio_mirror_idx].count = count; |
143 | } | ||
144 | /* update the dreq->count by finding the minimum agreed count from all | ||
145 | * mirrors */ | ||
146 | count = dreq->mirrors[0].count; | ||
143 | 147 | ||
144 | for (i = 1; i < dreq->mirror_count; i++) | 148 | for (i = 1; i < dreq->mirror_count; i++) |
145 | count = min(count, dreq->mirrors[i].count); | 149 | count = min(count, dreq->mirrors[i].count); |
146 | 150 | ||
147 | dreq->count = count; | 151 | dreq->count = count; |
152 | } | ||
148 | } | 153 | } |
149 | 154 | ||
150 | /* | 155 | /* |