diff options
author | Daniel De Graaf <dgdegra@tycho.nsa.gov> | 2011-11-28 11:49:03 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-20 07:52:41 -0400 |
commit | 4f14faaab4ee46a046b6baff85644be199de718c (patch) | |
tree | 4aae9cfd08498d4476f045d0fe56c2f78ed7e68e | |
parent | c16fa4f2ad19908a47c63d8fa436a1178438c7e7 (diff) |
xen/blkback: use grant-table.c hypercall wrappers
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | drivers/block/xen-blkback/blkback.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 0088bf60f368..31743534d1e5 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -321,6 +321,7 @@ struct seg_buf { | |||
321 | static void xen_blkbk_unmap(struct pending_req *req) | 321 | static void xen_blkbk_unmap(struct pending_req *req) |
322 | { | 322 | { |
323 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 323 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
324 | struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
324 | unsigned int i, invcount = 0; | 325 | unsigned int i, invcount = 0; |
325 | grant_handle_t handle; | 326 | grant_handle_t handle; |
326 | int ret; | 327 | int ret; |
@@ -332,25 +333,12 @@ static void xen_blkbk_unmap(struct pending_req *req) | |||
332 | gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), | 333 | gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), |
333 | GNTMAP_host_map, handle); | 334 | GNTMAP_host_map, handle); |
334 | pending_handle(req, i) = BLKBACK_INVALID_HANDLE; | 335 | pending_handle(req, i) = BLKBACK_INVALID_HANDLE; |
336 | pages[invcount] = virt_to_page(vaddr(req, i)); | ||
335 | invcount++; | 337 | invcount++; |
336 | } | 338 | } |
337 | 339 | ||
338 | ret = HYPERVISOR_grant_table_op( | 340 | ret = gnttab_unmap_refs(unmap, pages, invcount, false); |
339 | GNTTABOP_unmap_grant_ref, unmap, invcount); | ||
340 | BUG_ON(ret); | 341 | BUG_ON(ret); |
341 | /* | ||
342 | * Note, we use invcount, so nr->pages, so we can't index | ||
343 | * using vaddr(req, i). | ||
344 | */ | ||
345 | for (i = 0; i < invcount; i++) { | ||
346 | ret = m2p_remove_override( | ||
347 | virt_to_page(unmap[i].host_addr), false); | ||
348 | if (ret) { | ||
349 | pr_alert(DRV_PFX "Failed to remove M2P override for %lx\n", | ||
350 | (unsigned long)unmap[i].host_addr); | ||
351 | continue; | ||
352 | } | ||
353 | } | ||
354 | } | 342 | } |
355 | 343 | ||
356 | static int xen_blkbk_map(struct blkif_request *req, | 344 | static int xen_blkbk_map(struct blkif_request *req, |
@@ -378,7 +366,7 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
378 | pending_req->blkif->domid); | 366 | pending_req->blkif->domid); |
379 | } | 367 | } |
380 | 368 | ||
381 | ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nseg); | 369 | ret = gnttab_map_refs(map, NULL, &blkbk->pending_page(pending_req, 0), nseg); |
382 | BUG_ON(ret); | 370 | BUG_ON(ret); |
383 | 371 | ||
384 | /* | 372 | /* |
@@ -398,15 +386,6 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
398 | if (ret) | 386 | if (ret) |
399 | continue; | 387 | continue; |
400 | 388 | ||
401 | ret = m2p_add_override(PFN_DOWN(map[i].dev_bus_addr), | ||
402 | blkbk->pending_page(pending_req, i), NULL); | ||
403 | if (ret) { | ||
404 | pr_alert(DRV_PFX "Failed to install M2P override for %lx (ret: %d)\n", | ||
405 | (unsigned long)map[i].dev_bus_addr, ret); | ||
406 | /* We could switch over to GNTTABOP_copy */ | ||
407 | continue; | ||
408 | } | ||
409 | |||
410 | seg[i].buf = map[i].dev_bus_addr | | 389 | seg[i].buf = map[i].dev_bus_addr | |
411 | (req->u.rw.seg[i].first_sect << 9); | 390 | (req->u.rw.seg[i].first_sect << 9); |
412 | } | 391 | } |