From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] task tracking: fix adding new entry if other PID is tracked
Date: Wed, 12 Nov 2025 14:14:43 +0100 [thread overview]
Message-ID: <20251112131525.645971-1-f.gruenbichler@proxmox.com> (raw)
if the tracking file contains an entry for another, still running PID, that
entry must be preserved, but a new entry for the current PID should still be
inserted..
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
found while benchmarking Samuel's datastore lookup caching series..
pbs-datastore/src/task_tracking.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pbs-datastore/src/task_tracking.rs b/pbs-datastore/src/task_tracking.rs
index 77851cab6..44a4522dc 100644
--- a/pbs-datastore/src/task_tracking.rs
+++ b/pbs-datastore/src/task_tracking.rs
@@ -108,6 +108,7 @@ pub fn update_active_operations(
Operation::Write => ActiveOperationStats { read: 0, write: 1 },
Operation::Lookup => ActiveOperationStats { read: 0, write: 0 },
};
+ let mut found_entry = false;
let mut updated_tasks: Vec<TaskOperations> = match file_read_optional_string(&path)? {
Some(data) => serde_json::from_str::<Vec<TaskOperations>>(&data)?
.iter_mut()
@@ -116,6 +117,7 @@ pub fn update_active_operations(
Some(stat) if pid == task.pid && stat.starttime != task.starttime => None,
Some(_) => {
if pid == task.pid {
+ found_entry = true;
match operation {
Operation::Read => task.active_operations.read += count,
Operation::Write => task.active_operations.write += count,
@@ -132,7 +134,7 @@ pub fn update_active_operations(
None => Vec::new(),
};
- if updated_tasks.is_empty() {
+ if !found_entry {
updated_tasks.push(TaskOperations {
pid,
starttime,
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
reply other threads:[~2025-11-12 13:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251112131525.645971-1-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox