Skip to content

Commit

Permalink
iscsi: Set request_alignment during .bdrv_refresh_limits()
Browse files Browse the repository at this point in the history
We want to eventually stick request_alignment alongside other
BlockLimits, but first, we must ensure it is populated at the
same time as all other limits, rather than being a special case
that is set only when a block is first opened.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
ebblake authored and kevmw committed Jul 5, 2016
1 parent 835db3e commit c8b3b99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/iscsi.c
Expand Up @@ -1589,7 +1589,6 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
goto out;
}
bs->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun);
bs->request_alignment = iscsilun->block_size;

/* We don't have any emulation for devices other than disks and CD-ROMs, so
* this must be sg ioctl compatible. We force it to be sg, otherwise qemu
Expand Down Expand Up @@ -1711,6 +1710,8 @@ static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
IscsiLun *iscsilun = bs->opaque;
uint32_t max_xfer_len = iscsilun->use_16_for_rw ? 0xffffffff : 0xffff;

bs->request_alignment = iscsilun->block_size;

if (iscsilun->bl.max_xfer_len) {
max_xfer_len = MIN(max_xfer_len, iscsilun->bl.max_xfer_len);
}
Expand Down

0 comments on commit c8b3b99

Please sign in to comment.