From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDzMe-0001fB-1T for qemu-devel@nongnu.org; Tue, 18 Sep 2012 11:05:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDzMZ-0001UF-Lm for qemu-devel@nongnu.org; Tue, 18 Sep 2012 11:05:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDzMZ-0001T5-Dq for qemu-devel@nongnu.org; Tue, 18 Sep 2012 11:05:23 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8IF5MeZ014542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 18 Sep 2012 11:05:22 -0400 Message-ID: <50588DB0.1000207@redhat.com> Date: Tue, 18 Sep 2012 17:05:20 +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> In-Reply-To: <50588D22.6080703@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: , To: Kevin Wolf Cc: qemu-devel@nongnu.org Il 18/09/2012 17:02, Kevin Wolf 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 ? Paolo