[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 04/12] xen/blkback: use grant-table.c hypercall wrappers



Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
 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 15ec4db..1e256dc 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -324,6 +324,7 @@ struct seg_buf {
 static void xen_blkbk_unmap(struct pending_req *req)
 {
        struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+       struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];
        unsigned int i, invcount = 0;
        grant_handle_t handle;
        int ret;
@@ -335,25 +336,12 @@ static void xen_blkbk_unmap(struct pending_req *req)
                gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i),
                                    GNTMAP_host_map, handle);
                pending_handle(req, i) = BLKBACK_INVALID_HANDLE;
+               pages[invcount] = virt_to_page(vaddr(req, i));
                invcount++;
        }
 
-       ret = HYPERVISOR_grant_table_op(
-               GNTTABOP_unmap_grant_ref, unmap, invcount);
+       ret = gnttab_unmap_refs(unmap, pages, invcount, false);
        BUG_ON(ret);
-       /*
-        * Note, we use invcount, so nr->pages, so we can't index
-        * using vaddr(req, i).
-        */
-       for (i = 0; i < invcount; i++) {
-               ret = m2p_remove_override(
-                       virt_to_page(unmap[i].host_addr), false);
-               if (ret) {
-                       pr_alert(DRV_PFX "Failed to remove M2P override for 
%lx\n",
-                                (unsigned long)unmap[i].host_addr);
-                       continue;
-               }
-       }
 }
 
 static int xen_blkbk_map(struct blkif_request *req,
@@ -381,7 +369,7 @@ static int xen_blkbk_map(struct blkif_request *req,
                                  pending_req->blkif->domid);
        }
 
-       ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nseg);
+       ret = gnttab_map_refs(map, NULL, &blkbk->pending_page(pending_req, 0), 
nseg);
        BUG_ON(ret);
 
        /*
@@ -401,15 +389,6 @@ static int xen_blkbk_map(struct blkif_request *req,
                if (ret)
                        continue;
 
-               ret = m2p_add_override(PFN_DOWN(map[i].dev_bus_addr),
-                       blkbk->pending_page(pending_req, i), NULL);
-               if (ret) {
-                       pr_alert(DRV_PFX "Failed to install M2P override for 
%lx (ret: %d)\n",
-                                (unsigned long)map[i].dev_bus_addr, ret);
-                       /* We could switch over to GNTTABOP_copy */
-                       continue;
-               }
-
                seg[i].buf  = map[i].dev_bus_addr |
                        (req->u.rw.seg[i].first_sect << 9);
        }
-- 
1.7.7.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.