summaryrefslogtreecommitdiff
path: root/block/iscsi.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-08-22 12:57:51 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-08-22 13:37:35 +0200
commite5164735e5b674a10134894589a060a0f5f32ccc (patch)
tree7fc7bff17b3c7831c126da8b144165c3b00137ad /block/iscsi.c
parentad5bc00194a981af3435835b5ceb5d624a98caf7 (diff)
downloadqemu-e5164735e5b674a10134894589a060a0f5f32ccc.tar.gz
block: do not directly set total_sectors
To prepare for expressing block sizes in bytes instead of sector counts, this patch replaces all direct assignments of bs->total_sectors. This converts the expression `bs->total_sectors = X` (where X is sector count) to `bdrv_setlength(bs, BDRV_SECTOR_SIZE * X)`. Expressions such as `bs->total_sectors = Y / 512` are changed to `bdrv_setlength(bs, BDRV_SECTOR_SIZE * (Y / 512))` to account for the floor division change. If these conditions can be relaxed, it will be done in the future. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'block/iscsi.c')
-rw-r--r--block/iscsi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index 3e19202488..38777d3dba 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1352,7 +1352,8 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
ret = -EINVAL;
goto out;
}
- bs->total_sectors = sector_lun2qemu(iscsilun->num_blocks, iscsilun);
+ bdrv_setlength(bs, BDRV_SECTOR_SIZE *
+ 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