With my qcow2 patch to blktap I contributed a bit to the mess, so here an attempt to clean up and remove at least some of the code duplication in the functions dealing with aio operations. This patch is mostly just moving code. Apart from renaming to get common names and such things, only very few changes are needed as big parts of the code were completely identical and obviously created by copy&paste without any change. If there are problems with the patch: I might not be able to answer mails until Tuesday, so don't be surprised if I don't answer right away. Signed-off-by: Kevin Wolf