From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNTog-00028U-UN for qemu-devel@nongnu.org; Fri, 20 May 2011 13:48:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNTof-00044l-Ul for qemu-devel@nongnu.org; Fri, 20 May 2011 13:48:50 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:64898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNTof-00044h-Kd for qemu-devel@nongnu.org; Fri, 20 May 2011 13:48:49 -0400 Received: by wwj40 with SMTP id 40so3889412wwj.10 for ; Fri, 20 May 2011 10:48:44 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4DD6A97B.6030702@redhat.com> Date: Fri, 20 May 2011 19:48:43 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1305630067-2119-1-git-send-email-pbonzini@redhat.com> <1305630067-2119-6-git-send-email-pbonzini@redhat.com> <20110520155807.GE4466@lst.de> In-Reply-To: <20110520155807.GE4466@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 05/21] scsi: reference-count requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org On 05/20/2011 05:58 PM, Christoph Hellwig wrote: >> > void scsi_req_free(SCSIRequest *req) >> > { >> > - scsi_req_dequeue(req); >> > + assert(req->refcount == 0); >> > qemu_free(req); >> > } > Is there any reason to keep a free function? It's internal for SCSIDevice implementation, kind of a "base implementation" for free_req > The pattern should be > that people just call the function to decrement the reference count, > and that frees the structure when it hits zero. In the current model > that would mean moving the freeing out of ->free_req into scsi_req_unref, > but that seems pretty sensible anyway. free_req is still needed, because it takes care of freeing the bounce buffers or any other allocated data. Paolo