From 5fcdaf334acbf47a5e33b81d033afd40bc1c4254 Mon Sep 17 00:00:00 2001 From: Carl Johnsen Date: Fri, 15 Nov 2024 13:40:21 +0100 Subject: [PATCH] FileProcessor now bursts their block requests --- .../Main/Operation/Restore/FileProcessor.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs b/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs index 07361174c..e0927cb0d 100644 --- a/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs +++ b/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs @@ -56,13 +56,22 @@ namespace Duplicati.Library.Main.Operation.Restore using var fs = new System.IO.FileStream(file.Path, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.None); - foreach (var block in blocks) + // TODO burst should be an option and should relate to the channel depth + int burst = 8; + for (int i = 0; i < blocks.Count; i += burst) { - await block_request.WriteAsync(block); + int this_burst = Math.Min(burst, blocks.Count - i); + for (int j = 0; j < this_burst; j++) + { + await block_request.WriteAsync(blocks[i + j]); + } + for (int j = 0; j < this_burst; j++) + { var data = await block_response.ReadAsync(); - // TODO verify the hash, size, volume ID, and file hash await fs.WriteAsync(data); bytes_written += data.Length; + + } } }