qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: allow resizing of images residing on host devices
Date: Fri, 09 Sep 2011 11:37:57 +0200	[thread overview]
Message-ID: <4E69DE75.5070507@redhat.com> (raw)
In-Reply-To: <20110907110245.GA3477@lst.de>

Am 07.09.2011 13:02, schrieb Christoph Hellwig:
> Allow to resize images that reside on host devices up to the available
> space.  This allows to grow images after resizing the device manually or
> vice versa.
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

You mean Signed-off-by, no?

> Index: qemu/block/raw-posix.c
> ===================================================================
> --- qemu.orig/block/raw-posix.c	2011-09-01 17:37:42.579651525 +0200
> +++ qemu/block/raw-posix.c	2011-09-01 17:43:28.882967337 +0200
> @@ -645,10 +645,23 @@ static void raw_close(BlockDriverState *
>  static int raw_truncate(BlockDriverState *bs, int64_t offset)
>  {
>      BDRVRawState *s = bs->opaque;
> -    if (s->type != FTYPE_FILE)
> -        return -ENOTSUP;
> -    if (ftruncate(s->fd, offset) < 0)
> +    struct stat st;
> +
> +    if (fstat(s->fd, &st))
>          return -errno;

Coding style requires braces.

> +
> +    if (S_ISREG(st.st_mode)) {
> +        if (ftruncate(s->fd, offset) < 0)
> +            return -errno;

Here as well.

> +    } else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) {
> +       if (offset > raw_getlength(bs)) {
> +           return -EINVAL;
> +       }
> +       return 0;

This return isn't needed and it's not there in the S_ISREG case. It
should be symmetrical at least.

Semantically the patch looks okay.

Kevin

  reply	other threads:[~2011-09-09  9:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 13:27 [Qemu-devel] QEMU online guest disk resize wrt host block devices Daniel P. Berrange
2011-09-01 14:05 ` Christoph Hellwig
2011-09-01 14:30   ` Daniel P. Berrange
2011-09-01 15:55     ` Christoph Hellwig
2011-09-02 15:00       ` Daniel P. Berrange
2011-09-07 11:02       ` [Qemu-devel] [PATCH] block: allow resizing of images residing on host devices Christoph Hellwig
2011-09-09  9:37         ` Kevin Wolf [this message]
2011-09-01 14:27 ` [Qemu-devel] QEMU online guest disk resize wrt host block devices Daniel P. Berrange
2011-09-01 15:56   ` Christoph Hellwig
2011-09-05 13:03     ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E69DE75.5070507@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).