From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyHG4-0004aV-0J for qemu-devel@nongnu.org; Sat, 21 Jun 2014 05:06:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WyHFu-0007Ga-VJ for qemu-devel@nongnu.org; Sat, 21 Jun 2014 05:06:47 -0400 Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]:41079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyHFu-0007Fh-Dq for qemu-devel@nongnu.org; Sat, 21 Jun 2014 05:06:38 -0400 Received: by mail-we0-f175.google.com with SMTP id k48so4760553wev.34 for ; Sat, 21 Jun 2014 02:06:37 -0700 (PDT) Date: Sat, 21 Jun 2014 17:06:29 +0800 From: Stefan Hajnoczi Message-ID: <20140621090629.GA11045@stefanha-thinkpad.redhat.com> References: <3e7848fff9d1ad0a72d43c61a3ddeabd0dc604f0.1403141617.git.peter.crosthwaite@xilinx.com> <78e1e234bb9d30f863bab5be6498bf827f906318.1403141617.git.peter.crosthwaite@xilinx.com> <53A2A89A.3090505@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0F1p//8PRICkK4MW" Content-Disposition: inline In-Reply-To: <53A2A89A.3090505@redhat.com> Subject: Re: [Qemu-devel] [PATCH block v1 2/2] block: m25p80: Support read only bdrvs. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Crosthwaite , qemu-devel@nongnu.org, stefanha@redhat.com --0F1p//8PRICkK4MW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 19, 2014 at 11:08:42AM +0200, Paolo Bonzini wrote: > >static void bdrv_sync_complete(void *opaque, int ret) > >{ > > /* do nothing. Masters do not directly interact with the backing sto= re, > > * only the working copy so no mutexing required. > > */ > >} > > > >static void flash_sync_page(Flash *s, int page) > >{ > > if (s->bdrv) { > > int bdrv_sector, nb_sectors; > > QEMUIOVector iov; > > > > bdrv_sector =3D (page * s->pi->page_size) / BDRV_SECTOR_SIZE; > > nb_sectors =3D DIV_ROUND_UP(s->pi->page_size, BDRV_SECTOR_SIZE); > > qemu_iovec_init(&iov, 1); > > qemu_iovec_add(&iov, s->storage + bdrv_sector * BDRV_SECTOR_SIZE, > > nb_sectors * BDRV_SECTOR= _SIZE); > > bdrv_aio_writev(s->bdrv, bdrv_sector, &iov, nb_sectors, > > bdrv_sync_complete, NULL= ); > > } > >} >=20 > Using AIO is a good idea, but you could have overlapping writes here if y= ou > get close calls to flash_sync_page. It can be bad. >=20 > Serializing can be done in fancy manners, but it can be as easy as adding > bdrv_drain(s->bdrv) before the bdrv_aio_writev. Since this issue was present before the patch and not caused by this series I'm keeping it in the block queue. It would be nice to address this in a separate series. Stefan --0F1p//8PRICkK4MW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTpUsVAAoJEJykq7OBq3PIkcwH/1Dy7ZHN+dhuc5JDDwzK2D3z u+WFiTSZno63s00+7KKW/pvaKk+GaTD9rFnRmWbuU7bk7DVwXVxMnpvvHaPz9C2G xKxRLgIxyopAuE1qwuff8rxfEP73Q+T4sj75th3Ob3+17SMPHTChN04XCqWrzUWl /EFqye4fl/V0Jek1jggOW8mDtFEP+yf72m+Wqwk6+akl9sgKbQM1xvbQoAlpOZrS /HtHEMuLN9Wi7pL9UzX7EAlguk9yUd+xvnGN8tQhAph01CC4mcIew/MTzk6TTXMT DZVrPy/OJSSonoUfYb7rJETLANDEN7pAlLKFSLA5OpY/n0VKla6B0CseIL0tbwc= =EE2w -----END PGP SIGNATURE----- --0F1p//8PRICkK4MW--