qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 4/4] rbd: Add bdrv_truncate implementation


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v5 4/4] rbd: Add bdrv_truncate implementation
Date: Thu, 26 May 2011 10:05:40 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10

Am 25.05.2011 22:34, schrieb Josh Durgin:
> Signed-off-by: Josh Durgin <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]