From: Kevin Wolf <kwolf@redhat.com>
To: Christian Quante <christian@quante.one>
Cc: John Snow <jsnow@redhat.com>, Hanna Reitz <hreitz@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] hw/block/fdc: account for read and write requests
Date: Tue, 29 Sep 2026 17:13:56 +0200 [thread overview]
Message-ID: <arvVtJO_MNvVSuUW@redhat.com> (raw)
In-Reply-To: <20260824114216.231916-1-christian@quante.one>
Am 24.08.2026 um 13:41 hat Christian Quante geschrieben:
> hw/block/fdc.c never calls block_acct_*, so a floppy drive stays at
> zero in query-blockstats and "info blockstats" while IDE, ATAPI, SCSI,
> virtio-blk, NVMe and xen-block all report their traffic. That is the
> only interface through which QEMU reports drive activity, so a
> front-end that shows per-drive activity LEDs -- the way 86Box does --
> can light up every bus except the floppy.
>
> The accounting is already set up for the drive: floppy_drive_realize()
> reaches block_acct_setup() through blkconf_apply_backend_options(), and
> -device floppy carries account-invalid, account-failed and
> stats-intervals through DEFINE_BLOCK_PROPERTIES. The properties can be
> set today, they just have nothing to act on.
>
> Wrap the five blk_pread()/blk_pwrite() calls in two helpers that
> account for the transfer. The cookie lives on the stack: floppy I/O is
> synchronous throughout, so it never outlives the call and there is no
> device state to migrate, unlike IDE where the cookie sits in the device
> because the transfer is asynchronous -- scsi-disk, nvme, ahci and
> xen-block all keep it in their request state for the same reason.
>
> Measured with a boot sector that reads 18 sectors from A: and 16 from
> C: and writes two back to each. The disk backend reports rd_ops=16
> rd_bytes=8192 wr_ops=2 wr_bytes=1024 either way, so the guest did the
> same work in both runs; the floppy went from rd_ops=0 wr_ops=0 to
> rd_ops=19 rd_bytes=9728 wr_ops=2 wr_bytes=1024 -- 19 reads being the
> boot sector the BIOS pulls in plus the 18 the guest asks for.
>
> Signed-off-by: Christian Quante <christian@quante.one>
Thanks, applied to the block branch.
Would you mind adding some assertions that we counted correctly to
some existing I/O in fdc-test as a followup?
Kevin
prev parent reply other threads:[~2026-09-29 15:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 11:41 [PATCH] hw/block/fdc: account for read and write requests Christian Quante
2026-09-11 14:53 ` Christian Quante
2026-09-15 14:30 ` John Snow
2026-09-15 16:44 ` Kevin Wolf
2026-09-29 15:13 ` Kevin Wolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arvVtJO_MNvVSuUW@redhat.com \
--to=kwolf@redhat.com \
--cc=christian@quante.one \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.