From a5490047b89a13adcf070fb81239ee9c73682bdd Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Wed, 14 May 2025 19:21:00 +0200 Subject: [PATCH] Slight fixes --- .../usatiuk/dhfsfs/service/DhfsFileService.java | 16 +++++++++------- .../src/main/resources/application.properties | 2 -- .../src/main/resources/application.properties | 2 -- .../src/main/resources/application.properties | 2 -- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileService.java b/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileService.java index ef72dac4..64dcee58 100644 --- a/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileService.java +++ b/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfsfs/service/DhfsFileService.java @@ -45,10 +45,8 @@ import java.util.stream.StreamSupport; */ @ApplicationScoped public class DhfsFileService { - @ConfigProperty(name = "dhfs.files.target_chunk_alignment") + @ConfigProperty(name = "dhfs.files.target_chunk_alignment", defaultValue = "17") int targetChunkAlignment; - @ConfigProperty(name = "dhfs.files.target_chunk_size") - int targetChunkSize; @ConfigProperty(name = "dhfs.files.max_chunk_size", defaultValue = "524288") int maxChunkSize; @ConfigProperty(name = "dhfs.files.allow_recursive_delete") @@ -84,6 +82,10 @@ public class DhfsFileService { return newChunk; } + int targetChunkSize() { + return 1 << targetChunkAlignment; + } + void init(@Observes @Priority(500) StartupEvent event) { Log.info("Initializing file service"); getTree(); @@ -494,7 +496,7 @@ public class DhfsFileService { else if (targetChunkAlignment < 0) end = combinedSize; else - end = Math.min(cur + targetChunkSize, combinedSize); + end = Math.min(cur + targetChunkSize(), combinedSize); var thisChunk = pendingWrites.substring(cur, end); @@ -638,11 +640,11 @@ public class DhfsFileService { while (cur < combinedSize) { long end; - if (targetChunkSize <= 0) + if (targetChunkSize() <= 0) end = combinedSize; else { - if ((combinedSize - cur) > (targetChunkSize * 1.5)) { - end = cur + targetChunkSize; + if ((combinedSize - cur) > (targetChunkSize() * 1.5)) { + end = cur + targetChunkSize(); } else { end = combinedSize; } diff --git a/dhfs-parent/dhfs-fs/src/main/resources/application.properties b/dhfs-parent/dhfs-fs/src/main/resources/application.properties index e09ec987..a2132ecd 100644 --- a/dhfs-parent/dhfs-fs/src/main/resources/application.properties +++ b/dhfs-parent/dhfs-fs/src/main/resources/application.properties @@ -12,8 +12,6 @@ dhfs.objects.persistence.stuff.root=${HOME}/dhfs_default/data/stuff dhfs.fuse.debug=false dhfs.fuse.enabled=true dhfs.files.allow_recursive_delete=false -dhfs.files.target_chunk_size=2097152 -dhfs.files.target_chunk_alignment=19 dhfs.objects.deletion.delay=1000 dhfs.objects.deletion.can-delete-retry-delay=10000 dhfs.objects.ref_verification=true diff --git a/dhfs-parent/dhfs-fuse/src/main/resources/application.properties b/dhfs-parent/dhfs-fuse/src/main/resources/application.properties index f5d79725..8c02bee4 100644 --- a/dhfs-parent/dhfs-fuse/src/main/resources/application.properties +++ b/dhfs-parent/dhfs-fuse/src/main/resources/application.properties @@ -9,8 +9,6 @@ dhfs.objects.persistence.stuff.root=${HOME}/dhfs_default/data/stuff dhfs.fuse.debug=false dhfs.fuse.enabled=true dhfs.files.allow_recursive_delete=false -dhfs.files.target_chunk_size=524288 -dhfs.files.target_chunk_alignment=17 dhfs.objects.deletion.delay=1000 dhfs.objects.deletion.can-delete-retry-delay=10000 dhfs.objects.ref_verification=true diff --git a/dhfs-parent/sync-base/src/main/resources/application.properties b/dhfs-parent/sync-base/src/main/resources/application.properties index e09ec987..a2132ecd 100644 --- a/dhfs-parent/sync-base/src/main/resources/application.properties +++ b/dhfs-parent/sync-base/src/main/resources/application.properties @@ -12,8 +12,6 @@ dhfs.objects.persistence.stuff.root=${HOME}/dhfs_default/data/stuff dhfs.fuse.debug=false dhfs.fuse.enabled=true dhfs.files.allow_recursive_delete=false -dhfs.files.target_chunk_size=2097152 -dhfs.files.target_chunk_alignment=19 dhfs.objects.deletion.delay=1000 dhfs.objects.deletion.can-delete-retry-delay=10000 dhfs.objects.ref_verification=true