summaryrefslogtreecommitdiff
path: root/include/block/block_int.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-06-05 14:39:02 +0200
committerFam Zheng <famz@redhat.com>2017-06-16 07:55:00 +0800
commit3783fa3dd3d0104e9780bde073f66f1e37f1ce1c (patch)
treeeee263b38e7576626762e5498b67858e7297e787 /include/block/block_int.h
parent47fec59941a7182380bc8dde3faf17cfb05b770f (diff)
downloadqemu-3783fa3dd3d0104e9780bde073f66f1e37f1ce1c.tar.gz
block: protect tracked_requests and flush_queue with reqs_lock
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20170605123908.18777-14-pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'include/block/block_int.h')
-rw-r--r--include/block/block_int.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h
index b7d0dfb0b9..ae74df97ec 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -609,11 +609,6 @@ struct BlockDriverState {
uint64_t write_threshold_offset;
NotifierWithReturn write_threshold_notifier;
- QLIST_HEAD(, BdrvTrackedRequest) tracked_requests;
- CoQueue flush_queue; /* Serializing flush queue */
- bool active_flush_req; /* Flush request in flight? */
- unsigned int flushed_gen; /* Flushed write generation */
-
QLIST_HEAD(, BdrvDirtyBitmap) dirty_bitmaps;
/* Offset after the highest byte written to */
@@ -647,6 +642,15 @@ struct BlockDriverState {
/* Accessed with atomic ops. */
int quiesce_counter;
unsigned int write_gen; /* Current data generation */
+
+ /* Protected by reqs_lock. */
+ CoMutex reqs_lock;
+ QLIST_HEAD(, BdrvTrackedRequest) tracked_requests;
+ CoQueue flush_queue; /* Serializing flush queue */
+ bool active_flush_req; /* Flush request in flight? */
+
+ /* Only read/written by whoever has set active_flush_req to true. */
+ unsigned int flushed_gen; /* Flushed write generation */
};
struct BlockBackendRootState {