Pierre
11/21/2025, 8:17 PMRohan
11/21/2025, 8:29 PMRohan
11/21/2025, 8:30 PMPierre
11/21/2025, 8:47 PMPierre
11/21/2025, 9:17 PMPierre
11/21/2025, 9:17 PMPierre
11/21/2025, 9:17 PMPierre
11/21/2025, 9:17 PMPierre
11/21/2025, 9:17 PMlet tmp_path = path.with_extension(format!("_tmp{}", self.make_rand_suffix()));Pierre
11/21/2025, 9:18 PMPierre
11/21/2025, 9:18 PMRohan
11/21/2025, 9:19 PMPierre
11/21/2025, 9:19 PMPierre
11/21/2025, 9:20 PMPierre
11/21/2025, 9:20 PMPierre
11/21/2025, 9:20 PMRohan
11/21/2025, 9:29 PMPierre
11/21/2025, 9:29 PMPierre
11/21/2025, 9:29 PMPierre
11/21/2025, 9:29 PMPierre
11/21/2025, 9:30 PMPierre
11/21/2025, 9:35 PMPierre
11/21/2025, 9:37 PMcriccomini
11/21/2025, 11:39 PMRohan
11/21/2025, 11:58 PMMany broken applications don't use fsync() when replacing existing files via patterns such as fd = open("foo.new")/write(fd,..)/close(fd)/ rename("foo.new", "foo"), or worse yet, fd = open("foo", O_TRUNC)/write(fd,..)/close(fd). If auto_da_alloc is enabled, ext4 will detect the replace-via-rename and replace-via-truncate patterns and force that any delayed allocation blocks are allocated such that at the next journal commit, in the default data=ordered mode, the data blocks of the new file are forced to disk before the rename() operation is committed. This provides roughly the same level of guarantees as ext3, and avoids the "zero-length" problem that can happen when a system crashes before the delayed allocation blocks are forced to disk.
It sounds like its safe for ext4. But I don't really see how it will improve performance then. Isn't it basically doing the equivalent of fsync under the hood?
I think maybe a safer approach would be to try to bypass the cache if it detects any corruption when doing checksum.Pierre
11/22/2025, 1:41 AMPierre
11/22/2025, 1:41 AMcriccomini
11/22/2025, 2:09 AMcriccomini
11/22/2025, 2:10 AMPierre
11/22/2025, 2:15 AMrust
/// Whether to cache PUT operations to disk. When enabled, data written via PUT operations
/// will be cached locally for faster subsequent reads. Default is false.
pub cache_puts: bool,Pierre
11/22/2025, 2:17 AMcriccomini
11/22/2025, 2:26 AMcriccomini
11/22/2025, 2:26 AMflaneur233
11/22/2025, 2:07 PMcriccomini
11/22/2025, 3:03 PMcriccomini
11/22/2025, 3:03 PMPierre
11/22/2025, 3:04 PMPierre
11/22/2025, 3:04 PM