diff options
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r-- | drivers/block/xen-blkfront.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 6af250113c2a..2bdebcb3ff16 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -186,31 +186,30 @@ static int blkif_queue_request(struct request *req) | |||
186 | 186 | ||
187 | ring_req->nr_segments = 0; | 187 | ring_req->nr_segments = 0; |
188 | rq_for_each_segment(bvec, req, iter) { | 188 | rq_for_each_segment(bvec, req, iter) { |
189 | BUG_ON(ring_req->nr_segments | 189 | BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST); |
190 | == BLKIF_MAX_SEGMENTS_PER_REQUEST); | 190 | buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page)); |
191 | buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page)); | 191 | fsect = bvec->bv_offset >> 9; |
192 | fsect = bvec->bv_offset >> 9; | 192 | lsect = fsect + (bvec->bv_len >> 9) - 1; |
193 | lsect = fsect + (bvec->bv_len >> 9) - 1; | 193 | /* install a grant reference. */ |
194 | /* install a grant reference. */ | 194 | ref = gnttab_claim_grant_reference(&gref_head); |
195 | ref = gnttab_claim_grant_reference(&gref_head); | 195 | BUG_ON(ref == -ENOSPC); |
196 | BUG_ON(ref == -ENOSPC); | 196 | |
197 | 197 | gnttab_grant_foreign_access_ref( | |
198 | gnttab_grant_foreign_access_ref( | ||
199 | ref, | 198 | ref, |
200 | info->xbdev->otherend_id, | 199 | info->xbdev->otherend_id, |
201 | buffer_mfn, | 200 | buffer_mfn, |
202 | rq_data_dir(req) ); | 201 | rq_data_dir(req) ); |
203 | 202 | ||
204 | info->shadow[id].frame[ring_req->nr_segments] = | 203 | info->shadow[id].frame[ring_req->nr_segments] = |
205 | mfn_to_pfn(buffer_mfn); | 204 | mfn_to_pfn(buffer_mfn); |
206 | 205 | ||
207 | ring_req->seg[ring_req->nr_segments] = | 206 | ring_req->seg[ring_req->nr_segments] = |
208 | (struct blkif_request_segment) { | 207 | (struct blkif_request_segment) { |
209 | .gref = ref, | 208 | .gref = ref, |
210 | .first_sect = fsect, | 209 | .first_sect = fsect, |
211 | .last_sect = lsect }; | 210 | .last_sect = lsect }; |
212 | 211 | ||
213 | ring_req->nr_segments++; | 212 | ring_req->nr_segments++; |
214 | } | 213 | } |
215 | 214 | ||
216 | info->ring.req_prod_pvt++; | 215 | info->ring.req_prod_pvt++; |