diff options
-rw-r--r-- | block/iscsi.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/block/iscsi.c b/block/iscsi.c index 3095887a27..1cafa782a1 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1384,6 +1384,20 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, sizeof(struct scsi_inquiry_block_limits)); scsi_free_scsi_task(task); task = NULL; + + if (iscsilun->bl.max_unmap < 0xffffffff) { + bs->bl.max_discard = sector_lun2qemu(iscsilun->bl.max_unmap, + iscsilun); + } + bs->bl.discard_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran, + iscsilun); + + if (iscsilun->bl.max_ws_len < 0xffffffff) { + bs->bl.max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len, + iscsilun); + } + bs->bl.write_zeroes_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran, + iscsilun); } #if defined(LIBISCSI_FEATURE_NOP_COUNTER) |