qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4] block-jobs: flush target at the end of .run()


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v4] block-jobs: flush target at the end of .run()
Date: Tue, 3 Oct 2023 12:53:42 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

On 03.08.23 05:43, Evanzhang wrote:
[...]

diff --git a/block/mirror.c b/block/mirror.c
index d3cacd1708..cd19b49f7f 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1143,6 +1143,10 @@ immediate_exit:
     g_free(s->in_flight_bitmap);
     bdrv_dirty_iter_free(s->dbi);

+    if (ret >= 0) {
+        ret = block_job_final_target_flush(&s->common, blk_bs(s->target));
+    }
+
     if (need_drain) {
         s->in_drain = true;
         bdrv_drained_begin(bs);

hi,I use gdb tested drive-mirror,break block_job_final_target_flush,
mirror_run  was not called it.
qmp command:
{"execute": "drive-mirror","arguments": {"device": "drive-virtio1","target":
"./data1.test","sync": "full"}}

Sorry for long answer. I"m going to resend a new version soon.

I now checked, and I see that block_job_final_target_flush() is called.

But it is called after executing block-job-complete command.


--- a/include/block/blockjob_int.h
+++ b/include/block/blockjob_int.h
@@ -152,4 +152,15 @@ void block_job_ratelimit_sleep(BlockJob *job);
BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
                                         int is_read, int error);

+/**
+ * block_job_final_target_flush:
+ * @job: The job to signal an error for if flush failed.
+ * @target_bs: The bs to flush.
+ *
+ * The function is intended to be called at the end of .run() for any data
+ * copying job.
+ */
+int coroutine_fn
+block_job_final_target_flush(BlockJob *job, BlockDriverState *target_bs);
+
#endif
--
2.34.1

--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]