From e5c66a9c2cbf158b860d8efbcf51067efaa2a4f2 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Fri, 11 Nov 2022 23:31:43 +0000 Subject: storage: Add functionality to rebuild the free set If we replace corrupted file(s), we may lose blocks that are now free but we couldn't walk the tree to find them. This change allows the free set to be entirely rebuilt by walking the file tree and noting all blocks in use. Bug: 244608684 Test: build.py generic-arm64-test-debug --test storage_block_test Change-Id: Id669b12e1f4c4f50999ee4287019d69ef05a1d15 --- file.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'file.h') diff --git a/file.h b/file.h index 56e1758..d6fd2ce 100644 --- a/file.h +++ b/file.h @@ -20,6 +20,7 @@ #include "block_cache.h" #include "block_mac.h" +struct block_set; struct fs; struct transaction; @@ -104,6 +105,9 @@ void file_transaction_complete_failed(struct transaction* tr); void file_transaction_success(struct transaction* tr); void file_transaction_failed(struct transaction* tr); +void files_rebuild_free_set(struct transaction* tr, + struct block_set* new_free_set, + struct block_mac* files_root); /* TODO: move to dir? */ enum file_create_mode { -- cgit v1.2.3