Skip to contentSkip to conversation

job_pause_point

Qemu-devel Vladimir Sementsov-Ogievskiy 2 participants 3 messages Jan 30, 2019 – Jan 31, 2019

lore
Share & tools
lore
#0 lore raw

Hi!

I have a question about job_pause_point. Now a good job of moving generic things about block-jobs to job.c is done..

job_pause_point do visible job-state change, as changing job->status and job->paused.

Is it assumed, that job don't do anything after that state change? Iotests are written exactly with this assumption. On the other hand, code don't guarantee, that all in-flight requests are finished to this point.

Moreover, only the job itself knows about it's in-flight requests, therefore we can't handle it in generic job_pause_point(). So, should not job do something like

if (job_should_pause()) {
don't create more requests
wait all in-flight requests to complete
}
job_pause_point()

Or didn't I miss these things already discussed?

Signature · 2 lines
Best regards,
Vladimir
#1 lore raw
Quoted 11 lines · Vladimir Sementsov-Ogievskiy

Hi!

I have a question about job_pause_point. Now a good job of moving generic things about block-jobs to job.c is done..

job_pause_point do visible job-state change, as changing job->status and job->paused.

Is it assumed, that job don't do anything after that state change? Iotests are written exactly with this assumption. On the other hand, code don't guarantee, that all in-flight requests are finished to this point.

Oh, right. The job being paused only certifies that the coroutine driving the job isn't running. It has no real idea about mirror's asynchronous children.

Quoted 11 lines

Moreover, only the job itself knows about it's in-flight requests, therefore we can't handle it in generic job_pause_point(). So, should not job do something like

if (job_should_pause()) {
don't create more requests
wait all in-flight requests to complete
}
job_pause_point()

Or didn't I miss these things already discussed?

Well, mirror's pause callback does this:

static void coroutine_fn mirror_pause(Job *job)

{
    MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job);

    mirror_wait_for_all_io(s);
}

That's invoked BEFORE we change our status. That ought to be sufficient, is it not?

--js

#2 lore raw
Quoted 40 lines · John Snow
Quoted 11 lines · Vladimir Sementsov-Ogievskiy

Hi!

I have a question about job_pause_point. Now a good job of moving generic things about block-jobs to job.c is done..

job_pause_point do visible job-state change, as changing job->status and job->paused.

Is it assumed, that job don't do anything after that state change? Iotests are written exactly with this assumption. On the other hand, code don't guarantee, that all in-flight requests are finished to this point.

Oh, right. The job being paused only certifies that the coroutine driving the job isn't running. It has no real idea about mirror's asynchronous children.

Quoted 11 lines

Moreover, only the job itself knows about it's in-flight requests, therefore we can't handle it in generic job_pause_point(). So, should not job do something like

if (job_should_pause()) {
don't create more requests
wait all in-flight requests to complete
}
job_pause_point()

Or didn't I miss these things already discussed?

Well, mirror's pause callback does this:

static void coroutine_fn mirror_pause(Job *job)

{
     MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job);

     mirror_wait_for_all_io(s);
}
Quoted 5 lines

That's invoked BEFORE we change our status. That ought to be sufficient, is it not?

--js

Oh, yes, seems that it is what I missed, thank you.

Signature · 2 lines
Best regards,
Vladimir