diff options
author | 2024-02-13 17:02:29 +0000 | |
---|---|---|
committer | 2024-04-10 09:10:30 +0000 | |
commit | 3e410f15eab500ad8248d9463b5fe1ec0a609a27 (patch) | |
tree | e972841a9759718c351b0fa7dfb2fdef302b3211 /compiler/optimizing/code_generator.cc | |
parent | db9cd130d8a3164c7c58c5c691d63aa0e5df8ca8 (diff) |
Support sparsity in FdFile::Copy
Output a sparse file during FdFile::Copy by reading and checking each
block of the source file in userspace, writing only the non-zero blocks
and skipping over any zeroed blocks (holes). This helps to save disk
space on file systems that support sparse files.
The current target use-case is odrefresh on Android U and earlier, where
sparse staging files which are copied to an installation directory must
remain sparse.
The implementation and tests are based on and replace a reverted lseek
SEEK_DATA/SEEK_HOLE based sparse file copy (7e06898) following observed
issues with lseek SEEK_DATA on f2fs, where lseek SEEK_DATA will
sometimes return an incorrect offset. This bug is not yet able to be
reproduced in the gtests, but can be reproduced with a manual odrefresh
invocation.
The implementation support and tests are refactored over that of 7e06898:
* Add tests for partial sparse-file copying, and that sparsity is
impacted as expected according to the copy alignment.
* Only dissallow copies to non-empty files if the existing data is in
the target copy region, and add a test case.
Bug: 323906594
Tested on oriole and shiba (ext4 and f2fs):
Test: dex2oat ... -g --strip -oat-symbols=...
Test: odrefresh --force-compile
Test: art/tools/run-gtests.sh
Co-authored-by: Richard Neill <richard.neill@arm.com>
Co-authored-by: Ruben Ayrapetyan <ruben.ayrapetyan@arm.com>
Change-Id: Idcc5a9c5320b3a80ea5c6186fa4c41d92f1727f8
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
0 files changed, 0 insertions, 0 deletions