[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/8] blockdev: Allow image files to auto-enable stre
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 6/8] blockdev: Allow image files to auto-enable streaming |
Date: |
Wed, 27 Apr 2011 14:27:33 +0100 |
Image files that having streaming enabled will automatically begin
streaming when opened.
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block.c | 5 +++++
block.h | 1 +
block_int.h | 1 +
blockdev.c | 9 +++++++++
4 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 5e3476c..68a97a3 100644
--- a/block.c
+++ b/block.c
@@ -1584,6 +1584,11 @@ const char *bdrv_get_device_name(BlockDriverState *bs)
return bs->device_name;
}
+int bdrv_stream_enabled(BlockDriverState *bs)
+{
+ return bs->stream;
+}
+
int bdrv_flush(BlockDriverState *bs)
{
if (bs->open_flags & BDRV_O_NO_FLUSH) {
diff --git a/block.h b/block.h
index fad828a..3357c50 100644
--- a/block.h
+++ b/block.h
@@ -189,6 +189,7 @@ int bdrv_is_removable(BlockDriverState *bs);
int bdrv_is_read_only(BlockDriverState *bs);
int bdrv_is_sg(BlockDriverState *bs);
int bdrv_enable_write_cache(BlockDriverState *bs);
+int bdrv_stream_enabled(BlockDriverState *bs);
int bdrv_is_inserted(BlockDriverState *bs);
int bdrv_media_changed(BlockDriverState *bs);
int bdrv_is_locked(BlockDriverState *bs);
diff --git a/block_int.h b/block_int.h
index 0c125d0..d0fe96c 100644
--- a/block_int.h
+++ b/block_int.h
@@ -155,6 +155,7 @@ struct BlockDriverState {
int encrypted; /* if true, the media is encrypted */
int valid_key; /* if true, a valid encryption key has been set */
int sg; /* if true, the device is a /dev/sg* */
+ int stream; /* if true, stream from the backing file */
/* event callback when inserting/removing */
void (*change_cb)(void *opaque, int reason);
void *change_opaque;
diff --git a/blockdev.c b/blockdev.c
index 99c0726..5d6cb2b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -678,6 +678,15 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
goto err;
}
+ if (bdrv_stream_enabled(dinfo->bdrv)) {
+ const char *device_name = bdrv_get_device_name(dinfo->bdrv);
+
+ if (!stream_start(device_name, 0, false, NULL, NULL)) {
+ fprintf(stderr, "qemu: warning: stream_start failed for '%s'\n",
+ device_name);
+ }
+ }
+
if (bdrv_key_required(dinfo->bdrv))
autostart = 0;
return dinfo;
--
1.7.4.4
- [Qemu-devel] [RFC PATCH 0/8] QED image streaming, Stefan Hajnoczi, 2011/04/27
- [Qemu-devel] [PATCH 1/8] block: add bdrv_aio_stream, Stefan Hajnoczi, 2011/04/27
- [Qemu-devel] [PATCH 3/8] qed: add support for Copy-on-Read, Stefan Hajnoczi, 2011/04/27
- [Qemu-devel] [PATCH 7/8] qed: Add QED_CF_STREAM flag to auto-enable streaming, Stefan Hajnoczi, 2011/04/27
- [Qemu-devel] [PATCH 4/8] qed: intelligent streaming implementation, Stefan Hajnoczi, 2011/04/27
- [Qemu-devel] [PATCH 6/8] blockdev: Allow image files to auto-enable streaming,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 5/8] qed: detect zero writes and skip them when to an unalloc cluster, Stefan Hajnoczi, 2011/04/27
- [Qemu-devel] [PATCH 2/8] qmp: Add QMP support for stream commands, Stefan Hajnoczi, 2011/04/27
- [Qemu-devel] [PATCH 8/8] qed: Add -o stream=on image creation option, Stefan Hajnoczi, 2011/04/27
- Re: [Qemu-devel] [RFC PATCH 0/8] QED image streaming, Stefan Hajnoczi, 2011/04/27