All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Alberto Garcia <berto@igalia.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
	Denis Lunev <den@virtuozzo.com>,
	"mreitz@redhat.com" <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 5/7] qcow2: use byte-based read in qcow2_decompress_cluster
Date: Tue, 6 Nov 2018 15:18:08 +0000	[thread overview]
Message-ID: <e4d6f89f-5d27-7456-1f4c-adf8ec377faf@virtuozzo.com> (raw)
In-Reply-To: <w51a7mme2im.fsf@maestria.local.igalia.com>

06.11.2018 16:53, Alberto Garcia wrote:
> On Thu 01 Nov 2018 07:27:36 PM CET, Vladimir Sementsov-Ogievskiy wrote:
>
>> diff --git a/block/qcow2.c b/block/qcow2.c
>> index e9d24b801e..950b9f7ec6 100644
>> --- a/block/qcow2.c
>> +++ b/block/qcow2.c
>> @@ -3956,14 +3956,15 @@ fail:
>>   int qcow2_decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset)
>>   {
>>       BDRVQcow2State *s = bs->opaque;
>> -    int ret, csize, nb_csectors, sector_offset;
>> +    int ret, csize, nb_csectors;
>>       uint64_t coffset;
>> +    struct iovec iov;
>> +    QEMUIOVector local_qiov;
>>   
>>       coffset = cluster_offset & s->cluster_offset_mask;
>>       if (s->cluster_cache_offset != coffset) {
>>           nb_csectors = ((cluster_offset >> s->csize_shift) & s->csize_mask) + 1;
>> -        sector_offset = coffset & 511;
>> -        csize = nb_csectors * 512 - sector_offset;
>> +        csize = nb_csectors * 512 - (coffset & 511);
>>   
>>           /* Allocate buffers on first decompress operation, most images are
>>            * uncompressed and the memory overhead can be avoided.  The buffers
>> @@ -3981,14 +3982,17 @@ int qcow2_decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset)
>>               s->cluster_cache = g_malloc(s->cluster_size);
>>           }
>>   
>> +        iov.iov_base = s->cluster_data;
>> +        iov.iov_len = csize;
>> +        qemu_iovec_init_external(&local_qiov, &iov, 1);
>> +
>>           BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED);
>> -        ret = bdrv_read(bs->file, coffset >> 9, s->cluster_data,
>> -                        nb_csectors);
>> +        ret = bdrv_co_preadv(bs->file, coffset, csize, &local_qiov,
>> 0);
> I think you should annotate the function with coroutine_fn or use
> bdrv_pread() instead.
>
> Berto

it is called only from qcow2_co_preadv, so it's ok to move to 
already-in-coroutine behaviour. I'll add coroutine_fn if new version is 
needed, or it can be added inflight.

-- 
Best regards,
Vladimir


  reply	other threads:[~2018-11-06 15:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 18:27 [Qemu-devel] [PATCH 0/7] qcow2 decompress in threads Vladimir Sementsov-Ogievskiy
2018-11-01 18:27 ` [Qemu-devel] [PATCH 1/7] qcow2: use Z_OK instead of 0 for deflateInit2 return code check Vladimir Sementsov-Ogievskiy
2018-11-05 15:30   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-11-01 18:27 ` [Qemu-devel] [PATCH 2/7] qcow2: make more generic interface for qcow2_compress Vladimir Sementsov-Ogievskiy
2018-11-05 15:45   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-11-01 18:27 ` [Qemu-devel] [PATCH 3/7] qcow2: move decompression from qcow2-cluster.c to qcow2.c Vladimir Sementsov-Ogievskiy
2018-11-05 15:45   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-11-01 18:27 ` [Qemu-devel] [PATCH 4/7] qcow2: refactor decompress_buffer Vladimir Sementsov-Ogievskiy
2018-11-06 10:45   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-11-01 18:27 ` [Qemu-devel] [PATCH 5/7] qcow2: use byte-based read in qcow2_decompress_cluster Vladimir Sementsov-Ogievskiy
2018-11-06 13:53   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-11-06 15:18     ` Vladimir Sementsov-Ogievskiy [this message]
2018-11-01 18:27 ` [Qemu-devel] [PATCH 6/7] qcow2: aio support for compressed cluster read Vladimir Sementsov-Ogievskiy
2018-11-06 15:06   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-11-06 15:13     ` Vladimir Sementsov-Ogievskiy
2018-11-06 15:30       ` Alberto Garcia
2018-11-06 16:24         ` Vladimir Sementsov-Ogievskiy
2018-11-09 13:51           ` Alberto Garcia
2018-11-01 18:27 ` [Qemu-devel] [PATCH 7/7] qcow2: do decompression in threads Vladimir Sementsov-Ogievskiy
2018-11-06 14:03   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-11-06 23:40   ` [Qemu-devel] " Paolo Bonzini
2018-11-12 15:32 ` [Qemu-devel] [PATCH 0/7] qcow2 decompress " Kevin Wolf
2018-11-12 16:16   ` Vladimir Sementsov-Ogievskiy

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=e4d6f89f-5d27-7456-1f4c-adf8ec377faf@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=berto@igalia.com \
    --cc=den@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 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.