Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
On 29.07.21 18:29, Vladimir Sementsov-Ogievskiy wrote: 29.07.2021 16:47, Max Reitz wrote: On 29.07.21 13:35, Vladimir Sementsov-Ogievskiy wrote: 29.07.2021 13:38, Max Reitz wrote: On 29.07.21 12:02, Vladimir Sementsov-Ogievskiy wrote: 28.07.2021 10:00, Max Reitz wrote: On 27.07.21 18:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Well, I would have preferred it if you’d rebased this on top of that series, precisely because it’s an alternative to only part of it. And if it’s just an untested draft, that would have been even better, because it would’ve given a better idea on what the cleanup looks like. There are also things like this series making cancel internally always a force-cancel, where I’m not sure whether we want that in the replication driver or not[1]. With my series, we add an explicit parameter, so we’re forced to think about it, and then in this series on top we can just drop the parameter for all force-cancel invocations again, and for all non-force-cancel invocations we would have to think a bit more. I now don't sure that patch 5 of your series is correct (see my last answer to it), that's why I decided to not base on it. Well, we can always take patch 5 from v1. (Where I changed any job_is_cancelled() to job_cancel_requested() when it influenced the external interface.) My series has the benefit of handling soft-mirror-cancel case the other way and handles mirror finalization in case of soft-cancel properly. Specifically as for this series, I don’t like job_complete_ex() very much, I think the parameter should be part of job_complete() itself. That was my idea. But job_complete is passed as function pointer, so changing its prototype would be more work.. But I think it's possible. If we think that’s too specific of a mirror parameter to include in normal job_complete(), well, then there shouldn’t be a job_complete_ex() either, and do_graph_change should be a property of the mirror job (perhaps as pivot_on_completion) that’s cleared by qmp_block_job_cancel() before invoking job_complete(). This way users will lose a way to make a decision during job running.. On the contrary, it would be a precursor to letting the user change this property explicitly with a new QMP command. But probably they don't need actually. Moving the option to mirror job parameter seems a good option to me. Max [1] Although looking at it again now, it probably wants force-cancel. What do you think of my idea to keep old bugs as is and just deprecate block-job-cancel and add a new interface for "no-graph-change mirror" case? I don’t see a reason for that. The fix isn’t that complicated. Also, honestly, I don’t see a good reason for deprecating anything. Current interface lead to mess in the code, that's bad. Cancellation mode that is actually a kind of completion (and having comments in many places about that) - that shows for me that interface is not good.. It's a question of terminology, what to call "cancel". Also, that's not the first time this question arise. Remember my recent cancel-in-flight-requests series, when I thought that "cancel is cancel" and didn't consider soft-cancel of mirror.. And reviewers didn't caught it. I don't think that interface is good, it will always confuse new developers and users. But that's just my opinion, I don't impose it ) If not deprecate, i.e. if we consider old interface to be good, than no reason for this my series and for introducing new interface :) I’m not against a better interface, I’m against using this current bug as an excuse to improve the interface. We’ve known we want to improve the interface for quite a long time now, we don’t need an excuse for that. If we use this bug as an excuse, I’m afraid of becoming hung up on interface discussions instead of just getting the bug fixed. And we must get the bug fixed, it’s real, it’s kind of bad, and saying “it won’t appear with the new interface, let’s not worry about the old one” is not something I like. OTOH, if we use this bug as an excuse, I’m also afraid of trying to rush the design instead of actually implementing the interface that we’ve always desired, i.e. where the user gets to choose the completion mode via yet-to-be-implemented some job property setter function. As a final note (but this is precisely the interface discussion that I want to avoid for now), I said I don’t see a good reason for deprecating anything, because `job-cancel force=false` can just internally do `set-job-property .pivot_on_completion=false; job-complete`. From an implementation perspective, that should be simple. I u
Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
29.07.2021 16:47, Max Reitz wrote: On 29.07.21 13:35, Vladimir Sementsov-Ogievskiy wrote: 29.07.2021 13:38, Max Reitz wrote: On 29.07.21 12:02, Vladimir Sementsov-Ogievskiy wrote: 28.07.2021 10:00, Max Reitz wrote: On 27.07.21 18:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Well, I would have preferred it if you’d rebased this on top of that series, precisely because it’s an alternative to only part of it. And if it’s just an untested draft, that would have been even better, because it would’ve given a better idea on what the cleanup looks like. There are also things like this series making cancel internally always a force-cancel, where I’m not sure whether we want that in the replication driver or not[1]. With my series, we add an explicit parameter, so we’re forced to think about it, and then in this series on top we can just drop the parameter for all force-cancel invocations again, and for all non-force-cancel invocations we would have to think a bit more. I now don't sure that patch 5 of your series is correct (see my last answer to it), that's why I decided to not base on it. Well, we can always take patch 5 from v1. (Where I changed any job_is_cancelled() to job_cancel_requested() when it influenced the external interface.) My series has the benefit of handling soft-mirror-cancel case the other way and handles mirror finalization in case of soft-cancel properly. Specifically as for this series, I don’t like job_complete_ex() very much, I think the parameter should be part of job_complete() itself. That was my idea. But job_complete is passed as function pointer, so changing its prototype would be more work.. But I think it's possible. If we think that’s too specific of a mirror parameter to include in normal job_complete(), well, then there shouldn’t be a job_complete_ex() either, and do_graph_change should be a property of the mirror job (perhaps as pivot_on_completion) that’s cleared by qmp_block_job_cancel() before invoking job_complete(). This way users will lose a way to make a decision during job running.. On the contrary, it would be a precursor to letting the user change this property explicitly with a new QMP command. But probably they don't need actually. Moving the option to mirror job parameter seems a good option to me. Max [1] Although looking at it again now, it probably wants force-cancel. What do you think of my idea to keep old bugs as is and just deprecate block-job-cancel and add a new interface for "no-graph-change mirror" case? I don’t see a reason for that. The fix isn’t that complicated. Also, honestly, I don’t see a good reason for deprecating anything. Current interface lead to mess in the code, that's bad. Cancellation mode that is actually a kind of completion (and having comments in many places about that) - that shows for me that interface is not good.. It's a question of terminology, what to call "cancel". Also, that's not the first time this question arise. Remember my recent cancel-in-flight-requests series, when I thought that "cancel is cancel" and didn't consider soft-cancel of mirror.. And reviewers didn't caught it. I don't think that interface is good, it will always confuse new developers and users. But that's just my opinion, I don't impose it ) If not deprecate, i.e. if we consider old interface to be good, than no reason for this my series and for introducing new interface :) I’m not against a better interface, I’m against using this current bug as an excuse to improve the interface. We’ve known we want to improve the interface for quite a long time now, we don’t need an excuse for that. If we use this bug as an excuse, I’m afraid of becoming hung up on interface discussions instead of just getting the bug fixed. And we must get the bug fixed, it’s real, it’s kind of bad, and saying “it won’t appear with the new interface, let’s not worry about the old one” is not something I like. OTOH, if we use this bug as an excuse, I’m also afraid of trying to rush the design instead of actually implementing the interface that we’ve always desired, i.e. where the user gets to choose the completion mode via yet-to-be-implemented some job property setter function. As a final note (but this is precisely the interface discussion that I want to avoid for now), I said I don’t see a good reason for deprecating anything, because `job-cancel force=false` can just internally do `set-job-property .pivot_on_completion=false; job-complete`. From an implementation perspective, that should be simple. I understand that for users the existence of the `force` flag may still be confusing
Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
On 29.07.21 13:35, Vladimir Sementsov-Ogievskiy wrote: 29.07.2021 13:38, Max Reitz wrote: On 29.07.21 12:02, Vladimir Sementsov-Ogievskiy wrote: 28.07.2021 10:00, Max Reitz wrote: On 27.07.21 18:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Well, I would have preferred it if you’d rebased this on top of that series, precisely because it’s an alternative to only part of it. And if it’s just an untested draft, that would have been even better, because it would’ve given a better idea on what the cleanup looks like. There are also things like this series making cancel internally always a force-cancel, where I’m not sure whether we want that in the replication driver or not[1]. With my series, we add an explicit parameter, so we’re forced to think about it, and then in this series on top we can just drop the parameter for all force-cancel invocations again, and for all non-force-cancel invocations we would have to think a bit more. I now don't sure that patch 5 of your series is correct (see my last answer to it), that's why I decided to not base on it. Well, we can always take patch 5 from v1. (Where I changed any job_is_cancelled() to job_cancel_requested() when it influenced the external interface.) My series has the benefit of handling soft-mirror-cancel case the other way and handles mirror finalization in case of soft-cancel properly. Specifically as for this series, I don’t like job_complete_ex() very much, I think the parameter should be part of job_complete() itself. That was my idea. But job_complete is passed as function pointer, so changing its prototype would be more work.. But I think it's possible. If we think that’s too specific of a mirror parameter to include in normal job_complete(), well, then there shouldn’t be a job_complete_ex() either, and do_graph_change should be a property of the mirror job (perhaps as pivot_on_completion) that’s cleared by qmp_block_job_cancel() before invoking job_complete(). This way users will lose a way to make a decision during job running.. On the contrary, it would be a precursor to letting the user change this property explicitly with a new QMP command. But probably they don't need actually. Moving the option to mirror job parameter seems a good option to me. Max [1] Although looking at it again now, it probably wants force-cancel. What do you think of my idea to keep old bugs as is and just deprecate block-job-cancel and add a new interface for "no-graph-change mirror" case? I don’t see a reason for that. The fix isn’t that complicated. Also, honestly, I don’t see a good reason for deprecating anything. Current interface lead to mess in the code, that's bad. Cancellation mode that is actually a kind of completion (and having comments in many places about that) - that shows for me that interface is not good.. It's a question of terminology, what to call "cancel". Also, that's not the first time this question arise. Remember my recent cancel-in-flight-requests series, when I thought that "cancel is cancel" and didn't consider soft-cancel of mirror.. And reviewers didn't caught it. I don't think that interface is good, it will always confuse new developers and users. But that's just my opinion, I don't impose it ) If not deprecate, i.e. if we consider old interface to be good, than no reason for this my series and for introducing new interface :) I’m not against a better interface, I’m against using this current bug as an excuse to improve the interface. We’ve known we want to improve the interface for quite a long time now, we don’t need an excuse for that. If we use this bug as an excuse, I’m afraid of becoming hung up on interface discussions instead of just getting the bug fixed. And we must get the bug fixed, it’s real, it’s kind of bad, and saying “it won’t appear with the new interface, let’s not worry about the old one” is not something I like. OTOH, if we use this bug as an excuse, I’m also afraid of trying to rush the design instead of actually implementing the interface that we’ve always desired, i.e. where the user gets to choose the completion mode via yet-to-be-implemented some job property setter function. As a final note (but this is precisely the interface discussion that I want to avoid for now), I said I don’t see a good reason for deprecating anything, because `job-cancel force=false` can just internally do `set-job-property .pivot_on_completion=false; job-complete`. From an implementation perspective, that should be simple. I understand that for users the existence of the `force` flag may still be confusing and so we might
Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
29.07.2021 13:38, Max Reitz wrote: On 29.07.21 12:02, Vladimir Sementsov-Ogievskiy wrote: 28.07.2021 10:00, Max Reitz wrote: On 27.07.21 18:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Well, I would have preferred it if you’d rebased this on top of that series, precisely because it’s an alternative to only part of it. And if it’s just an untested draft, that would have been even better, because it would’ve given a better idea on what the cleanup looks like. There are also things like this series making cancel internally always a force-cancel, where I’m not sure whether we want that in the replication driver or not[1]. With my series, we add an explicit parameter, so we’re forced to think about it, and then in this series on top we can just drop the parameter for all force-cancel invocations again, and for all non-force-cancel invocations we would have to think a bit more. I now don't sure that patch 5 of your series is correct (see my last answer to it), that's why I decided to not base on it. Well, we can always take patch 5 from v1. (Where I changed any job_is_cancelled() to job_cancel_requested() when it influenced the external interface.) My series has the benefit of handling soft-mirror-cancel case the other way and handles mirror finalization in case of soft-cancel properly. Specifically as for this series, I don’t like job_complete_ex() very much, I think the parameter should be part of job_complete() itself. That was my idea. But job_complete is passed as function pointer, so changing its prototype would be more work.. But I think it's possible. If we think that’s too specific of a mirror parameter to include in normal job_complete(), well, then there shouldn’t be a job_complete_ex() either, and do_graph_change should be a property of the mirror job (perhaps as pivot_on_completion) that’s cleared by qmp_block_job_cancel() before invoking job_complete(). This way users will lose a way to make a decision during job running.. On the contrary, it would be a precursor to letting the user change this property explicitly with a new QMP command. But probably they don't need actually. Moving the option to mirror job parameter seems a good option to me. Max [1] Although looking at it again now, it probably wants force-cancel. What do you think of my idea to keep old bugs as is and just deprecate block-job-cancel and add a new interface for "no-graph-change mirror" case? I don’t see a reason for that. The fix isn’t that complicated. Also, honestly, I don’t see a good reason for deprecating anything. Current interface lead to mess in the code, that's bad. Cancellation mode that is actually a kind of completion (and having comments in many places about that) - that shows for me that interface is not good.. It's a question of terminology, what to call "cancel". Also, that's not the first time this question arise. Remember my recent cancel-in-flight-requests series, when I thought that "cancel is cancel" and didn't consider soft-cancel of mirror.. And reviewers didn't caught it. I don't think that interface is good, it will always confuse new developers and users. But that's just my opinion, I don't impose it ) If not deprecate, i.e. if we consider old interface to be good, than no reason for this my series and for introducing new interface :) -- Best regards, Vladimir
Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
On 29.07.21 12:02, Vladimir Sementsov-Ogievskiy wrote: 28.07.2021 10:00, Max Reitz wrote: On 27.07.21 18:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Well, I would have preferred it if you’d rebased this on top of that series, precisely because it’s an alternative to only part of it. And if it’s just an untested draft, that would have been even better, because it would’ve given a better idea on what the cleanup looks like. There are also things like this series making cancel internally always a force-cancel, where I’m not sure whether we want that in the replication driver or not[1]. With my series, we add an explicit parameter, so we’re forced to think about it, and then in this series on top we can just drop the parameter for all force-cancel invocations again, and for all non-force-cancel invocations we would have to think a bit more. I now don't sure that patch 5 of your series is correct (see my last answer to it), that's why I decided to not base on it. Well, we can always take patch 5 from v1. (Where I changed any job_is_cancelled() to job_cancel_requested() when it influenced the external interface.) My series has the benefit of handling soft-mirror-cancel case the other way and handles mirror finalization in case of soft-cancel properly. Specifically as for this series, I don’t like job_complete_ex() very much, I think the parameter should be part of job_complete() itself. That was my idea. But job_complete is passed as function pointer, so changing its prototype would be more work.. But I think it's possible. If we think that’s too specific of a mirror parameter to include in normal job_complete(), well, then there shouldn’t be a job_complete_ex() either, and do_graph_change should be a property of the mirror job (perhaps as pivot_on_completion) that’s cleared by qmp_block_job_cancel() before invoking job_complete(). This way users will lose a way to make a decision during job running.. On the contrary, it would be a precursor to letting the user change this property explicitly with a new QMP command. But probably they don't need actually. Moving the option to mirror job parameter seems a good option to me. Max [1] Although looking at it again now, it probably wants force-cancel. What do you think of my idea to keep old bugs as is and just deprecate block-job-cancel and add a new interface for "no-graph-change mirror" case? I don’t see a reason for that. The fix isn’t that complicated. Also, honestly, I don’t see a good reason for deprecating anything. Max
Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
28.07.2021 10:00, Max Reitz wrote: On 27.07.21 18:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Well, I would have preferred it if you’d rebased this on top of that series, precisely because it’s an alternative to only part of it. And if it’s just an untested draft, that would have been even better, because it would’ve given a better idea on what the cleanup looks like. There are also things like this series making cancel internally always a force-cancel, where I’m not sure whether we want that in the replication driver or not[1]. With my series, we add an explicit parameter, so we’re forced to think about it, and then in this series on top we can just drop the parameter for all force-cancel invocations again, and for all non-force-cancel invocations we would have to think a bit more. I now don't sure that patch 5 of your series is correct (see my last answer to it), that's why I decided to not base on it. My series has the benefit of handling soft-mirror-cancel case the other way and handles mirror finalization in case of soft-cancel properly. Specifically as for this series, I don’t like job_complete_ex() very much, I think the parameter should be part of job_complete() itself. That was my idea. But job_complete is passed as function pointer, so changing its prototype would be more work.. But I think it's possible. If we think that’s too specific of a mirror parameter to include in normal job_complete(), well, then there shouldn’t be a job_complete_ex() either, and do_graph_change should be a property of the mirror job (perhaps as pivot_on_completion) that’s cleared by qmp_block_job_cancel() before invoking job_complete(). This way users will lose a way to make a decision during job running.. But probably they don't need actually. Moving the option to mirror job parameter seems a good option to me. Max [1] Although looking at it again now, it probably wants force-cancel. What do you think of my idea to keep old bugs as is and just deprecate block-job-cancel and add a new interface for "no-graph-change mirror" case? -- Best regards, Vladimir
Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
On 27.07.21 18:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Well, I would have preferred it if you’d rebased this on top of that series, precisely because it’s an alternative to only part of it. And if it’s just an untested draft, that would have been even better, because it would’ve given a better idea on what the cleanup looks like. There are also things like this series making cancel internally always a force-cancel, where I’m not sure whether we want that in the replication driver or not[1]. With my series, we add an explicit parameter, so we’re forced to think about it, and then in this series on top we can just drop the parameter for all force-cancel invocations again, and for all non-force-cancel invocations we would have to think a bit more. Specifically as for this series, I don’t like job_complete_ex() very much, I think the parameter should be part of job_complete() itself. If we think that’s too specific of a mirror parameter to include in normal job_complete(), well, then there shouldn’t be a job_complete_ex() either, and do_graph_change should be a property of the mirror job (perhaps as pivot_on_completion) that’s cleared by qmp_block_job_cancel() before invoking job_complete(). Max [1] Although looking at it again now, it probably wants force-cancel.
Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
27.07.2021 19:47, Vladimir Sementsov-Ogievskiy wrote: Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Side idea: Instead of this all we can do the following: 1. Add new interface as alternative to soft-cancelling READY mirror. It may be argument to job-complete qmp command, or some separate command to change job parameters, or just an option for blockdev-mirror command (may be our users actually know what they want when they start the job). 2. Deprecate block-job-cancel command (with recommendation to use job-cancel and new interface [1] instead) 3. Wait for 3 releases and apply patch 3, improved by dropping block-job-cancel at all. This way, deprecated interface remains buggy until dropped, but that's not bad. It's good actually :) Vladimir Sementsov-Ogievskiy (3): job: add job_complete_ex with do_graph_change argument job: use complete(do_graph_change=false) to handle soft cancel job: drop force argument of *job*cancel include/qemu/job.h | 19 -- block/backup.c | 2 +- block/mirror.c | 33 +--- blockdev.c | 13 +++-- job-qmp.c| 2 +- job.c| 27 ++ tests/unit/test-bdrv-drain.c | 2 +- tests/unit/test-block-iothread.c | 2 +- tests/unit/test-blockjob-txn.c | 8 tests/unit/test-blockjob.c | 4 ++-- 10 files changed, 62 insertions(+), 50 deletions(-) -- Best regards, Vladimir
[PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror
Hi all! That's an alternative to (part of) Max's "[PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel" and shows' my idea of handling soft-cancelling READY mirror case directly in qmp_block_job_cancel. And cleanup all other job cancelling functions. That's untested draft, don't take it to heart :) Vladimir Sementsov-Ogievskiy (3): job: add job_complete_ex with do_graph_change argument job: use complete(do_graph_change=false) to handle soft cancel job: drop force argument of *job*cancel include/qemu/job.h | 19 -- block/backup.c | 2 +- block/mirror.c | 33 +--- blockdev.c | 13 +++-- job-qmp.c| 2 +- job.c| 27 ++ tests/unit/test-bdrv-drain.c | 2 +- tests/unit/test-block-iothread.c | 2 +- tests/unit/test-blockjob-txn.c | 8 tests/unit/test-blockjob.c | 4 ++-- 10 files changed, 62 insertions(+), 50 deletions(-) -- 2.29.2