Am 05.07.2017 um 23:08 hat Eric Blake geschrieben: > We are gradually converting to byte-based interfaces, as they are > easier to reason about than sector-based. Convert another internal > function (no semantic change), and add mirror_clip_bytes() as a > counterpart to mirror_clip_sectors(). Some of the conversion is > a bit tricky, requiring temporaries to convert between units; it > will be cleared up in a following patch. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > Reviewed-by: John Snow <js...@redhat.com> > Reviewed-by: Jeff Cody <jc...@redhat.com>
> - if (align_nb_sectors > max_sectors) { > - align_nb_sectors = max_sectors; > + if (align_bytes > max_bytes) { > + align_bytes = max_bytes; > if (need_cow) { > - align_nb_sectors = QEMU_ALIGN_DOWN(align_nb_sectors, > - s->target_cluster_size >> > - BDRV_SECTOR_BITS); > + align_bytes = QEMU_ALIGN_DOWN(align_bytes, > + s->target_cluster_size); This would fit in a single line, if you have to respin for some reason. Reviewed-by: Kevin Wolf <kw...@redhat.com>