Comments
Patch
@@ -409,6 +409,7 @@ static int curl_open(BlockDriverState *bs, const char *filename, int flags)
curl_multi_setopt( s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb );
curl_multi_do(s);
+ bs->open_flags |= BDRV_O_NOCACHE;
return 0;
out:
@@ -474,6 +474,7 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags)
return -EINVAL;
}
+ bs->open_flags |= BDRV_O_NOCACHE;
memset(iscsilun, 0, sizeof(IscsiLun));
/* Should really append the KVM name after the ':' here */
@@ -176,6 +176,7 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)
*/
result = nbd_establish_connection(bs);
+ bs->open_flags |= BDRV_O_NOCACHE;
qemu_co_mutex_init(&s->lock);
return result;
}
@@ -492,6 +492,7 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
}
bs->read_only = (s->snap != NULL);
+ bs->open_flags |= BDRV_O_NOCACHE;
s->event_reader_pos = 0;
r = qemu_pipe(s->fds);
@@ -1248,6 +1248,7 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags)
s->min_dirty_data_idx = UINT32_MAX;
s->max_dirty_data_idx = 0;
+ bs->open_flags |= BDRV_O_NOCACHE;
bs->total_sectors = s->inode.vdi_size / SECTOR_SIZE;
strncpy(s->name, vdi, sizeof(s->name));
qemu_co_mutex_init(&s->lock);
@@ -441,6 +441,7 @@ static int vdi_open(BlockDriverState *bs, int flags)
goto fail;
}
+ bs->open_flags |= BDRV_O_NOCACHE;
bs->total_sectors = header.disk_size / SECTOR_SIZE;
s->block_size = header.block_size;
Non-raw protocols never cache their data. Make this visible by setting BDRV_O_NOCACHE in the open_flags. It will be used to handle block sizes smaller than the backend's block size. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- block/curl.c | 1 + block/iscsi.c | 1 + block/nbd.c | 1 + block/rbd.c | 1 + block/sheepdog.c | 1 + block/vdi.c | 1 + 6 files changed, 6 insertions(+), 0 deletions(-)