From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv5 12/14] xen-blkback: safely unmap grants in case they are still in use Date: Thu, 12 Mar 2015 18:25:36 +0000 Message-ID: <5501DA20.80002@citrix.com> References: <1422377057-19221-1-git-send-email-david.vrabel@citrix.com> <1422377057-19221-13-git-send-email-david.vrabel@citrix.com> <54FD6331.8040503@oracle.com> <54FD6831.5020700@citrix.com> <54FD7B49.7080401@oracle.com> <54FD7DC8.60401@citrix.com> <5500D90A.6080006@oracle.com> <55010869.6000403@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YW7nt-0008DW-4S for xen-devel@lists.xenproject.org; Thu, 12 Mar 2015 18:25:53 +0000 In-Reply-To: <55010869.6000403@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: =?windows-1252?Q?Roger_Pau_Monn=E9?= , Bob Liu , David Vrabel Cc: xen-devel@lists.xenproject.org, Boris Ostrovsky , Jenny Herbert List-Id: xen-devel@lists.xenproject.org On 12/03/15 03:30, Roger Pau Monn=E9 wrote: > = > @@ -343,20 +353,19 @@ void xen_blkbk_unmap_purged_grants(struct work_stru= ct *work) > = > pages[segs_to_unmap] =3D persistent_gnt->page; > = > - if (++segs_to_unmap =3D=3D BLKIF_MAX_SEGMENTS_PER_REQUEST) { > - ret =3D gnttab_unmap_refs(unmap, NULL, pages, > - segs_to_unmap); > - BUG_ON(ret); > + if (++segs_to_unmap =3D=3D BLKIF_MAX_SEGMENTS_PER_REQUEST || > + list_empty(&blkif->persistent_purge_list)) { > + > + unmap_data.count =3D segs_to_unmap; > + gnttab_unmap_refs_async(&unmap_data); > + wait_for_completion(&unmap_completion); > + We now have a number of places that use the async unmap and wait for completion. Could this be moved into common code? David