From 007aac81da306ed7fc56ce84840367b02be5f50e Mon Sep 17 00:00:00 2001 From: Bruce Luckcuck Date: Thu, 16 May 2019 12:40:15 -0400 Subject: [PATCH] Increase Async FAT filesystem cache sectors to prevent blackbox header corruption In testing I found that once the blackbox header exceeded 3072 bytes (3K) it would be truncated and overwritten with logging data. 3K would be 6 sectors and it looks like the previous cache of 8 sectors was insufficient when considering the other FAT filesystem overhead. Increased the cache to 10 sectors (1K extra memory usage) and the problem is resolved. If the blackbox header continues to expand in size this will have to be revisited. --- src/main/io/asyncfatfs/asyncfatfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/asyncfatfs/asyncfatfs.c b/src/main/io/asyncfatfs/asyncfatfs.c index b91545b699..71d91f99b8 100644 --- a/src/main/io/asyncfatfs/asyncfatfs.c +++ b/src/main/io/asyncfatfs/asyncfatfs.c @@ -58,7 +58,7 @@ #define ONLY_EXPOSE_FOR_TESTING static #endif -#define AFATFS_NUM_CACHE_SECTORS 8 +#define AFATFS_NUM_CACHE_SECTORS 10 // FAT filesystems are allowed to differ from these parameters, but we choose not to support those weird filesystems: #define AFATFS_SECTOR_SIZE 512