diff options
| author | Anthony Liguori | 2010-12-17 16:58:22 +0100 |
|---|---|---|
| committer | Kevin Wolf | 2011-04-13 12:06:41 +0200 |
| commit | 21df65b6444858ddee3a86d8666571bb41695614 (patch) | |
| tree | 142793b8ae8e6fef8b1aa412cf39e2340091fdf9 /block/qed.h | |
| parent | docs: Describe zero data clusters in QED specification (diff) | |
| download | qemu-21df65b6444858ddee3a86d8666571bb41695614.tar.gz qemu-21df65b6444858ddee3a86d8666571bb41695614.tar.xz qemu-21df65b6444858ddee3a86d8666571bb41695614.zip | |
qed: Add support for zero clusters
Zero clusters are similar to unallocated clusters except instead of reading
their value from a backing file when one is available, the cluster is always
read as zero.
This implements read support only. At this stage, QED will never write a
zero cluster.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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 2925e37b1c..3e1ab84781 100644 --- a/block/qed.h +++ b/block/qed.h @@ -161,6 +161,7 @@ typedef struct { enum { QED_CLUSTER_FOUND, /* cluster found */ + QED_CLUSTER_ZERO, /* zero cluster found */ QED_CLUSTER_L2, /* cluster missing in L2 */ QED_CLUSTER_L1, /* cluster missing in L1 */ }; @@ -298,4 +299,29 @@ static inline bool qed_check_table_offset(BDRVQEDState *s, uint64_t offset) qed_check_cluster_offset(s, end_offset); } +static inline bool qed_offset_is_cluster_aligned(BDRVQEDState *s, + uint64_t offset) +{ + if (qed_offset_into_cluster(s, offset)) { + return false; + } + return true; +} + +static inline bool qed_offset_is_unalloc_cluster(uint64_t offset) +{ + if (offset == 0) { + return true; + } + return false; +} + +static inline bool qed_offset_is_zero_cluster(uint64_t offset) +{ + if (offset == 1) { + return true; + } + return false; +} + #endif /* BLOCK_QED_H */ |
