From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTnax-0005BM-MA for qemu-devel@nongnu.org; Tue, 16 Sep 2014 03:54:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTnao-0002gx-LQ for qemu-devel@nongnu.org; Tue, 16 Sep 2014 03:54:39 -0400 Received: from mail-qa0-x234.google.com ([2607:f8b0:400d:c00::234]:59655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTnao-0002g9-CY for qemu-devel@nongnu.org; Tue, 16 Sep 2014 03:54:30 -0400 Received: by mail-qa0-f52.google.com with SMTP id m5so5004826qaj.25 for ; Tue, 16 Sep 2014 00:54:26 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5417ECAC.4070009@redhat.com> Date: Tue, 16 Sep 2014 09:54:20 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1410582855-21870-1-git-send-email-jsnow@redhat.com> <1410582855-21870-3-git-send-email-jsnow@redhat.com> <541444D2.6090709@redhat.com> <54174703.2070901@redhat.com> In-Reply-To: <54174703.2070901@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 02/10] AHCI: Update byte count after DMA completion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-devel@nongnu.org Cc: stefanha@redhat.com, mst@redhat.com Il 15/09/2014 22:07, John Snow ha scritto: >>> >>> - /* free sglist that was created in ahci_populate_sglist() */ >>> - qemu_sglist_destroy(&s->sg); >>> + /* free sglist, update byte count */ >>> + ahci_commit_buf(dma, true); >> >> Perhaps you should make dma_buf_commit public (and add the call to the >> hook), so that ahci_commit_buf does not have to mess with &s->sg. >> > > As above, the ahci layer is already messing around with &s->sg during > preparation, so I don't see why I'd try to abstract this away from parts > of that file. I think it would make sense if you moved the QEMUSGList to the DMA layer instead of the IDE layer. However, if you leave it in the IDE layer, it makes sense to leave qemu_sglist_destroy within the IDE layer as well. That's because qemu_sglist_destroy is idempotent. Moving the QEMUSGList to the DMA layer would be a relatively large change, so I would keep it where it is now. Paolo