On Mon, 07/03 17:14, Eric Blake wrote: > We are gradually moving away from sector-based interfaces, towards > byte-based. In the common case, allocation is unlikely to ever use > values that are not naturally sector-aligned, but it is possible > that byte-based values will let us be more precise about allocation > at the end of an unaligned file that can do byte-based access. > > Changing the name of the function from bdrv_get_block_status() to > bdrv_block_status() ensures that the compiler enforces that all > callers are updated. For now, the io.c layer still assert()s that > all callers are sector-aligned, but that can be relaxed when a later > patch implements byte-based block status in the drivers. > > Note that we have an inherent limitation in the BDRV_BLOCK_* return > values: BDRV_BLOCK_OFFSET_VALID can only return the start of a > sector, even if we later relax the interface to query for the status > starting at an intermediate byte; document the obvious interpretation > that valid offsets are always sector-relative. > > Therefore, for the most part this patch is just the addition of scaling > at the callers followed by inverse scaling at bdrv_block_status(). But > some code, particularly bdrv_is_allocated(), gets a lot simpler because > it no longer has to mess with sectors. > > For ease of review, bdrv_get_block_status_above() will be tackled > separately. > > Signed-off-by: Eric Blake <ebl...@redhat.com> >
Reviewed-by: Fam Zheng <f...@redhat.com>