From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WswWH-0003nE-48 for qemu-devel@nongnu.org; Fri, 06 Jun 2014 11:57:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WswWA-0006Xd-Jj for qemu-devel@nongnu.org; Fri, 06 Jun 2014 11:57:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WswWA-0006XT-BM for qemu-devel@nongnu.org; Fri, 06 Jun 2014 11:57:22 -0400 Date: Fri, 6 Jun 2014 17:57:17 +0200 From: Stefan Hajnoczi Message-ID: <20140606155717.GA25089@stefanha-thinkpad.redhat.com> References: <1401448724-27851-1-git-send-email-benoit.canet@irqsave.net> <1401448724-27851-3-git-send-email-benoit.canet@irqsave.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline In-Reply-To: <1401448724-27851-3-git-send-email-benoit.canet@irqsave.net> Subject: Re: [Qemu-devel] [PATCH v5 2/3] block: Add drive-mirror-replace command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: kwolf@redhat.com, Benoit Canet , qemu-devel@nongnu.org, mreitz@redhat.com --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 30, 2014 at 01:18:43PM +0200, Beno=EEt Canet wrote: > When a quorum file is totally destroyed (broken NAS or SAN) the user can = start a > drive-mirror job on the quorum block backend and then replace the broken > quorum file with drive-mirror-replace given it has a node-name. >=20 > Signed-off-by: Benoit Canet > --- > block.c | 8 ++-- > block/mirror.c | 118 ++++++++++++++++++++++++++++++++++++++++= ++++-- > blockdev.c | 27 +++++++++++ > include/block/block.h | 3 ++ > include/block/block_int.h | 15 ++++++ > qapi-schema.json | 33 +++++++++++++ > qmp-commands.hx | 5 ++ > trace-events | 1 + > 8 files changed, 204 insertions(+), 6 deletions(-) The drive-mirror-replace command is just block-job-complete plus stashing arguments away. I think the approach you took in v1 was simpler: add an argument to drive-mirror and don't introduce new QAPI commands. There was discussion of a generic swap command, but drive-mirror-replace is not generic. Please revert to the drive-mirror argument approach since the drive-mirror + block-job-complete API is sufficient to implement this behavior. > @@ -502,6 +518,11 @@ immediate_exit: > bdrv_unref(p); > } > } > + if (s->must_replace) { > + bdrv_op_unblock_all(s->to_replace, s->replace_blocker); > + error_free(s->replace_blocker); > + bdrv_unref(s->to_replace); > + } > bdrv_unref(s->target); > block_job_completed(&s->common, ret); > } Can we do this unconditionally on the to_replace target (s->common.bs or user-defined BDS)? This code is already fairly complex and it's nice to avoid more conditionals. The swap operation is really the same whether to_replace =3D=3D s->common.bs or a user-defined BDS. The op blocker cleanup and unref could be unconditional as long as we op block and ref s->common.bs when no user-defined BDS was given. Stefan --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTkeTdAAoJEJykq7OBq3PIrP8H/02KkHAOSUG349DlQVmMQkaw veyRyUhCY7lhUh4shDoqSF6LgbnFNOio6oWAUHa5u9jJAsvn+Y3pGLkWs3/UJHlW T9C9VrbnbOs8cg/PacLXTm28DCJtfhgnIJrCYxnj+l231lnLPPY6YeVfhoPDiEOQ G3s8EHueOWPSAKgha+qvASXgxI1v5Nv2RcqKAdYPS+TkSggbnfcCuCR80kFW30SU Iz8qgWmIxbJnkUtyf2+42oI9rCXF4WJvmcmwYWkqx4USB+C0EFvuP+ncYrcba4SZ PpLFhbutKXwB73RSQHwlsPpJdVfEDRzvM/wosN3hSHjEj1jqB2KzOg5etyE/mAQ= =imy7 -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz--