On Mon, Sep 18, 2017 at 06:47:38PM +0000, Derrick McKee wrote:
> I am trying to figure out if a particular disk operation is reading from
> the same location in an image file.

The following trace event is fired when a BlockBackend (a drive) is
read:

  # block/block-backend.c
  blk_co_preadv(void *blk, void *bs, int64_t offset, unsigned int bytes, int 
flags) "blk %p bs %p offset %"PRId64" bytes %u flags 0x%x"

Here is an example:

  $ qemu-system-x86_64 -M accel=kvm -m 1G -cpu host \
                       -trace enable=blk_co_preadv \
                       -drive if=virtio,file=test.img,format=raw
23087@1505812623.056729:blk_co_preadv blk 0x55f703389390 bs 0x55f7033895f0 
offset 0 bytes 512 flags 0x0
23087@1505812623.176042:blk_co_preadv blk 0x55f703389390 bs 0x55f7033895f0 
offset 0 bytes 512 flags 0x0

"offset" is the byte address that the guest is reading from.

See docs/devel/tracing.txt for more information on tracing.  One or more
tracing backends are compiled into QEMU.  By default the "log" backend
prints to stderr.

If you are using the QEMU binary from a Linux distribution package, they
may have compiled in only the SystemTap backend so try compiling your
own QEMU if you don't see any output from the example above.

Stefan

Reply via email to