From ee223ec561876deb568b3b79f2943e9e39abec51 Mon Sep 17 00:00:00 2001 From: ma Date: Fri, 7 Feb 2025 12:04:22 +0100 Subject: [PATCH] virtnbdmap: read data at valid block position --- virtnbd-nbdkit-plugin | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/virtnbd-nbdkit-plugin b/virtnbd-nbdkit-plugin index 8fd136e..43ca37b 100644 --- a/virtnbd-nbdkit-plugin +++ b/virtnbd-nbdkit-plugin @@ -228,9 +228,9 @@ def pread(h, buf, offset, _): to_read = remaining if next_block["data"]: - log(f"Read {to_read} data size from this block.") - fileOffset = next_block["offset"] - next_block["originalOffset"] + offset - data += os.pread(h, to_read, fileOffset) + fileOffset = next_block["offset"] + log(f"Read {to_read} data size at {next_block['offset']} from this block.") + data += os.pread(h, to_read, next_block["offset"]) else: log(f"Next block contains zeroes, return {remaining} zeroes") data += b"\0" * to_read