From: "Gabriel Goller" <g.goller@proxmox.com>
To: "Proxmox Backup Server development discussion"
<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] datastore: remove datastore from internal cache based on maintenance mode
Date: Thu, 29 Feb 2024 18:13:31 +0100 [thread overview]
Message-ID: <CZHQC54Z023V.3EGPI7YN8JAQG@proxmox.com> (raw)
In-Reply-To: <20240222103319.49966-1-h.laimer@proxmox.com>
Tested this thoroughly and it works as advertised!
Just some small nits inline:
> impl MaintenanceMode {
> + /// Used for deciding weather the datastore is cleared from the internal cache after the last
Small typo: weather -> whether
> + // remove datastore from cache iff last task finished
> + // and datastore is in a maintenance mode that says it should be
Did something get cut off here? The sentence doesn't sound correct...
> + let remove_from_cache = last_task
> + && pbs_config::datastore::config()
> + .and_then(|(s, _)| s.lookup::<DataStoreConfig>("datastore", &self.name()))
`self.name()` is enough here, we don't need `&self.name()`
> + pub fn update_datastore_cache() -> Result<(), Error> {
> + let (config, _digest) = pbs_config::datastore::config()?;
> + for (store, (_, _)) in &config.sections {
> + let datastore: DataStoreConfig = config.lookup("datastore", &store)?;
`store` is already a &String, we don't need to write `&store`
> + if datastore
> + .get_maintenance_mode()
> + .map_or(false, |m| m.clear_from_cache())
> + {
> + let _ = DataStore::lookup_datastore(&store, Some(Operation::Lookup));
Same here
> match operation {
> Operation::Read => task.active_operations.read += count,
> Operation::Write => task.active_operations.write += count,
> Operation::Lookup => (), // no IO must happen there
> };
> + updated_active_operations = task.active_operations.clone();
You can remove the `.clone()` call here
Consider:
Tested-by: Gabriel Goller <g.goller@proxmox.com>
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
next prev parent reply other threads:[~2024-02-29 17:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 10:33 Hannes Laimer
2024-02-29 17:13 ` Gabriel Goller [this message]
2024-03-01 10:43 ` Hannes Laimer
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=CZHQC54Z023V.3EGPI7YN8JAQG@proxmox.com \
--to=g.goller@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 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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal