am 81f55c6d: Mount emulated volumes as consistent location.
* commit '81f55c6dc1a14ed68e404fa3a2c244dd343e4990':
Mount emulated volumes as consistent location.
diff --git a/Benchmark.cpp b/Benchmark.cpp
index 7a3af65..810adf4 100644
--- a/Benchmark.cpp
+++ b/Benchmark.cpp
@@ -28,6 +28,8 @@
#include <sys/resource.h>
#include <unistd.h>
+#define ENABLE_DROP_CACHES 1
+
using android::base::ReadFileToString;
using android::base::WriteStringToFile;
@@ -88,11 +90,13 @@
sync();
nsecs_t create = systemTime(SYSTEM_TIME_BOOTTIME);
+#if ENABLE_DROP_CACHES
LOG(VERBOSE) << "Before drop_caches";
if (!WriteStringToFile("3", "/proc/sys/vm/drop_caches")) {
PLOG(ERROR) << "Failed to drop_caches";
}
LOG(VERBOSE) << "After drop_caches";
+#endif
nsecs_t drop = systemTime(SYSTEM_TIME_BOOTTIME);
BenchmarkRun();
diff --git a/EmulatedVolume.cpp b/EmulatedVolume.cpp
index d8d9198..f1ca97b 100644
--- a/EmulatedVolume.cpp
+++ b/EmulatedVolume.cpp
@@ -54,12 +54,19 @@
}
status_t EmulatedVolume::doMount() {
- mFuseDefault = StringPrintf("/mnt/runtime_default/%s", mLabel.c_str());
- mFuseRead = StringPrintf("/mnt/runtime_read/%s", mLabel.c_str());
- mFuseWrite = StringPrintf("/mnt/runtime_write/%s", mLabel.c_str());
+ // We could have migrated storage to an adopted private volume, so always
+ // call primary storage "emulated" to avoid media rescans.
+ std::string label = mLabel;
+ if (getMountFlags() & MountFlags::kPrimary) {
+ label = "emulated";
+ }
+
+ mFuseDefault = StringPrintf("/mnt/runtime_default/%s", label.c_str());
+ mFuseRead = StringPrintf("/mnt/runtime_read/%s", label.c_str());
+ mFuseWrite = StringPrintf("/mnt/runtime_write/%s", label.c_str());
setInternalPath(mRawPath);
- setPath(StringPrintf("/storage/%s", mLabel.c_str()));
+ setPath(StringPrintf("/storage/%s", label.c_str()));
if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||
fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
@@ -77,7 +84,7 @@
"-m",
"-w",
mRawPath.c_str(),
- mLabel.c_str(),
+ label.c_str(),
NULL)) {
PLOG(ERROR) << "Failed to exec";
}
diff --git a/PrivateVolume.cpp b/PrivateVolume.cpp
index 74b6b5b..6ddef3f 100644
--- a/PrivateVolume.cpp
+++ b/PrivateVolume.cpp
@@ -159,6 +159,7 @@
if (PrepareDir(mPath + "/app", 0771, AID_SYSTEM, AID_SYSTEM) ||
PrepareDir(mPath + "/user", 0711, AID_SYSTEM, AID_SYSTEM) ||
PrepareDir(mPath + "/media", 0770, AID_MEDIA_RW, AID_MEDIA_RW) ||
+ PrepareDir(mPath + "/media/0", 0770, AID_MEDIA_RW, AID_MEDIA_RW) ||
PrepareDir(mPath + "/local", 0751, AID_ROOT, AID_ROOT) ||
PrepareDir(mPath + "/local/tmp", 0771, AID_SHELL, AID_SHELL)) {
PLOG(ERROR) << getId() << " failed to prepare";