am 81f55c6d: Mount emulated volumes as consistent location.

* commit '81f55c6dc1a14ed68e404fa3a2c244dd343e4990':
  Mount emulated volumes as consistent location.
This commit is contained in:
Jeff Sharkey 2015-07-08 22:08:07 +00:00 committed by Android Git Automerger
commit 0d3fe8152e
3 changed files with 17 additions and 5 deletions

View file

@ -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 @@ static nsecs_t benchmark(const std::string& path) {
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();

View file

@ -54,12 +54,19 @@ EmulatedVolume::~EmulatedVolume() {
}
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 @@ status_t EmulatedVolume::doMount() {
"-m",
"-w",
mRawPath.c_str(),
mLabel.c_str(),
label.c_str(),
NULL)) {
PLOG(ERROR) << "Failed to exec";
}

View file

@ -159,6 +159,7 @@ status_t PrivateVolume::doMount() {
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";