Commit ffb1dabd authored by Roger Pau Monne's avatar Roger Pau Monne Committed by Konrad Rzeszutek Wilk

xen-blkback: don't store dev_bus_addr

dev_bus_addr returned in the grant ref map operation is the mfn of the
passed page, there's no need to store it in the persistent grant
entry, since we can always get it provided that we have the page.

This reduces the memory overhead of persistent grants in blkback.

While at it, rename the 'seg[i].buf' to be 'seg[i].offset' as
it makes much more sense - as we use that value in bio_add_page
which as the fourth argument expects the offset.

We hadn't used the physical address as part of this at all.
Signed-off-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xen.org
[v1: s/buf/offset/]
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 155b7edb
...@@ -442,7 +442,7 @@ int xen_blkif_schedule(void *arg) ...@@ -442,7 +442,7 @@ int xen_blkif_schedule(void *arg)
} }
struct seg_buf { struct seg_buf {
unsigned long buf; unsigned int offset;
unsigned int nsec; unsigned int nsec;
}; };
/* /*
...@@ -621,30 +621,21 @@ static int xen_blkbk_map(struct blkif_request *req, ...@@ -621,30 +621,21 @@ static int xen_blkbk_map(struct blkif_request *req,
* If this is a new persistent grant * If this is a new persistent grant
* save the handler * save the handler
*/ */
persistent_gnts[i]->handle = map[j].handle; persistent_gnts[i]->handle = map[j++].handle;
persistent_gnts[i]->dev_bus_addr =
map[j++].dev_bus_addr;
} }
pending_handle(pending_req, i) = pending_handle(pending_req, i) =
persistent_gnts[i]->handle; persistent_gnts[i]->handle;
if (ret) if (ret)
continue; continue;
seg[i].buf = persistent_gnts[i]->dev_bus_addr |
(req->u.rw.seg[i].first_sect << 9);
} else { } else {
pending_handle(pending_req, i) = map[j].handle; pending_handle(pending_req, i) = map[j++].handle;
bitmap_set(pending_req->unmap_seg, i, 1); bitmap_set(pending_req->unmap_seg, i, 1);
if (ret) { if (ret)
j++;
continue; continue;
}
seg[i].buf = map[j++].dev_bus_addr |
(req->u.rw.seg[i].first_sect << 9);
} }
seg[i].offset = (req->u.rw.seg[i].first_sect << 9);
} }
return ret; return ret;
} }
...@@ -971,7 +962,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, ...@@ -971,7 +962,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
(bio_add_page(bio, (bio_add_page(bio,
pages[i], pages[i],
seg[i].nsec << 9, seg[i].nsec << 9,
seg[i].buf & ~PAGE_MASK) == 0)) { seg[i].offset) == 0)) {
bio = bio_alloc(GFP_KERNEL, nseg-i); bio = bio_alloc(GFP_KERNEL, nseg-i);
if (unlikely(bio == NULL)) if (unlikely(bio == NULL))
......
...@@ -187,7 +187,6 @@ struct persistent_gnt { ...@@ -187,7 +187,6 @@ struct persistent_gnt {
struct page *page; struct page *page;
grant_ref_t gnt; grant_ref_t gnt;
grant_handle_t handle; grant_handle_t handle;
uint64_t dev_bus_addr;
struct rb_node node; struct rb_node node;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment