Disable bind mounts for data and obb if FUSE BPF is available
FUSE BPF aims at achieving comparable performance to bind-mounts, with the flexibility of FUSE. Disable data and obb bind-mounts in favor of the FUSE filesystem if the system implements the feature. Bug: 202785178 Test: mount | grep obb Signed-off-by: Alessio Balsini <balsini@google.com> Change-Id: Ia8b289b84542125831a857b559bb6f93afbee494
This commit is contained in:
parent
e9c951590e
commit
dd1e91ff58
3 changed files with 17 additions and 7 deletions
1
Utils.h
1
Utils.h
|
@ -36,6 +36,7 @@ namespace vold {
|
||||||
|
|
||||||
static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_isolation_enabled";
|
static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_isolation_enabled";
|
||||||
static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled";
|
static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled";
|
||||||
|
static const char* kFuseBpfEnabled = "persist.sys.fuse.bpf.enable";
|
||||||
|
|
||||||
/* SELinux contexts used depending on the block device type */
|
/* SELinux contexts used depending on the block device type */
|
||||||
extern char* sBlkidContext;
|
extern char* sBlkidContext;
|
||||||
|
|
|
@ -49,6 +49,7 @@ EmulatedVolume::EmulatedVolume(const std::string& rawPath, int userId)
|
||||||
mRawPath = rawPath;
|
mRawPath = rawPath;
|
||||||
mLabel = "emulated";
|
mLabel = "emulated";
|
||||||
mFuseMounted = false;
|
mFuseMounted = false;
|
||||||
|
mFuseBpfEnabled = base::GetBoolProperty(kFuseBpfEnabled, false);
|
||||||
mUseSdcardFs = IsSdcardfsUsed();
|
mUseSdcardFs = IsSdcardfsUsed();
|
||||||
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
|
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
|
||||||
}
|
}
|
||||||
|
@ -60,6 +61,7 @@ EmulatedVolume::EmulatedVolume(const std::string& rawPath, dev_t device, const s
|
||||||
mRawPath = rawPath;
|
mRawPath = rawPath;
|
||||||
mLabel = fsUuid;
|
mLabel = fsUuid;
|
||||||
mFuseMounted = false;
|
mFuseMounted = false;
|
||||||
|
mFuseBpfEnabled = base::GetBoolProperty(kFuseBpfEnabled, false);
|
||||||
mUseSdcardFs = IsSdcardfsUsed();
|
mUseSdcardFs = IsSdcardfsUsed();
|
||||||
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
|
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
|
||||||
}
|
}
|
||||||
|
@ -359,10 +361,12 @@ status_t EmulatedVolume::doMount() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only do the bind-mounts when we know for sure the FUSE daemon can resolve the path.
|
if (!mFuseBpfEnabled) {
|
||||||
res = mountFuseBindMounts();
|
// Only do the bind-mounts when we know for sure the FUSE daemon can resolve the path.
|
||||||
if (res != OK) {
|
res = mountFuseBindMounts();
|
||||||
return res;
|
if (res != OK) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureReadAheadForFuse(GetFuseMountPathForUser(user_id, label), 256u);
|
ConfigureReadAheadForFuse(GetFuseMountPathForUser(user_id, label), 256u);
|
||||||
|
@ -416,9 +420,11 @@ status_t EmulatedVolume::doUnmount() {
|
||||||
if (mFuseMounted) {
|
if (mFuseMounted) {
|
||||||
std::string label = getLabel();
|
std::string label = getLabel();
|
||||||
|
|
||||||
// Ignoring unmount return status because we do want to try to unmount
|
if (!mFuseBpfEnabled) {
|
||||||
// the rest cleanly.
|
// Ignoring unmount return status because we do want to try to
|
||||||
unmountFuseBindMounts();
|
// unmount the rest cleanly.
|
||||||
|
unmountFuseBindMounts();
|
||||||
|
}
|
||||||
|
|
||||||
if (UnmountUserFuse(userId, getInternalPath(), label) != OK) {
|
if (UnmountUserFuse(userId, getInternalPath(), label) != OK) {
|
||||||
PLOG(INFO) << "UnmountUserFuse failed on emulated fuse volume";
|
PLOG(INFO) << "UnmountUserFuse failed on emulated fuse volume";
|
||||||
|
|
|
@ -64,6 +64,9 @@ class EmulatedVolume : public VolumeBase {
|
||||||
/* Whether we mounted FUSE for this volume */
|
/* Whether we mounted FUSE for this volume */
|
||||||
bool mFuseMounted;
|
bool mFuseMounted;
|
||||||
|
|
||||||
|
/* Whether the FUSE BPF feature is enabled */
|
||||||
|
bool mFuseBpfEnabled;
|
||||||
|
|
||||||
/* Whether to use sdcardfs for this volume */
|
/* Whether to use sdcardfs for this volume */
|
||||||
bool mUseSdcardFs;
|
bool mUseSdcardFs;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue