Handle devices without quota, speed up lookup.
Start tracking which block devices have quota support, and gracefully
clear FLAG_USE_QUOTA when no support is present.
Also build a cached map of mounted volumes that support quota, which
halves the average quota calculation speed from 0.70ms to 0.35ms,
since we're no longer parsing procfs every time.
Test: builds, boots, common operations work
Bug: 34249218
Change-Id: Ie791df7801b67495331f3eea256c018860c9b4f6
diff --git a/cmds/installd/InstalldNativeService.h b/cmds/installd/InstalldNativeService.h
index ec81462..0208fb1 100644
--- a/cmds/installd/InstalldNativeService.h
+++ b/cmds/installd/InstalldNativeService.h
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <vector>
+#include <unordered_map>
#include <binder/BinderService.h>
#include <cutils/multiuser.h>
@@ -100,8 +101,15 @@
binder::Status deleteOdex(const std::string& apkPath, const std::string& instructionSet,
const std::string& outputPath);
+ binder::Status invalidateMounts();
+
private:
std::recursive_mutex mLock;
+
+ /* Map from mount point to underlying device node */
+ std::unordered_map<std::string, std::string> mQuotaDevices;
+
+ std::string findQuotaDeviceForUuid(const std::unique_ptr<std::string>& uuid);
};
} // namespace installd