From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ3TO-00008b-1C for qemu-devel@nongnu.org; Wed, 16 May 2018 16:56:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ3TN-000413-De for qemu-devel@nongnu.org; Wed, 16 May 2018 16:56:34 -0400 Date: Wed, 16 May 2018 22:56:26 +0200 From: Kevin Wolf Message-ID: <20180516205626.GI4435@localhost.localdomain> References: <20180509162637.15575-1-kwolf@redhat.com> <20180509162637.15575-15-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 14/42] job: Add reference counting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-block@nongnu.org, mreitz@redhat.com, jsnow@redhat.com, armbru@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org Am 16.05.2018 um 20:17 hat Eric Blake geschrieben: > On 05/09/2018 11:26 AM, Kevin Wolf wrote: > > This moves reference counting from BlockJob to Job. > > > > In order to keep calling the BlockJob cleanup code when the job is > > deleted via job_unref(), introduce a new JobDriver.free callback. Every > > block job must use block_job_free() for this callback, this is asserted > > in block_job_create(). > > > > Signed-off-by: Kevin Wolf > > --- > > > +++ b/job.c > > > + > > +void job_unref(Job *job) > > +{ > > + if (--job->refcnt == 0) { > > Should this be free()-like and allow an incoming job == NULL as a no-op? This behaves like block_job_unref() always behavec, and I don't see a single caller having a NULL check before calling job_unref(), so is it worth it? Kevin