[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 05/16] tmem: cleanup: rm unneeded parameters from get path
On Wed, Nov 20, 2013 at 04:46:14PM +0800, Bob Liu wrote: > tmem only takes a page as unit, so parameters tmem_offset, pfn_offset and len > are meanless, this patch remove them from do_tmem_get() related path. Could you just squash this and the previous one please? > > Signed-off-by: Bob Liu <bob.liu@xxxxxxxxxx> > --- > xen/common/tmem.c | 19 ++++++++----------- > xen/common/tmem_xen.c | 18 ++++-------------- > xen/include/xen/tmem_xen.h | 3 +-- > 3 files changed, 13 insertions(+), 27 deletions(-) > > diff --git a/xen/common/tmem.c b/xen/common/tmem.c > index e2e69bf..de3559d 100644 > --- a/xen/common/tmem.c > +++ b/xen/common/tmem.c > @@ -330,8 +330,7 @@ static int pcd_copy_to_client(xen_pfn_t cmfn, struct > tmem_page_descriptor *pgp) > else if ( tmem_tze_enabled() && pcd->size < PAGE_SIZE ) > ret = tmem_copy_tze_to_client(cmfn, pcd->tze, pcd->size); > else > - ret = tmem_copy_to_client(cmfn, pcd->pfp, 0, 0, PAGE_SIZE, > - tmem_cli_buf_null); > + ret = tmem_copy_to_client(cmfn, pcd->pfp, tmem_cli_buf_null); > tmem_read_unlock(&pcd_tree_rwlocks[firstbyte]); > return ret; > } > @@ -1647,8 +1646,7 @@ free: > } > > static int do_tmem_get(struct tmem_pool *pool, struct oid *oidp, uint32_t > index, > - xen_pfn_t cmfn, pagesize_t tmem_offset, > - pagesize_t pfn_offset, pagesize_t len, tmem_cli_va_param_t > clibuf) > + xen_pfn_t cmfn, tmem_cli_va_param_t clibuf) > { > struct tmem_object_root *obj; > struct tmem_page_descriptor *pgp; > @@ -1680,12 +1678,10 @@ static int do_tmem_get(struct tmem_pool *pool, struct > oid *oidp, uint32_t index, > rc = pcd_copy_to_client(cmfn, pgp); > else if ( pgp->size != 0 ) > { > - rc = tmem_decompress_to_client(cmfn, pgp->cdata, > - pgp->size, clibuf); > + rc = tmem_decompress_to_client(cmfn, pgp->cdata, pgp->size, clibuf); > } > else > - rc = tmem_copy_to_client(cmfn, pgp->pfp, tmem_offset, > - pfn_offset, len, clibuf); > + rc = tmem_copy_to_client(cmfn, pgp->pfp, clibuf); > if ( rc <= 0 ) > goto bad_copy; > > @@ -2377,7 +2373,7 @@ static int tmemc_save_get_next_page(int cli_id, > uint32_t pool_id, > h.index = pgp->index; > tmem_copy_to_client_buf(buf, &h, 1); > tmem_client_buf_add(buf, sizeof(h)); > - ret = do_tmem_get(pool, &oid, pgp->index, 0, 0, 0, pagesize, buf); > + ret = do_tmem_get(pool, &oid, pgp->index, 0, buf); > > out: > tmem_spin_unlock(&pers_lists_spinlock); > @@ -2647,13 +2643,14 @@ EXPORT long do_tmem_op(tmem_cli_op_t uops) > break; > case TMEM_PUT_PAGE: > tmem_ensure_avail_pages(); > - rc = do_tmem_put(pool, oidp, op.u.gen.index, op.u.gen.cmfn, > tmem_cli_buf_null); > + rc = do_tmem_put(pool, oidp, op.u.gen.index, op.u.gen.cmfn, > + tmem_cli_buf_null); > if (rc == 1) succ_put = 1; > else non_succ_put = 1; > break; > case TMEM_GET_PAGE: > rc = do_tmem_get(pool, oidp, op.u.gen.index, op.u.gen.cmfn, > - 0, 0, PAGE_SIZE, tmem_cli_buf_null); > + tmem_cli_buf_null); > if (rc == 1) succ_get = 1; > else non_succ_get = 1; > break; > diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c > index 165c7cf..efc2259 100644 > --- a/xen/common/tmem_xen.c > +++ b/xen/common/tmem_xen.c > @@ -164,7 +164,6 @@ EXPORT int tmem_compress_from_client(xen_pfn_t cmfn, > } > > EXPORT int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp, > - pagesize_t tmem_offset, pagesize_t pfn_offset, pagesize_t len, > tmem_cli_va_param_t clibuf) > { > unsigned long tmem_mfn, cli_mfn = 0; > @@ -172,8 +171,6 @@ EXPORT int tmem_copy_to_client(xen_pfn_t cmfn, struct > page_info *pfp, > struct page_info *cli_pfp = NULL; > int rc = 1; > > - if ( tmem_offset > PAGE_SIZE || pfn_offset > PAGE_SIZE || len > > PAGE_SIZE ) > - return -EINVAL; > ASSERT(pfp != NULL); > if ( guest_handle_is_null(clibuf) ) > { > @@ -183,21 +180,14 @@ EXPORT int tmem_copy_to_client(xen_pfn_t cmfn, struct > page_info *pfp, > } > tmem_mfn = page_to_mfn(pfp); > tmem_va = map_domain_page(tmem_mfn); > - if ( len == PAGE_SIZE && !tmem_offset && !pfn_offset && cli_va ) > - memcpy(cli_va, tmem_va, PAGE_SIZE); > - else if ( (tmem_offset+len <= PAGE_SIZE) && (pfn_offset+len <= > PAGE_SIZE) ) > + if ( cli_va ) > { > - if ( cli_va ) > - memcpy(cli_va + pfn_offset, tmem_va + tmem_offset, len); > - else if ( copy_to_guest_offset(clibuf, pfn_offset, > - tmem_va + tmem_offset, len) ) > - rc = -EFAULT; > + memcpy(cli_va, tmem_va, PAGE_SIZE); > + cli_put_page(cli_va, cli_pfp, cli_mfn, 1); > } > - else if ( len ) > + else > rc = -EINVAL; > unmap_domain_page(tmem_va); > - if ( cli_va ) > - cli_put_page(cli_va, cli_pfp, cli_mfn, 1); > smp_mb(); > return rc; > } > diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h > index 25ce268..ae6acf3 100644 > --- a/xen/include/xen/tmem_xen.h > +++ b/xen/include/xen/tmem_xen.h > @@ -387,8 +387,7 @@ int tmem_compress_from_client(xen_pfn_t, void **, size_t > *, > > int tmem_copy_from_client(struct page_info *, xen_pfn_t, > tmem_cli_va_param_t); > > -int tmem_copy_to_client(xen_pfn_t, struct page_info *, pagesize_t > tmem_offset, > - pagesize_t pfn_offset, pagesize_t len, tmem_cli_va_param_t); > +int tmem_copy_to_client(xen_pfn_t, struct page_info *, tmem_cli_va_param_t); > > extern int tmem_copy_tze_to_client(xen_pfn_t cmfn, void *tmem_va, pagesize_t > len); > extern void *tmem_persistent_pool_page_get(unsigned long size); > -- > 1.7.10.4 > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |