[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 13/20] block/iscsi: use UNMAP to write zeroes if
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v2 13/20] block/iscsi: use UNMAP to write zeroes if LBPRZ=1 |
Date: |
Tue, 19 Nov 2013 18:07:36 +0100 |
The latest revision of SCSI SBC clarifies the semantics of LBPRZ
in a way that lets the iscsi driver remove the distinction between
bdrv_unallocated_blocks_are_zero and bdrv_can_write_zeroes_with_unmap.
See Table 8:
"[If] the LBA became mapped as the result of an autonomous transition,
and no write command has specified that LBA since the LBA was mapped,
[a read operation returns the] logical block data that would be returned
if that autonomous transition had not occurred and the LBA had remained
unmapped."
Thus, we can assume that even after an UNMAP command, unallocated blocks
return zero. The distinction may remain for other drivers, for example
qcow2 or qed or vmdk.
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/iscsi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 93fee6d..63b451d 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -984,6 +984,9 @@ coroutine_fn iscsi_co_write_zeroes(BlockDriverState *bs,
int64_t sector_num,
if ((flags & BDRV_REQ_MAY_UNMAP) && !iscsilun->lbp.lbpws) {
/* WRITE SAME with UNMAP is not supported by the target */
+ if (iscsilun->lbp.lbpu && iscsilun->lbprz) {
+ return iscsi_co_discard(bs, sector_num, nb_sectors);
+ }
return -ENOTSUP;
}
@@ -1579,7 +1582,7 @@ static int iscsi_get_info(BlockDriverState *bs,
BlockDriverInfo *bdi)
{
IscsiLun *iscsilun = bs->opaque;
bdi->unallocated_blocks_are_zero = !!iscsilun->lbprz;
- bdi->can_write_zeroes_with_unmap = iscsilun->lbprz && iscsilun->lbp.lbpws;
+ bdi->can_write_zeroes_with_unmap = !!iscsilun->lbprz;
return 0;
}
--
1.8.4.2
- Re: [Qemu-devel] [PATCH v2 07/20] vpc, vhdx: add get_info, (continued)
- [Qemu-devel] [PATCH v2 10/20] block/iscsi: remove .bdrv_has_zero_init, Paolo Bonzini, 2013/11/19
- [Qemu-devel] [PATCH v2 09/20] block drivers: expose requirement for write same alignment from formats, Paolo Bonzini, 2013/11/19
- [Qemu-devel] [PATCH v2 11/20] block/iscsi: updated copyright, Paolo Bonzini, 2013/11/19
- [Qemu-devel] [PATCH v2 12/20] block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP, Paolo Bonzini, 2013/11/19
- [Qemu-devel] [PATCH v2 13/20] block/iscsi: use UNMAP to write zeroes if LBPRZ=1,
Paolo Bonzini <=
[Qemu-devel] [PATCH v2 14/20] raw-posix: implement write_zeroes with MAY_UNMAP for files, Paolo Bonzini, 2013/11/19
[Qemu-devel] [PATCH v2 15/20] raw-posix: implement write_zeroes with MAY_UNMAP for block devices, Paolo Bonzini, 2013/11/19
[Qemu-devel] [PATCH v2 16/20] raw-posix: add support for write_zeroes on XFS and block devices, Paolo Bonzini, 2013/11/19
[Qemu-devel] [PATCH v2 17/20] qemu-iotests: 033 is fast, Paolo Bonzini, 2013/11/19
[Qemu-devel] [PATCH v2 18/20] scsi-disk: catch write protection errors in UNMAP, Paolo Bonzini, 2013/11/19
[Qemu-devel] [PATCH v2 19/20] scsi-disk: reject ANCHOR=1 for UNMAP and WRITE SAME commands, Paolo Bonzini, 2013/11/19