[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/20] block: Introduce bdrv_co_writev_flags()
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 12/20] block: Introduce bdrv_co_writev_flags() |
Date: |
Fri, 18 Mar 2016 19:21:21 +0100 |
This function will allow drivers to implement BDRV_REQ_FUA natively
instead of sending a separate flush after the write.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/io.c | 9 ++++++++-
include/block/block_int.h | 5 +++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/block/io.c b/block/io.c
index 14f12c8..cce508a 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1150,13 +1150,20 @@ static int coroutine_fn
bdrv_aligned_pwritev(BlockDriverState *bs,
} else if (flags & BDRV_REQ_ZERO_WRITE) {
bdrv_debug_event(bs, BLKDBG_PWRITEV_ZERO);
ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags);
+ } else if (drv->bdrv_co_writev_flags) {
+ bdrv_debug_event(bs, BLKDBG_PWRITEV);
+ ret = drv->bdrv_co_writev_flags(bs, sector_num, nb_sectors, qiov,
+ flags);
} else {
+ assert(drv->supported_write_flags == 0);
bdrv_debug_event(bs, BLKDBG_PWRITEV);
ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
}
bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE);
- if (ret == 0 && (flags & BDRV_REQ_FUA)) {
+ if (ret == 0 && (flags & BDRV_REQ_FUA) &&
+ !(drv->supported_write_flags & BDRV_REQ_FUA))
+ {
ret = bdrv_co_flush(bs);
}
diff --git a/include/block/block_int.h b/include/block/block_int.h
index ce9d764..d090646 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -155,6 +155,11 @@ struct BlockDriver {
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov);
int coroutine_fn (*bdrv_co_writev)(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov);
+ int coroutine_fn (*bdrv_co_writev_flags)(BlockDriverState *bs,
+ int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, int flags);
+
+ int supported_write_flags;
+
/*
* Efficiently zero a region of the disk image. Typically an image format
* would use a compact metadata representation to implement this. This
--
1.8.3.1
- [Qemu-devel] [PATCH 07/20] block: blockdev_init(): Call blk_set_enable_write_cache() explicitly, (continued)
- [Qemu-devel] [PATCH 07/20] block: blockdev_init(): Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 08/20] block: Always set writeback mode in blk_new_open(), Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB level, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 16/20] block: Use bdrv_parse_cache_mode() in drive_init(), Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 15/20] raw: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 12/20] block: Introduce bdrv_co_writev_flags(),
Kevin Wolf <=
- [Qemu-devel] [PATCH 13/20] iscsi: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 11/20] block/qapi: Use blk_enable_write_cache(), Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 14/20] nbd: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 18/20] block: Remove bdrv_parse_cache_flags(), Kevin Wolf, 2016/03/18