#
7f0317cf |
| 05-Jul-2016 |
Alberto Garcia <berto@igalia.com> |
blockjob: Add 'job_id' parameter to block_job_create()
When a new job is created, the job ID is taken from the device name of the BDS. This patch adds a new 'job_id' parameter to let the caller prov
blockjob: Add 'job_id' parameter to block_job_create()
When a new job is created, the job ID is taken from the device name of the BDS. This patch adds a new 'job_id' parameter to let the caller provide one instead.
This patch also verifies that the ID is always unique and well-formed. This causes problems in a couple of places where no ID is being set, because the BDS does not have a device name.
In the case of test_block_job_start() (from test-blockjob-txn.c) we can simply use this new 'job_id' parameter to set the missing ID.
In the case of img_commit() (from qemu-img.c) we still don't have the API to make commit_active_start() set the job ID, so we solve it by setting a default value. We'll get rid of this as soon as we extend the API.
Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
ffb1f10c |
| 05-Jul-2016 |
Alberto Garcia <berto@igalia.com> |
blockjob: Add block_job_get()
Currently the way to look for a specific block job is to iterate the list manually using block_job_next().
Since we want to be able to identify a job primarily by its
blockjob: Add block_job_get()
Currently the way to look for a specific block job is to iterate the list manually using block_job_next().
Since we want to be able to identify a job primarily by its ID it makes sense to have a function that does just that.
Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
9df229c3 |
| 05-Jul-2016 |
Alberto Garcia <berto@igalia.com> |
blockjob: Update description of the 'id' field
The 'id' field of the BlockJob structure will be able to hold any ID, not only a device name. This patch updates the description of that field and the
blockjob: Update description of the 'id' field
The 'id' field of the BlockJob structure will be able to hold any ID, not only a device name. This patch updates the description of that field and the error messages where it is being used.
Soon we'll add the ability to set an arbitrary ID when creating a block job.
Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
b48100cf |
| 23-Jun-2016 |
Changlong Xie <xiecl.fnst@cn.fujitsu.com> |
blockjob: assert(cb) when create job
Callback for block job should always exist
Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Changlon
blockjob: assert(cb) when create job
Callback for block job should always exist
Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Message-id: 1466672241-22485-2-git-send-email-xiecl.fnst@cn.fujitsu.com Signed-off-by: Jeff Cody <jcody@redhat.com>
show more ...
|
#
463e0be1 |
| 16-Jun-2016 |
Stefan Hajnoczi <stefanha@redhat.com> |
blockjob: add AioContext attached callback
Block jobs that use additional BDSes or event loop resources need a callback to get their affairs in order when the AioContext is switched.
Simple block j
blockjob: add AioContext attached callback
Block jobs that use additional BDSes or event loop resources need a callback to get their affairs in order when the AioContext is switched.
Simple block jobs don't need an attach callback, they automatically work thanks to the generic attach/detach notifiers that this patch adds.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1466096189-6477-7-git-send-email-stefanha@redhat.com
show more ...
|
#
9f6bc648 |
| 16-Jun-2016 |
Stefan Hajnoczi <stefanha@redhat.com> |
blockjob: add block_job_get_aio_context()
Add a helper function to document why block jobs sometimes run in the QEMU main loop and to avoid code duplication in a following patch.
Signed-off-by: Ste
blockjob: add block_job_get_aio_context()
Add a helper function to document why block jobs sometimes run in the QEMU main loop and to avoid code duplication in a following patch.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1466096189-6477-5-git-send-email-stefanha@redhat.com
show more ...
|
#
fc9c0a9c |
| 16-Jun-2016 |
Stefan Hajnoczi <stefanha@redhat.com> |
blockjob: add pause points
Block jobs are coroutines that usually perform I/O but sometimes also sleep or yield. Currently only sleeping or yielded block jobs can be paused. This means jobs that d
blockjob: add pause points
Block jobs are coroutines that usually perform I/O but sometimes also sleep or yield. Currently only sleeping or yielded block jobs can be paused. This means jobs that do not sleep or yield (using block_job_yield()) are unaffected by block_job_pause().
Add block_job_pause_point() so that block jobs can mark quiescent points that are suitable for pausing. This solves the problem that it can take a block job a long time to pause if it is performing a long series of I/O operations.
Transitioning to paused state involves a .pause()/.resume() callback. These callbacks are used to ensure that I/O and event loop activity has ceased while the job is at a pause point.
Note that this patch introduces a stricter pause state than previously. The job->busy flag was incorrectly documented as a quiescent state without I/O pending. This is violated by any job that has I/O pending across sleep or block_job_yield(), like the mirror block job.
[Add missing block_job_should_pause() check to avoid deadlock after job->driver->pause() in block_job_pause_point(). --Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1466096189-6477-4-git-send-email-stefanha@redhat.com
show more ...
|
#
a7f3b7ff |
| 16-Jun-2016 |
Stefan Hajnoczi <stefanha@redhat.com> |
blockjob: rename block_job_is_paused()
The block_job_is_paused() function name is not great because callers only use it to determine whether pausing has been requested. Rename it to highlight those
blockjob: rename block_job_is_paused()
The block_job_is_paused() function name is not great because callers only use it to determine whether pausing has been requested. Rename it to highlight those semantics and remove it from the public header file as there are no external callers.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1466096189-6477-3-git-send-email-stefanha@redhat.com
show more ...
|
#
17bd51f9 |
| 16-Jun-2016 |
Stefan Hajnoczi <stefanha@redhat.com> |
blockjob: move iostatus reset out of block_job_enter()
The QMP block-job-resume command and cancellation may want to reset the job's iostatus. The next patches add a user who does not want to reset
blockjob: move iostatus reset out of block_job_enter()
The QMP block-job-resume command and cancellation may want to reset the job's iostatus. The next patches add a user who does not want to reset iostatus so move it up to block_job_enter() callers.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1466096189-6477-2-git-send-email-stefanha@redhat.com
show more ...
|
#
0824afda |
| 27-May-2016 |
Alberto Garcia <berto@igalia.com> |
block: Prevent sleeping jobs from resuming if they have been paused
If we pause a block job and drain its BlockDriverState we want that the job remains inactive until we call block_job_resume() agai
block: Prevent sleeping jobs from resuming if they have been paused
If we pause a block job and drain its BlockDriverState we want that the job remains inactive until we call block_job_resume() again.
However if we pause the job while it is sleeping then it will resume when the sleep timer fires.
This patch prevents that from happening by checking if the job has been paused after it comes back from sleeping.
Signed-off-by: Alberto Garcia <berto@igalia.com> Suggested-by: Kevin Wolf <kwolf@redhat.com> Message-id: 3d9011151512326b890d22bdab3530244ef349d7.1464346103.git.berto@igalia.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
show more ...
|
Revision tags: v2.6.0, v2.5.1.1, v2.6.0-rc5, v2.6.0-rc4, v2.6.0-rc3 |
|
#
b75536c9 |
| 18-Apr-2016 |
Kevin Wolf <kwolf@redhat.com> |
blockjob: Remove BlockJob.bs
There is a single remaining user in qemu-img, and another one in a test case, both of which can be trivially converted to using BlockJob.blk instead.
Signed-off-by: Kev
blockjob: Remove BlockJob.bs
There is a single remaining user in qemu-img, and another one in a test case, both of which can be trivially converted to using BlockJob.blk instead.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
Revision tags: v2.6.0-rc2 |
|
#
b6d2e599 |
| 08-Apr-2016 |
Kevin Wolf <kwolf@redhat.com> |
block: Convert block job core to BlockBackend
This adds a new BlockBackend field to the BlockJob struct, which coexists with the BlockDriverState while converting the individual jobs.
When creating
block: Convert block job core to BlockBackend
This adds a new BlockBackend field to the BlockJob struct, which coexists with the BlockDriverState while converting the individual jobs.
When creating a block job, a new BlockBackend is created on top of the given BlockDriverState, and it is destroyed when the BlockJob ends. The reference to the BDS is now held by the BlockBackend instead of calling bdrv_ref/unref manually.
We have to be careful when we use bdrv_replace_in_backing_chain() in block jobs because this changes the BDS that job->blk points to. At the moment block jobs are too tightly coupled with their BDS, so that moving a job to another BDS isn't easily possible; therefore, we need to just manually undo this change afterwards.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
show more ...
|
#
a1a2af07 |
| 08-Apr-2016 |
Kevin Wolf <kwolf@redhat.com> |
block: Cancel jobs first in bdrv_close_all()
So far, bdrv_close_all() first removed all root BlockDriverStates of BlockBackends and monitor owned BDSes, and then assumed that the remaining BDSes mus
block: Cancel jobs first in bdrv_close_all()
So far, bdrv_close_all() first removed all root BlockDriverStates of BlockBackends and monitor owned BDSes, and then assumed that the remaining BDSes must be related to jobs and cancelled these jobs.
This order doesn't work that well any more when block jobs use BlockBackends internally because then they will lose their BDS before being cancelled.
This patch changes bdrv_close_all() to first cancel all jobs and then remove all root BDSes from the remaining BBs.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
show more ...
|
Revision tags: v2.6.0-rc1 |
|
#
a7112795 |
| 04-Apr-2016 |
Alberto Garcia <berto@igalia.com> |
block: keep a list of block jobs
The current way to obtain the list of existing block jobs is to iterate over all root nodes and check which ones own a job.
Since we want to be able to support bloc
block: keep a list of block jobs
The current way to obtain the list of existing block jobs is to iterate over all root nodes and check which ones own a job.
Since we want to be able to support block jobs in other nodes as well, this patch keeps a list of jobs that is updated every time one is created or destroyed.
Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
show more ...
|
#
81e254dc |
| 18-Apr-2016 |
Kevin Wolf <kwolf@redhat.com> |
blockjob: Don't set iostatus of target
When block job errors were introduced, we assigned the iostatus of the target BDS "just in case". The field has never been accessible for the user because the
blockjob: Don't set iostatus of target
When block job errors were introduced, we assigned the iostatus of the target BDS "just in case". The field has never been accessible for the user because the target isn't listed in query-block.
Before we can allow the user to have a second BlockBackend on the target, we need to clean this up. If anything, we would want to set the iostatus for the internal BB of the job (which we can always do later), but certainly not for a separate BB which the job doesn't even use.
As a nice side effect, this gets us rid of another bs->blk use.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
show more ...
|
Revision tags: v2.6.0-rc0, v2.5.1 |
|
#
794f0141 |
| 02-Feb-2016 |
Fam Zheng <famz@redhat.com> |
blockjob: Fix hang in block_job_finish_sync
With a mirror job running on a virtio-blk dataplane disk, sending "q" to HMP will cause a dead loop in block_job_finish_sync.
This is because the aio_pol
blockjob: Fix hang in block_job_finish_sync
With a mirror job running on a virtio-blk dataplane disk, sending "q" to HMP will cause a dead loop in block_job_finish_sync.
This is because the aio_poll() only processes the AIO context of bs which has no more work to do, while the main loop BH that is scheduled for setting the job->completed flag is never processed.
Fix this by adding a flag in BlockJob structure, to track which context to poll for the block job to make progress. Its value is set to true when block_job_coroutine_complete() is called, and is checked in block_job_finish_sync to determine which context to poll.
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1454379144-29807-1-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
d38ea87a |
| 29-Jan-2016 |
Peter Maydell <peter.maydell@linaro.org> |
all: Clean up includes
Clean up includes so that osdep.h is included first and headers which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-b
all: Clean up includes
Clean up includes so that osdep.h is included first and headers which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
show more ...
|
#
e43f7f6f |
| 28-Jan-2016 |
Fam Zheng <famz@redhat.com> |
block: Remove unused struct definition BlockFinishData
Unused since 94db6d2d3.
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wol
block: Remove unused struct definition BlockFinishData
Unused since 94db6d2d3.
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
show more ...
|
Revision tags: v2.5.0, v2.5.0-rc4, v2.5.0-rc3, v2.5.0-rc2, v2.5.0-rc1, v2.5.0-rc0 |
|
#
c55a832f |
| 05-Nov-2015 |
Fam Zheng <famz@redhat.com> |
block: Add block job transactions
Sometimes block jobs must execute as a transaction group. Finishing jobs wait until all other jobs are ready to complete successfully. Failure or cancellation of o
block: Add block job transactions
Sometimes block jobs must execute as a transaction group. Finishing jobs wait until all other jobs are ready to complete successfully. Failure or cancellation of one job cancels the other jobs in the group.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1446765200-3054-10-git-send-email-jsnow@redhat.com [Rewrite the implementation which is now contained in block_job_completed. --Fam] Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
94db6d2d |
| 05-Nov-2015 |
Fam Zheng <famz@redhat.com> |
blockjob: Simplify block_job_finish_sync
With job->completed and job->ret to replace BlockFinishData.
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-
blockjob: Simplify block_job_finish_sync
With job->completed and job->ret to replace BlockFinishData.
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1446765200-3054-9-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
a689dbf2 |
| 05-Nov-2015 |
Fam Zheng <famz@redhat.com> |
blockjob: Add "completed" and "ret" in BlockJob
They are set when block_job_completed is called.
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Ma
blockjob: Add "completed" and "ret" in BlockJob
They are set when block_job_completed is called.
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1446765200-3054-8-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
18930ba3 |
| 05-Nov-2015 |
Fam Zheng <famz@redhat.com> |
blockjob: Introduce reference count and fix reference to job->bs
Add reference count to block job, meanwhile move the ownership of the reference to job->bs from the caller (which is released in two
blockjob: Introduce reference count and fix reference to job->bs
Add reference count to block job, meanwhile move the ownership of the reference to job->bs from the caller (which is released in two completion callbacks) to the block job itself. It is necessary for block_job_complete_sync to work, because block job shouldn't live longer than its bs, as asserted in bdrv_delete.
Now block_job_complete_sync can be simplified.
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1446765200-3054-6-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
Revision tags: v2.4.1 |
|
#
373340b2 |
| 19-Oct-2015 |
Max Reitz <mreitz@redhat.com> |
block: Move I/O status and error actions into BB
These options are only relevant for the user of a whole BDS tree (like a guest device or a block job) and should thus be moved into the BlockBackend.
block: Move I/O status and error actions into BB
These options are only relevant for the user of a whole BDS tree (like a guest device or a block job) and should thus be moved into the BlockBackend.
Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
Revision tags: v2.4.0.1 |
|
#
10817bf0 |
| 01-Sep-2015 |
Daniel P. Berrange <berrange@redhat.com> |
coroutine: move into libqemuutil.a library
The coroutine files are currently referenced by the block-obj-y variable. The coroutine functionality though is already used by more than just the block co
coroutine: move into libqemuutil.a library
The coroutine files are currently referenced by the block-obj-y variable. The coroutine functionality though is already used by more than just the block code. eg migration code uses coroutine yield. In the future the I/O channel code will also use the coroutine yield functionality. Since the coroutine code is nicely self-contained it can be easily built as part of the libqemuutil.a library, making it widely available.
The headers are also moved into include/qemu, instead of the include/block directory, since they are now part of the util codebase, and the impl was never in the block/ directory either.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
show more ...
|
#
8ccb9569 |
| 16-Sep-2015 |
Kevin Wolf <kwolf@redhat.com> |
blockjob: Store device name at job creation
Some block jobs change the block device graph on completion. This means that the device that owns the job and originally was addressed with its device nam
blockjob: Store device name at job creation
Some block jobs change the block device graph on completion. This means that the device that owns the job and originally was addressed with its device name may no longer be what the corresponding BlockBackend points to.
Previously, the effects of bdrv_swap() ensured that the job was (at least partially) transferred to the target image. Events that contain the device name could still use bdrv_get_device_name(job->bs) and get the same result.
After removing bdrv_swap(), this won't work any more. Instead, save the device name at job creation and use that copy for QMP events and anything else identifying the job.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|