Currently, there is one thread per partition
for snapshot merge. When all these threads are
run in parallel, this may stress the system
as the merge threads are both CPU and I/O bound.
Allow only two merge threads to be in-flight
at any point in time. This will ensure that there
is forward progress done with respect to snapshot-merge
and only two cores are used as against using
5-6 cores.
Additionally, system and prodcut partitions are merged
first. This is primarily because /root is mounted
of system partition and faster the merge completes
on /system partition, we can switch the dm tables
immediately. There is no change in the merge phase
from libsnapshot perspective. This prioritization
is based on each merge phase. If the system partition
merge is in second phase, then it takes priority
in that phase.
As a side benefit, this should also
reduce the memory usage when merge is in-flight
given that we now limit the threads.
There is slight delay in overall merge time as
we now throttle the merge.
No boot time regressions observed.
Full OTA:
Merge time (Without this patch): 42 seconds
Merge time (With this patch): 46 seconds
Incremental OTA:
Merge time (Without this patch): 52 seconds
Merge time (With this patch): 57 seconds
system partition merge completes in the first ~12-16 seconds.
App-launch (COLD) on Pixel:
Baseline (After snapshot-merge is completed when there is no daemon):
==========================
Chrome: 250
youtube: 631
camera: 230
==========================
Without this patch when snapshot-merge is in-progress (in ms):
Full - OTA
Chrome: 1729
youtube: 3126
camera: 1525
==========================
With this patch when snapshot-merge is in-progress (in ms):
Full - OTA
Chrome: 1061
youtube: 820
camera: 1378
Incremental - OTA (350M)
Chrome: 495
youtube: 1442
camera: 641
=====================
Bug: 237490659
Test: Full and incremental OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I887d5073dba88e9a8a85ac10c771e4ccee7c84ff
Deprecate DSU booting support on Q first_stage_init.
Now kDsuActiveFile and kGsiLpNamesFile must be accessible for
ReadFstabFromFile() to return successfully.
Bug: 235111004
Test: Presubmit GSI boot test
Change-Id: I5760eb9aa05610085dd7b7b78940f22fba425229
Add lz4 support in CowWriter/CowReader. Lz4 should offer faster
read/write performance but slightly larger COW sizes.
Download time: Reduced from 1264s to 825s (~35% faster)
Filesystem verification time: from 69s to 59s (~15% faster)
COW Size: 2.59GB to 3.21GB, (~25% regression)
Merge time: 37046ms to 27690ms (~25% faster)
Boot time: LZ4 is 2.7% faster
Overall, LZ4 offers faster read/write performance at the cost of 25%
space regression.
Test: th
Bug: 228478555
Change-Id: Ie521852fb3c9ff8a12e55b764c1eb1838f7b2181
Include EXT4_FEATURE_COMPAT_STABLE_INODES feature
flag from system/extra.
Test: m
Test: mmma system/core
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
Change-Id: I85f4a1c66cdfb37246808d58ca6315861daafe83
Synthesis mount entry for erofs and ext4.
Fix the synthesis logic to always create a new entry from scratch. The
old logic of "copy an existing mount entry and edit its fs_type"
doesn't work because different fs_type would have incomptable
fs_options. For example, changing this:
system /system ext4 ro,barrier=1 wait,logical,first_stage_mount
to this:
system /system erofs ro,barrier=1 wait,logical,first_stage_mount
doesn't work, because the erofs driver won't recognize the "barrier=1"
mount flag, since "barrier=1" is specific to ext4.
Bug: 235111004
Test: Boot erofs GSI.
Test: atest CtsFsMgrTestCases
Change-Id: I57132a55a089c7aae3e17c717ecd9dc1047fede8
If the vendor partition is on S and system partition is on T,
certain tests in vts_libsnapshot_test used to fail. This is primarily
because of inconsistent check between daemon and vts test.
vts test checks the userspace.snapshots.enabled property which is true on T
but never checks if the underlying vendor partition is on S. Hence,
vts test will enable userspace snapshots. However, daemon checks
the vendor partition and disables userspace snapshots thereby
leading to inconsistency.
This is only a problem on vts tests. The underlying OTA on devices
works fine as we have the vendor partition check.
Bug: 231401995
Test: vts_libsnapshot_test on S vendor and T system
vts_libsnapshot_test on T vendor and T system
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Iad4f299bd2e07c9c01f5fbee6a20e2f01bf1778a
"adb-remount-test.sh" is sh_binary,
not cc_prebuilt_binary.
Test: m
Test: cd system/core/fs_mgr; mma
Change-Id: Ie5e2446f87d38905d728e2c5a76f6f02381d10ce
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
Initiate update verification from daemon. This will help
in two ways:
1: We avoid reading everything into page-cache. Since,
low end devices are already short on memory, we don't
want to read and populate page-cache which can slow
down boot.
2: During boot, once the selinux transition is done, daemon
is all ready to kick off the verification since verity is
already setup. Note that we are still guarded by update_verifier.
Update_verifier will still block marking new slot as
boot success until the verification is completed. So, there
is no change in the behavior.
Bug: 193863442
Test: Full and incremental OTA on Pixel 6
Incremental OTA of 500M (Monthly OTA)
Boot-time (Without this patch): 38 seconds
Boot-time (With this patch): 32 seconds
Full OTA of 2.2G:
Boot-time (Without this patch): 27 seconds
Boot-time (With this patch): 21 seconds
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I4f17db19bdd0dd261902c670be6212862d861fe1
The return code check should be after TEMP_FAILURE_RETRY.
Discovered by the tautological-constant-compare warning.
Test: presubmit
Bug: 72331526
Change-Id: I531a9e0498ce9448facc692ddedc14434e7ab507
These were backported to android13-5.10 and should be present in
T-launch kernels.
Bug: 233926292
Test: vts_fs_test
Change-Id: Ifb5ff6a200b081fe8696d5803d4a128740eb8e21
This patch also begins reducing the complexity of SnapshotMergeStats by
eliminating the indirection layer between the protobuf and
SnapshotManager.
Bug: 222117189
Test: statsd_testdrive
Change-Id: I15d740121c381da7d8311f0cbbd0da82db877555
merge_op_start_ is used to set the iterator for merge operations.
Uninitialized value can potentially lead to setting up
of bad iterator.
Bug: 233246309
Test: Full OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I3cc48a66b532cfe8b2d87c8724d77ab3169a2ddb
Bug:231647359
Test:call ensure_path_mounted("/data") in WipeData function in recovery then factory reset
Change-Id: Ia5b669319776fae9478534484e3993c15fe4e6bf
We need to fix the below error happening in early stage.
[ 24.835617][ T1] init: [libfs_mgr]Running /system/bin/fsck.f2fs -a -c 10000 --debug-cache /dev/block/sda1
[ 24.843693][ T1] logwrapper: Cannot log to file /dev/fscklogs/log
Bug: 230637147
Bug: 230879192
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I19bc5f7154577e29414f855de6ce72172b281975
If there are snapshot metadata persisting in /metadata/ota/snapshots,
remove them before applying a new update. Make sure that
the snapshots are indeed invalid before removing them.
On a sidenote, add a comment in init.cpp related to
b/223076262.
Bug: 228250473
Test: 1: Apply OTA in recovery through adb sideload
2: Reboot
3: Apply OTA OTA again through update_device.py
4: Re-run Full OTA updates just from update_device.py
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I116bbafae09042b9c391ccd58c102704571c214e
In Android S, snapuserd binary was on vendor partition.
When there is an OTA update from S -> T, it is possible
that vendor partitions are not updated. In that case,
successive OTA updates T1 -> T2 will continue to have
snapuserd from Android S as vendor partition wasn't updated
to T. All this means, we should disable user-space snapshots.
When installing OTA during runtime, check for property
ro.vendor.build.version.release_or_codename; if the property
is set to "12", then skip userspace-snapshots.
Bug: 227614163
Test: Simulate OTA test on Pixel 6 from T1 -> T2 by forcefully
setting the property to 12 and verify OTA is applied
successfully by falling back to dm-snapshot.
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I95f29145e5cd9ffb8d03d28ae414f0037b88be90
Fix SnapshotUpdateTest.QueryStatusError which
was failing on targets where userspace-snapshots are not
yet enabled.
Bug: 224586316
Test: vts_libsnapshot_test -force_config dmsnap --gtest_filter=SnapshotUpdateTest.QueryStatusError
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ibaacff9b03eafe0bfa537d0f9cab98b7caceb37e
This should be using unreserved free space, not total free space.
Bug: 223701928
Test: vts_libsnapshot_test
Change-Id: Ic0a657fe094b57734c93958d7e5da56fbfbada7f
There have been two bugs where people use !metadata_encryption.empty()
to check whether metadata encryption is enabled. It should actually be
!metadata_key_dir.empty(), since 'metadata_encryption' is the encryption
options, which can be empty if the defaults are sufficient.
Rename the field in FstabEntry appropriately.
To avoid breaking fstab files, don't rename the flag in the fstab file
itself. So, now the fstab flags map to FstabEntry fields as follows:
keydirectory => metadata_key_dir
metadata_encryption => metadata_encryption_options
Change-Id: I5bf673047c99e077bd6e1ac006d80e7e16bc814b
__mount gets called multiple times. Set the read-only property only upon
success since it can't be set multiple times. Selinux disallows modifying
read-only property and therefore the property holds a wrong value, the one
when __mount was called first even in case the call failed.
Bug: 224824099
Signed-off-by: Padmanabha V <padmanabha.v@sasken.com>
Change-Id: If2900fcf988b6225bb0f96586b00b97386ca8a81
This reverts commit 471643a909.
Reason for revert: Given https://r.android.com/1960063, it is safe to revert this diagnostics patch
Change-Id: Ib3600c1982ee10a0204ac0fdbc3e160c2833ed07