From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v2 proxmox-backup 1/5] client: pxar: refactor report vanished/changed helpers
Date: Thu, 14 Nov 2024 15:41:10 +0100 [thread overview]
Message-ID: <20241114144114.375987-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20241114144114.375987-1-c.ebner@proxmox.com>
Switch from mutable reference to shared reference on `self` and drop
unused return value.
These helpers only write log messages, there is currently no need for
a mutable reference to `self`, nor to return a `Result`.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 1:
- not present in previous version
pbs-client/src/pxar/create.rs | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index c0c492f8d..4d1883118 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -476,7 +476,7 @@ impl Archiver {
Ok(fd) => Ok(Some(fd)),
Err(Errno::ENOENT) => {
if existed {
- self.report_vanished_file()?;
+ self.report_vanished_file();
}
Ok(None)
}
@@ -671,25 +671,22 @@ impl Archiver {
Ok(file_list)
}
- fn report_vanished_file(&mut self) -> Result<(), Error> {
+ fn report_vanished_file(&self) {
log::warn!("warning: file vanished while reading: {:?}", self.path);
- Ok(())
}
- fn report_file_shrunk_while_reading(&mut self) -> Result<(), Error> {
+ fn report_file_shrunk_while_reading(&self) {
log::warn!(
"warning: file size shrunk while reading: {:?}, file will be padded with zeros!",
self.path,
);
- Ok(())
}
- fn report_file_grew_while_reading(&mut self) -> Result<(), Error> {
+ fn report_file_grew_while_reading(&self) {
log::warn!(
"warning: file size increased while reading: {:?}, file will be truncated!",
self.path,
);
- Ok(())
}
async fn add_entry<T: SeqWrite + Send>(
@@ -1239,14 +1236,14 @@ impl Archiver {
Err(err) => bail!(err),
};
if got as u64 > remaining {
- self.report_file_grew_while_reading()?;
+ self.report_file_grew_while_reading();
got = remaining as usize;
}
out.write_all(&self.file_copy_buffer[..got]).await?;
remaining -= got as u64;
}
if remaining > 0 {
- self.report_file_shrunk_while_reading()?;
+ self.report_file_shrunk_while_reading();
let to_zero = remaining.min(self.file_copy_buffer.len() as u64) as usize;
vec::clear(&mut self.file_copy_buffer[..to_zero]);
while remaining != 0 {
--
2.39.5
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-11-14 14:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 14:41 [pbs-devel] [PATCH v2 proxmox-backup 0/5] fix #5853: ignore stale files Christian Ebner
2024-11-14 14:41 ` Christian Ebner [this message]
2024-11-14 14:41 ` [pbs-devel] [PATCH v2 proxmox-backup 2/5] client: pxar: skip directories on stale file handle Christian Ebner
2024-11-14 14:41 ` [pbs-devel] [PATCH v2 proxmox-backup 3/5] client: pxar: skip directory entries " Christian Ebner
2024-11-14 14:41 ` [pbs-devel] [PATCH v2 proxmox-backup 4/5] client: pxar: warn user and ignore stale file handles on file open Christian Ebner
2024-11-14 14:41 ` [pbs-devel] [PATCH v2 proxmox-backup 5/5] fix #5853: client: pxar: exclude stale files on metadata/link read Christian Ebner
2024-11-21 12:25 ` [pbs-devel] applied-series: [PATCH v2 proxmox-backup 0/5] fix #5853: ignore stale files Fabian Grünbichler
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=20241114144114.375987-2-c.ebner@proxmox.com \
--to=c.ebner@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