commit 2257593d583b2016d73d4b6eb7a76bda751c1c5a
Author: Stéphane Glondu <glondu@debian.org>
Date:   Sat Aug 23 10:57:03 2025 +0200

    libstore: use 512-byte blocks if file size is a multiple
    
    As suggested in:
    
      https://lists.debian.org/aKheR0SX8yI5Aw9Q@begin

diff --git a/libstore/file.c b/libstore/file.c
index c54eee91..80d6812a 100644
--- a/libstore/file.c
+++ b/libstore/file.c
@@ -271,16 +271,29 @@ store_file_create (file_t file, int flags, struct store **store)
   struct store_run run;
   struct stat stat;
   error_t err = io_stat (file, &stat);
+  size_t block_size;
+  size_t sector_size = 512;
 
   if (err)
     return err;
 
   run.start = 0;
-  run.length = stat.st_size;
+
+  /* Try to use a sector as block size.  */
+  if ((stat.st_size % sector_size) == 0)
+    {
+      block_size = sector_size;
+      run.length = stat.st_size / sector_size;
+    }
+  else
+    {
+      block_size = 1;
+      run.length = stat.st_size;
+    }
 
   flags |= STORE_ENFORCED;	/* 'cause it's the whole file.  */
 
-  return _store_file_create (file, flags, 1, &run, 1, store);
+  return _store_file_create (file, flags, block_size, &run, 1, store);
 }
 
 /* Like store_file_create, but doesn't query the file for information.  */
