From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1.8 5/6] qemu-img: add option to align writes to cluster_sectors during convert
Date: Mon, 25 Nov 2013 16:11:36 +0100 [thread overview]
Message-ID: <529368A8.8050807@redhat.com> (raw)
In-Reply-To: <1385387840-17307-6-git-send-email-pl@kamp.de>
Il 25/11/2013 14:57, Peter Lieven ha scritto:
> Signed-off-by: Peter Lieven <pl@kamp.de>
Ok, given this patch I think the cluster_size is the right one to use
here---and also the way you used the optimal unmap granularity makes
sense; you could also use MAX(optimal unmap granularity, optimal
transfer length granularity).
However, there is no need to write one cluster at a time. What matters,
I think, is to align the *end* of the transfer, so that the next
transfer can start aligned.
> + if (align && cluster_sectors > 0) {
> + int64_t next_aligned_sector = (sector_num + cluster_sectors);
So this should be "+ n", not "+ cluster_sectors".
Perhaps it could be conditional on "n > cluster_sectors" (small requests
happen when you have sparse region, and breaking them doesn't help).
Finally, I believe there is no need for a separate "-a" knob.
The patch looks fine to me with these small changes, though.
Also, a couple of ideas for separate patches. Perhaps the default value
of "-S" could be cluster_size if specified? This would avoid making raw
images too fragmented, and compounding filesystem-level fragmentation
with qcow2-level fragmentation. And 4K is too small a default in my
opinion; it could be easily changed to 64K, though 4K was of course an
improvement compared to 512 before commit a22f123 (qemu-img: Require
larger zero areas for sparse handling, 2011-08-26).
Paolo
> + next_aligned_sector -= next_aligned_sector % cluster_sectors;
> + if (sector_num + n > next_aligned_sector) {
> + n = next_aligned_sector - sector_num;
> + }
> + }
> +
> if (n > bs_offset + bs_sectors - sector_num) {
> n = bs_offset + bs_sectors - sector_num;
> }
> diff --git a/qemu-img.texi b/qemu-img.texi
> index 87f9d0f..9b1720f 100644
> --- a/qemu-img.texi
> +++ b/qemu-img.texi
> @@ -179,11 +179,14 @@ Error on reading data
>
> @end table
>
> -@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] [-m @var{iobuf_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
> +@item convert [-c] [-p] [-n] [-a] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] [-m @var{iobuf_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
>
> Convert the disk image @var{filename} or a snapshot @var{snapshot_name} to disk image @var{output_filename}
> using format @var{output_fmt}. It can be optionally compressed (@code{-c}
> option) or use any format specific options like encryption (@code{-o} option).
> +If the @code{-a} option is specified write requests will be aligned
> +to the cluster size of the output image if possible. This is the default
> +for compressed images.
>
> Only the formats @code{qcow} and @code{qcow2} support compression. The
> compression is read-only. It means that if a compressed sector is
>
next prev parent reply other threads:[~2013-11-25 15:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 13:57 [Qemu-devel] [PATCH 1.8 0/6] qemu-img convert optimizations Peter Lieven
2013-11-25 13:57 ` [Qemu-devel] [PATCH 1.8 1/6] qemu-img: add support for skipping zeroes in input during convert Peter Lieven
2013-11-25 13:57 ` [Qemu-devel] [PATCH 1.8 2/6] qemu-img: fix usage instruction for qemu-img convert Peter Lieven
2013-11-25 17:21 ` Eric Blake
2013-11-26 7:01 ` Peter Lieven
2013-11-25 13:57 ` [Qemu-devel] [PATCH 1.8 3/6] qemu-img: add option to specify alternate iobuffer size Peter Lieven
2013-11-25 14:54 ` Paolo Bonzini
2013-11-25 15:01 ` Peter Lieven
2013-11-25 15:07 ` Peter Lieven
2013-11-25 15:14 ` Paolo Bonzini
2013-11-25 15:24 ` Peter Lieven
2013-11-25 15:48 ` Paolo Bonzini
2013-11-25 15:56 ` Peter Lieven
2013-11-25 13:57 ` [Qemu-devel] [PATCH 1.8 4/6] block/iscsi: set bdi->cluster_size Peter Lieven
2013-11-25 14:51 ` Paolo Bonzini
2013-11-25 15:02 ` Paolo Bonzini
2013-11-25 13:57 ` [Qemu-devel] [PATCH 1.8 5/6] qemu-img: add option to align writes to cluster_sectors during convert Peter Lieven
2013-11-25 15:11 ` Paolo Bonzini [this message]
2013-11-25 15:32 ` Peter Lieven
2013-11-25 15:50 ` Paolo Bonzini
2013-11-25 15:55 ` Peter Lieven
2013-11-25 16:02 ` Paolo Bonzini
2013-11-25 16:11 ` Peter Lieven
2013-11-25 16:34 ` Paolo Bonzini
2013-11-25 13:57 ` [Qemu-devel] [PATCH 1.8 6/6] qemu-img: add option to show progress in sectors Peter Lieven
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=529368A8.8050807@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=pl@kamp.de \
--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.