On Tue, 2014-04-22 at 15:07 +0800, Jiang Liu wrote: > + size_t size = 0; > +#if 0 > + /* current the third argument of intel_unmap_page is unsued */ > + int i; > + struct scatterlist *sg; > > - freelist = domain_unmap(domain, start_pfn, last_pfn); > + for_each_sg(sglist, sg, nelems, i) > + size += sg->length; > +#endif Please don't do that. If you want to rely on the fact that intel_unmap_page() currently just uses the size from the IOVA it finds, then split it out into a separate function which explicitly does precisely that. And call that new function from both intel_unmap_sg() and intel_unmap_page(). -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation