Skip to content

Commit 6654770

Browse files
authored
Merge pull request #1582 from filipe-norte-red/wpe-2.46-improve-quota-manager-accuracy
Improve Quota Manager accuracy to mitigate "disk full" issues
2 parents 78bf57c + 1e8d68c commit 6654770

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Source/WebKit/NetworkProcess/storage/OriginQuotaManager.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ bool OriginQuotaManager::grantWithCurrentQuota(uint64_t spaceRequested)
110110
}
111111
m_quotaCountdown = *m_usage < m_quota ? m_quota - *m_usage : 0;
112112

113+
// As the overhead to store data by the underlying storage backend may be significant, the quota countdown may not
114+
// be accurate enough. Depending on the data size persisted, we may run out of disk space on constraint devices even
115+
// when quota is in theory available (when a lot of data is written without checking the real usage).
116+
// To mitigate this, we force the read of the real usage after consuming 25% of the theoretically available space.
117+
// If the remaining available space is too small that the overhead becomes insignificant (100 KB), we just take all
118+
// remaining space is available from that point on
119+
if (m_quotaCountdown > (100*1024))
120+
m_quotaCountdown /= 4;
121+
113122
return grantFastPath(spaceRequested);
114123
}
115124

0 commit comments

Comments
 (0)