aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:21 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:25 +0200
commitb9f7855a50a7cbf04454fa84e9d1f333151f2259 (patch)
tree15fa9cfcfab14eccc0eaa76dc3ec56ee22c27a06 /qemu-img.c
parent29cc6a6834add5cddbc391d07c1b3ace2ad9b8eb (diff)
downloadqemu-arm-b9f7855a50a7cbf04454fa84e9d1f333151f2259.tar.gz
block: Switch discard length bounds to byte-based
Sector-based limits are awkward to think about; in our on-going quest to move to byte-based interfaces, convert max_discard and discard_alignment. Rename them, using 'pdiscard' as an aid to track which remaining discard interfaces need conversion, and so that the compiler will help us catch the change in semantics across any rebased code. The BlockLimits type is now completely byte-based; and in iscsi.c, sector_limits_lun2qemu() is no longer needed. pdiscard_alignment is made unsigned (we use power-of-2 alignments as bitmasks, where unsigned is easier to think about) while leaving max_pdiscard signed (since we still have an 'int' interface); this is comparable to what commit cf081fc did for write zeroes limits. We may later want to make everything an unsigned 64-bit limit - but that requires a bigger code audit. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 046b267420..3a7c162fb0 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2091,7 +2091,8 @@ static int img_convert(int argc, char **argv)
bufsectors = MIN(32768,
MAX(bufsectors,
MAX(out_bs->bl.opt_transfer >> BDRV_SECTOR_BITS,
- out_bs->bl.discard_alignment)));
+ out_bs->bl.pdiscard_alignment >>
+ BDRV_SECTOR_BITS)));
if (skip_create) {
int64_t output_sectors = blk_nb_sectors(out_blk);