qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v1 04/17] block: prepare for supporting selective by


From: Ming Lei
Subject: [Qemu-devel] [PATCH v1 04/17] block: prepare for supporting selective bypass coroutine
Date: Tue, 5 Aug 2014 11:33:05 +0800

If device thinks that it isn't necessary to apply coroutine
in its performance sensitive path, it can call
block_set_bypass_co(false) to bypass the coroutine
and just call the function directly in the aio read/write path.

One example is virtio-blk dataplane.

Signed-off-by: Ming Lei <address@hidden>
---
 block.c                   |   10 ++++++++++
 include/block/block.h     |    3 +++
 include/block/block_int.h |    3 +++
 3 files changed, 16 insertions(+)

diff --git a/block.c b/block.c
index 8cf519b..ac184ef 100644
--- a/block.c
+++ b/block.c
@@ -5840,3 +5840,13 @@ void bdrv_flush_io_queue(BlockDriverState *bs)
         bdrv_flush_io_queue(bs->file);
     }
 }
+
+void bdrv_set_bypass_co(BlockDriverState *bs, bool bypass)
+{
+    bs->bypass_co = bypass;
+}
+
+bool bdrv_get_bypass_co(BlockDriverState *bs)
+{
+    return bs->bypass_co;
+}
diff --git a/include/block/block.h b/include/block/block.h
index f08471d..92f2f3a 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -588,4 +588,7 @@ void bdrv_io_plug(BlockDriverState *bs);
 void bdrv_io_unplug(BlockDriverState *bs);
 void bdrv_flush_io_queue(BlockDriverState *bs);
 
+void bdrv_set_bypass_co(BlockDriverState *bs, bool bypass);
+bool bdrv_get_bypass_co(BlockDriverState *bs);
+
 #endif
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 7b541a0..9fa2f4c 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -354,6 +354,9 @@ struct BlockDriverState {
     /* Whether produces zeros when read beyond eof */
     bool zero_beyond_eof;
 
+    /* Whether bypasses coroutine when doing aio read & write */
+    bool bypass_co;
+
     /* Alignment requirement for offset/length of I/O requests */
     unsigned int request_alignment;
 
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]