From 15433b93ff9d46c1951839e7b246b8c2785b0561 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 17 Mar 2022 20:35:52 -0700 Subject: [PATCH] vts_libsnapshot_test: Fix free space calculation. This should be using unreserved free space, not total free space. Bug: 223701928 Test: vts_libsnapshot_test Change-Id: Ic0a657fe094b57734c93958d7e5da56fbfbada7f --- fs_mgr/libsnapshot/test_helpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs_mgr/libsnapshot/test_helpers.cpp b/fs_mgr/libsnapshot/test_helpers.cpp index e3e3af853..71fe12435 100644 --- a/fs_mgr/libsnapshot/test_helpers.cpp +++ b/fs_mgr/libsnapshot/test_helpers.cpp @@ -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::max()); + uint64_t next_consume = std::min(available_space_ - max_free_space, + (uint64_t)std::numeric_limits::max()); off_t allocated = 0; while (next_consume > 0 && free_space_ > max_free_space) { int status = fallocate(big_file_->fd, 0, allocated, next_consume);