aboutsummaryrefslogtreecommitdiff
path: root/block/iscsi.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-01 15:10:01 -0600
committerKevin Wolf <kwolf@redhat.com>2016-06-08 10:21:08 +0200
commit8b1847445159ff6c12e7a24f04dc989ff97e34d4 (patch)
treea3c61bf77b983bcbb04282d08cee881baf6bbb8e /block/iscsi.c
parentebb718a5c7240f6ffb308e0d0b67a92c3b63b91c (diff)
iscsi: Use block size as minimum zero/discard alignment
If hardware does not advertise a minimum zero/discard alignment, we still want to guarantee that the block layer will align requests to our blocks, rather than the arbitrary 512-byte BDRV sector size. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/iscsi.c')
-rw-r--r--block/iscsi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index e7d5f7b0c3..94f9974f10 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1711,6 +1711,8 @@ static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
}
bs->bl.discard_alignment =
sector_limits_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
+ } else {
+ bs->bl.discard_alignment = iscsilun->block_size >> BDRV_SECTOR_BITS;
}
if (iscsilun->bl.max_ws_len < 0xffffffff) {
@@ -1720,6 +1722,9 @@ static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
if (iscsilun->lbp.lbpws) {
bs->bl.write_zeroes_alignment =
sector_limits_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
+ } else {
+ bs->bl.write_zeroes_alignment =
+ iscsilun->block_size >> BDRV_SECTOR_BITS;
}
bs->bl.opt_transfer_length =
sector_limits_lun2qemu(iscsilun->bl.opt_xfer_len, iscsilun);