On 04/11/2017 06:29 PM, Eric Blake wrote: > There are patches floating around to add NBD_CMD_BLOCK_STATUS, > but NBD wants to report status on byte granularity (even if the > reporting will probably be naturally aligned to sectors or even > much higher levels). I've therefore started the task of > converting our block status code to report at a byte granularity > rather than sectors. > > This is part one of that conversion: bdrv_is_allocated(). > Other parts (still to be written) include tracking dirty bitmaps > by bytes (it's still one bit per granularity, but now we won't > be double-scaling from bytes to sectors to granularity), then > replacing bdrv_get_block_status() with a byte based callback > in all the drivers. > > Available as a tag at: > git fetch git://repo.or.cz/qemu/ericb.git nbd-byte-allocated-v1 > > It requires v9 or later of my prior work on blkdebug: > https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg01723.html > which in turn requires Max's block-next tree: > https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg01298.html > > Eric Blake (17): > blockjob: Track job ratelimits via bytes, not sectors > trace: Show blockjob actions via bytes, not sectors > stream: Switch stream_populate() to byte-based > stream: Switch stream_run() to byte-based > commit: Switch commit_populate() to byte-based > commit: Switch commit_run() to byte-based > mirror: Switch MirrorBlockJob to byte-based > mirror: Switch mirror_do_zero_or_discard() to byte-based > mirror: Switch mirror_cow_align() to byte-based > mirror: Switch mirror_do_read() to byte-based > mirror: Switch mirror_iteration() to byte-based > backup: Switch BackupBlockJob to byte-based > backup: Switch block_backup.h to byte-based > backup: Switch backup_do_cow() to byte-based > backup: Switch backup_run() to byte-based > block: Make bdrv_is_allocated() byte-based > block: Make bdrv_is_allocated_above() byte-based > > include/block/block.h | 6 +- > include/block/block_backup.h | 11 +- > include/qemu/ratelimit.h | 3 +- > block/backup.c | 126 ++++++++---------- > block/commit.c | 54 ++++---- > block/io.c | 59 +++++---- > block/mirror.c | 300 > ++++++++++++++++++++++--------------------- > block/replication.c | 29 +++-- > block/stream.c | 35 +++-- > block/vvfat.c | 34 +++-- > migration/block.c | 9 +- > qemu-img.c | 15 ++- > qemu-io-cmds.c | 57 ++++---- > block/trace-events | 14 +- > 14 files changed, 381 insertions(+), 371 deletions(-)
Shame, you added ten lines! > Patches 1-15: Reviewed-by: John Snow <js...@redhat.com> 9: Is there a good reason for a void fn() to return its argument via a passed parameter? I see you're matching the other interface, but that strikes me as wonky. 11: Looks correct to me, but this one's a bit hairier than the rest. How many times do we truly need to round, adjust, clip, round again, align, clip, round, align, ... I'll take a peek at the last two tomorrow. --js