-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Support explicitly call GC during idle times on SPIFFS #2870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@joelucid this looks interesting. Care to make a PR? |
What is the status of the internal garbage collector right now? Arduino/cores/esp8266/spiffs/spiffs_nucleus.cpp Lines 449 to 468 in f706c83
Is there a better way to help improve SPIFFS performance? Or is this currently the best way to do it? |
No work has been on this front. As you said, this applies in the case where there is little space left, hence the smaller SPIFFS sizes. |
It looks to me, this This does make it even more useful for a separate GC function to be called. I will create a PR with the changes suggested in the opening post. |
Original issue: esp8266#2870
Closed with #5944 |
SPIFFS writes get very slow when there are no free blocks available. Therefore it makes sense to clear blocks in the background when the application is idle. The following patch exposes a gc() call which in turn calls SPIFFS_gc_quick which serves exactly this purpose.
diff --git a/cores/esp8266/FS.cpp b/cores/esp8266/FS.cpp
index 6ae11e1..6bd359c 100644
--- a/cores/esp8266/FS.cpp
+++ b/cores/esp8266/FS.cpp
@@ -173,6 +173,13 @@ void FS::end() {
}
}
+bool FS::gc() {
+}
bool FS::format() {
if (!_impl) {
return false;
diff --git a/cores/esp8266/FS.h b/cores/esp8266/FS.h
index 79620f9..ce42ccf 100644
--- a/cores/esp8266/FS.h
+++ b/cores/esp8266/FS.h
@@ -125,6 +125,7 @@ public:
bool rename(const char* pathFrom, const char* pathTo);
bool rename(const String& pathFrom, const String& pathTo);
protected:
FSImplPtr _impl;
};
diff --git a/cores/esp8266/FSImpl.h b/cores/esp8266/FSImpl.h
index e5694b5..242811c 100644
--- a/cores/esp8266/FSImpl.h
+++ b/cores/esp8266/FSImpl.h
@@ -71,6 +71,8 @@ public:
virtual DirImplPtr openDir(const char* path) = 0;
virtual bool rename(const char* pathFrom, const char* pathTo) = 0;
virtual bool remove(const char* path) = 0;
};
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPIFFS)
diff --git a/cores/esp8266/spiffs_api.h b/cores/esp8266/spiffs_api.h
index f98df11..f42e43e 100644
--- a/cores/esp8266/spiffs_api.h
+++ b/cores/esp8266/spiffs_api.h
@@ -165,6 +165,12 @@ public:
return true;
}
The text was updated successfully, but these errors were encountered: