qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/8] block: add bdrv_aio_stream
Date: Fri, 29 Apr 2011 13:56:59 +0200	[thread overview]
Message-ID: <4DBAA78B.3060706@redhat.com> (raw)
In-Reply-To: <1303910855-28999-2-git-send-email-stefanha@linux.vnet.ibm.com>

Am 27.04.2011 15:27, schrieb Stefan Hajnoczi:
> From: Anthony Liguori <aliguori@us.ibm.com>
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  block.c     |   32 ++++++++++++++++++++++++++++++++
>  block.h     |    2 ++
>  block_int.h |    3 +++
>  3 files changed, 37 insertions(+), 0 deletions(-)
> 
> diff --git a/block.c b/block.c
> index f731c7a..5e3476c 100644
> --- a/block.c
> +++ b/block.c
> @@ -2248,6 +2248,38 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
>      return ret;
>  }
>  
> +/**
> + * Attempt to stream an image starting from sector_num.
> + *
> + * @sector_num - the first sector to start streaming from
> + * @cb - block completion callback
> + * @opaque - data to pass completion callback
> + *
> + * Returns NULL if the image format not support streaming, the image is
> + * read-only, or no image is open.
> + *
> + * The intention of this function is for a user to execute it once with a
> + * sector_num of 0 and then upon receiving a completion callback, to remember
> + * the number of sectors "streamed", and then to call this function again with
> + * an offset adjusted by the number of sectors previously streamed.
> + *
> + * This allows a user to progressive stream in an image at a pace that makes
> + * sense.  In general, this function tries to do the smallest amount of I/O
> + * possible to do some useful work.
> + *
> + * This function only really makes sense in combination with a block format
> + * that supports copy on read and has it enabled.  If copy on read is not
> + * enabled, a block format driver may return NULL.
> + */
> +BlockDriverAIOCB *bdrv_aio_stream(BlockDriverState *bs, int64_t sector_num,
> +                                  BlockDriverCompletionFunc *cb, void *opaque)

I think bdrv_aio_stream is a bad name for this. It only becomes image
streaming because the caller repeatedly calls this function. What the
function really does is copying some data from the backing file into the
overlay image.

I'm not sure how the caller would know how many sectors have been
copied. A BlockDriverCompletionFunc usually returns 0 on success, did
you change it here to use positive numbers for something else? At least
this must be documented somewhere, but I would suggest to add a
nb_sectors argument instead so that the caller decides how many sectors
to copy.

If you say that it only makes sense with copy on read, should one think
of it as a read that throws the read data away? I think considering it a
copy function makes more sense and is independent of copy on read.

Kevin

  reply	other threads:[~2011-04-29 11:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 13:27 [Qemu-devel] [RFC PATCH 0/8] QED image streaming Stefan Hajnoczi
2011-04-27 13:27 ` [Qemu-devel] [PATCH 1/8] block: add bdrv_aio_stream Stefan Hajnoczi
2011-04-29 11:56   ` Kevin Wolf [this message]
2011-05-06 13:21     ` Stefan Hajnoczi
2011-05-06 13:36       ` Kevin Wolf
2011-05-06 15:47         ` Stefan Hajnoczi
2011-04-27 13:27 ` [Qemu-devel] [PATCH 2/8] qmp: Add QMP support for stream commands Stefan Hajnoczi
2011-04-29 12:09   ` Kevin Wolf
2011-05-06 13:23     ` Stefan Hajnoczi
2011-04-27 13:27 ` [Qemu-devel] [PATCH 3/8] qed: add support for Copy-on-Read Stefan Hajnoczi
2011-04-27 14:29   ` Paolo Bonzini
2011-04-29 12:14   ` Kevin Wolf
2011-05-06 13:24     ` Stefan Hajnoczi
2011-04-27 13:27 ` [Qemu-devel] [PATCH 4/8] qed: intelligent streaming implementation Stefan Hajnoczi
2011-04-27 13:27 ` [Qemu-devel] [PATCH 5/8] qed: detect zero writes and skip them when to an unalloc cluster Stefan Hajnoczi
2011-04-27 13:27 ` [Qemu-devel] [PATCH 6/8] blockdev: Allow image files to auto-enable streaming Stefan Hajnoczi
2011-04-29 12:20   ` Kevin Wolf
2011-04-27 13:27 ` [Qemu-devel] [PATCH 7/8] qed: Add QED_CF_STREAM flag " Stefan Hajnoczi
2011-04-27 13:27 ` [Qemu-devel] [PATCH 8/8] qed: Add -o stream=on image creation option Stefan Hajnoczi
2011-04-27 13:41 ` [Qemu-devel] [RFC PATCH 0/8] QED image streaming Stefan Hajnoczi

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=4DBAA78B.3060706@redhat.com \
    --to=kwolf@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.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 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).