@@ -876,7 +876,16 @@ bool block_job_is_cancelled(BlockJob *job)
return job->cancelled;
}
-int block_job_sleep_ns(BlockJob *job, int64_t ns)
+/**
+ * block_job_sleep_ns:
+ * @job: The job that calls the function.
+ * @ns: How many nanoseconds to stop for.
+ *
+ * Put the job to sleep (assuming that it wasn't canceled) for @ns
+ * %QEMU_CLOCK_REALTIME nanoseconds. Canceling the job will immediately
+ * interrupt the wait.
+ */
+static int block_job_sleep_ns(BlockJob *job, int64_t ns)
{
assert(job->busy);
@@ -138,17 +138,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
uint64_t shared_perm, int64_t speed, int flags,
BlockCompletionFunc *cb, void *opaque, Error **errp);
-/**
- * block_job_sleep_ns:
- * @job: The job that calls the function.
- * @ns: How many nanoseconds to stop for.
- *
- * Put the job to sleep (assuming that it wasn't canceled) for @ns
- * %QEMU_CLOCK_REALTIME nanoseconds. Canceling the job will immediately
- * interrupt the wait.
- */
-int block_job_sleep_ns(BlockJob *job, int64_t ns);
-
/**
* block_job_yield:
* @job: The job that calls the function.
@@ -506,7 +506,7 @@ static void coroutine_fn test_job_start(void *opaque)
TestBlockJob *s = opaque;
while (!s->should_complete) {
- block_job_sleep_ns(&s->common, 100000);
+ block_job_relax(&s->common, 100000);
}
block_job_defer_to_main_loop(&s->common, test_job_completed, NULL);
@@ -44,7 +44,7 @@ static void coroutine_fn test_block_job_run(void *opaque)
while (s->iterations--) {
if (s->use_timer) {
- block_job_sleep_ns(job, 0);
+ block_job_relax(job, 0);
} else {
block_job_yield(job);
}
There's not currently any external caller of it. Except in tests, but we'll fix that here too. Replace usages in test cases with block_job_relax, which functions similarly enough to be used as a drop-in replacement. Very technically block_job_sleep_ns(job, 0) behaves differently from block_job_relax(job, 0) in that relax may resolve to a no-op, but this makes no difference in the test in which it is used. Signed-off-by: John Snow <jsnow@redhat.com> --- blockjob.c | 11 ++++++++++- include/block/blockjob_int.h | 11 ----------- tests/test-bdrv-drain.c | 2 +- tests/test-blockjob-txn.c | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-)