diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2010-12-06 16:08:02 +0000 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-12-17 16:11:04 +0100 |
commit | eabba580e6bb8d6b969c1368c6f90d72b4cde4f4 (patch) | |
tree | 879b2822adbf7fea8d7ac7a1166f22d40d3b4d77 /block/qed.h | |
parent | 298800cae72eb2a549374189e87615b2b0b79262 (diff) |
qed: Read/write support
This patch implements the read/write state machine. Operations are
fully asynchronous and multiple operations may be active at any time.
Allocating writes lock tables to ensure metadata updates do not
interfere with each other. If two allocating writes need to update the
same L2 table they will run sequentially. If two allocating writes need
to update different L2 tables they will run in parallel.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qed.h')
-rw-r--r-- | block/qed.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/block/qed.h b/block/qed.h index 6d49a4de55..046a4102c0 100644 --- a/block/qed.h +++ b/block/qed.h @@ -116,6 +116,29 @@ typedef struct QEDRequest { CachedL2Table *l2_table; } QEDRequest; +typedef struct QEDAIOCB { + BlockDriverAIOCB common; + QEMUBH *bh; + int bh_ret; /* final return status for completion bh */ + QSIMPLEQ_ENTRY(QEDAIOCB) next; /* next request */ + bool is_write; /* false - read, true - write */ + bool *finished; /* signal for cancel completion */ + uint64_t end_pos; /* request end on block device, in bytes */ + + /* User scatter-gather list */ + QEMUIOVector *qiov; + size_t qiov_offset; /* byte count already processed */ + + /* Current cluster scatter-gather list */ + QEMUIOVector cur_qiov; + uint64_t cur_pos; /* position on block device, in bytes */ + uint64_t cur_cluster; /* cluster offset in image file */ + unsigned int cur_nclusters; /* number of clusters being accessed */ + int find_cluster_ret; /* used for L1/L2 update */ + + QEDRequest request; +} QEDAIOCB; + typedef struct { BlockDriverState *bs; /* device */ uint64_t file_size; /* length of image file, in bytes */ @@ -127,6 +150,9 @@ typedef struct { uint32_t l1_shift; uint32_t l2_shift; uint32_t l2_mask; + + /* Allocating write request queue */ + QSIMPLEQ_HEAD(, QEDAIOCB) allocating_write_reqs; } BDRVQEDState; enum { |