• Stefan Hajnoczi's avatar
    block: fix I/O throttling accounting blind spot · 5905fbc9
    Stefan Hajnoczi authored
    I/O throttling relies on bdrv_acct_done() which is called when a request
    completes.  This leaves a blind spot since we only charge for completed
    requests, not submitted requests.
    For example, if there is 1 operation remaining in this time slice the
    guest could submit 3 operations and they will all be submitted
    successfully since they don't actually get accounted for until they
    Originally we probably thought this is okay since the requests will be
    accounted when the time slice is extended.  In practice it causes
    fluctuations since the guest can exceed its I/O limit and it will be
    punished for this later on.
    Account for I/O upon submission so that I/O limits are enforced
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Tested-By: default avatarBenoit Canet <benoit@irqsave.net>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>