libsnapshot:VABC: Allow batch merge
Kernel will batch the merge operations only when
block numbers of source and cow device are contiguous.
Daemon will read the COW file and post-process
the operations so that kernel can batch merge the potential
operations.
There are two key changes done in post-processing:
1: COW file contains all the copy operations at the
beginning of the file. We cannot allow batch
merging of COPY operations as a crash in between
the overlapping copies can result in a corrupted state.
Hence, allow copying individual blocks at a time.
2: Replace and Zero operations can be batch merged.
However, reading our existing COW format as-is
will not allow kernel to batch merge. Hence,
process the operations in such a way that kernel can batch
merge them.
Furthermore, it is observed that sync() after every
merge is a overhead. Hence, we will only sync()
for copy operations only. For replace and zero
operations, we will not explicitly sync. This is ok as
crash in between replace/zero merge operations can
redo those operations. However for copy, we have
to make sure that sync is completed before next copy
operation is initiated.
Merge time of a full OTA on bramble is around ~60
seconds as compared to ~10+ minutes prior to this
optimization.
Note that we still have copy operations which are not
batch merged. Hence, OTA with significant number of
copy operations can still have overhead on merge timings.
Bug: 174112589
Test: vts_libsnapshot, cow_snapuserd_test
Full OTA on bramble.
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I1dc286067a26ea399fa5d4e8e826e5622ce3fa58
Loading
Please register or sign in to comment