aboutsummaryrefslogtreecommitdiff
path: root/block/qed-table.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2017-10-11 22:46:58 -0500
committerKevin Wolf <kwolf@redhat.com>2017-10-26 14:45:57 +0200
commitc9ce8c4da65b0c2b1dc82cbf2328ff3e23d76943 (patch)
tree09c5f8509ccd75d44a0a3686820166c8fcc3705e /block/qed-table.c
parent298a1665a2800f7264e483c2dd1f551574243a2f (diff)
block: Add flag to avoid wasted work in bdrv_is_allocated()
Not all callers care about which BDS owns the mapping for a given range of the file, or where the zeroes lie within that mapping. In particular, bdrv_is_allocated() cares more about finding the largest run of allocated data from the guest perspective, whether or not that data is consecutive from the host perspective, and whether or not the data reads as zero. Therefore, doing subsequent refinements such as checking how much of the format-layer allocation also satisfies BDRV_BLOCK_ZERO at the protocol layer is wasted work - in the best case, it just costs extra CPU cycles during a single bdrv_is_allocated(), but in the worst case, it results in a smaller *pnum, and forces callers to iterate through more status probes when visiting the entire file for even more extra CPU cycles. This patch only optimizes the block layer (no behavior change when want_zero is true, but skip unnecessary effort when it is false). Then when subsequent patches tweak the driver callback to be byte-based, we can also pass this hint through to the driver. Tweak BdrvCoGetBlockStatusData to declare arguments in parameter order, rather than mixing things up (minimizing padding is not necessary here). Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qed-table.c')
0 files changed, 0 insertions, 0 deletions