• A
    qemu-file: Add fast ftell code path · 97221400
    Alexander Graf 提交于
    For ftell we flush the output buffer to ensure that we don't have anything
    lingering in our internal buffers. This is a very safe thing to do.
    
    However, with the dynamic size measurement that the dynamic vmstate
    description will bring this would turn out quite slow.
    
    Instead, we can fast path this specific measurement and just take the
    internal buffers into account when telling the kernel our position.
    
    I'm sure I overlooked some corner cases where this doesn't work, so
    instead of tuning the safe, existing version, this patch adds a fast
    variant of ftell that gets used by the dynamic vmstate description code
    which isn't critical when it fails.
    Signed-off-by: NAlexander Graf <agraf@suse.de>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    Signed-off-by: NAmit Shah <amit.shah@redhat.com>
    Signed-off-by: NJuan Quintela <quintela@redhat.com>
    97221400
qemu-file.c 12.3 KB