提交 c9d20029 编写于 作者: K Kevin Wolf

block: Remove bs->zero_beyond_eof

It is always true for open images now.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NFam Zheng <famz@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 734a7758
...@@ -938,7 +938,6 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file, ...@@ -938,7 +938,6 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file,
} }
bs->request_alignment = drv->bdrv_co_preadv ? 1 : 512; bs->request_alignment = drv->bdrv_co_preadv ? 1 : 512;
bs->zero_beyond_eof = true;
bs->read_only = !(bs->open_flags & BDRV_O_RDWR); bs->read_only = !(bs->open_flags & BDRV_O_RDWR);
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) { if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
...@@ -2192,7 +2191,6 @@ static void bdrv_close(BlockDriverState *bs) ...@@ -2192,7 +2191,6 @@ static void bdrv_close(BlockDriverState *bs)
bs->encrypted = 0; bs->encrypted = 0;
bs->valid_key = 0; bs->valid_key = 0;
bs->sg = 0; bs->sg = 0;
bs->zero_beyond_eof = false;
QDECREF(bs->options); QDECREF(bs->options);
QDECREF(bs->explicit_options); QDECREF(bs->explicit_options);
bs->options = NULL; bs->options = NULL;
......
...@@ -967,6 +967,7 @@ static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs, ...@@ -967,6 +967,7 @@ static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs,
BdrvTrackedRequest *req, int64_t offset, unsigned int bytes, BdrvTrackedRequest *req, int64_t offset, unsigned int bytes,
int64_t align, QEMUIOVector *qiov, int flags) int64_t align, QEMUIOVector *qiov, int flags)
{ {
int64_t total_bytes, max_bytes;
int ret; int ret;
assert(is_power_of_2(align)); assert(is_power_of_2(align));
...@@ -1008,12 +1009,6 @@ static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs, ...@@ -1008,12 +1009,6 @@ static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs,
} }
/* Forward the request to the BlockDriver */ /* Forward the request to the BlockDriver */
if (!bs->zero_beyond_eof) {
ret = bdrv_driver_preadv(bs, offset, bytes, qiov, 0);
} else {
/* Read zeros after EOF */
int64_t total_bytes, max_bytes;
total_bytes = bdrv_getlength(bs); total_bytes = bdrv_getlength(bs);
if (total_bytes < 0) { if (total_bytes < 0) {
ret = total_bytes; ret = total_bytes;
...@@ -1042,7 +1037,6 @@ static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs, ...@@ -1042,7 +1037,6 @@ static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs,
uint64_t zero_bytes = offset + bytes - zero_offset; uint64_t zero_bytes = offset + bytes - zero_offset;
qemu_iovec_memset(qiov, zero_offset, 0, zero_bytes); qemu_iovec_memset(qiov, zero_offset, 0, zero_bytes);
} }
}
out: out:
return ret; return ret;
......
...@@ -451,9 +451,6 @@ struct BlockDriverState { ...@@ -451,9 +451,6 @@ struct BlockDriverState {
/* I/O Limits */ /* I/O Limits */
BlockLimits bl; BlockLimits bl;
/* Whether produces zeros when read beyond eof */
bool zero_beyond_eof;
/* Alignment requirement for offset/length of I/O requests */ /* Alignment requirement for offset/length of I/O requests */
unsigned int request_alignment; unsigned int request_alignment;
/* Flags honored during pwrite (so far: BDRV_REQ_FUA) */ /* Flags honored during pwrite (so far: BDRV_REQ_FUA) */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册