qemu-e2k/include/block
Eric Blake d6a644bbfe block: Make bdrv_is_allocated() byte-based
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 signature of the function to use int64_t *pnum 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
on input and that *pnum is sector-aligned on return to the caller,
but that can be relaxed when a later patch implements byte-based
block status.  Therefore, this code adds usages like
DIV_ROUND_UP(,BDRV_SECTOR_SIZE) to callers that still want aligned
values, where the call might reasonbly give non-aligned results
in the future; on the other hand, no rounding is needed for callers
that should just continue to work with byte alignment.

For the most part this patch is just the addition of scaling at the
callers followed by inverse scaling at bdrv_is_allocated().  But
some code, particularly bdrv_commit(), gets a lot simpler because it
no longer has to mess with sectors; also, it is now possible to pass
NULL if the caller does not care how much of the image is allocated
beyond the initial offset.  Leave comments where we can further
simplify once a later patch eliminates the need for sector-aligned
requests through bdrv_is_allocated().

For ease of review, bdrv_is_allocated_above() will be tackled
separately.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-07-10 13:18:07 +02:00
..
accounting.h block: make accounting thread-safe 2017-06-16 07:55:00 +08:00
aio.h aio: add missing aio_notify() to aio_enable_external() 2017-05-12 10:36:46 -04:00
block.h block: Make bdrv_is_allocated() byte-based 2017-07-10 13:18:07 +02:00
block_backup.h backup: Switch block_backup.h to byte-based 2017-07-10 13:18:06 +02:00
block_int.h block: change variable names in BlockDriverState 2017-06-26 14:54:46 +02:00
blockjob.h fix: avoid an infinite loop or a dangling pointer problem in img_commit 2017-06-26 14:54:46 +02:00
blockjob_int.h blockjob: use deferred_to_main_loop to indicate the coroutine has ended 2017-05-24 16:38:51 -04:00
dirty-bitmap.h block: protect modification of dirty bitmaps with a mutex 2017-06-16 07:55:00 +08:00
nbd.h nbd: rename read_sync and friends 2017-06-15 11:04:06 +02:00
qapi.h block/qapi: Use blk_enable_write_cache() 2016-03-30 12:16:02 +02:00
raw-aio.h linux-aio: share one LinuxAioState within an AioContext 2016-07-18 15:09:31 +01:00
scsi.h * SCSI scanner support 2016-07-14 13:44:06 +01:00
snapshot.h include: Clean up includes 2016-02-23 12:43:05 +00:00
thread-pool.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
throttle-groups.h block: Move I/O throttling configuration functions to BlockBackend 2016-05-19 16:45:30 +02:00
write-threshold.h Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00