[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 36/48] block: Introduce bdrv_co_writev_flags()
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 36/48] block: Introduce bdrv_co_writev_flags() |
Date: |
Tue, 29 Mar 2016 17:08:36 +0200 |
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>
Reviewed-by: Max Reitz <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 4c9e3f4..fb5cba0 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1152,13 +1152,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 4884609..10d8759 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-block] [PULL 27/48] qemu-io: Call blk_set_enable_write_cache() explicitly, (continued)
- [Qemu-block] [PULL 27/48] qemu-io: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 29/48] qemu-img: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 30/48] xen_disk: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 33/48] block: Handle flush error in bdrv_pwrite_sync(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 31/48] block: blockdev_init(): Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 32/48] block: Always set writeback mode in blk_new_open(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 20/48] block: an interoperability test for luks vs dm-crypt/cryptsetup, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 34/48] block: Move enable_write_cache to BB level, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 37/48] iscsi: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 35/48] block/qapi: Use blk_enable_write_cache(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 36/48] block: Introduce bdrv_co_writev_flags(),
Kevin Wolf <=
- [Qemu-block] [PULL 39/48] raw: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 38/48] nbd: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 41/48] qemu-io: Use bdrv_parse_cache_mode() in reopen_f(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 40/48] block: Use bdrv_parse_cache_mode() in drive_init(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 42/48] block: Remove bdrv_parse_cache_flags(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 44/48] block: Remove bdrv_(set_)enable_write_cache(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 43/48] block: Remove BDRV_O_CACHE_WB, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 46/48] block/null-{co, aio}: Allow reading zeroes, Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 47/48] block/null-{co, aio}: Implement get_block_status(), Kevin Wolf, 2016/03/29
- [Qemu-block] [PULL 45/48] qemu-img: Fix preallocation with -S 0 for convert, Kevin Wolf, 2016/03/29