Merge "vts_libsnapshot_test: Fix free space calculation." am: f1df9ba5c4 am: 5b9eb5fde0

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2031284

Change-Id: Ie378aa231a1f0915fd00db724a575f9585359b2b
This commit is contained in:
Treehugger Robot 2022-03-23 17:21:21 +00:00 committed by Automerger Merge Worker
commit 1123fcd107

View file

@ -267,8 +267,8 @@ AssertionResult LowSpaceUserdata::Init(uint64_t max_free_space) {
return AssertionFailure() << "Temp file allocated to " << big_file_->path << ", not in "
<< kUserDataDevice;
}
uint64_t next_consume =
std::min(free_space_ - max_free_space, (uint64_t)std::numeric_limits<off_t>::max());
uint64_t next_consume = std::min(available_space_ - max_free_space,
(uint64_t)std::numeric_limits<off_t>::max());
off_t allocated = 0;
while (next_consume > 0 && free_space_ > max_free_space) {
int status = fallocate(big_file_->fd, 0, allocated, next_consume);