diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 5af8a295..ef21cad0 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -470,7 +470,7 @@ impl DataStore { .recursive_iter_backup_ns(ns.to_owned())? .collect::, Error>>()?; - children.sort_by(|a, b| b.depth().cmp(&a.depth())); + children.sort_by_key(|b| std::cmp::Reverse(b.depth())); let base_file = std::fs::File::open(self.base_path())?; let base_fd = base_file.as_raw_fd(); @@ -982,8 +982,10 @@ impl DataStore { .oldest_writer() .unwrap_or(phase1_start_time); - let mut gc_status = GarbageCollectionStatus::default(); - gc_status.upid = Some(upid.to_string()); + let mut gc_status = GarbageCollectionStatus { + upid: Some(upid.to_string()), + ..Default::default() + }; task_log!(worker, "Start GC phase1 (mark used chunks)"); @@ -1140,8 +1142,8 @@ impl DataStore { self.inner.verify_new } - /// returns a list of chunks sorted by their inode number on disk - /// chunks that could not be stat'ed are at the end of the list + /// returns a list of chunks sorted by their inode number on disk chunks that couldn't get + /// stat'ed are placed at the end of the list pub fn get_chunks_in_order( &self, index: &Box, diff --git a/pbs-datastore/src/snapshot_reader.rs b/pbs-datastore/src/snapshot_reader.rs index abd8837f..a2bb6aa1 100644 --- a/pbs-datastore/src/snapshot_reader.rs +++ b/pbs-datastore/src/snapshot_reader.rs @@ -60,8 +60,7 @@ impl SnapshotReader { let mut client_log_path = snapshot_path; client_log_path.push(CLIENT_LOG_BLOB_NAME); - let mut file_list = Vec::new(); - file_list.push(MANIFEST_BLOB_NAME.to_string()); + let mut file_list = vec![MANIFEST_BLOB_NAME.to_string()]; for item in manifest.files() { file_list.push(item.filename.clone()); }