summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-19 23:25:11 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-19 23:25:11 +0000
commit006be06d31434191531a80c2fbb3c65de876f266 (patch)
tree794be81aa0839b8c8891e2e69e595d6a402ff418
parente860e8779f9288b28e81f5c3dcbc17fc83ff4b76 (diff)
parentcd1ae69fcfb100d7d4b83d02ba95d0821ea9b838 (diff)
Snap for 9506976 from cd1ae69fcfb100d7d4b83d02ba95d0821ea9b838 to t-keystone-qcom-release
Change-Id: I354edefd129291ca82af06e7393b8ece3f8c8ebc
-rw-r--r--fs_mgr/fs_mgr_overlayfs.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp
index 82b5275a3..6942d0ccd 100644
--- a/fs_mgr/fs_mgr_overlayfs.cpp
+++ b/fs_mgr/fs_mgr_overlayfs.cpp
@@ -1140,7 +1140,13 @@ static inline uint64_t GetIdealDataScratchSize() {
return 0;
}
- return std::min(super_info.size, (uint64_t(s.f_frsize) * s.f_bfree) / 2);
+ auto ideal_size = std::min(super_info.size, (uint64_t(s.f_frsize) * s.f_bfree) / 2);
+
+ // Align up to the filesystem block size.
+ if (auto remainder = ideal_size % s.f_bsize; remainder > 0) {
+ ideal_size += s.f_bsize - remainder;
+ }
+ return ideal_size;
}
static bool CreateScratchOnData(std::string* scratch_device, bool* partition_exists, bool* change) {