]> git.proxmox.com Git - proxmox-backup.git/commitdiff
tape: cleanup: rename bytes_written to bytes_written_after_sync
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 8 May 2024 07:16:57 +0000 (09:16 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 8 May 2024 07:16:57 +0000 (09:16 +0200)
src/tape/pool_writer/mod.rs

index 1a47e837c6574e3e92fba947c8a4656f91d8e8ec..68e28714af1919e61d56222dd5f2c80cc46a9f48 100644 (file)
@@ -44,7 +44,7 @@ struct PoolWriterState {
     // tell if we already moved to EOM
     at_eom: bool,
     // bytes written after the last tape flush/sync and catalog commit
-    bytes_written: usize,
+    bytes_written_after_sync: usize,
 }
 
 /// Helper to manage a backup job, writing several tapes of a pool
@@ -202,7 +202,7 @@ impl PoolWriter {
     pub fn commit(&mut self) -> Result<(), Error> {
         if let Some(ref mut status) = self.status {
             status.drive.sync()?; // sync all data to the tape
-            status.bytes_written = 0; // reset bytes written
+            status.bytes_written_after_sync = 0; // reset bytes written
         }
         self.catalog_set.lock().unwrap().commit()?; // then commit the catalog
         Ok(())
@@ -292,7 +292,7 @@ impl PoolWriter {
             drive,
             media_uuid: media_uuid.clone(),
             at_eom: false,
-            bytes_written: 0,
+            bytes_written_after_sync: 0,
         });
 
         if is_new_media {
@@ -481,9 +481,9 @@ impl PoolWriter {
             }
         };
 
-        status.bytes_written += bytes_written;
+        status.bytes_written_after_sync += bytes_written;
 
-        let request_sync = status.bytes_written >= COMMIT_BLOCK_SIZE;
+        let request_sync = status.bytes_written_after_sync >= COMMIT_BLOCK_SIZE;
 
         if !done || request_sync {
             self.commit()?;
@@ -516,7 +516,7 @@ impl PoolWriter {
         let (saved_chunks, content_uuid, leom, bytes_written) =
             write_chunk_archive(worker, writer, chunk_iter, store, MAX_CHUNK_ARCHIVE_SIZE)?;
 
-        status.bytes_written += bytes_written;
+        status.bytes_written_after_sync += bytes_written;
 
         let elapsed = start_time.elapsed()?.as_secs_f64();
         task_log!(
@@ -527,7 +527,7 @@ impl PoolWriter {
             (bytes_written as f64) / (1_000_000.0 * elapsed),
         );
 
-        let request_sync = status.bytes_written >= COMMIT_BLOCK_SIZE;
+        let request_sync = status.bytes_written_after_sync >= COMMIT_BLOCK_SIZE;
 
         // register chunks in media_catalog
         self.catalog_set.lock().unwrap().register_chunk_archive(