Loading fs_mgr/libsnapshot/android/snapshot/snapshot.proto +4 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,10 @@ message SnapshotUpdateStatus { // Enable direct reads from source device bool o_direct = 12; // Number of cow operations to be merged at once uint32 cow_op_merge_size = 13; } // Next: 10 Loading fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +2 −0 Original line number Diff line number Diff line Loading @@ -831,6 +831,8 @@ class SnapshotManager final : public ISnapshotManager { // Check if direct reads are enabled for the source image bool UpdateUsesODirect(LockedFile* lock); // Get value of maximum cow op merge size uint32_t GetUpdateCowOpMergeSize(LockedFile* lock); // Wrapper around libdm, with diagnostics. bool DeleteDeviceIfExists(const std::string& name, const std::chrono::milliseconds& timeout_ms = {}); Loading fs_mgr/libsnapshot/snapshot.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -1709,6 +1709,10 @@ bool SnapshotManager::PerformInitTransition(InitTransition transition, if (UpdateUsesODirect(lock.get())) { snapuserd_argv->emplace_back("-o_direct"); } uint cow_op_merge_size = GetUpdateCowOpMergeSize(lock.get()); if (cow_op_merge_size != 0) { snapuserd_argv->emplace_back("-cow_op_merge_size=" + std::to_string(cow_op_merge_size)); } } size_t num_cows = 0; Loading Loading @@ -2131,6 +2135,11 @@ bool SnapshotManager::UpdateUsesODirect(LockedFile* lock) { return update_status.o_direct(); } uint32_t SnapshotManager::GetUpdateCowOpMergeSize(LockedFile* lock) { SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock); return update_status.cow_op_merge_size(); } bool SnapshotManager::MarkSnapuserdFromSystem() { auto path = GetSnapuserdFromSystemPath(); Loading Loading @@ -3092,6 +3101,7 @@ bool SnapshotManager::WriteUpdateState(LockedFile* lock, UpdateState state, status.set_io_uring_enabled(old_status.io_uring_enabled()); status.set_legacy_snapuserd(old_status.legacy_snapuserd()); status.set_o_direct(old_status.o_direct()); status.set_cow_op_merge_size(old_status.cow_op_merge_size()); } return WriteSnapshotUpdateStatus(lock, status); } Loading Loading @@ -3474,6 +3484,8 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife status.set_legacy_snapuserd(true); LOG(INFO) << "Setting legacy_snapuserd to true"; } status.set_cow_op_merge_size( android::base::GetUintProperty<uint32_t>("ro.virtual_ab.cow_op_merge_size", 0)); } else if (legacy_compression) { LOG(INFO) << "Virtual A/B using legacy snapuserd"; } else { Loading Loading @@ -3909,6 +3921,7 @@ bool SnapshotManager::Dump(std::ostream& os) { ss << "Using userspace snapshots: " << update_status.userspace_snapshots() << std::endl; ss << "Using io_uring: " << update_status.io_uring_enabled() << std::endl; ss << "Using o_direct: " << update_status.o_direct() << std::endl; ss << "Cow op merge size (0 for uncapped): " << update_status.cow_op_merge_size() << std::endl; ss << "Using XOR compression: " << GetXorCompressionEnabledProperty() << std::endl; ss << "Current slot: " << device_->GetSlotSuffix() << std::endl; ss << "Boot indicator: booting from " << GetCurrentSlot() << " slot" << std::endl; Loading fs_mgr/libsnapshot/snapuserd/snapuserd_daemon.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ DEFINE_bool(socket_handoff, false, DEFINE_bool(user_snapshot, false, "If true, user-space snapshots are used"); DEFINE_bool(io_uring, false, "If true, io_uring feature is enabled"); DEFINE_bool(o_direct, false, "If true, enable direct reads on source device"); DEFINE_int32(cow_op_merge_size, 0, "number of operations to be processed at once"); namespace android { namespace snapshot { Loading Loading @@ -106,7 +107,6 @@ bool Daemon::StartServerForUserspaceSnapshots(int arg_start, int argc, char** ar } return user_server_.Run(); } for (int i = arg_start; i < argc; i++) { auto parts = android::base::Split(argv[i], ","); Loading @@ -114,8 +114,8 @@ bool Daemon::StartServerForUserspaceSnapshots(int arg_start, int argc, char** ar LOG(ERROR) << "Malformed message, expected at least four sub-arguments."; return false; } auto handler = user_server_.AddHandler(parts[0], parts[1], parts[2], parts[3], FLAGS_o_direct); auto handler = user_server_.AddHandler(parts[0], parts[1], parts[2], parts[3], FLAGS_o_direct, FLAGS_cow_op_merge_size); if (!handler || !user_server_.StartHandler(parts[0])) { return false; } Loading fs_mgr/libsnapshot/snapuserd/user-space-merge/extractor.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ Extractor::Extractor(const std::string& base_path, const std::string& cow_path) bool Extractor::Init() { auto opener = factory_.CreateTestOpener(control_name_); handler_ = std::make_shared<SnapshotHandler>(control_name_, cow_path_, base_path_, base_path_, opener, 1, false, false, false); opener, 1, false, false, false, 0); if (!handler_->InitCowDevice()) { return false; } Loading Loading
fs_mgr/libsnapshot/android/snapshot/snapshot.proto +4 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,10 @@ message SnapshotUpdateStatus { // Enable direct reads from source device bool o_direct = 12; // Number of cow operations to be merged at once uint32 cow_op_merge_size = 13; } // Next: 10 Loading
fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +2 −0 Original line number Diff line number Diff line Loading @@ -831,6 +831,8 @@ class SnapshotManager final : public ISnapshotManager { // Check if direct reads are enabled for the source image bool UpdateUsesODirect(LockedFile* lock); // Get value of maximum cow op merge size uint32_t GetUpdateCowOpMergeSize(LockedFile* lock); // Wrapper around libdm, with diagnostics. bool DeleteDeviceIfExists(const std::string& name, const std::chrono::milliseconds& timeout_ms = {}); Loading
fs_mgr/libsnapshot/snapshot.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -1709,6 +1709,10 @@ bool SnapshotManager::PerformInitTransition(InitTransition transition, if (UpdateUsesODirect(lock.get())) { snapuserd_argv->emplace_back("-o_direct"); } uint cow_op_merge_size = GetUpdateCowOpMergeSize(lock.get()); if (cow_op_merge_size != 0) { snapuserd_argv->emplace_back("-cow_op_merge_size=" + std::to_string(cow_op_merge_size)); } } size_t num_cows = 0; Loading Loading @@ -2131,6 +2135,11 @@ bool SnapshotManager::UpdateUsesODirect(LockedFile* lock) { return update_status.o_direct(); } uint32_t SnapshotManager::GetUpdateCowOpMergeSize(LockedFile* lock) { SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock); return update_status.cow_op_merge_size(); } bool SnapshotManager::MarkSnapuserdFromSystem() { auto path = GetSnapuserdFromSystemPath(); Loading Loading @@ -3092,6 +3101,7 @@ bool SnapshotManager::WriteUpdateState(LockedFile* lock, UpdateState state, status.set_io_uring_enabled(old_status.io_uring_enabled()); status.set_legacy_snapuserd(old_status.legacy_snapuserd()); status.set_o_direct(old_status.o_direct()); status.set_cow_op_merge_size(old_status.cow_op_merge_size()); } return WriteSnapshotUpdateStatus(lock, status); } Loading Loading @@ -3474,6 +3484,8 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife status.set_legacy_snapuserd(true); LOG(INFO) << "Setting legacy_snapuserd to true"; } status.set_cow_op_merge_size( android::base::GetUintProperty<uint32_t>("ro.virtual_ab.cow_op_merge_size", 0)); } else if (legacy_compression) { LOG(INFO) << "Virtual A/B using legacy snapuserd"; } else { Loading Loading @@ -3909,6 +3921,7 @@ bool SnapshotManager::Dump(std::ostream& os) { ss << "Using userspace snapshots: " << update_status.userspace_snapshots() << std::endl; ss << "Using io_uring: " << update_status.io_uring_enabled() << std::endl; ss << "Using o_direct: " << update_status.o_direct() << std::endl; ss << "Cow op merge size (0 for uncapped): " << update_status.cow_op_merge_size() << std::endl; ss << "Using XOR compression: " << GetXorCompressionEnabledProperty() << std::endl; ss << "Current slot: " << device_->GetSlotSuffix() << std::endl; ss << "Boot indicator: booting from " << GetCurrentSlot() << " slot" << std::endl; Loading
fs_mgr/libsnapshot/snapuserd/snapuserd_daemon.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ DEFINE_bool(socket_handoff, false, DEFINE_bool(user_snapshot, false, "If true, user-space snapshots are used"); DEFINE_bool(io_uring, false, "If true, io_uring feature is enabled"); DEFINE_bool(o_direct, false, "If true, enable direct reads on source device"); DEFINE_int32(cow_op_merge_size, 0, "number of operations to be processed at once"); namespace android { namespace snapshot { Loading Loading @@ -106,7 +107,6 @@ bool Daemon::StartServerForUserspaceSnapshots(int arg_start, int argc, char** ar } return user_server_.Run(); } for (int i = arg_start; i < argc; i++) { auto parts = android::base::Split(argv[i], ","); Loading @@ -114,8 +114,8 @@ bool Daemon::StartServerForUserspaceSnapshots(int arg_start, int argc, char** ar LOG(ERROR) << "Malformed message, expected at least four sub-arguments."; return false; } auto handler = user_server_.AddHandler(parts[0], parts[1], parts[2], parts[3], FLAGS_o_direct); auto handler = user_server_.AddHandler(parts[0], parts[1], parts[2], parts[3], FLAGS_o_direct, FLAGS_cow_op_merge_size); if (!handler || !user_server_.StartHandler(parts[0])) { return false; } Loading
fs_mgr/libsnapshot/snapuserd/user-space-merge/extractor.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ Extractor::Extractor(const std::string& base_path, const std::string& cow_path) bool Extractor::Init() { auto opener = factory_.CreateTestOpener(control_name_); handler_ = std::make_shared<SnapshotHandler>(control_name_, cow_path_, base_path_, base_path_, opener, 1, false, false, false); opener, 1, false, false, false, 0); if (!handler_->InitCowDevice()) { return false; } Loading