Checkpoint Reclaim in Copy-on-Write File Systems
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In copy-on-write file systems, the large traversing scale and data amount calculated during checkpoint and snapshot operations lead to inefficiencies in reclaiming space, as existing methods require extensive traversal operations for reference count adjustments.
Innovation Solution
A method that obtains data blocks allocated between previous and current checkpoint reclaims, performs fixed-step reference count operations to identify blocks for reclamation, and reclaims them without traversing unnecessary blocks, focusing only on those reserved for reclamation.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of substance
If reference count subtraction traversal operation is performed on all data blocks to reclaim space, then space reclamation is achieved, but traversing scale and data amount calculated are relatively large
Solution Approach 1:
The patent applies preliminary action by maintaining reference count information in memory before actual reclamation is needed. The system pre-calculates and stores reference counts for all data blocks during checkpoint creation, so when reclamation is needed, the system can directly use this pre-computed information without performing full traversal operations at reclamation time.
Solution Approach 2:
The patent uses copying by creating a copy of reference count information from the checkpoint metadata and storing it in a separate data structure (hash table or array) that can be efficiently queried. This copied reference count data allows the system to determine which blocks need reclamation without traversing the actual data blocks themselves.
2Reliability
If reference count addition traversal operation is performed on each generated checkpoint and snapshot, then reference count accuracy is maintained, but amount of data calculated during traversal is relatively large
Solution Approach 1:
The system performs preliminary action by computing and storing reference counts when checkpoints are created, rather than computing them during deletion operations. This shifts the computational workload to checkpoint creation time when the data is still organized and accessible, avoiding repeated traversal operations during each deletion.
Solution Approach 2:
The checkpoint metadata structure serves itself by containing embedded reference count information that automatically tracks which data blocks are referenced by which checkpoints and snapshots. This self-maintaining structure eliminates the need for external traversal operations to determine reference counts.
Data Source
Figure 1A
Figure 1B
Figure 1C
AI summary
Embodiments of the present invention disclose a checkpoint reclaim method and apparatus in a copy-on-write file system. The checkpoint reclaim method includes: obtaining, according to a checkpoint reclaim instruction, M data blocks allocated by the file system between a moment of a previous checkpoint reclaim and a moment of a current checkpoint reclaim, where M is an integer not less than 1, and the M data blocks are data blocks allocated for at least one of a checkpoint or a snapshot generated between the moment of the previous checkpoint reclaim and the moment of the current checkpoint reclaim; performing an addition operation with a fixed step on a reference count of a data block that needs to be reserved in the M data blocks, and determining, in the M data blocks, a first data block that needs to be reclaimed; determining, in N data blocks allocated for at least one of a checkpoint or a snapshot reserved at the moment of the previous checkpoint reclaim, a second data block that needs to be reclaimed, where N is an integer not less than 1; and reclaiming the first data block and the second data block.