diff mbox

[15/20] raw: Support BDRV_REQ_FUA

Message ID 1458325289-17848-16-git-send-email-kwolf@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kevin Wolf March 18, 2016, 6:21 p.m. UTC
Pass through the FUA flag to the lower layer so that the separate flush
can be saved in practically relevant cases where a (raw) format driver
sits on top of the protocol driver.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/raw_bsd.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Max Reitz March 26, 2016, 8:49 p.m. UTC | #1
On 18.03.2016 19:21, Kevin Wolf wrote:
> Pass through the FUA flag to the lower layer so that the separate flush
> can be saved in practically relevant cases where a (raw) format driver
> sits on top of the protocol driver.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/raw_bsd.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Looks good, modulo the bdrv_co_writev() issue.

Max
diff mbox

Patch

diff --git a/block/raw_bsd.c b/block/raw_bsd.c
index ea16a23..4e802a7 100644
--- a/block/raw_bsd.c
+++ b/block/raw_bsd.c
@@ -56,8 +56,9 @@  static int coroutine_fn raw_co_readv(BlockDriverState *bs, int64_t sector_num,
     return bdrv_co_readv(bs->file->bs, sector_num, nb_sectors, qiov);
 }
 
-static int coroutine_fn raw_co_writev(BlockDriverState *bs, int64_t sector_num,
-                                      int nb_sectors, QEMUIOVector *qiov)
+static int coroutine_fn
+raw_co_writev_flags(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
+                    QEMUIOVector *qiov, int flags)
 {
     void *buf = NULL;
     BlockDriver *drv;
@@ -103,7 +104,8 @@  static int coroutine_fn raw_co_writev(BlockDriverState *bs, int64_t sector_num,
     }
 
     BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
-    ret = bdrv_co_writev(bs->file->bs, sector_num, nb_sectors, qiov);
+    ret = bdrv_co_do_pwritev(bs->file->bs, sector_num * BDRV_SECTOR_SIZE,
+                             nb_sectors * BDRV_SECTOR_SIZE, qiov, flags);
 
 fail:
     if (qiov == &local_qiov) {
@@ -246,7 +248,8 @@  BlockDriver bdrv_raw = {
     .bdrv_close           = &raw_close,
     .bdrv_create          = &raw_create,
     .bdrv_co_readv        = &raw_co_readv,
-    .bdrv_co_writev       = &raw_co_writev,
+    .bdrv_co_writev_flags = &raw_co_writev_flags,
+    .supported_write_flags = BDRV_REQ_FUA,
     .bdrv_co_write_zeroes = &raw_co_write_zeroes,
     .bdrv_co_discard      = &raw_co_discard,
     .bdrv_co_get_block_status = &raw_co_get_block_status,