vold: support F2FS compression am: f64d30aa82

Change-Id: I03d6c574c922f08c67a662e483a1ed05ea7c4351
This commit is contained in:
Jaegeuk Kim 2020-04-14 15:58:30 +00:00 committed by Automerger Merge Worker
commit 0770085201
2 changed files with 15 additions and 4 deletions

View file

@ -85,7 +85,12 @@ status_t Format(const std::string& source) {
cmd.push_back("-O"); cmd.push_back("-O");
cmd.push_back("encrypt"); cmd.push_back("encrypt");
} }
if (android::base::GetBoolProperty("vold.has_compress", false)) {
cmd.push_back("-O");
cmd.push_back("compression");
cmd.push_back("-O");
cmd.push_back("extra_attr");
}
cmd.push_back("-O"); cmd.push_back("-O");
cmd.push_back("verity"); cmd.push_back("verity");

View file

@ -42,7 +42,7 @@
#include <sys/types.h> #include <sys/types.h>
static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quota, static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quota,
bool* has_reserved); bool* has_reserved, bool* has_compress);
static void coldboot(const char* path); static void coldboot(const char* path);
static void parse_args(int argc, char** argv); static void parse_args(int argc, char** argv);
@ -103,8 +103,9 @@ int main(int argc, char** argv) {
bool has_adoptable; bool has_adoptable;
bool has_quota; bool has_quota;
bool has_reserved; bool has_reserved;
bool has_compress;
if (process_config(vm, &has_adoptable, &has_quota, &has_reserved)) { if (process_config(vm, &has_adoptable, &has_quota, &has_reserved, &has_compress)) {
PLOG(ERROR) << "Error reading configuration... continuing anyways"; PLOG(ERROR) << "Error reading configuration... continuing anyways";
} }
@ -131,6 +132,7 @@ int main(int argc, char** argv) {
android::base::SetProperty("vold.has_adoptable", has_adoptable ? "1" : "0"); android::base::SetProperty("vold.has_adoptable", has_adoptable ? "1" : "0");
android::base::SetProperty("vold.has_quota", has_quota ? "1" : "0"); android::base::SetProperty("vold.has_quota", has_quota ? "1" : "0");
android::base::SetProperty("vold.has_reserved", has_reserved ? "1" : "0"); android::base::SetProperty("vold.has_reserved", has_reserved ? "1" : "0");
android::base::SetProperty("vold.has_compress", has_compress ? "1" : "0");
// Do coldboot here so it won't block booting, // Do coldboot here so it won't block booting,
// also the cold boot is needed in case we have flash drive // also the cold boot is needed in case we have flash drive
@ -214,7 +216,7 @@ static void coldboot(const char* path) {
} }
static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quota, static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quota,
bool* has_reserved) { bool* has_reserved, bool* has_compress) {
ATRACE_NAME("process_config"); ATRACE_NAME("process_config");
if (!ReadDefaultFstab(&fstab_default)) { if (!ReadDefaultFstab(&fstab_default)) {
@ -226,6 +228,7 @@ static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quot
*has_adoptable = false; *has_adoptable = false;
*has_quota = false; *has_quota = false;
*has_reserved = false; *has_reserved = false;
*has_compress = false;
for (auto& entry : fstab_default) { for (auto& entry : fstab_default) {
if (entry.fs_mgr_flags.quota) { if (entry.fs_mgr_flags.quota) {
*has_quota = true; *has_quota = true;
@ -233,6 +236,9 @@ static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quot
if (entry.reserved_size > 0) { if (entry.reserved_size > 0) {
*has_reserved = true; *has_reserved = true;
} }
if (entry.fs_mgr_flags.fs_compress) {
*has_compress = true;
}
/* Make sure logical partitions have an updated blk_device. */ /* Make sure logical partitions have an updated blk_device. */
if (entry.fs_mgr_flags.logical && !fs_mgr_update_logical_partition(&entry)) { if (entry.fs_mgr_flags.logical && !fs_mgr_update_logical_partition(&entry)) {