Pre-validation of blocks for garbage collection
A data storage device includes a memory device and a controller. The controller is configured to select a source block, read metadata associated with the source block and compare to a logical block address to physical block address (L2P) table, determine if a flash management unit (FMU) of the source block is valid, and add a new entry associated with the FMU into a valid FMU buffer when the FMU of the source block is determined to be valid. The controller is further configured to determine that the source block has been fully validated and select a next source block based on a valid counter. The valid counter corresponds to an amount of valid data of the next source block.
1 . A data storage device, comprising:
a memory device; and
a controller coupled to the memory device, the controller configured to:
select a source block;
determine if a flash management unit (FMU) of the source block is valid;
add a new entry corresponding to the FMU into a valid FMU buffer when the FMU of the source block is determined to be valid, wherein the new entry comprises data associated with the valid FMU;
determine if a pre-validation operation has been completed for the source block;
perform at least one garbage collection operation utilizing the valid FMU buffer;
adjust a size of the valid FMU buffer using a valid count (VC) counter of the source block; and
re-validate the FMU.
2 . The data storage device of claim 1 , wherein performing the at least one garbage collection operation is triggered based on exceeding a free space threshold.
3 . The data storage device of claim 1 , wherein, during the at least one garbage collection operation, only FMUs identified in associated entries in the valid FMU buffer are re-validated.
4 . The data storage device of claim 1 , wherein the controller is further configured to determine if there is a pre-validation operation in progress for the source block.
5 . The data storage device of claim 4 , wherein the at least one garbage collection operation utilizing the valid FMU buffer is performed when no pre-validation operation is in progress for the source block.
6 . The data storage device of claim 1 , where the at least one garbage collection operation comprises a first garbage collection operation and a second garbage collection operation, wherein the second garbage collection operation utilizes the valid FMU buffer and the second garbage collection operation is performed in response to determining there is a pre-validation operation in progress and after the pre-validation operation is completed.
7 . The data storage device of claim 6 , wherein, during the first garbage collection operation, a first number of FMUs need to be validated; and
during the second garbage collection operation, a second number of FMUs need to be re-validated, the second number of FMUs being less than a total number of FMUs associated with the source block corresponding to valid FMUs in the valid FMU buffer.
8 . The data storage device of claim 7 , wherein the second number of FMUs needing to be re-validated is less than the first number of FMUs needing to be validated.
9 . The data storage device of claim 1 , wherein data associated with valid FMUs of the valid FMU buffer are relocated from the source block to a destination block during the at least one garbage collection operation.