From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yktvs-0007uG-MP for qemu-devel@nongnu.org; Wed, 22 Apr 2015 08:39:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yktvo-00055J-Mn for qemu-devel@nongnu.org; Wed, 22 Apr 2015 08:39:12 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:35672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yktvo-00055D-F2 for qemu-devel@nongnu.org; Wed, 22 Apr 2015 08:39:08 -0400 Received: by widdi4 with SMTP id di4so176001285wid.0 for ; Wed, 22 Apr 2015 05:39:07 -0700 (PDT) Date: Wed, 22 Apr 2015 13:39:05 +0100 From: Stefan Hajnoczi Message-ID: <20150422123905.GE27617@stefanha-thinkpad.redhat.com> References: <1426069701-1405-1-git-send-email-den@openvz.org> <1426069701-1405-6-git-send-email-den@openvz.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3O1VwFp74L81IIeR" Content-Disposition: inline In-Reply-To: <1426069701-1405-6-git-send-email-den@openvz.org> Subject: Re: [Qemu-devel] [PATCH 05/27] block/parallels: add get_block_status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Roman Kagan --3O1VwFp74L81IIeR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Mar 11, 2015 at 01:27:59PM +0300, Denis V. Lunev wrote: > +static int64_t coroutine_fn parallels_co_get_block_status(BlockDriverState *bs, > + int64_t sector_num, int nb_sectors, int *pnum) > +{ > + BDRVParallelsState *s = bs->opaque; > + int64_t offset; > + > + qemu_co_mutex_lock(&s->lock); > + offset = seek_to_sector(s, sector_num); > + qemu_co_mutex_unlock(&s->lock); The lock isn't necessary here yet. It may become necessary when write support is added, but probably not even then since seek_to_sector() cannot yield (it's not a coroutine function), so there are no possible races with other coroutines. The same also applies for parallels_co_read(). The lock there isn't necessary since the block driver is read-only and has no mutable state - there is no shared state that needs lock protection. --3O1VwFp74L81IIeR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVN5ZpAAoJEJykq7OBq3PItBkH/3zVGqx6ZhgQDcdE6zUfBvb/ ImJtsnPLiQfDBEtsNIBipNOkjghn+S8/zOLUbQXAW9YyJc5SJSEkErBehwII9n4/ AN07pBNSw1BfxR6RdsptQ/VZMKRtjMeSffvRJ0MKrtU9jvB901123K4NuwPC1c/V HphMtB+qHQmZT4qmh4eCEZfWWRPrqgQyVkV3Xe6yvvstZvwJ8kqGMj4BTJSalGOg 13PwxdqIZw/4L/6YYh2cf9l1TnLue3l5JxwNJcIy/2HP16JS48pVDY+Yrkqsi24u DcWwMnO7k913+EtacSvDQv8RGfQOOJseykh95Qu+RqynaYNH5F6R1YIBsMMC/1A= =x937 -----END PGP SIGNATURE----- --3O1VwFp74L81IIeR--