[Devel] [PATCH vz9 v2] dm-qcow2: support mixed compression images
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Wed Feb 19 08:39:04 MSK 2025
On 2/19/25 12:36, Alexander Atanasov wrote:
> On 19.02.25 4:27, Pavel Tikhomirov wrote:
>>
>>
>> On 2/18/25 22:06, Alexander Atanasov wrote:
>>> Currently code uses only top qcow2 delta to handle decompression.
>>> Images have compression type in the qcow2 header already set when
>>> loaded.
>>> To support mixed compression switch to use qio->qcow2 and respective
>>> qcow2 header so the decompression is performed with the correct type.
>>> Remove qcow2 argument in functions called from decompression where
>>> possible and use qio->qcow2 which is the respective qcow2 image for
>>> the qio, a qio references only one image.
>>>
>>> https://virtuozzo.atlassian.net/browse/VSTOR-97155
>>> Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
>>> ---
>>> drivers/md/dm-qcow2-map.c | 70 +++++++++++++++++++++++----------------
>>> 1 file changed, 42 insertions(+), 28 deletions(-)
>>>
>>>
>>> v1->v2:
>>> - drop extra stream reset for zstd
>>>
>>> diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
>>> index ccc8d4484049..568bf68981b4 100644
>>> --- a/drivers/md/dm-qcow2-map.c
>>> +++ b/drivers/md/dm-qcow2-map.c
>>> @@ -3009,8 +3009,9 @@ static int copy_buf_to_bvec_iter(const struct
>>> bio_vec *bvec,
>>> return ret;
>>> }
>>> -static int copy_clu_part_to_qio(struct qcow2 *qcow2, const void
>>> *buf, struct qio *qio)
>>> +static int copy_clu_part_to_qio(const void *buf, struct qio *qio)
>>> {
>>> + struct qcow2 *qcow2 = qio->qcow2;
>>> u32 max, seek, clu_size = qcow2->clu_size;
>>> seek = bytes_off_in_cluster(qcow2, qio);
>>> @@ -3047,7 +3048,7 @@ static int copy_zcow_slice(loff_t start, loff_t
>>> end, void *qio_p,
>>> return copy_buf_to_bvec_iter(bvec, &iter, buf + off, clu_size -
>>> off);
>>> }
>>> -static int prepare_zcow_slices(struct qcow2 *qcow2, void *buf,
>>> struct qio *qio)
>>> +static int prepare_zcow_slices(void *buf, struct qio *qio)
>>> {
>>> loff_t consumed = 0;
>>> /* Place required slices in that pages like further COW expects */
>>> @@ -3655,46 +3656,59 @@ static int complete_metadata_writeback(struct
>>> qcow2 *qcow2)
>>> }
>>> /* Process completed compressed READs */
>>> -static void process_compressed_read(struct qcow2 *qcow2, struct
>>> list_head *read_list,
>>> +static void process_compressed_read(struct list_head *read_list,
>>> struct list_head *cow_list)
>>> {
>>> + struct qcow2 *qcow2, *qcow2_prev = NULL;
>>> struct qcow2_bvec *qvec;
>>> struct qio_ext *ext;
>>> int ret;
>>> void *buf = NULL, *arg;
>>> struct qio *qio;
>>> bool for_cow;
>>> + size_t dctxlen_alloced = 0;
>>
>> Let's fix spelling in variable name: s/alloced/allocated/
>
> there is nothing wrong with the spelling here.
> we do *alloc, and not *allocate - that is why to form a past participle
> is to add an ed suffix. this form is widely used and recognised in
> various projects both in source code and documentation. you will find it
> in some dictionaries too. And if you check, you will find it in kernel
> source code too, where it is used more than 500 times.
Ok. I just didn't see any "alloced" in the dictionaries:
https://www.collinsdictionary.com/conjugation/english/allocate
Past Participle
allocated
https://www.merriam-webster.com/dictionary/allocate
And my spell checker highlights it.
But it seems ok, as we already have it all over
drivers/md/dm-qcow2-map.c, and codespell also allows it.
>
--
Best regards, Tikhomirov Pavel
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list