[pbs-devel] [PATCH backup v4 1/2] pxar-fuse: use ReplyBufState::is_full() when possible

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Feb 14 09:23:34 CET 2024


Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
Differences from vN-1:
 - Separate into two commits
 - Leave unrelated changes for a follow up patch

 pbs-pxar-fuse/src/lib.rs | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/pbs-pxar-fuse/src/lib.rs b/pbs-pxar-fuse/src/lib.rs
index 98d28c57..bf196b6c 100644
--- a/pbs-pxar-fuse/src/lib.rs
+++ b/pbs-pxar-fuse/src/lib.rs
@@ -525,9 +525,11 @@ impl SessionImpl {
             let file = file?.decode_entry().await?;
             let stat = to_stat(to_inode(&file), &file)?;
             let name = file.file_name();
-            match request.add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)? {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(lookups),
+            if request
+                .add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)?
+                .is_full()
+            {
+                return Ok(lookups);
             }
             lookups.push(self.make_lookup(request.inode, stat.st_ino, &file)?);
         }
@@ -537,9 +539,11 @@ impl SessionImpl {
             let file = dir.lookup_self().await?;
             let stat = to_stat(to_inode(&file), &file)?;
             let name = OsStr::new(".");
-            match request.add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)? {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(lookups),
+            if request
+                .add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)?
+                .is_full()
+            {
+                return Ok(lookups);
             }
             lookups.push(LookupRef::clone(&dir_lookup));
         }
@@ -551,9 +555,11 @@ impl SessionImpl {
             let file = parent_dir.lookup_self().await?;
             let stat = to_stat(to_inode(&file), &file)?;
             let name = OsStr::new("..");
-            match request.add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)? {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(lookups),
+            if request
+                .add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)?
+                .is_full()
+            {
+                return Ok(lookups);
             }
             lookups.push(lookup);
         }
@@ -619,9 +625,8 @@ impl SessionImpl {
         let xattrs = self.listxattrs(request.inode).await?;
 
         for entry in xattrs {
-            match request.add_c_string(entry.name()) {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(ReplyBufState::Full),
+            if request.add_c_string(entry.name()).is_full() {
+                return Ok(ReplyBufState::Full);
             }
         }
 
-- 
2.39.2





More information about the pbs-devel mailing list