All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Jeff Cody <jcody@redhat.com>,
	qemu-stable@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/4] block/curl: Use BDRV_SECTOR_SIZE
Date: Wed, 26 Oct 2016 10:31:59 +0100	[thread overview]
Message-ID: <20161026093159.GC27578@redhat.com> (raw)
In-Reply-To: <20161025025431.24714-2-mreitz@redhat.com>

On Tue, Oct 25, 2016 at 04:54:28AM +0200, Max Reitz wrote:
> Currently, curl defines its own constant SECTOR_SIZE. There is no
> advantage over using the global BDRV_SECTOR_SIZE, so drop it.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/curl.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/block/curl.c b/block/curl.c
> index e5eaa7b..12afa15 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -73,7 +73,6 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
>  
>  #define CURL_NUM_STATES 8
>  #define CURL_NUM_ACB    8
> -#define SECTOR_SIZE     512
>  #define READ_AHEAD_DEFAULT (256 * 1024)
>  #define CURL_TIMEOUT_DEFAULT 5
>  #define CURL_TIMEOUT_MAX 10000
> @@ -738,12 +737,12 @@ static void curl_readv_bh_cb(void *p)
>      CURLAIOCB *acb = p;
>      BDRVCURLState *s = acb->common.bs->opaque;
>  
> -    size_t start = acb->sector_num * SECTOR_SIZE;
> +    size_t start = acb->sector_num * BDRV_SECTOR_SIZE;
>      size_t end;
>  
>      // In case we have the requested data already (e.g. read-ahead),
>      // we can just call the callback and be done.
> -    switch (curl_find_buf(s, start, acb->nb_sectors * SECTOR_SIZE, acb)) {
> +    switch (curl_find_buf(s, start, acb->nb_sectors * BDRV_SECTOR_SIZE, acb)) {
>          case FIND_RET_OK:
>              qemu_aio_unref(acb);
>              // fall through
> @@ -762,7 +761,7 @@ static void curl_readv_bh_cb(void *p)
>      }
>  
>      acb->start = 0;
> -    acb->end = (acb->nb_sectors * SECTOR_SIZE);
> +    acb->end = (acb->nb_sectors * BDRV_SECTOR_SIZE);
>  
>      state->buf_off = 0;
>      g_free(state->orig_buf);
> @@ -779,8 +778,8 @@ static void curl_readv_bh_cb(void *p)
>      state->acb[0] = acb;
>  
>      snprintf(state->range, 127, "%zd-%zd", start, end);
> -    DPRINTF("CURL (AIO): Reading %d at %zd (%s)\n",
> -            (acb->nb_sectors * SECTOR_SIZE), start, state->range);
> +    DPRINTF("CURL (AIO): Reading %llu at %zd (%s)\n",
> +            (acb->nb_sectors * BDRV_SECTOR_SIZE), start, state->range);
>      curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);
>  
>      curl_multi_add_handle(s->multi, state->curl);

ACK, this change is obvious.

Eric's comment about use of size_t instead of off_t or int64_t in
curl_readv_bh_cb (and maybe elsewhere) is dead right too.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

  parent reply	other threads:[~2016-10-26  9:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25  2:54 [Qemu-devel] [PATCH 0/4] block/curl: Fix FTP Max Reitz
2016-10-25  2:54 ` [Qemu-devel] [PATCH 1/4] block/curl: Use BDRV_SECTOR_SIZE Max Reitz
2016-10-25 18:31   ` Eric Blake
2016-10-26 14:39     ` Max Reitz
2016-10-26  9:31   ` Richard W.M. Jones [this message]
2016-10-25  2:54 ` [Qemu-devel] [PATCH 2/4] block/curl: Fix return value from curl_read_cb Max Reitz
2016-10-25 18:37   ` Eric Blake
2016-10-26  9:17     ` Kevin Wolf
2016-11-01  9:58       ` Matthew Booth
2016-10-26 14:43     ` Max Reitz
2016-10-26  9:38   ` Richard W.M. Jones
2016-10-25  2:54 ` [Qemu-devel] [PATCH 3/4] block/curl: Remember all sockets Max Reitz
2016-10-25  2:54 ` [Qemu-devel] [PATCH 4/4] block/curl: Do not wait for data beyond EOF Max Reitz
2016-10-26  9:44 ` [Qemu-devel] [PATCH 0/4] block/curl: Fix FTP Richard W.M. Jones
2016-11-15  3:47   ` Jeff Cody

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=20161026093159.GC27578@redhat.com \
    --to=rjones@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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 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.