On 22.09.26 14:14, Kevin Wolf wrote:
Am 31.08.2026 um 15:52 hat Hanna Czenczek geschrieben:
The BlockBackend reference is required to be able to generate the QOM
path as part of emitted events.
A weak reference is enough because BlockAcctStats is tied directly to
one BlockBackend, and will be deleted via block_acct_cleanup() before
the BlockBackend is truly deleted.
Signed-off-by: Hanna Czenczek <[email protected]>
The subject line is a bit confusing as there is no latency checker yet.
Should it say "to BlockAcctStats"?
Oops. I fixed the body, but not the subject. Yes, it absolutely should,
thanks!
include/block/accounting.h | 3 ++-
block/accounting.c | 7 ++++++-
block/block-backend.c | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 164bda846f4..ca091a8bf5d 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -369,7 +369,7 @@ BlockBackend *blk_new(AioContext *ctx, uint64_t perm,
uint64_t shared_perm)
blk->on_read_error = BLOCKDEV_ON_ERROR_REPORT;
blk->on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
- block_acct_init(&blk->stats);
+ block_acct_init(blk, &blk->stats);
This is the only caller. I'm not sure what other callers could look
like, but now that a BlockBackend is required for it, could the second
parameter ever give any useful additional information (as opposed to
block_acct_init() just accessing blk->stats internally now that it has
blk)?
I mean, to me personally it looks a bit nicer this way, because it makes
it a bit clearer *what* is initialized.
But you’re right. Functionally, there’s absolutely no point in passing
both, so I’ll cut it down (depending on what the next version of this
series is going to look like…).
Hanna