From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDzPz-0003cO-0B for qemu-devel@nongnu.org; Tue, 18 Sep 2012 11:09:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDzPy-0002lb-7D for qemu-devel@nongnu.org; Tue, 18 Sep 2012 11:08:54 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:64687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDzPy-0002lP-0b for qemu-devel@nongnu.org; Tue, 18 Sep 2012 11:08:54 -0400 Received: by pbbrp12 with SMTP id rp12so188750pbb.4 for ; Tue, 18 Sep 2012 08:08:53 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <50588E7F.2060908@redhat.com> Date: Tue, 18 Sep 2012 17:08:47 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1347968442-8860-1-git-send-email-kwolf@redhat.com> <1347968442-8860-16-git-send-email-kwolf@redhat.com> <505888CC.8070207@redhat.com> <50588D22.6080703@redhat.com> <50588DB0.1000207@redhat.com> In-Reply-To: <50588DB0.1000207@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 15/16] qcow2: Cancel COW when overwritten List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org Il 18/09/2012 17:05, Paolo Bonzini ha scritto: >>>>>> >>> >> + qemu_co_mutex_unlock(&s->lock); >>>>>> >>> >> + qemu_co_rwlock_wrlock(&m->l2_writeback_lock); >>>> >> > >>>> >> > Can anybody else take the lock as reader again at this point? If not, I >>>> >> > wonder if this is more clear if you write it as a CoQueue. >> > This isn't "let one writer complete, then wake up n readers" (which >> > would indeed be represented more naturally as CoQueue), but rather "let >> > n readers complete, then wake up one writer". > So would it be representable as a list of children (matching the parent > pointer) and then unlocking is > > remove self from children list > if the children list is empty, wake parent->co > > ? Of course this only work if the list of children cannot become non-empty anymore after the writer restarts. Paolo