Whamcloud - gitweb
AOSP: e2fsdroid: Do not allocate invalid blocks from BaseFS.
authorDavid Anderson <dvander@google.com>
Thu, 5 Dec 2019 21:27:44 +0000 (13:27 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 1 Jan 2020 18:41:35 +0000 (13:41 -0500)
commitaf4d3f8916f72a4756468d1277ded1d2e371e32b
tree32a1c64f3c877abbbd97c56e8db0745b1b32439f
parentdcbe79c4fa09f87983df09c82f006a455661c47c
AOSP: e2fsdroid: Do not allocate invalid blocks from BaseFS.

If certain metadata properties change in between builds, such as the
inode table size, then block mappings may not be valid from one build to
the next. For example, build A could allocate block N for a file. If
build B has a larger inode table, block N may no longer be a data block.

In this case, we need to remove the block from the BaseFS range list so
we do not give it back to libext2fs for writing data. We do this with a
new "owned_block_map" bitmap. If a block from the base FS is not in use
by the initial image, and is not used by any other file, it is
considered owned, and can be claimed by that file.

Note that while this produces correct images, it also prevents
deduplicated blocks from being re-used. This will be addressed in a
follow-up patch.

Bug: 145316683
Test: e2fsdroid block mapping with dynamic partitions
Change-Id: I3145e45156f7879bdf956384723fab4bd69acb93
Signed-off-by: David Anderson <dvander@google.com>
From AOSP commit: b3d1ccdb673772588b7bb14c4581980ef549a0b8
contrib/android/basefs_allocator.c