From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abjD9-0005gi-2s for qemu-devel@nongnu.org; Fri, 04 Mar 2016 01:27:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abjD3-0000PM-Tw for qemu-devel@nongnu.org; Fri, 04 Mar 2016 01:27:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abjD3-0000PI-OR for qemu-devel@nongnu.org; Fri, 04 Mar 2016 01:27:33 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 3BA4246A for ; Fri, 4 Mar 2016 06:27:33 +0000 (UTC) Date: Fri, 4 Mar 2016 11:57:23 +0530 From: Amit Shah Message-ID: <20160304062723.GH15443@grmbl.mre> References: <1457010971-24771-1-git-send-email-lprosek@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1457010971-24771-1-git-send-email-lprosek@redhat.com> Subject: Re: [Qemu-devel] [PATCH] rng: switch request queue to QSIMPLEQ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ladi Prosek Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, pagupta@redhat.com On (Thu) 03 Mar 2016 [14:16:11], Ladi Prosek wrote: > QSIMPLEQ supports appending to tail in O(1) and is intrusive so > it doesn't require extra memory allocations for the bookkeeping > data. > > Suggested-by: Paolo Bonzini > Signed-off-by: Ladi Prosek > @@ -83,24 +83,27 @@ static void rng_backend_free_request(RngRequest *req) > > static void rng_backend_free_requests(RngBackend *s) > { > - GSList *i; > + RngRequest *req, *next; > > - for (i = s->requests; i; i = i->next) { > - rng_backend_free_request(i->data); > + QSIMPLEQ_FOREACH_SAFE(req, &s->requests, next, next) { > + rng_backend_free_request(req); > } > > - g_slist_free(s->requests); > - s->requests = NULL; > + QSIMPLEQ_INIT(&s->requests); > } This init here isn't necessary, the accessors for the queue will take care of this. Amit