Received: from eggs.gnu.org ([2001:4830:134:3::10]:32897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7qRW-0008FD-LO for qemu-devel@nongnu.org; Fri, 18 Nov 2016 16:11:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7qRV-0003Ei-Ne for qemu-devel@nongnu.org; Fri, 18 Nov 2016 16:11:30 -0500 References: <1478798349-28983-1-git-send-email-kwolf@redhat.com> <1478798349-28983-7-git-send-email-kwolf@redhat.com> <20161118122112.GA4694@noname.redhat.com> From: Eric Blake Message-ID: Date: Fri, 18 Nov 2016 15:11:22 -0600 MIME-Version: 1.0 In-Reply-To: <20161118122112.GA4694@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hVUsiiUU7SI4OFxAajxnnLnVtqIDkjigV" Subject: Re: [Qemu-devel] [RFC PATCH 6/8] quorum: Avoid bdrv_aio_writev() for rewrites List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , Alberto Garcia Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hVUsiiUU7SI4OFxAajxnnLnVtqIDkjigV From: Eric Blake To: Kevin Wolf , Alberto Garcia Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com Message-ID: Subject: Re: [Qemu-devel] [RFC PATCH 6/8] quorum: Avoid bdrv_aio_writev() for rewrites References: <1478798349-28983-1-git-send-email-kwolf@redhat.com> <1478798349-28983-7-git-send-email-kwolf@redhat.com> <20161118122112.GA4694@noname.redhat.com> In-Reply-To: <20161118122112.GA4694@noname.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/18/2016 06:21 AM, Kevin Wolf wrote: >>> + ret =3D bdrv_co_pwritev(s->children[co->i], >>> + acb->sector_num * BDRV_SECTOR_SIZE, >>> + acb->nb_sectors * BDRV_SECTOR_SIZE, >>> + acb->qiov, 0); >>> + (void) ret; >> >> Why do you need 'ret' at all? If it's a placeholder to remind us to do= >> something with this value in the future, you can simply add a FIXME >> comment. >=20 > I'm not sure whether we want to fix anything, it looks intentional to > me. I just wanted to be explicit about the ignored return value, both > for human readers and for tools like Coverity. In bdrv_co_flush(), we have: /* Return value is ignored - it's ok if wait queue is empty */ qemu_co_queue_next(&bs->flush_queue); I don't know if Coverity would squawk, but the cast to void looks a bit stranger to me than a comment, where what we did in bdrv_co_flush() seems reasonable. There's also the patch proposal to introduce ignore_value() in place of a cast to void, which is a bit more self-documenting about places that intentionally ignore a return value while still shutting Coverity up: https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05165.html >=20 >>> + /* one less rewrite to do */ >>> + acb->rewrite_count--; >>> + qemu_coroutine_enter_if_inactive(acb->co); >> >> I think you should only enter acb->co when acb->rewrite_count reaches >> zero. >> >> In all other cases the main coroutine simply iterates inside the while= () >> loop, verifies that the number is still positive and yields again. >> >> The same applies to all other cases of qemu_coroutine_enter_if_inactiv= e, >> by the way (I failed to notice it in patch #5). >=20 > I think I like it better this way because it keeps the loop condition > local to the caller instead of spreading it across the caller and the > places that reenter. On the other hand, I can see that not doing the > extra context switch might be a little more efficient. Do we have a feel for how many context switches this would save? If it's in the noise, cleaner code is probably a win; but if it is a hotspot, then we should definitely try the optimization. >=20 > If you feel strongly about this, I will change it. >=20 > Kevin >=20 >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hVUsiiUU7SI4OFxAajxnnLnVtqIDkjigV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYL256AAoJEKeha0olJ0Nq+msIAKecVPoJBtP5XSElRlzdRoL5 ZgD+G/qmJdLARw3NTiLdT4msOmAEXhHPbTrO4FK8x5ra0hoGUc2YV0jqBsWCZLtW kZFP+7F0gekDhNNItjdUDUZ7OSPpdaskb9lPVg0lpOySBj3Yg63h1ukf3YtOykul qc7bcaEhXSw7Ozh3K0YC9gOP07ol/Q3KbtKtUB2lwHpuj5ewSm+6qqx57XfoVHre CE3Ydk4dusIKrnb5ZZOrcWcTV0R5i0Truq93KevrTVuFW/IiNoKPvcibeqS0u9fU zaic4w7w9gwH3iWnub3eEy18eSq32WxM7LFwT+Yh9Sp5YIzCH5UbTiBsUMX3ljY= =h6n8 -----END PGP SIGNATURE----- --hVUsiiUU7SI4OFxAajxnnLnVtqIDkjigV--