[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 37/48] iscsi: Support BDRV_REQ_FUA
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 37/48] iscsi: Support BDRV_REQ_FUA |
Date: |
Tue, 29 Mar 2016 17:08:37 +0200 |
This replaces the existing hack in the iscsi driver that sent the FUA
bit in writethrough mode and ignored the following flush in order to
optimise the number of roundtrips (see commit 73b5394e).
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block/iscsi.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 3b54536..302baf8 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -70,7 +70,6 @@ typedef struct IscsiLun {
bool lbprz;
bool dpofua;
bool has_write_same;
- bool force_next_flush;
bool request_timed_out;
} IscsiLun;
@@ -84,7 +83,6 @@ typedef struct IscsiTask {
QEMUBH *bh;
IscsiLun *iscsilun;
QEMUTimer retry_timer;
- bool force_next_flush;
int err_code;
} IscsiTask;
@@ -282,8 +280,6 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
}
iTask->err_code = iscsi_translate_sense(&task->sense);
error_report("iSCSI Failure: %s", iscsi_get_error(iscsi));
- } else {
- iTask->iscsilun->force_next_flush |= iTask->force_next_flush;
}
out:
@@ -452,15 +448,15 @@ static void iscsi_allocationmap_clear(IscsiLun *iscsilun,
int64_t sector_num,
}
}
-static int coroutine_fn iscsi_co_writev(BlockDriverState *bs,
- int64_t sector_num, int nb_sectors,
- QEMUIOVector *iov)
+static int coroutine_fn
+iscsi_co_writev_flags(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
+ QEMUIOVector *iov, int flags)
{
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
uint64_t lba;
uint32_t num_sectors;
- int fua;
+ bool fua;
if (!is_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
return -EINVAL;
@@ -476,8 +472,7 @@ static int coroutine_fn iscsi_co_writev(BlockDriverState
*bs,
num_sectors = sector_qemu2lun(nb_sectors, iscsilun);
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
- fua = iscsilun->dpofua && !bdrv_enable_write_cache(bs);
- iTask.force_next_flush = !fua;
+ fua = iscsilun->dpofua && (flags & BDRV_REQ_FUA);
if (iscsilun->use_16_for_rw) {
iTask.task = iscsi_write16_task(iscsilun->iscsi, iscsilun->lun, lba,
NULL, num_sectors *
iscsilun->block_size,
@@ -518,6 +513,13 @@ retry:
return 0;
}
+static int coroutine_fn
+iscsi_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
+ QEMUIOVector *iov)
+{
+ return iscsi_co_writev_flags(bs, sector_num, nb_sectors, iov, 0);
+}
+
static bool iscsi_allocationmap_is_allocated(IscsiLun *iscsilun,
int64_t sector_num, int
nb_sectors)
@@ -715,11 +717,6 @@ static int coroutine_fn iscsi_co_flush(BlockDriverState
*bs)
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
- if (!iscsilun->force_next_flush) {
- return 0;
- }
- iscsilun->force_next_flush = false;
-
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
if (iscsi_synchronizecache10_task(iscsilun->iscsi, iscsilun->lun, 0, 0, 0,
@@ -1019,7 +1016,6 @@ coroutine_fn iscsi_co_write_zeroes(BlockDriverState *bs,
int64_t sector_num,
}
iscsi_co_init_iscsitask(iscsilun, &iTask);
- iTask.force_next_flush = true;
retry:
if (use_16_for_ws) {
iTask.task = iscsi_writesame16_task(iscsilun->iscsi, iscsilun->lun,
lba,
@@ -1852,6 +1848,8 @@ static BlockDriver bdrv_iscsi = {
.bdrv_co_write_zeroes = iscsi_co_write_zeroes,
.bdrv_co_readv = iscsi_co_readv,
.bdrv_co_writev = iscsi_co_writev,
+ .bdrv_co_writev_flags = iscsi_co_writev_flags,
+ .supported_write_flags = BDRV_REQ_FUA,
.bdrv_co_flush_to_disk = iscsi_co_flush,
#ifdef __linux__
--
1.8.3.1
- [Qemu-devel] [PULL 22/48] replay: bh scheduling fix, (continued)
- [Qemu-devel] [PULL 22/48] replay: bh scheduling fix, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 26/48] qemu-nbd: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 28/48] qemu-img: Expand all BDRV_O_FLAGS uses, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 29/48] qemu-img: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 27/48] qemu-io: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 24/48] replay: introduce block devices record/replay, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 30/48] xen_disk: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 33/48] block: Handle flush error in bdrv_pwrite_sync(), Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 31/48] block: blockdev_init(): Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 34/48] block: Move enable_write_cache to BB level, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 37/48] iscsi: Support BDRV_REQ_FUA,
Kevin Wolf <=
- [Qemu-devel] [PULL 32/48] block: Always set writeback mode in blk_new_open(), Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 39/48] raw: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 36/48] block: Introduce bdrv_co_writev_flags(), Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 35/48] block/qapi: Use blk_enable_write_cache(), Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 38/48] nbd: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 41/48] qemu-io: Use bdrv_parse_cache_mode() in reopen_f(), Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 44/48] block: Remove bdrv_(set_)enable_write_cache(), Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 40/48] block: Use bdrv_parse_cache_mode() in drive_init(), Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 20/48] block: an interoperability test for luks vs dm-crypt/cryptsetup, Kevin Wolf, 2016/03/29
- [Qemu-devel] [PULL 42/48] block: Remove bdrv_parse_cache_flags(), Kevin Wolf, 2016/03/29