[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] blktap: don't use vma->vm_start to calculate offset.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1240922626 -3600 # Node ID cb25b9d5a594a1d48594b6552a4f30be3575face # Parent 3232c6e19bdc219363446f837c4136dc9959c205 blktap: don't use vma->vm_start to calculate offset. struct vma can be split by partial munmap(), we can't depend on vm_start. Instead, use tap_blkif_t::rings_vstart. Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx> --- drivers/xen/blktap/blktap.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff -r 3232c6e19bdc -r cb25b9d5a594 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Tue Apr 28 13:43:06 2009 +0100 +++ b/drivers/xen/blktap/blktap.c Tue Apr 28 13:43:46 2009 +0100 @@ -317,7 +317,7 @@ static pte_t blktap_clear_pte(struct vm_ pte_t copy; tap_blkif_t *info; int offset, seg, usr_idx, pending_idx, mmap_idx; - unsigned long uvstart = vma->vm_start + (RING_PAGES << PAGE_SHIFT); + unsigned long uvstart; unsigned long kvaddr; struct tap_vma_priv *priv; struct page *pg; @@ -329,11 +329,15 @@ static pte_t blktap_clear_pte(struct vm_ * If the address is before the start of the grant mapped region or * if vm_file is NULL (meaning mmap failed and we have nothing to do) */ - if (uvaddr < uvstart || vma->vm_file == NULL) + if (vma->vm_file != NULL) { + info = vma->vm_file->private_data; + uvstart = info->rings_vstart + (RING_PAGES << PAGE_SHIFT); + } else + uvstart = uvaddr; /* make the following if clause true */ + if (uvaddr < uvstart) return ptep_get_and_clear_full(vma->vm_mm, uvaddr, ptep, is_fullmm); - info = vma->vm_file->private_data; priv = vma->vm_private_data; /* TODO Should these be changed to if statements? */ @@ -1200,8 +1204,7 @@ static int blktap_read_ufe_ring(tap_blki pg = pfn_to_page(__pa(kvaddr) >> PAGE_SHIFT); ClearPageReserved(pg); - offset = (uvaddr - info->vma->vm_start) - >> PAGE_SHIFT; + offset = (uvaddr - info->rings_vstart) >> PAGE_SHIFT; priv->map[offset] = NULL; } fast_flush_area(pending_req, pending_idx, usr_idx, info->minor); @@ -1492,7 +1495,7 @@ static void dispatch_rw_block_io(blkif_t set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT, FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT)); - offset = (uvaddr - info->vma->vm_start) >> PAGE_SHIFT; + offset = (uvaddr - info->rings_vstart) >> PAGE_SHIFT; pg = pfn_to_page(__pa(kvaddr) >> PAGE_SHIFT); priv->map[offset] = pg; } @@ -1519,7 +1522,7 @@ static void dispatch_rw_block_io(blkif_t if (ret) continue; - offset = (uvaddr - info->vma->vm_start) >> PAGE_SHIFT; + offset = (uvaddr - info->rings_vstart) >> PAGE_SHIFT; pg = pfn_to_page(__pa(kvaddr) >> PAGE_SHIFT); priv->map[offset] = pg; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |