* [PATCH v1] block/stream:add flush l2_table_cache, ensure data integrity
@ 2023-07-24 7:30 Evanzhang
2023-07-24 7:30 ` Evanzhang
0 siblings, 1 reply; 6+ messages in thread
From: Evanzhang @ 2023-07-24 7:30 UTC (permalink / raw)
To: qemu-devel, qemu-block; +Cc: jsnow, vsementsov, kwolf, hreitz, Evanzhang
Verification steps:
1.qemu-img create -f qcow2 data1.img 10M
qemu-img create -f qcow2 -b data1.img data1.qcow2
2.write 1M data to data1.img
3.create vm use data1.qcow2 as the data disk
/usr/libexec/qemu-kvm -M pc,accel=kvm -smp 4 -cpu host -m 4g -drive
file=./centos_7.5_64_20200603.qcow2,if=none,id=drive-virtio0,cache=none,
aio=native -device virtio-blk-pci,drive=drive-virtio0,id=virtio0 -drive
file=./data1.qcow2,if=none,id=drive-virtio1,cache=none,l2-cache-size=
1048576,aio=native -device virtio-blk-pci,drive=drive-virtio1,id=virtio1
-vnc :101 -qmp stdio
4.{"execute": "block-stream", "arguments":{"device":"drive-virtio1"}}
5.kill -9 $(pidof qemu-kvm)
6.md5sum data1.img data1.qcow2,check if it is the same
Evanzhang (1):
block/stream:add flush l2_table_cache,ensure data integrity
block/stream.c | 6 ++++++
1 file changed, 6 insertions(+)
--
2.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1] block/stream:add flush l2_table_cache, ensure data integrity
2023-07-24 7:30 [PATCH v1] block/stream:add flush l2_table_cache, ensure data integrity Evanzhang
@ 2023-07-24 7:30 ` Evanzhang
2023-07-25 14:25 ` [PATCH v1] block/stream:add flush l2_table_cache,ensure " Vladimir Sementsov-Ogievskiy
0 siblings, 1 reply; 6+ messages in thread
From: Evanzhang @ 2023-07-24 7:30 UTC (permalink / raw)
To: qemu-devel, qemu-block; +Cc: jsnow, vsementsov, kwolf, hreitz, Evanzhang
block_stream will not actively flush l2_table_cache,when qemu
process exception exit,causing disk data loss
Signed-off-by: Evanzhang <Evanzhang@archeros.com>
---
block/stream.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/stream.c b/block/stream.c
index e522bbd..a5e08da 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -207,6 +207,12 @@ static int coroutine_fn stream_run(Job *job, Error **errp)
}
}
+ /*
+ * Complete stream_populate,force flush l2_table_cache,to
+ * avoid unexpected termination of process, l2_table loss
+ */
+ qcow2_cache_flush(bs, ((BDRVQcow2State *)bs->opaque)->l2_table_cache);
+
/* Do not remove the backing file if an error was there but ignored. */
return error;
}
--
2.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] block/stream:add flush l2_table_cache,ensure data integrity
2023-07-24 7:30 ` Evanzhang
@ 2023-07-25 14:25 ` Vladimir Sementsov-Ogievskiy
2023-07-25 15:13 ` Denis V. Lunev
0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2023-07-25 14:25 UTC (permalink / raw)
To: Evanzhang, qemu-devel, qemu-block; +Cc: jsnow, kwolf, hreitz, Denis V. Lunev
On 24.07.23 10:30, Evanzhang wrote:
> block_stream will not actively flush l2_table_cache,when qemu
> process exception exit,causing disk data loss
>
> Signed-off-by: Evanzhang <Evanzhang@archeros.com>
> ---
> block/stream.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/block/stream.c b/block/stream.c
> index e522bbd..a5e08da 100644
> --- a/block/stream.c
> +++ b/block/stream.c
> @@ -207,6 +207,12 @@ static int coroutine_fn stream_run(Job *job, Error **errp)
> }
> }
>
> + /*
> + * Complete stream_populate,force flush l2_table_cache,to
> + * avoid unexpected termination of process, l2_table loss
> + */
> + qcow2_cache_flush(bs, ((BDRVQcow2State *)bs->opaque)->l2_table_cache);
> +
> /* Do not remove the backing file if an error was there but ignored. */
> return error;
> }
Hi!
I think, it's more correct just call bdrv_co_flush(bs), which should do all the job. Also, stream_run() should fail if flush fails.
Also, I remember I've done it for all (or at least several) blockjobs generically, so that any blockjob must succesfully flush target to report success.. But now I can find neither my patches nor the code :( Den, Kevin, Hanna, don't you remember this topic?
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] block/stream:add flush l2_table_cache,ensure data integrity
2023-07-25 14:25 ` [PATCH v1] block/stream:add flush l2_table_cache,ensure " Vladimir Sementsov-Ogievskiy
@ 2023-07-25 15:13 ` Denis V. Lunev
2023-07-25 16:38 ` Vladimir Sementsov-Ogievskiy
0 siblings, 1 reply; 6+ messages in thread
From: Denis V. Lunev @ 2023-07-25 15:13 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy, Evanzhang, qemu-devel, qemu-block
Cc: jsnow, kwolf, hreitz
On 7/25/23 16:25, Vladimir Sementsov-Ogievskiy wrote:
> On 24.07.23 10:30, Evanzhang wrote:
>> block_stream will not actively flush l2_table_cache,when qemu
>> process exception exit,causing disk data loss
>>
>> Signed-off-by: Evanzhang <Evanzhang@archeros.com>
>> ---
>> block/stream.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/block/stream.c b/block/stream.c
>> index e522bbd..a5e08da 100644
>> --- a/block/stream.c
>> +++ b/block/stream.c
>> @@ -207,6 +207,12 @@ static int coroutine_fn stream_run(Job *job,
>> Error **errp)
>> }
>> }
>> + /*
>> + * Complete stream_populate,force flush l2_table_cache,to
>> + * avoid unexpected termination of process, l2_table loss
>> + */
>> + qcow2_cache_flush(bs, ((BDRVQcow2State
>> *)bs->opaque)->l2_table_cache);
>> +
>> /* Do not remove the backing file if an error was there but
>> ignored. */
>> return error;
>> }
>
> Hi!
>
> I think, it's more correct just call bdrv_co_flush(bs), which should
> do all the job. Also, stream_run() should fail if flush fails.
>
> Also, I remember I've done it for all (or at least several) blockjobs
> generically, so that any blockjob must succesfully flush target to
> report success.. But now I can find neither my patches nor the code :(
> Den, Kevin, Hanna, don't you remember this topic?
>
This was a part of compressed write cache series, which was postponed.
https://lore.kernel.org/all/20210305173507.393137-1-vsementsov@virtuozzo.com/T/#m87315593ed5ab16e5d0e4e7a5ae6d776fbbaec77
We have it ported to 7.0 QEMU.
Not a problem to port to master and resend.
Will this make a sense?
Den
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] block/stream:add flush l2_table_cache,ensure data integrity
2023-07-25 15:13 ` Denis V. Lunev
@ 2023-07-25 16:38 ` Vladimir Sementsov-Ogievskiy
2023-07-26 7:04 ` 回复: " 张承
0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2023-07-25 16:38 UTC (permalink / raw)
To: Denis V. Lunev, Evanzhang, qemu-devel, qemu-block; +Cc: jsnow, kwolf, hreitz
On 25.07.23 18:13, Denis V. Lunev wrote:
> On 7/25/23 16:25, Vladimir Sementsov-Ogievskiy wrote:
>> On 24.07.23 10:30, Evanzhang wrote:
>>> block_stream will not actively flush l2_table_cache,when qemu
>>> process exception exit,causing disk data loss
>>>
>>> Signed-off-by: Evanzhang <Evanzhang@archeros.com>
>>> ---
>>> block/stream.c | 6 ++++++
>>> 1 file changed, 6 insertions(+)
>>>
>>> diff --git a/block/stream.c b/block/stream.c
>>> index e522bbd..a5e08da 100644
>>> --- a/block/stream.c
>>> +++ b/block/stream.c
>>> @@ -207,6 +207,12 @@ static int coroutine_fn stream_run(Job *job, Error **errp)
>>> }
>>> }
>>> + /*
>>> + * Complete stream_populate,force flush l2_table_cache,to
>>> + * avoid unexpected termination of process, l2_table loss
>>> + */
>>> + qcow2_cache_flush(bs, ((BDRVQcow2State *)bs->opaque)->l2_table_cache);
>>> +
>>> /* Do not remove the backing file if an error was there but ignored. */
>>> return error;
>>> }
>>
>> Hi!
>>
>> I think, it's more correct just call bdrv_co_flush(bs), which should do all the job. Also, stream_run() should fail if flush fails.
>>
>> Also, I remember I've done it for all (or at least several) blockjobs generically, so that any blockjob must succesfully flush target to report success.. But now I can find neither my patches nor the code :( Den, Kevin, Hanna, don't you remember this topic?
>>
> This was a part of compressed write cache series, which was postponed.
>
> https://lore.kernel.org/all/20210305173507.393137-1-vsementsov@virtuozzo.com/T/#m87315593ed5ab16e5d0e4e7a5ae6d776fbbaec77
>
> We have it ported to 7.0 QEMU.
>
> Not a problem to port to master and resend.
> Will this make a sense?
>
O, thanks! Patch 01 applies with a little conflict to master, so I'll just resend it myself.
--
Best regards,
Vladimir
^ permalink raw reply [flat|nested] 6+ messages in thread
* 回复: [PATCH v1] block/stream:add flush l2_table_cache,ensure data integrity
2023-07-25 16:38 ` Vladimir Sementsov-Ogievskiy
@ 2023-07-26 7:04 ` 张承
0 siblings, 0 replies; 6+ messages in thread
From: 张承 @ 2023-07-26 7:04 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy, Denis V. Lunev,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: jsnow@redhat.com, kwolf@redhat.com, hreitz@redhat.com
>On 25.07.23 18:13, Denis V. Lunev wrote:
>>On 7/25/23 16:25, Vladimir Sementsov-Ogievskiy wrote:
>>>On 24.07.23 10:30, Evanzhang wrote:
>>>> On 7/26/23 01:41, Vladimir Sementsov-Ogievskiy wrote:
>>>>block_stream will not actively flush l2_table_cache,when qemu
>>>> process exception exit,causing disk data loss
>>>>
>>>>Signed-off-by: Evanzhang <Evanzhang@archeros.com>
>>>>---
>>>> block/stream.c | 6 ++++++
>>>> 1 file changed, 6 insertions(+)
>>>>
>>> >diff --git a/block/stream.c b/block/stream.c index e522bbd..a5e08da
>>>>100644
>>>> --- a/block/stream.c
>>>> +++ b/block/stream.c
>>>>@@ -207,6 +207,12 @@ static int coroutine_fn stream_run(Job *job,
>>>> Error **errp)
>>>> }
>>>> }
>>>> + /*
>>>> + * Complete stream_populate,force flush l2_table_cache,to
>>>> + * avoid unexpected termination of process, l2_table loss
>>>> + */
>>>> + qcow2_cache_flush(bs, ((BDRVQcow2State
>>>> +*)bs->opaque)->l2_table_cache);
>>>> +
>>>> /* Do not remove the backing file if an error was there but
>>>> ignored. */
>>>> return error;
>>>> }
>>>
>>> Hi!
>>>
>>> I think, it's more correct just call bdrv_co_flush(bs), which should do all the job. Also, stream_run() should fail if flush fails.
>>>
>>> Also, I remember I've done it for all (or at least several) blockjobs generically, so that any blockjob must succesfully flush target to report success.. But now I can find neither my patches nor the code :( Den, Kevin, Hanna, don't you remember this topic?
>>>
>> This was a part of compressed write cache series, which was postponed.
>>
>> https://lore.kernel.org/all/20210305173507.393137-1-vsementsov@virtuoz
>> zo.com/T/#m87315593ed5ab16e5d0e4e7a5ae6d776fbbaec77
>>
>> We have it ported to 7.0 QEMU.
>>
>> Not a problem to port to master and resend.
>> Will this make a sense?
>>
>O, thanks! Patch 01 applies with a little conflict to master, so I'll just resend it myself.
>
Thanks all !
With best regards !
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-26 7:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-24 7:30 [PATCH v1] block/stream:add flush l2_table_cache, ensure data integrity Evanzhang
2023-07-24 7:30 ` Evanzhang
2023-07-25 14:25 ` [PATCH v1] block/stream:add flush l2_table_cache,ensure " Vladimir Sementsov-Ogievskiy
2023-07-25 15:13 ` Denis V. Lunev
2023-07-25 16:38 ` Vladimir Sementsov-Ogievskiy
2023-07-26 7:04 ` 回复: " 张承
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).