Use the new CachedChunkReader with the shared_cache implementation to
provide a concurrency-safe async way of accessing data. This provides
two benefits:
* uses a shared LRU cache, which is very helpful for random-access like
during a live-restore
* does away with the global Mutex in read_image_at, providing real
concurrency without lock contention
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Provides a shared AsyncLruCache of 256MB (w/ 4MB chunks) that can be
used by multiple readers at the same time. It is dropped once no more
readers exist, so the memory gets freed if all QEMU block/pbs instances
disappear.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
for easier auto-generation of versioned deps. when adding new symbols,
the build should display a warning + diff (in addition to our manual
tracking of the generated header file). changes in symbol signatures or
semantics are not caught automatically by the symbols file, but still
require bumping the minimum library version for that symbol accordingly.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Otherwise the string gets included in the QEMU binary, not the library.
Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
but accept old variant as well for now, to not invalidate bitmaps for
freshly migrated VMs.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
...so we can get the library version a binary is currently running with.
Version information is retrieved from the build environment (set by
cargo/make) and appended using 'with_after_include' to appear within the
include guard.
The version string in current-api.h is inconsequential, so ignore it in
diff. This way we only have to re-commit that file whenever the *actual*
API changes, not the version.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
modified to avoid spawning subcommands
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
For dirty-bitmap migration, QEMU also needs to move the static state of
the library to the target. proxmox_{import,export}_state provide a means
of accessing said data in a serialized fashion.
QEMU treats the state as some unknown quantity of bytes and the result
does not need to be human-readable, so we encode it with 'bincode',
which is based on serde.
Since the quantity is only known *after* serialization, we have to
allocate the buffer ourselves. This is handled by Box::leak-ing a Rust
allocated buffer and cleaning up via the explicit
proxmox_free_state_buf function.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
by computing and remembering the ID digest of a static string, we can
detect when the passed in key has changed without keeping a copy of it
around inbetween backup jobs.
this is a follow-up/fixup for
104fae9111fix#2866: invalidate bitmap on crypt_mode change
which implemented detection for crypt MODE changes.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
clippy complains that a `Mutex<Bool>` could just as well be
an `AtomicBool`, but we also use a `Condvar`, so it cannot.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
clippy suggests a way-too-long
for (i, index) in index.iter_mut().enumerate().take(index_count) {
*index = ...
}
which is just massive in comparison, and not at all more
readable...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>