Method and non-transitory computer-readable storage medium and apparatus for performing sudden power off recovery process
The invention introduces a method for performing a sudden power off recovery (SPOR) process, performed by a processing unit of a flash controller, to include: performing operations for the SPOR process after regaining power; and performing operations for a reduced garbage collection (GC) process. An execution time of the operations for the SPOR process and the reduced GC process is limited to a preset time that a host side waits for a completion of the SPOR process by the flash controller.
1 . A method for performing a sudden power off recovery (SPOR) process, performed by a processing unit of a flash controller, comprising:
performing operations for the SPOR process after regaining power; and
performing operations for a reduced garbage collection (GC) process,
wherein an execution time of the operations for the SPOR process and the reduced GC process is limited to a preset time that a host side waits for a completion of the SPOR process by the flash controller.
2 . The method of claim 1 , wherein the reduced GC process comprises a loop that is repeatedly executed, and the loop comprises:
collecting user data of a plurality of valid pages from a source block;
determining whether a reading fail has occurred, or a first execution time of the reduced GC process has exceeded a predetermined time after collecting the user data of the valid pages from the source block;
exiting the SPOR process when the reading fail has occurred, or the first execution time of the reduced GC process has exceeded the predetermined time;
programming the user data of the valid pages into a physical page in a destination block when a reading is successful and the first execution time of the reduced GC process hasn't exceeded the predetermined time;
determining whether a second execution time of the reduced GC process has exceeded the predetermined time after programming the user data of the valid pages into the physical page in the destination block;
exiting the SPOR process when the second execution time of the reduced GC process has exceeded the predetermined time; and
executing a next iteration of the loop when the second execution time of the reduced GC process hasn't exceeded the predetermined time.
3 . The method of claim 2 , comprising:
starting a timer to count from 0 at a beginning of the reduced GC process,
wherein a counting value of the timer indicates the first execution time or the second execution time of the reduced GC process.
4 . The method of claim 2 , wherein the predetermined time is any time from 400 to 500 milliseconds (ms).
5 . The method of claim 1 , wherein an execution time of the SPOR process and the reduced GC process is limited to any time from 0.8 to 1 second.
6 . The method of claim 1 , wherein functions of a soft decoding process and a redundant array of independent disks (RAID) decoding process are disabled in the reduced GC process.
7 . The method of claim 6 , wherein, for user data of an erroneous page, the soft decoding process executes a bit flipping algorithm to generate new variable nodes according to soft bits corresponding to hard bits or variable nodes, and syndromes, and uses a formula to calculate soft bits of the new variable nodes; and the RAID decoding process generates corrected user data of the erroneous page according to user data of other pages, and data of a parity page in a page group.
8 . A non-transitory computer-readable storage medium having stored therein program code that, when loaded and executed by a processing unit of a flash controller, causes the processing unit to:
perform operations for a sudden power off recovery (SPOR) process after regaining power; and
perform operations for a reduced garbage collection (GC) process,
wherein an execution time of the operations for the SPOR process and the reduced GC process is limited to a preset time that a host side waits for a completion of the SPOR process by the flash controller.
9 . The non-transitory computer-readable storage medium of claim 8 , wherein the reduced GC process comprises a loop that is repeatedly executed, the loop comprises:
collecting user data of a plurality of valid pages from a source block;
determining whether a reading fail has occurred, or a first execution time of the reduced GC process has exceeded a predetermined time after collecting the user data of the valid pages from the source block;
exiting the SPOR process when the reading fail has occurred, or the first execution time of the reduced GC process has exceeded the predetermined time;
programing the user data of the valid pages into a physical page in a destination block when a reading is successful and the first execution time of the reduced GC process hasn't exceeded the predetermined time;
determining whether a second execution time of the reduced GC process has exceeded the predetermined time after programming the user data of the valid pages into the physical page in the destination block;
exiting the SPOR process when the second execution time of the reduced GC process has exceeded the predetermined time; and
executing a next iteration of the loop when the second execution time of the reduced GC process hasn't exceeded the predetermined time.
10 . The non-transitory computer-readable storage medium of claim 9 , wherein the program code that, when loaded and executed by the processing unit, causes the processing unit to:
start a timer to count from 0 at a beginning of the reduced GC process,
wherein a counting value of the timer indicates the first execution time or the second execution time of the reduced GC process.
11 . The non-transitory computer-readable storage medium of claim 9 , wherein the predetermined time is any time from 400 to 500 milliseconds (ms).
12 . The non-transitory computer-readable storage medium of claim 8 , wherein an execution time of the SPOR process and the reduced GC process is limited to any time from 0.8 to 1 second.
13 . The non-transitory computer-readable storage medium of claim 8 ,
wherein functions of a soft decoding process and a redundant array of independent disks (RAID) decoding process are disabled in the reduced GC process,
wherein, for user data of an erroneous page, the soft decoding process executes a bit flipping algorithm to generate new variable nodes according to soft bits corresponding to hard bits or variable nodes, and syndromes, and uses a formula to calculate soft bits of the new variable nodes; and the RAID decoding process generates corrected user data of the erroneous page according to user data of other pages, and data of a parity page in a page group.
14 . An apparatus for performing a sudden power off recovery (SPOR) process, comprising:
a processing unit, arranged operably to: perform operations for the SPOR process after regaining power; and perform operations for a reduced garbage collection (GC) process,
wherein an execution time of the operations for the SPOR process and the reduced GC process is limited to a preset time that a host side waits for a completion of the SPOR process by a flash controller.
15 . The apparatus of claim 14 , wherein the reduced GC process comprises a loop that is repeatedly executed, the loop comprises:
collecting user data of a plurality of valid pages from a source block;
determining whether a reading fail has occurred, or a first execution time of the reduced GC process has exceeded a predetermined time after collecting the user data of the valid pages from the source block;
exiting the SPOR process when the reading fail has occurred, or the first execution time of the reduced GC process has exceeded the predetermined time;
programming the user data of the valid pages into a physical page in a destination block when a reading is successful and the first execution time of the reduced GC process hasn't exceeded the predetermined time;
determining whether a second execution time of the reduced GC process has exceeded the predetermined time after programming the user data of the valid pages into the physical page in the destination block;
exiting the SPOR process when the second execution time of the reduced GC process has exceeded the predetermined time; and
executing a next iteration of the loop when the second execution time of the reduced GC process hasn't exceeded the predetermined time.
16 . The apparatus of claim 15 , wherein the processing unit is arranged operably to: start a timer to count from 0 at a beginning of the reduced GC process, and a counting value of the timer indicates the first execution time or the second execution time of the reduced GC process.
17 . The apparatus of claim 15 , wherein the predetermined time is any time from 400 to 500 milliseconds (ms).
18 . The apparatus of claim 14 , wherein an execution time of the SPOR process and the reduced GC process is limited to any time from 0.8 to 1 second.
19 . The apparatus of claim 14 , wherein the processing unit is arranged operably to: disable functions of a soft decoding process and a redundant array of independent disks (RAID) decoding process in the reduced GC process.
20 . The apparatus of claim 19 , wherein, for user data of an erroneous page, the soft decoding process executes a bit flipping algorithm to generate new variable nodes according to soft bits corresponding to hard bits or variable nodes, and syndromes, and uses a formula to calculate soft bits of the new variable nodes; and the RAID decoding process generates corrected user data of the erroneous page according to user data of other pages, and data of a parity page in a page group.