From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Liu Subject: Re: [PATCHv5 12/14] xen-blkback: safely unmap grants in case they are still in use Date: Fri, 13 Mar 2015 08:43:21 +0800 Message-ID: <550232A9.7030006@oracle.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> <5501DA20.80002@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 1YWDhM-0006p7-NB for xen-devel@lists.xenproject.org; Fri, 13 Mar 2015 00:43:32 +0000 In-Reply-To: <5501DA20.80002@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: David Vrabel Cc: xen-devel@lists.xenproject.org, Boris Ostrovsky , Jenny Herbert , =?windows-1252?Q?Roger_Pau_Monn=E9?= List-Id: xen-devel@lists.xenproject.org On 03/13/2015 02:25 AM, David Vrabel wrote: > On 12/03/15 03:30, Roger Pau Monn=E9 wrote: >> >> @@ -343,20 +353,19 @@ void xen_blkbk_unmap_purged_grants(struct work_str= uct *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? > = Sure, I'll make a patch after complete the testing. Thanks, -Bob