libsnapshot:snapuserd: Batch merge copy operation

Allow batch merge of copy operations during merge.
When metadata is read from COW device, assign
the chunk-id by validating there is no overlap
of copy operations. Furthermore, detect the blocks
which are contiguous and batch merge them.

No regression in merge time for full OTA (~35-40 seconds)

Merge time for incremental OTA of ~200M takes about 2 minutes
as compared to 15-20+ minutes without this change.

Add unit test to test ReadMetadata() functionality.

Multiple incremental OTA and full OTA test done on pixel.
adb reboot during merge and validate the merge resume operations.

Bug: 179629624
Test: incremental OTA and full OTA on pixel,
      cow_snapuserd_test
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I4cd84e4923e42afacc796b8cec01738b1bb1f420
9 files changed