Skip to content

Split Garbage Collection (SPIFFS_gc) Into Smaller Chunks #289

@peteman720

Description

@peteman720

Hello,

I am running SPIFFS on an ARM M4F processor connected to an 8MB MX25R6435F SPI flash. SPIFFS is allocated 6MB of the external flash, and has been configured for 64KB blocks with 256B pages.

As the flash fills up, write performance degrades. I can improve write performance by manually running garbage collection, but SPIFFS_gc often requires several seconds to run when the flash is ~85% full and SPIFFS_GC_MAX_RUNS=1. I would like to run garbage collection in the background, but 3 seconds is far too long to block all IO in my application.

My question is thus: Is it possible to split up garbage collection into smaller chunks that can be interspersed between other, more important operations? A quick look at SPIFFS_gc shows that SPIFFS_LOCK is held during the entirety of spiffs_gc_check, which leads me to believe the that garbage collection must be done atomically.

I'd be interested to hear from anyone else who has encountered similar performance problems and found a way to run garbage collection in the background without blocking other filesystem IO for an extended period.

Thanks for the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions