spiffs tryes sometimes to write 0 -> 1, problem?
I noticed today that spiffs tried to write a value when flushing a file after write to the flash memory which contained a few 1 that already has been flipped to 0 at this particular location.
I noticed that because my flash write function always reads back the result and reports an error if it encounters a mismatch.
The issue is not hardware related, as when I simulate the operation with a large block of RAM and some code to simulate the behavior of flash 1 to 0 but never 0 to 1, unless on erase, the issue also appears.
Now I wonder is that a problem, or does spiffs expect that and is just lazy with computing the value to be written?
this could be the same issue as i reported and subsequently fixed in https://github.com/pellepl/spiffs/issues/172
summary: it's a deliberate behavior called "blind writes". it works on most controllers and is an optimization which saves a read in certain cases. however, it can be turned off by enabling SPIFFS_NO_BLIND_WRITES.