All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Chunyan Liu <cyliu@suse.com>, stefanha@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-img info: show nocow info
Date: Wed, 02 Jul 2014 07:03:26 -0600	[thread overview]
Message-ID: <53B4031E.3030400@redhat.com> (raw)
In-Reply-To: <1404294640-16360-1-git-send-email-cyliu@suse.com>

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

On 07/02/2014 03:50 AM, Chunyan Liu wrote:
> Add nocow info in 'qemu-img info' output to show whether the file
> currently has NOCOW flag set or not.
> 
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> ---
>  block/qapi.c         | 25 +++++++++++++++++++++++++
>  qapi/block-core.json |  3 ++-
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 

> +
> +    /* get NOCOW info */
> +    fd = qemu_open(bs->filename, O_RDONLY | O_NONBLOCK);
> +    if (fd >= 0) {
> +        if (ioctl(fd, FS_IOC_GETFLAGS, &attr) == 0 && (attr & FS_NOCOW_FL)) {
> +            info->has_nocow = true;
> +            info->nocow = true;

Better is:

if (ioctl... == 0) {
    info->has_nocow = true;
    info->nocow = !!(attr & FS_NOCOW_FL)
}

to explicitly document the cases where we know nocow works but is not
set (and omitting it in cases where nocow doesn't exist because of the fs)


> +++ b/qapi/block-core.json
> @@ -126,7 +126,8 @@
>             '*backing-filename': 'str', '*full-backing-filename': 'str',
>             '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
>             '*backing-image': 'ImageInfo',
> -           '*format-specific': 'ImageInfoSpecific' } }
> +           '*format-specific': 'ImageInfoSpecific',
> +           '*nocow': 'bool' } }

Missing documentation. When adding that, remember to add '(since 2.2)'
(or even since 2.1 if you think this is a bug fix that should go in
during hard freeze)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-07-02 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02  9:50 [Qemu-devel] [PATCH] qemu-img info: show nocow info Chunyan Liu
2014-07-02 13:03 ` Eric Blake [this message]
2014-07-03  4:30   ` Chun Yan Liu

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=53B4031E.3030400@redhat.com \
    --to=eblake@redhat.com \
    --cc=cyliu@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.