From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPVWy-0007Yb-RI for qemu-devel@nongnu.org; Thu, 26 May 2011 04:02:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPVWx-0007iC-Vg for qemu-devel@nongnu.org; Thu, 26 May 2011 04:02:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPVWx-0007i5-NQ for qemu-devel@nongnu.org; Thu, 26 May 2011 04:02:55 -0400 Message-ID: <4DDE09D4.6020705@redhat.com> Date: Thu, 26 May 2011 10:05:40 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1306355687-4647-1-git-send-email-josh.durgin@dreamhost.com> <1306355687-4647-5-git-send-email-josh.durgin@dreamhost.com> In-Reply-To: <1306355687-4647-5-git-send-email-josh.durgin@dreamhost.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 4/4] rbd: Add bdrv_truncate implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Josh Durgin Cc: ceph-devel@vger.kernel.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, Christian Brunner Am 25.05.2011 22:34, schrieb Josh Durgin: > Signed-off-by: Josh Durgin > --- > block/rbd.c | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/block/rbd.c b/block/rbd.c > index a44d160..b95b1eb 100644 > --- a/block/rbd.c > +++ b/block/rbd.c > @@ -688,6 +688,20 @@ static int64_t qemu_rbd_getlength(BlockDriverState *bs) > return info.size; > } > > +static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset) > +{ > + BDRVRBDState *s = bs->opaque; > + int r; > + > + r = rbd_resize(s->image, offset); > + if (r < 0) { > + error_report("failed to resize rbd image"); > + return -EIO; > + } Don't print an error message here. The caller will do it, too, so we end up with two error messages saying the same. What kind of error code does rbd_resize return? If it is a valid errno value, you should return r instead of turning it into EIO. Kevin