scsi: fix accounting of writes
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 5 Sep 2011 16:11:51 +0000 (18:11 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 6 Sep 2011 11:15:25 +0000 (13:15 +0200)
commitf1b56e0e4b97e4cec598fde7ddf3a6131215522e
treee6a61b4f5bc4a00e0142f82068a8a42c64f22236
parentd7d8655b1402ad259cc6351d733ba0242e04c47b
scsi: fix accounting of writes

Writes go through scsi_write_complete at least twice, the first time
to get some data without having actually written anything.  Because
of this, the first time scsi_write_complete is called it will call
bdrv_acct_done and account a read incorrectly.  Fix this by looking
at the aiocb.  I am doing the same in scsi_read_complete for symmetry,
but it is only needed in the (bogus) case of bdrv_aio_readv returning
NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/scsi-disk.c