qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 05/21] scsi: reference-count requests


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v3 05/21] scsi: reference-count requests
Date: Fri, 20 May 2011 19:48:43 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]