From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUXrL-0004Jt-Um for qemu-devel@nongnu.org; Thu, 18 Sep 2014 05:18:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUXrC-00069I-Td for qemu-devel@nongnu.org; Thu, 18 Sep 2014 05:18:39 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:55631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUXrC-00068q-Ha for qemu-devel@nongnu.org; Thu, 18 Sep 2014 05:18:30 -0400 Received: by mail-we0-f179.google.com with SMTP id x48so572675wes.10 for ; Thu, 18 Sep 2014 02:18:24 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <541AA35B.4030409@redhat.com> Date: Thu, 18 Sep 2014 11:18:19 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411007799-23199-1-git-send-email-famz@redhat.com> <1411007799-23199-3-git-send-email-famz@redhat.com> In-Reply-To: <1411007799-23199-3-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 2/3] scsi: Introduce scsi_req_cancel_async List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi Il 18/09/2014 04:36, Fam Zheng ha scritto: > @@ -552,7 +552,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, > SCSIBus *bus = scsi_bus_from_device(d); > BusState *qbus = BUS(bus); > > - req = g_malloc0(reqops->size); > + req = g_malloc0(reqops ? reqops->size : sizeof(SCSIRequest)); Let's just add a NotifierList to SCSIRequest instead, and pass a Notifier to scsi_req_cancel_async. There can be multiple aborts for the same SCSIRequest, we can leave it to the HBA to create a Notifier for each TMF. The notifier can be embedded in a struct to track the request count, as mentioned in the other message I just sent. Paolo