CN-121979453-A - Garbage collection method, garbage collection device and readable storage medium for flash memory device
Abstract
The application discloses a garbage recycling method, a garbage recycling device and a readable storage medium of a flash memory device, wherein the garbage recycling method comprises the steps of performing data operation on the flash memory device, and determining ECC error correction bits of a current storage block in the flash memory device and the temperature of the flash memory device; judging whether the ECC error correction bit number of the current storage block and the temperature of the flash memory device meet a first preset condition at the same time, if so, making a corresponding delay verification strategy for the current storage block, and if not, marking the current storage block as a block to be recycled, so that the current storage block enters a garbage recycling queue. Through the design, the fake trigger GC can be effectively avoided, and the reliability and user experience of the product are improved.
Inventors
- LIU ZHUWEN
- HUANG SHANYONG
Assignees
- 深圳市时创意电子股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251231
Claims (10)
- 1. A garbage collection method for a flash memory device, comprising the steps of: Performing data operation on a flash memory device, and determining ECC error correction bits of a current storage block in the flash memory device and the temperature of the flash memory device; Judging whether the ECC error correction bit number of the current storage block and the temperature of the flash memory device meet a first preset condition at the same time; If not, marking the current storage block as a block to be recycled, and enabling the current storage block to enter a garbage recycling queue.
- 2. The method for recycling garbage of flash memory device of claim 1, wherein when said first preset condition is that the number of ECC error correction bits of said current memory block is greater than or equal to a preset number, the temperature of said flash memory device is in a high temperature range within product specifications; The delay verification strategy is that after preset time, if a first temperature condition is met, the ECC error correction number of the current storage block is detected again, if the ECC error correction number of the current storage block is smaller than the preset number, the current storage block is restored to a normal state, garbage collection is canceled from the current storage block, if the ECC error correction number of the current storage block is still larger than or equal to the preset number, whether the current storage block meets a second preset condition is further detected, and if the ECC error correction number of the current storage block is met, the current storage block is marked as a block to be collected, and the current storage block enters a garbage collection queue.
- 3. The garbage collection method of a flash memory device according to claim 2, wherein the delay verification policy comprises the steps of: Marking the current storage block as an important observation block; Recording a log of the key observation block; After the preset time, if the temperature of the flash memory device is detected to fall back to a normal range or the temperature of the flash memory device is continuously not falling back, detecting the ECC error correction bit number of the current storage block again; If the number of ECC error correction bits of the current storage block is smaller than the preset number, the current storage block is restored to a normal state, garbage collection of the current storage block is canceled, and if the number of ECC error correction bits of the current storage block is still larger than or equal to the preset number, load state judgment is carried out; if the load of the current storage block is low, marking the current storage block as a block to be recycled, enabling the current storage block to enter a garbage recycling queue, if the load of the current storage block is high, detecting whether the current storage block triggers a preset item, if yes, marking the current storage block as the block to be recycled, enabling the current storage block to enter the garbage recycling queue, and if not, continuously monitoring whether the current storage block triggers the preset item.
- 4. The method for recycling garbage of flash memory device of claim 1, wherein when said first preset condition is that the number of ECC error correction bits of said current memory block is greater than or equal to a preset number, the temperature of said flash memory device exceeds a high temperature range within product specifications; The delay verification strategy comprises the steps of detecting the type of a current storage block, marking the current storage block as a block to be recycled if the current storage block is a three-level unit block, enabling the current storage block to enter a garbage recycling queue, detecting the ECC error correction bit number of the current storage block again if the current storage block is a single-level unit block and a second temperature condition is met after preset time, restoring the current storage block to a normal state if the ECC error correction bit number of the current storage block is smaller than the preset number, canceling garbage recycling of the current storage block, further detecting whether the current storage block meets a second preset condition if the ECC error correction bit number of the current storage block is still larger than the preset number, and enabling the current storage block to enter the garbage recycling queue if the ECC error correction bit number of the current storage block is still larger than the preset number.
- 5. The garbage collection method of a flash memory device according to claim 4, wherein the delay verification policy comprises the steps of: detecting the type of the current storage block; If the current storage block is a three-level unit block, marking the current storage block as a block to be recycled, and enabling the current storage block to enter a garbage recycling queue; recording the abnormal information of the current storage block mark; after the preset time, if the temperature of the flash memory device is detected to fall back to a high temperature range within the product specification or the temperature of the flash memory device is continuously not fallen back, detecting the ECC error correction bit number of the current storage block again; If the number of ECC error correction bits of the current storage block is smaller than the preset number, the current storage block is restored to a normal state, garbage collection of the current storage block is canceled, and if the number of ECC error correction bits of the current storage block is still larger than or equal to the preset number, load state judgment is carried out; if the load of the current storage block is low, marking the current storage block as a block to be recycled, enabling the current storage block to enter a garbage recycling queue, if the load of the current storage block is high, detecting whether the current storage block triggers a preset item, if yes, marking the current storage block as the block to be recycled, enabling the current storage block to enter the garbage recycling queue, and if not, continuously monitoring whether the current storage block triggers the preset item.
- 6. The garbage collection method of a flash memory device according to claim 1, wherein the step of determining the number of ECC error correction bits of a current block stored in the flash memory device and the temperature of the flash memory device in performing a data operation on the flash memory device comprises: Reading data of the flash memory device, and synchronously performing ECC (error correction code) check on the current storage block; And if the ECC error correction bit number of the current storage block exceeds the preset number, reading the temperature of the flash memory device.
- 7. The garbage collection method of a flash memory device according to claim 1, wherein the step of determining the number of ECC error correction bits of a current block stored in the flash memory device and the temperature of the flash memory device in performing a data operation on the flash memory device comprises: Background scanning is carried out on the flash memory device, and ECC check is carried out on storage blocks in the flash memory device one by one; And if the ECC error correction bit number of the current storage block exceeds the preset number, reading the temperature of the flash memory device.
- 8. The garbage collection method of a flash memory device according to claim 1, wherein when determining the number of ECC error correction bits of a current memory block in the flash memory device, the number of reads of the current memory block is also detected; the first preset condition further includes that the number of times of reading the current storage block is smaller than a preset number of times.
- 9. A garbage collection device for a flash memory device, wherein the garbage collection device comprises a memory, a processor, and a garbage collection program stored on the memory and executable on the processor, the garbage collection program when executed by the processor implementing the steps of the garbage collection method for a flash memory device according to any one of claims 1 to 8.
- 10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a garbage collection program, which when executed by a processor, implements the steps of the garbage collection method of a flash memory device according to any one of claims 1 to 8.
Description
Garbage collection method, garbage collection device and readable storage medium for flash memory device Technical Field The present application relates to the field of garbage collection technologies of flash memories, and in particular, to a garbage collection method, a garbage collection device, and a readable storage medium for a flash memory device. Background Flash memory is a long-life nonvolatile (that retains stored data information in the event of a power failure) memory in which data erasures are not in units of individual bytes but in units of fixed blocks, typically 256KB to 20MB in size. Flash memory is a variation of electrically erasable read-only memory (EEPROM), which differs from EEPROM in that EEPROM can be erased and rewritten on a byte level rather than an entire chip, while most chips of flash memory require block erasure. Flash memory is commonly used to store setup information, such as data stored in the BIOS (basic program) of a computer, a PDA (personal digital assistant), a digital camera, etc., because it can still store data when it is powered off. Since flash memory cannot be repeatedly re-written after writing data, additional memory blocks must be used to sort the written data, a process called garbage collection (GarbageCollection, GC). The existing garbage collection mechanism lacks temperature sensing capability, and only triggers the garbage collection flow according to ECC check results, so that a large number of false trigger GCs are generated in a temperature abnormal scene, and the reliability of products and user experience can be seriously affected by frequent false trigger GCs. Disclosure of Invention The embodiment of the application aims to provide a garbage collection method, a garbage collection device and a readable storage medium of a flash memory device, which can effectively avoid false triggering GC and improve the reliability and user experience of products. The embodiment of the application discloses a garbage collection method of a flash memory device, which comprises the following steps: Performing data operation on a flash memory device, and determining ECC error correction bits of a current storage block in the flash memory device and the temperature of the flash memory device; Judging whether the ECC error correction bit number of the current storage block and the temperature of the flash memory device meet a first preset condition at the same time; If not, marking the current storage block as a block to be recycled, and enabling the current storage block to enter a garbage recycling queue. Optionally, when the first preset condition is that the number of ECC error correction bits of the current storage block is greater than or equal to a preset number, the temperature of the flash memory device is in a high temperature range within the product specification; The delay verification strategy is that after preset time, if a first temperature condition is met, the ECC error correction number of the current storage block is detected again, if the ECC error correction number of the current storage block is smaller than the preset number, the current storage block is restored to a normal state, garbage collection is canceled from the current storage block, if the ECC error correction number of the current storage block is still larger than or equal to the preset number, whether the current storage block meets a second preset condition is further detected, and if the ECC error correction number of the current storage block is met, the current storage block is marked as a block to be collected, and the current storage block enters a garbage collection queue. Optionally, the delay verification policy includes the steps of: Marking the current storage block as an important observation block; Recording a log of the key observation block; After the preset time, if the temperature of the flash memory device is detected to fall back to a normal range or the temperature of the flash memory device is continuously not falling back, detecting the ECC error correction bit number of the current storage block again; If the number of ECC error correction bits of the current storage block is smaller than the preset number, the current storage block is restored to a normal state, garbage collection of the current storage block is canceled, and if the number of ECC error correction bits of the current storage block is still larger than or equal to the preset number, load state judgment is carried out; if the load of the current storage block is low, marking the current storage block as a block to be recycled, enabling the current storage block to enter a garbage recycling queue, if the load of the current storage block is high, detecting whether the current storage block triggers a preset item, if yes, marking the current storage block as the block to be recycled, enabling the current storage block to enter the garbage recycling queue, and if not, continuously monitoring w