CN111459708A - Bad block processing method and device - Google Patents

Bad block processing method and device Download PDF

Info

Publication number
CN111459708A
CN111459708A CN202010167035.XA CN202010167035A CN111459708A CN 111459708 A CN111459708 A CN 111459708A CN 202010167035 A CN202010167035 A CN 202010167035A CN 111459708 A CN111459708 A CN 111459708A
Authority
CN
China
Prior art keywords
target block
error type
block
read
error
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010167035.XA
Other languages
Chinese (zh)
Other versions
CN111459708B (en
Inventor
赖文辉
叶欣
张翔
李振华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Biwin Storage Technology Co Ltd
Original Assignee
Biwin Storage Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Biwin Storage Technology Co Ltd filed Critical Biwin Storage Technology Co Ltd
Priority to CN202010167035.XA priority Critical patent/CN111459708B/en
Publication of CN111459708A publication Critical patent/CN111459708A/en
Application granted granted Critical
Publication of CN111459708B publication Critical patent/CN111459708B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1044Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices with specific ECC/EDC distribution
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a bad block processing method, which comprises the following steps: reading storage data in a target block; when ECC failure occurs in the read storage data, acquiring an error code of a target block; according to the data recorded by the error codes, performing reading error type analysis on the target block to determine the reading error type of the target block; and performing state identification on the target block according to the read error type of the target block. The bad block processing method provided by the invention can determine the reading error type of the target block when ECC fails, so as to identify the target block with reading error caused by software as a block to be determined, rather than directly identifying the target block as a bad block. Therefore, if the block to be determined is read wrongly due to software, the block to be determined can be normally used through software optimization, so that the number of bad blocks is reduced, the erasing times of the available blocks are reduced, and the service cycle of the product is prolonged. In addition, the invention also discloses a bad block processing device.

Description

Bad block processing method and device
Technical Field
The present invention relates to the field of memories, and in particular, to a bad block processing method and apparatus.
Background
Flash Memory (Flash Memory), also known as Flash Memory, is an electrically erasable programmable read-only Memory that allows for multiple erases in operation. Commonly used Flash memory media are NandFlash and Nor Flash, which both divide the memory space into erase blocks of a specific size, such as 16KB and 64 KB. When the erasing operation is executed, all the bits of one erasing block are set to be 1 at one time, and when the writing operation is executed, the 1 of a single bit can be written to be 0, but the 0 can not be written to be 1, so the original content of the whole erasing block is firstly erased and new data is then written in the normal writing action.
ECC (Error Correcting Code) is a technique that can perform Error checking and correction, and in a memory, ECC can tolerate errors and correct errors, so that a system can continue to operate normally without interruption due to errors.
The current data read command has ECC Fail, which is that the data cannot be restored under the conventional L DPC (L ow-dense Parity-check) error correction capability, and at this time, this block is marked as a bad block and removed from the operation chain.
Disclosure of Invention
The invention mainly aims to provide a bad block processing method to solve the technical problem that the service cycle of the existing flash memory product is shortened due to the continuous increase of bad blocks.
In order to achieve the above object, the present invention provides a bad block processing method, including:
reading storage data in a target block; when ECC failure occurs in the read storage data, acquiring an error code of the target block; according to the data recorded by the error code, performing reading error type analysis on the target block to determine the reading error type of the target block; and performing state identification on the target block according to the read error type of the target block.
Preferably, the performing, according to the data recorded by the error code, read error type analysis on the target block, and determining the read error type of the target block includes: if all the data recorded by the error codes are first numerical values, acquiring write command parameters of the target block; judging whether a target writing block in the writing command parameter is consistent with the target block; if the target block is inconsistent with the target block, determining that the read error type of the target block is a first error type, wherein the first error type represents that the storage data of the target block is incorrect; if the data is consistent with the target block, acquiring a target writing page in the target block, and judging whether the target writing page completes data writing; if not, determining that the read error type of the target block is a second error type, wherein the second error type represents that the target write page of the target block does not finish data writing; and if so, determining that the read error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block.
Preferably, the performing the state identification on the target block according to the read error type of the target block includes: if the read error type is a first error type or a second error type, marking the target block as a block to be determined; and if the read error type is a bad block error type, marking the target block as a bad block.
Preferably, the performing, according to the data recorded by the error code, read error type analysis on the target block, and determining the read error type of the target block includes: if all the data recorded by the error codes are the second numerical values, judging whether all the stored data of the target block are the second numerical values; if so, determining that the read error type of the target block is a third error type, wherein the third error type represents that the target block is not abnormal; if not, acquiring a write operation mode and a read operation mode of the target block, and judging that the write operation mode is inconsistent with the read operation mode; if so, determining that the read error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block; and if the current read operation mode and the current write operation mode of the target block are inconsistent, determining that the read error type of the target block is a fourth error type, wherein the fourth error type represents that the current read operation mode and the current write operation mode of the target block are inconsistent.
Preferably, the bad block processing method further includes: if the stored data of the target block is not all the second numerical value, acquiring scrambling parameters of the stored data of the target block during writing operation and reading operation, and judging whether the scrambling parameters of the target block during writing operation and reading operation are consistent; if so, determining that the read error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block; and if the target block is inconsistent with the read operation parameter, determining that the read error type of the target block is a fifth error type, wherein the fifth error type represents that the current scrambling code parameters of the read operation and the write operation of the target block are inconsistent.
Preferably, the performing the state identification on the target block according to the read error type of the target block includes: if the read error type is a third error type, a fourth error type or a fifth error type, marking the target block as a block to be determined; and if the read error type is a bad block error type, marking the target block as a bad block.
Preferably, the performing, according to the data recorded by the error code, read error type analysis on the target block, and determining the read error type of the target block includes: if the data recorded by the error code comprises a first numerical value and a second numerical value, determining an operation page of the target block for currently performing reading operation; reading adjacent pages in the preset range of the operation page according to a reading strategy; acquiring the ECC failure number of the adjacent pages, and judging whether the ECC failure number of all the adjacent pages is greater than a preset value of low-density parity check error correction capability or not; if the ECC failure number of all the adjacent pages is smaller than the preset value of the low-density parity check error correction capability, determining that the read error type of the target block is a bad block error type, wherein the bad block error type indicates that the target block is a bad block; and if the ECC failure number of all the adjacent pages is greater than or equal to the preset value of the low-density parity check error correction capability, determining that the read error type of the target block is a sixth error type, wherein the sixth error type represents that the read algorithm of the target block is to be optimized.
Preferably, the performing, according to the data recorded by the error code, read error type analysis on the target block, and determining the read error type of the target block includes: if the data recorded by the error code comprises a first numerical value and a second numerical value, acquiring a maintenance parameter of the target block, and determining the erasing times of the target block; judging whether the erasing times of the target block are larger than or equal to the preset erasing times; if the erasing times of the target block are smaller than the preset erasing times, determining that the reading error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block; and if the erasing times of the target block are more than or equal to the preset erasing times, determining that the reading error type of the target block is a seventh error type, wherein the seventh error type represents that the target block needs to be subjected to wear leveling.
Preferably, the performing the state identification on the target block according to the read error type of the target block includes: if the read error type is a sixth error type or a seventh error type, marking the target block as a block to be determined; and if the read error type is a bad block error type, marking the target block as a bad block.
The present invention also provides a bad block processing apparatus, including: the data reading module is used for reading the storage data in the target block; the data acquisition module is used for acquiring the error code of the target block when the ECC failure occurs in the read storage data; the error analysis module is used for performing read error type analysis on the target block according to the data recorded by the error code and determining the read error type of the target block; and the error identification module is used for carrying out state identification on the target block according to the reading error type of the target block.
Compared with the prior art, the embodiment of the invention has the beneficial effects that: the bad block processing method provided by the invention can determine the reading error type of the target block when ECC failure occurs in the reading storage data, so as to identify the target block with reading error caused by software as a block to be determined, rather than directly identifying the target block as a bad block. Therefore, if the block to be determined is a read error caused by software, the block to be determined can be normally used through software optimization, so that the number of bad blocks is reduced, the erasing times of the available blocks are reduced, and the service cycle of the product is prolonged.
Drawings
FIG. 1 is a flowchart of a bad block processing method according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating a bad block handling method according to a second embodiment of the present invention;
FIG. 3 is a flowchart illustrating a bad block handling method according to a third embodiment of the present invention;
FIG. 4 is a flowchart illustrating a bad block handling method according to a fourth embodiment of the present invention;
FIG. 5 is a flowchart of a fifth embodiment of a bad block handling method according to the present invention;
FIG. 6 is a flowchart illustrating a bad block handling method according to a sixth embodiment of the present invention;
FIG. 7 is a flowchart illustrating a bad block handling method according to a seventh embodiment of the present invention;
fig. 8 is a schematic structural diagram of a bad block processing apparatus according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be illustrative of the present invention and should not be construed as limiting the present invention, and all other embodiments that can be obtained by one skilled in the art based on the embodiments of the present invention without inventive efforts shall fall within the scope of protection of the present invention.
The present invention provides a bad block processing method, and in an embodiment, referring to fig. 1, the bad block processing method includes:
step S10, reading the storage data in the target block; the flash memory comprises blocks (blocks) for storing data, the data to be stored are all written in the blocks, and when the data in the flash memory needs to be called, the data are read from the corresponding blocks. It should be noted that the target block referred to in the present embodiment refers to a block currently being subjected to data reading.
Step S20, when ECC failure occurs in the read storage data, acquiring the error code of the target block; after the command for reading the storage data is completed, corresponding data feedback exists, if ECC information exists in the data, the ECC failure condition occurs when the storage data is read, and then the error code of the target block can be acquired.
Step S30, according to the data recorded by the error code, the reading error type of the target block is analyzed, and the reading error type of the target block is determined; it should be noted that the error code of the target block records the type of read data, and the reason for the read error of the target block can be analyzed according to the data type to determine the type of read error of the target block.
And step S40, performing state identification on the target block according to the read error type of the target block. In this embodiment, after determining the read error type of the target block, the target block with the read error type caused by the software may be identified as the block to be determined, and the target block with the read error type caused by the non-software may be identified as the bad block, so that the system may remove the bad block from the operation chain. For the block to be determined due to the software, it can be verified afterwards to perform targeted optimization on the software, such as resetting the write command parameters, or changing the read/write operation mode, etc., including but not limited to this. If the ECC failure condition does not occur after the software optimization is carried out on the data read of the block to be determined, the block to be determined is an available block which is a read error caused by software reasons and is not an inoperable bad block.
In an embodiment, referring to fig. 2, performing read error type resolution on the target block according to the data recorded by the error code, and determining the read error type of the target block includes:
step S31, if the data recorded by the error code are all the first numerical value, acquiring the write command parameter of the target block; in this embodiment, the first value is 1, that is, if all the data recorded by the error code is 1, it indicates that an error has occurred during the process of writing data, and thus the data is not written into the target block, and the read data is all 1 after erasure. It should be noted that 1 herein represents a storage form of data, which is represented in binary. When the available block executes the erasing operation, all the bits of one erasing block are set to be 1 at one time, and when the writing operation is executed, the 1 of a single bit can be written to be 0, but the 0 can not be written to be 1, so the original content of the whole erasing block is firstly erased by the normal writing action, and then new data is written.
Step S32, judging whether the target writing block in the writing command parameter is consistent with the target block;
step S33, if not, determining that the read error type of the target block is a first error type, wherein the first error type represents that the storage data of the target block is incorrect;
in this embodiment, it is first determined whether the addresses of the target write block and the target block are consistent. If the storage data read from the target block does not match with the target block, the storage error indicates that the storage location of the storage data read from the target block is wrong, the correct storage location of the storage data is the target write block and is not the target block, and in practical application, the data stored in two different blocks are different. Therefore, in this embodiment, if all the pieces of memory data BBB read from the target block a have the first value 1, the write command parameter of the target block is acquired, the target write block a 'of the read memory data BBB is acquired from the write command parameter, and if the addresses of the target block a and the target write block a' match, it indicates that the storage location of the memory data read from the target block a is correct, and if the addresses of the target block a and the target write block a 'do not match, it indicates that the storage location of the memory data read from the target block a is incorrect, that is, the storage location of the memory data BBB should be the target write block a', but the memory data BBB is stored in the target block a. Since the storage location of the stored data BBB is wrong, all the read stored data BBB are 1 in the current reading operation. In this step, if the target block a is not identical to the target write block a', it is determined that the first error type occurs in the read operation from the target block a this time.
Step S34, if yes, acquiring a target writing page in the target block, and judging whether the target writing page completes data writing;
it should be noted that, when it is determined whether the target write Page completes data writing, that is, whether multiple pages of the same Word line write data according to the specification of Flash, if data is not written according to the specification of Flash, the data is not written into the target Block, which results in a failure of a read command, such that the read data is all 1.
Step S35, if not, determining that the read error type of the target block is a second error type, where the second error type indicates that the target write page of the target block does not complete data writing;
in step S36, if the determination is completed, the read error type of the target block is determined to be a bad block error type, and the bad block error type indicates that the target block is a bad block.
In this embodiment, after it is determined that the target write page does not complete data writing, that is, the data is not written in the target write page of the target block, the target block is determined as the second error type. After it is determined that the target write page completes the data writing, i.e., indicates that the data has been written in this target block, since the data read out from the target block is all 1's, it is determined that the target block is a bad block.
In the above-mentioned embodiment, referring to fig. 3, the performing the status identification on the target block according to the read error type of the target block includes:
step S41, if the read error type is the first error type or the second error type, marking the target block as a block to be determined;
in step S42, if the read error type is a bad block error type, the target block is marked as a bad block.
In this embodiment, if the read error type is the first error type or the second error type, the target block is marked as a block to be determined. After the status identification is completed, a determination operation may be performed on the blocks to be determined of the first error type and the second error type to verify whether the blocks to be determined are caused by a software cause to cause a read data error, so as to determine whether the blocks to be determined can be used continuously. Specifically, for the first error type, the correct storage data may be stored in the target block and the reading operation of the storage data may be performed again, and if the read data is correct and the ECC failure does not occur, it indicates that the block to be determined is an available block, which is the last reading error caused by the software reason. Otherwise, if the ECC fails when the data is read, it indicates that the block to be determined is a bad block. Similarly, for the second error type, the block to be determined can be read and written again according to the specification of Flash, and if the read data is correct and the ECC failure does not occur, the block to be determined is represented as an available block, which is the last reading error caused by software reasons. If ECC failure still occurs during data reading, the block to be determined is a bad block.
In another embodiment, referring to fig. 4, performing read error type resolution on the target block according to the data recorded by the error code, and determining the read error type of the target block includes:
step S37, if the data recorded by the error code are all the second numerical value, judging whether the stored data of the target block are all the second numerical value; in this embodiment, the second value is 0, that is, if all the data recorded by the error code is 0, all the written data may be 0, and all the 0 may be erased when the data is read. It should be noted that 0 here represents a storage form of data, which is in binary representation.
Step S38, if yes, determining that the read error type of the target block is a third error type, wherein the third error type indicates that the target block is not abnormal;
step S39, if not, acquiring a write operation mode and a read operation mode of the target block, and judging that the write operation mode and the read operation mode are inconsistent;
in this embodiment, if the data written in the target block is all 0 s, it indicates that the target block is an available block without any exception, and the error type of the target block is determined as the third error type. And if the data written in the target block is not all 0, acquiring the writing operation mode and the reading operation mode of the target block so as to judge whether the operation modes of the target block during writing and reading are consistent or not. Data writing and data reading generally include the following four modes: a Slc (Single level cell, Single level storage) mode, a Tlc (triple level cell, triple level storage) mode, an Mlc (Multi level cell, Multi level storage) mode, and an Qlc (Quad level cell, four level storage) mode. If the data writing mode is different from the data reading mode, the data writing mode and the data reading mode of the target block are not matched. For example, data is written in the Slc mode and read in the Tlc mode; alternatively, data is written in the Tlc mode and read in the Slc mode.
Step S310, if the error types are consistent, determining that the reading error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block;
in step S311, if the current read operation mode of the target block is inconsistent with the write operation mode, the read error type of the target block is determined to be a fourth error type.
In this embodiment, if the write operation mode and the read operation mode of the target block are the same, the read error type of the target block may be determined to be a bad block error type. And if the write operation mode and the read operation mode of the target block are inconsistent, indicating that the current read operation mode and the write operation mode of the target block are inconsistent, and determining that the error type of the target block is a fourth error type.
In another embodiment, referring to fig. 5, the bad block processing method according to the present invention further includes:
step S312, if the stored data of the target block is not all the second numerical value, acquiring the scrambling parameters of the stored data of the target block during the writing operation and the reading operation, and judging whether the scrambling parameters of the target block during the writing operation and the reading operation are consistent; in this embodiment, if the scrambling parameters set by the target block in the data write operation and the data read operation are not the same, all the read data will be 0. For example, data is written when Scramble (scrambling parameter) is on, and read when Scramble is off; alternatively, data is written with the Scramble off and read with the Scramble on.
Step S313, if the error types are consistent, determining that the reading error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block;
in step S314, if the read error type of the target block is inconsistent with the write error type of the target block, the fifth error type indicates that the scrambling code parameters of the current read operation and the current write operation of the target block are inconsistent.
In this embodiment, if the scrambling parameters set in the data writing operation and the data reading operation of the target block are consistent, the data reading error caused by inconsistent scrambling parameters can be eliminated, so that the reading error type of the target block is determined as the bad block error type. And if the scrambling code parameters set by the target block in the data writing operation and the data reading operation are not consistent, determining the read error type of the target block as a fifth error type.
In another embodiment, referring to fig. 3, the status identification of the target block according to the read error type of the target block includes:
step S43, if the read error type is the third error type, the fourth error type or the fifth error type, marking the target block as a block to be determined;
in step S44, if the read error type is a bad block error type, the target block is marked as a bad block.
In this embodiment, if the read error type is the third error type, the fourth error type or the fifth error type, the target block is marked as the block to be determined. After the status identification is completed, a determination operation may be performed on the blocks to be determined of the third error type, the fourth error type and the fifth error type to verify whether the blocks to be determined are caused by a software cause to cause a read data error, so as to determine whether the blocks to be determined can be used continuously. Specifically, for the third error type, the target block may be re-read and written, before that, all data stored in the target block needs to be erased, the erased data type is all 1, and then data is written into the target block, that is, 1 is correspondingly rewritten to 0. And after the data is rewritten, reading the data in the target block again, if the read data is correct and the ECC failure does not occur, indicating that the block to be determined is an available block and is the last reading error caused by software reasons. Otherwise, if the ECC fails when the data is read, it indicates that the block to be determined is a bad block. Similarly, for the fourth error type and the fifth error type, the data stored in the target block may be read again by changing the operation mode and the scrambling parameter of the target block to be opposite to those of the current read command, and if the read data is correct and no ECC failure occurs, it indicates that the block to be determined is an available block, which is the last read error due to software reasons. Otherwise, if the ECC fails when the data is read, it indicates that the block to be determined is a bad block.
In yet another embodiment, referring to fig. 6, performing read error type resolution on the target block according to the error code data, determining the read error type of the target block includes:
step S315, if the data recorded by the error code includes a first value and a second value, determining an operation Page of a target Block currently performing a read operation, in this embodiment, when the data recorded by the error code includes 1 and 0, mainly considering three conditions, firstly, determining whether the currently operated Block is an Open Block, secondly, determining whether the number of ECC failures in an adjacent Page or an adjacent word line exceeds a preset value of low density parity check error correction capability (L DPC), and thirdly, determining whether the number of Program/Erase times of the currently operated Block exceeds a preset Erase times, that is, if the data read from the target Block includes 1 and 0, the reasons for ECC failures in this case are mainly caused by the above three conditions.
Step S316, reading adjacent pages in a preset range of the operation page according to the reading strategy;
step S317, acquiring the ECC failure number of adjacent pages, and judging whether the ECC failure number of all the adjacent pages is larger than a preset value of low-density parity check error correction capability or not;
in the present embodiment, firstly, confirmation is made for the second case, where the reading policy includes reading a preset number of pages from the currently operating Page number, and generally reading a number of 12 pages, it should be understood that this number of pages is merely exemplary and not limiting. And after reading is finished, checking whether the ECC failure number in all the 12 pages is larger than a preset value of the low-density parity check error correction capability or not, and accordingly analyzing the read error type of the target block.
Step S318, if the ECC failure number of all the adjacent pages is less than the preset value of the low-density parity check error correction capability, determining that the read error type of the target block is a bad block error type, and the bad block error type indicates that the target block is a bad block;
in step S319, if the number of ECC failures of all the adjacent pages is greater than or equal to the preset value of the low density parity check error correction capability, it is determined that the read error type of the target block is a sixth error type, and the sixth error type indicates that the read algorithm of the target block is to be optimized.
When the number of ECC failures in the 12 pages read in the past is greater than or equal to the preset value of the low-density parity check error correction capability, the ECC failure condition occurring when the target block stores data is read is shown, and the ECC failure condition is related to the higher number of ECC failures in the adjacent pages. That is to say, the number of ECC failures in adjacent pages may affect data reading of the current Page, so that the Page for currently reading data has an ECC failure. Further, the read error type of the target block may be determined as a sixth error type, which indicates that the read algorithm of the target block is to be optimized. On the contrary, when the number of ECC failures in the previously read 12 pages is smaller than the preset value of the low density parity check error correction capability, the ECC failure condition occurring when the target block is read to store data due to a higher number of ECC failures in the adjacent pages can be eliminated, that is, the target block is an inoperable bad block. Preferably, the preset value of the low density parity check error correction capability related to the present embodiment takes half of the low density parity check error correction capability as a reference threshold, and it should be understood that this value is merely exemplary and not restrictive.
In yet another embodiment, referring to fig. 7, performing read error type resolution on the target block according to the data recorded by the error code, and determining the read error type of the target block includes:
step S320, if the data recorded by the error code comprises a first numerical value and a second numerical value, acquiring a maintenance parameter of the target block, and determining the erasing times of the target block;
step S321, judging whether the erasing times of the target block are larger than or equal to the preset erasing times;
in this embodiment, for the third case, whether the erasing frequency of the target block is higher is checked by checking the software maintenance parameter. It can be understood that if the number of times of erasing and writing of the target block is high, there may be a data read error caused by this reason, that is, if the number of times of erasing and writing of the target block has exceeded the preset number of times of erasing and writing, the data stored in the target block may have an error itself, rather than the data read error caused by the target block being a bad block.
Step S322, if the erasing times of the target block are less than the preset erasing times, determining that the reading error type of the target block is a bad block error type, and the bad block error type represents that the target block is a bad block;
in step S323, if the erasing frequency of the target block is greater than or equal to the preset erasing frequency, the read error type of the target block is determined to be a seventh error type, and the seventh error type indicates that the target block needs to be wear balanced.
In this embodiment, if it is determined that the number of times of erasing of the target block is less than the preset number of times of erasing, the case that the stored data in the target block is erroneous due to the fact that the number of times of erasing of the target block exceeds the preset number of times of erasing can be eliminated, and thus the read error type of the target block is determined as the bad block error type. On the contrary, if it is determined that the erasing times of the target block are greater than or equal to the preset erasing times, it may be caused by a software wear leveling algorithm error that the cause of the data reading error of the target block is, and therefore the target block is identified as the seventh error type, rather than being directly identified as the bad block error type.
As for the first mentioned case, it should be noted that Open Block refers to a Block that does not write the complete Page, for example, 200 pages are 1 Block, and only 100 or 199 pages are written during data writing, and this Block belongs to the category of Open Block. In the case of Open Block, this also results in the data read from the target Block having both 1 and 0. For this reason, if the data read from the target Block has both 1 and 0, it is necessary to confirm whether all pages in the target Block are written, or send a read command to read the last page of the target Block to determine whether the target Block is an Open Block. Whether the target Block is an Open Block or not can be determined from reading the last page of the target Block because data is written page by page during the writing process. For such a case, all the data stored in the target Block may be erased, all the data in the erased target Block are 1, and then the data is read from the target Block again, where if all the read data are 1 or all the data in the last page of the target Block are 1, the target Block is an Open Block, which is an available Block that can be continuously operated, and is not a bad Block.
In the above further embodiment or further embodiment, referring to fig. 3, the performing the status identification on the target block according to the read error type of the target block includes:
step S45, if the read error type is the sixth error type or the seventh error type, marking the target block as a block to be determined;
in step S46, if the read error type is a bad block error type, the target block is marked as a bad block.
In this embodiment, if the read error type is the above-mentioned sixth error type or seventh error type, the target block is marked as a block to be determined. After the status identification is completed, a determination operation may be performed on the block to be determined of the sixth error type or the seventh error type to verify whether the block to be determined is a read data error caused by a software cause, so as to determine whether the block to be determined can be used continuously. Specifically, for the sixth error type, the data stored in the target block may be re-read after the re-read algorithm of the software is optimized, that is, the stored data in the target block is re-read without being affected by the number of ECC failures of adjacent pages, and if the read data is correct and no ECC failure occurs, the block to be determined is an available block, which is a last read error caused by the software. Otherwise, if the ECC fails when the data is read, it indicates that the block to be determined is a bad block. Similarly, for the seventh error type, after wear leveling is performed on the target block, the stored data in the target block is read again, and if the read data is correct and no ECC failure occurs, it indicates that the block to be determined is an available block, which is the last read error caused by software reasons. If ECC failure still occurs during data reading, the block to be determined is a bad block.
Based on the foregoing proposed bad block processing method, the present invention further proposes a bad block processing apparatus, referring to fig. 8, the bad block processing apparatus includes:
the data reading module 1 is used for reading the storage data in the target block;
the data acquisition module 2 is used for acquiring an error code of a target block when ECC (error correction code) failure occurs in the read storage data;
the error analysis module 3 is used for performing read error type analysis on the target block according to the data recorded by the error code and determining the read error type of the target block;
and the error identification module 4 is used for carrying out state identification on the target block according to the reading error type of the target block.
In an embodiment, the error resolution module 3 according to the present invention includes:
the first acquisition unit is used for acquiring the write command parameter of the target block if all the data recorded by the error codes are the first numerical value;
the first judging unit is used for judging whether a target writing block in the writing command parameter is consistent with a target block;
the first determining unit is used for determining that the read error type of the target block is a first error type if the target block is inconsistent with the target block, and the first error type indicates that the storage data of the target block is incorrect;
the second judgment unit is used for acquiring a target writing page in the target block and judging whether the target writing page completes data writing if the target writing page is consistent with the target writing page;
a second determining unit, configured to determine that a read error type of the target block is a second error type, where the second error type indicates that data writing is not completed in a target write page of the target block;
and the third determining unit is used for determining that the read error type of the target block is a bad block error type if the operation is finished, and the bad block error type indicates that the target block is a bad block.
In the above embodiment, the error identification module 4 according to the present invention includes:
the first marking unit is used for marking the target block as a block to be determined if the read error type is a first error type or a second error type;
and the second marking unit is used for marking the target block as a bad block if the reading error type is the bad block error type.
In another embodiment, the error resolution module 3 according to the present invention further includes:
a third judging unit, configured to judge whether all the stored data of the target block are the second numerical value if all the data recorded by the error code are the second numerical value;
a fourth determining unit, configured to determine, if the target block is a second error type, that the read error type of the target block is the third error type, where the third error type indicates that the target block is abnormal;
a fourth judging unit, configured to, if not, obtain a write operation mode and a read operation mode of the target block, and judge that the write operation mode and the read operation mode are inconsistent;
a fifth determining unit, configured to determine, if the target block is a bad block error type, that the read error type of the target block is the bad block error type, where the bad block error type indicates that the target block is a bad block;
and the sixth determining unit is used for determining that the read error type of the target block is a fourth error type if the read error type of the target block is inconsistent with the write operation mode, wherein the fourth error type represents that the current read operation mode of the target block is inconsistent with the write operation mode.
In another embodiment, the error analysis module 3 according to the present invention further includes:
a fifth judging unit, configured to, if it is judged that all the stored data of the target block are the second numerical value, obtain a scrambling parameter of the stored data of the target block during the write operation and the read operation, and judge whether the scrambling parameter of the target block during the write operation and the read operation is consistent;
a seventh determining unit, configured to determine, if the target block is a bad block error type, that the read error type of the target block is the bad block error type, where the bad block error type indicates that the target block is a bad block;
and the eighth determining unit is used for determining that the read error type of the target block is a fifth error type if the read error type of the target block is inconsistent, wherein the fifth error type represents that the scrambling code parameters of the current read operation and the current write operation of the target block are inconsistent.
In another embodiment, the error identification module 4 according to the present invention further includes:
a third marking unit, configured to mark the target block as a block to be determined if the read error type is a third error type, a fourth error type, or a fifth error type;
and the fourth marking unit is used for marking the target block as a bad block if the reading error type is the bad block error type.
In another embodiment, the error resolution module 3 according to the present invention further includes:
a ninth determining unit, configured to determine, if the data recorded by the error code includes the first numerical value and the second numerical value, an operation page of the target block currently performing a read operation;
the reading unit is used for reading adjacent pages in a preset range of the operation page according to the reading strategy;
a sixth judging unit, configured to obtain the ECC failure number of adjacent pages, and judge whether the ECC failure number of all adjacent pages is greater than a preset value of low-density parity-check error correction capability;
a tenth determining unit, configured to determine that the read error type of the target block is a bad block error type if the number of ECC failures of all adjacent pages is less than a preset value of low-density parity check error correction capability, where the bad block error type indicates that the target block is a bad block;
and the eleventh determining unit is used for determining that the read error type of the target block is a sixth error type if the ECC failure number of all the adjacent pages is greater than or equal to a preset value of the low-density parity check error correction capability, wherein the sixth error type indicates that a read algorithm of the target block is to be optimized.
In another embodiment, the error analysis module 3 according to the present invention further includes:
a twelfth determining unit, configured to, if the data recorded by the error code includes the first numerical value and the second numerical value, obtain a maintenance parameter of the target block, and determine the erasing frequency of the target block;
a seventh judging unit, configured to judge whether the number of times of erasing of the target block is greater than or equal to a preset number of times of erasing;
a thirteenth determining unit, configured to determine that the read error type of the target block is a bad block error type if the number of times of erasing the target block is less than the preset number of times of erasing, where the bad block error type indicates that the target block is a bad block;
and the fourteenth determining unit is used for determining that the read error type of the target block is a seventh error type if the erasing times of the target block are greater than or equal to the preset erasing times, wherein the seventh error type represents that the target block needs to be subjected to wear leveling.
In the above further embodiment or another embodiment, the error identification module 4 according to the present invention further includes:
the fifth marking module is used for marking the target block as a block to be determined if the read error type is the sixth error type or the seventh error type;
and the sixth marking module is used for marking the target block as a bad block if the reading error type is the bad block error type.
Based on the foregoing proposed bad block processing method, the present invention further proposes a bad block processing apparatus, which includes:
a memory for storing a computer program;
a processor, configured to implement the steps of the bad block processing method in the foregoing embodiments when executing a computer program, where the steps of the bad block processing method at least include:
step S10, reading the storage data in the target block;
step S20, when ECC failure occurs in the read storage data, acquiring the error code of the target block;
step S30, according to the data recorded by the error code, the reading error type of the target block is analyzed, and the reading error type of the target block is determined;
and step S40, performing state identification on the target block according to the read error type of the target block.
Based on the bad block processing method proposed by the aforementioned proposal, the present invention further proposes a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the bad block processing method in the aforementioned embodiments, the steps of the bad block processing method at least comprising:
step S10, reading the storage data in the target block;
step S20, when ECC failure occurs in the read storage data, acquiring the error code of the target block;
step S30, according to the data recorded by the error code, the reading error type of the target block is analyzed, and the reading error type of the target block is determined;
and step S40, performing state identification on the target block according to the read error type of the target block.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical division, and other divisions may be realized in practice, for example, a plurality of modules or components may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a part of or preferred embodiments of the present invention, and neither the text nor the drawings should be construed as limiting the scope of the present invention, and all equivalent structural changes, which are made by using the contents of the present specification and the drawings, or any other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A bad block processing method is characterized by comprising the following steps:
reading storage data in a target block;
when ECC failure occurs in the read storage data, acquiring an error code of the target block;
according to the data recorded by the error code, performing reading error type analysis on the target block to determine the reading error type of the target block;
and performing state identification on the target block according to the read error type of the target block.
2. The method as claimed in claim 1, wherein the performing read error type resolution on the target block according to the data recorded by the error code, and determining the read error type of the target block comprises:
if all the data recorded by the error codes are first numerical values, acquiring write command parameters of the target block;
judging whether a target writing block in the writing command parameter is consistent with the target block;
if the target block is inconsistent with the target block, determining that the read error type of the target block is a first error type, wherein the first error type represents that the storage data of the target block is incorrect;
if the data is consistent with the target block, acquiring a target writing page in the target block, and judging whether the target writing page completes data writing;
if not, determining that the read error type of the target block is a second error type, wherein the second error type represents that the target write page of the target block does not finish data writing;
and if so, determining that the read error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block.
3. The method of claim 2, wherein the identifying the status of the target block according to the type of read error of the target block comprises:
if the read error type is a first error type or a second error type, marking the target block as a block to be determined;
and if the read error type is a bad block error type, marking the target block as a bad block.
4. The method as claimed in claim 1, wherein the performing read error type resolution on the target block according to the data recorded by the error code, and determining the read error type of the target block comprises:
if all the data recorded by the error codes are the second numerical values, judging whether all the stored data of the target block are the second numerical values;
if so, determining that the read error type of the target block is a third error type, wherein the third error type represents that the target block is not abnormal;
if not, acquiring a write operation mode and a read operation mode of the target block, and judging that the write operation mode is inconsistent with the read operation mode;
if so, determining that the read error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block;
and if the current read operation mode and the current write operation mode of the target block are inconsistent, determining that the read error type of the target block is a fourth error type, wherein the fourth error type represents that the current read operation mode and the current write operation mode of the target block are inconsistent.
5. The bad block processing method according to claim 4, further comprising:
if the stored data of the target block is not all the second numerical value, acquiring scrambling parameters of the stored data of the target block during writing operation and reading operation, and judging whether the scrambling parameters of the target block during writing operation and reading operation are consistent;
if so, determining that the read error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block;
and if the target block is inconsistent with the read operation parameter, determining that the read error type of the target block is a fifth error type, wherein the fifth error type represents that the current scrambling code parameters of the read operation and the write operation of the target block are inconsistent.
6. The method of claim 5, wherein the identifying the status of the target block according to the type of read error of the target block comprises:
if the read error type is a third error type, a fourth error type or a fifth error type, marking the target block as a block to be determined;
and if the read error type is a bad block error type, marking the target block as a bad block.
7. The method as claimed in claim 1, wherein the performing read error type resolution on the target block according to the data recorded by the error code, and determining the read error type of the target block comprises:
if the data recorded by the error code comprises a first numerical value and a second numerical value, determining an operation page of the target block for currently performing reading operation;
reading adjacent pages in the preset range of the operation page according to a reading strategy;
acquiring the ECC failure number of the adjacent pages, and judging whether the ECC failure number of all the adjacent pages is greater than a preset value of low-density parity check error correction capability or not;
if the ECC failure number of all the adjacent pages is smaller than the preset value of the low-density parity check error correction capability, determining that the read error type of the target block is a bad block error type, wherein the bad block error type indicates that the target block is a bad block;
and if the ECC failure number of all the adjacent pages is greater than or equal to the preset value of the low-density parity check error correction capability, determining that the read error type of the target block is a sixth error type, wherein the sixth error type represents that the read algorithm of the target block is to be optimized.
8. The method as claimed in claim 1, wherein the performing read error type resolution on the target block according to the data recorded by the error code, and determining the read error type of the target block comprises:
if the data recorded by the error code comprises a first numerical value and a second numerical value, acquiring a maintenance parameter of the target block, and determining the erasing times of the target block;
judging whether the erasing times of the target block are larger than or equal to the preset erasing times;
if the erasing times of the target block are smaller than the preset erasing times, determining that the reading error type of the target block is a bad block error type, wherein the bad block error type represents that the target block is a bad block;
and if the erasing times of the target block are more than or equal to the preset erasing times, determining that the reading error type of the target block is a seventh error type, wherein the seventh error type represents that the target block needs to be subjected to wear leveling.
9. The bad block processing method according to claim 7 or 8, wherein said performing the status identification on the target block according to the read error type of the target block comprises:
if the read error type is a sixth error type or a seventh error type, marking the target block as a block to be determined;
and if the read error type is a bad block error type, marking the target block as a bad block.
10. A bad block processing apparatus, comprising:
the data reading module is used for reading the storage data in the target block;
the data acquisition module is used for acquiring the error code of the target block when the ECC failure occurs in the read storage data;
the error analysis module is used for performing read error type analysis on the target block according to the data recorded by the error code and determining the read error type of the target block;
and the error identification module is used for carrying out state identification on the target block according to the reading error type of the target block.
CN202010167035.XA 2020-03-11 2020-03-11 Bad block processing method and device Active CN111459708B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010167035.XA CN111459708B (en) 2020-03-11 2020-03-11 Bad block processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010167035.XA CN111459708B (en) 2020-03-11 2020-03-11 Bad block processing method and device

Publications (2)

Publication Number Publication Date
CN111459708A true CN111459708A (en) 2020-07-28
CN111459708B CN111459708B (en) 2023-08-29

Family

ID=71685756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010167035.XA Active CN111459708B (en) 2020-03-11 2020-03-11 Bad block processing method and device

Country Status (1)

Country Link
CN (1) CN111459708B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112035417A (en) * 2020-09-07 2020-12-04 浙江大华技术股份有限公司 Method and device for managing storage block, storage medium and electronic device
CN113885416A (en) * 2021-10-20 2022-01-04 上海新纪元机器人有限公司 Method and system for automatically detecting servo motor parameters
CN114879916A (en) * 2022-07-12 2022-08-09 合肥康芯威存储技术有限公司 Method and device for managing storage unit

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455386A (en) * 2013-08-28 2013-12-18 华为技术有限公司 Method and equipment for restoring error data
CN103514104A (en) * 2012-06-27 2014-01-15 安凯(广州)微电子技术有限公司 Method for reading data and method for writing data
CN103645965A (en) * 2013-11-28 2014-03-19 陕西千山航空电子有限责任公司 NAND-FLASH bad block recovery method based on ECCs

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103514104A (en) * 2012-06-27 2014-01-15 安凯(广州)微电子技术有限公司 Method for reading data and method for writing data
CN103455386A (en) * 2013-08-28 2013-12-18 华为技术有限公司 Method and equipment for restoring error data
CN103645965A (en) * 2013-11-28 2014-03-19 陕西千山航空电子有限责任公司 NAND-FLASH bad block recovery method based on ECCs

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112035417A (en) * 2020-09-07 2020-12-04 浙江大华技术股份有限公司 Method and device for managing storage block, storage medium and electronic device
CN113885416A (en) * 2021-10-20 2022-01-04 上海新纪元机器人有限公司 Method and system for automatically detecting servo motor parameters
CN114879916A (en) * 2022-07-12 2022-08-09 合肥康芯威存储技术有限公司 Method and device for managing storage unit

Also Published As

Publication number Publication date
CN111459708B (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN111459708B (en) Bad block processing method and device
CN103995784B (en) Flash memory controller, storage device and flash memory control method
KR101696389B1 (en) System and method to correct data errors using a stored count of bit values
EP2530595B1 (en) System and method of tracking error data within a storage device
KR100321302B1 (en) A method of controlling flash memory and a flash memory chip
US7240178B2 (en) Non-volatile memory and non-volatile memory data rewriting method
US20020199054A1 (en) Method of overwriting data in nonvolatile memory and a control apparatus used for the method
US7979737B2 (en) Method for accessing a Flash memory, and associated memory device and controller thereof
KR20020032340A (en) Method of managing a defect in a flash memory
US11567689B2 (en) Handling bad blocks generated during a block erase operation
CN109582216A (en) Data storage device and data processing method of memory device
CN116880782B (en) Embedded memory and testing method thereof
CN101727401A (en) Link table recovery method
CN102929740A (en) Method and device for detecting bad block of storage equipment
CN101253485A (en) Memory arrangement and method for the operation thereof
CN105988936A (en) Non-volatile memory device and controller
TWI744049B (en) Data processing method and memory controller utilizing the same
JP3675375B2 (en) Nonvolatile memory and data rewriting method of nonvolatile memory
US20220283894A1 (en) Detection method and system applied to intelligent analysis and detection for flash, intelligent terminal, and computer-readable storage medium
CN111273857A (en) Selective relocation of data of subgroups of data blocks based on statistical distribution of reliability
CN114627959A (en) Flash memory detection method, flash memory detection device, equipment and medium
KR20050064887A (en) Flash memory having enhanced error detection capability and method for detecting multi-bit errors
CN113050888B (en) Method, system, device and storage medium for quickly removing unstable Flash blocks
CN114550772A (en) Method for managing particles in NAND flash memory, storage medium and storage device
US10019186B2 (en) Data maintenance method for error control and data storage device using the same

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 518000 floors 1-3 and 4 of buildings 4 and 8, zone 2, Zhongguan honghualing Industrial South Zone, No. 1213 Liuxian Avenue, Pingshan community, Taoyuan Street, Nanshan District, Shenzhen, Guangdong

Applicant after: BIWIN STORAGE TECHNOLOGY Co.,Ltd.

Address before: 518000 1st, 2nd, 4th and 5th floors of No.4 factory building, tongfuyu industrial town, Taoyuan Street, Nanshan District, Shenzhen City, Guangdong Province

Applicant before: BIWIN STORAGE TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant