Received: from eggs.gnu.org ([2001:4830:134:3::10]:54324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPtlZ-0008WN-VB for qemu-devel@nongnu.org; Tue, 27 Jun 2017 12:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPsdq-0002zC-SO for qemu-devel@nongnu.org; Tue, 27 Jun 2017 11:43:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dPsdq-0002uO-LH for qemu-devel@nongnu.org; Tue, 27 Jun 2017 11:43:02 -0400 References: <20170605123908.18777-1-pbonzini@redhat.com> <20170605123908.18777-17-pbonzini@redhat.com> <37960694-8f25-8201-5f17-e59c3ee67e90@redhat.com> <5ed4c5a0-11f3-14e7-77e6-47fa01a07d75@virtuozzo.com> <3a438db2-2c6d-e07b-94eb-b7c08073b9ae@virtuozzo.com> <13257113-2f2b-ccf5-93d1-66b2b963efce@virtuozzo.com> <5458c8fb-f73b-6651-b418-87bab8d3d143@redhat.com> <38cee5dc-4051-28b0-5258-015f7fa61979@virtuozzo.com> <81e85700-241a-c078-bb90-6ca756aceaeb@virtuozzo.com> From: Paolo Bonzini Message-ID: Date: Tue, 27 Jun 2017 17:42:49 +0200 MIME-Version: 1.0 In-Reply-To: <81e85700-241a-c078-bb90-6ca756aceaeb@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 16/19] block: protect modification of dirty bitmaps with a mutex List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org Cc: famz@redhat.com On 27/06/2017 17:32, Vladimir Sementsov-Ogievskiy wrote: >>>> >>>> >>>> - we protect inserting into list from other threads, but what preven= t >>>> creating bitmap with the same name from other thread after >>>> bdrv_find_dirty_bitmap() and before bdrv_dirty_bitmaps_lock() ? >>> It's like a read-write lock. >> >> Ok, finally I understand (not all, but the main idea=3D), sorry for >> annoying. >=20 > Is there any example of accessing dirty bitmaps for read not under BQL > but only under dirty bitmap lock? Yes, search for bdrv_dirty_bitmap_lock...unlock in block/mirror.c. There is also block/backup.c, which operates on a frozen bitmap. Paolo