CN112083891B - Method for detecting data block in memory and related equipment - Google Patents

Method for detecting data block in memory and related equipment Download PDF

Info

Publication number
CN112083891B
CN112083891B CN202011002456.3A CN202011002456A CN112083891B CN 112083891 B CN112083891 B CN 112083891B CN 202011002456 A CN202011002456 A CN 202011002456A CN 112083891 B CN112083891 B CN 112083891B
Authority
CN
China
Prior art keywords
data block
data
block set
memory
source
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.)
Active
Application number
CN202011002456.3A
Other languages
Chinese (zh)
Other versions
CN112083891A (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.)
Chipsbank Technologies Shenzhen Co ltd
Original Assignee
Chipsbank Technologies Shenzhen 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 Chipsbank Technologies Shenzhen Co ltd filed Critical Chipsbank Technologies Shenzhen Co ltd
Priority to CN202011002456.3A priority Critical patent/CN112083891B/en
Publication of CN112083891A publication Critical patent/CN112083891A/en
Application granted granted Critical
Publication of CN112083891B publication Critical patent/CN112083891B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

The application provides a method and related equipment for detecting data blocks in a memory, which are used for determining available data blocks in the memory and avoiding data writing errors caused by writing data into the memory by mistake and writing wrong data blocks into the memory. The method comprises the following steps: writing random data into each data block in the erased first source data block set to obtain a second source data block set, and writing the data of each data block in the second source data block set into the first data block set to obtain a second data block set; performing data verification on each data block in the second data block set to determine a third data block set with correct data verification; writing the data of each data block in the fourth source data block set filled with the random data into the first source data block set to obtain a fifth source data block set; and performing data verification on each data block in the fifth source data block set to determine a fourth data block set with correct data verification.

Description

Method for detecting data block in memory and related equipment
Technical Field
The present application relates to the field of storage, and in particular, to a method and related device for detecting a data block in a memory.
Background
In order to improve the storage security of Nand Flash, it is necessary to determine which blocks of Nand Flash are available good blocks before storing data.
At present, when a good block in Nand Flash is determined, data is written into all pages of the whole block one by using a page programming mode for all blocks of the Nand Flash, and the data is verified while being written, so as to pick out a block with a verification error.
Disclosure of Invention
The application provides a method and related equipment for detecting data blocks in a memory, which are used for determining available data blocks in the memory and avoiding data writing errors caused by writing data into the memory by mistake and writing wrong data blocks into the memory.
A first aspect of the present application provides a method for detecting a data block in a memory, including:
determining a first set of source data blocks in memory;
writing random data into each data block in the erased first source data block set to obtain a second source data block set;
writing data of each data block in the second source data block set into a first data block set to obtain a second data block set, where the first data block set is a set of data blocks in the memory except for the first source data block set;
performing data verification on each data block in the second data block set to determine a third data block set with correct data verification in the second data block set;
determining a third source data block set in the third source data block set, where the number of data blocks in the third source data block set is the same as the number of data blocks in the first source data block set;
writing random data in each data block in the erased third source data block set to obtain a fourth source data block set;
writing data of each data block in the fourth source data block set into the first source data block set to obtain a fifth source data block set;
and performing data check on each data block in the fifth source data block set to determine a fourth data block set with correct data check in the fifth source data block set.
Optionally, the determining the first source data block set in the memory includes:
acquiring the effective page number M of the data block in the memory and the page number N of the memory in an SLC mode;
and extracting from the data blocks corresponding to the memory according to the effective page number M and the page number N to obtain the first source data block set.
Optionally, the extracting, according to the effective number of pages M and the number of pages N, from the data blocks corresponding to the memory to obtain the first source data block set includes:
determining the number of data blocks in the first source data block set according to the ratio of the effective page number M to the page number N;
and extracting the data blocks corresponding to the memory based on the number of the data blocks to obtain the first source data block set.
Optionally, the extracting, from the data blocks corresponding to the storage based on the number of the data blocks, to obtain the first source data block set includes:
extracting data blocks corresponding to the memory based on the number of the data blocks to obtain an initial data block set;
determining an error data block from the initial data block set in a data reading and writing mode;
determining a set of data blocks in the initial set of data blocks, except the erroneous data block, as the first set of source data blocks.
Optionally, the method further comprises:
marking data blocks in the memory other than the third set of data blocks and the fourth set of data blocks as bad blocks;
receiving a target operation instruction for the memory;
and responding to the target operation instruction, and writing target data into a data block in the third data block set and/or a data block in the fourth data block set, wherein the target data is data to be written into the memory corresponding to the target operation instruction.
A second aspect of the present application provides an apparatus for detecting a data block in a memory, including:
a determining unit, configured to determine a first source data block set in the storage;
a writing unit, configured to write random data into each data block in the erased first source data block set to obtain a second source data block set;
the writing unit is further configured to write data of each data block in the second source data block set into a first data block set to obtain a second data block set, where the first data block set is a set of data blocks in the memory except for the first source data block set;
the checking unit is used for performing data checking on each data block in the second data block set to determine a third data block set with correct data checking in the second data block set;
the determining unit is further configured to determine a third source data block set in the third source data block set, where a number of data blocks in the third source data block set is the same as a number of data blocks in the first source data block set;
the writing unit is further configured to write random data into each data block in the erased third source data block set to obtain a fourth source data block set;
the writing unit is configured to write data of each data block in the fourth source data block set into the first source data block set, so as to obtain a fifth source data block set;
the checking unit is configured to perform data check on each data block in the fifth source data block set, so as to determine a fourth data block set in the fifth source data block set, where the data check is correct.
Optionally, the determining unit includes:
an obtaining module, configured to obtain an effective number M of pages of the data block in the memory and a number N of pages of the memory in the SLC mode;
and the extraction module is used for extracting the data blocks corresponding to the memory according to the effective page number M and the page number N to obtain the first source data block set.
Optionally, the extraction module is specifically configured to:
determining the number of data blocks in the first source data block set according to the ratio of the effective page number M to the page number N;
and extracting the data blocks corresponding to the memory based on the number of the data blocks to obtain the first source data block set.
Optionally, the extracting module extracts, based on the number of data blocks, data blocks corresponding to the storage to obtain the first source data block set, where the extracting module includes:
extracting data blocks corresponding to the memory based on the number of the data blocks to obtain an initial data block set;
determining an error data block from the initial data block set in a data reading and writing mode;
determining a set of data blocks in the initial set of data blocks, except the erroneous data block, as the first set of source data blocks.
Optionally, the apparatus further comprises:
a processing unit to:
marking data blocks in the memory other than the third set of data blocks and the fourth set of data blocks as bad blocks;
receiving a target operation instruction for the memory;
and responding to the target operation instruction, and writing target data into a data block in the third data block set and/or a data block in the fourth data block set, wherein the target data is data to be written into the memory corresponding to the target operation instruction.
A third aspect of the present application provides a computer apparatus comprising at least one processor and a memory connected to each other, wherein the memory is used for storing program codes, and the program codes are loaded and executed by the processor to implement the steps of the method for detecting data blocks in the memory.
A fourth aspect of the present application provides a computer-readable storage medium, which includes instructions that, when executed on a computer, cause the computer to perform the steps of the method for detecting a data block in a memory described above.
In summary, it can be seen that, in the embodiment provided by the present application, a small number of data blocks in a memory are selected as source data blocks, random data are written into the source data blocks page by page, data in the source data blocks in which the random data are written into other data blocks in the memory except the source data blocks one by one, and then the data are read out for verification, so as to obtain a data block in the memory with correct data verification, so that when data are written into the memory, the data can be written into the data block with correct data verification, thereby avoiding bad blocks in the memory, and solving the problem of data writing errors.
Drawings
FIG. 1 is a flowchart illustrating a method for detecting a data block in a memory according to an embodiment of the present disclosure;
FIG. 2 is a schematic view of a virtual structure of an apparatus for detecting a data block in a memory according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a hardware structure of a server according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
The terms "first," "second," and the like in the description and claims of this application and in the foregoing drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprise," "include," and "have," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules expressly listed, but may include other steps or modules not expressly listed or inherent to such process, method, article, or apparatus, wherein the division of modules presented herein is merely a logical division and may be implemented in a practical application in a different manner, such that a plurality of modules may be combined or integrated into another system or some feature vectors may be omitted or not implemented, and wherein shown or discussed as coupled or directly coupled or communicatively coupled to each other may be through some interfaces and indirectly coupled or communicatively coupled to each other module may be electrically or otherwise similarly situated, all without limitation. The modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in a plurality of circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present disclosure.
The method for detecting a data block in a memory provided in the present application is described below from the perspective of a device for detecting a data block in a memory, and the device for detecting a data block in a memory may be a server or a service unit in a server, and is not particularly limited.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a method for detecting a data block in a memory according to an embodiment of the present disclosure, including:
101. a first set of source data blocks in memory is determined.
In this embodiment, the detection apparatus for the data block in the memory may determine the first source data block set in the memory, where the memory is NandFlash.
In one embodiment, the detecting means for the in-memory data blocks determining the first set of source data blocks in the memory comprises:
acquiring the effective page number M of the data block in the memory and the page number N of the memory in an SLC mode;
and extracting the data blocks corresponding to the memory according to the effective page number M and the page number N to obtain a first source data block set.
In this embodiment, the detection apparatus for the data block in the memory may obtain an effective number M of pages of the data block in the memory and a number N of pages of the memory in an SLC mode, and may specifically obtain the effective number M of pages of the data block in the memory and the number N of pages of the memory in the SLC mode according to detection software, where the detection software sends an ID command for reading Nand Flash, reads the ID of the Nand Flash, and then finds out M and N by using the ID of the Nand Flash, and certainly may also detect M and N by using a series of Nand Flash operation commands, which is not limited specifically, as long as the effective number M of pages of the data block in the memory and the number N of pages of the memory in the SLC mode are obtained, and in addition, because the writing speed of a page in the SLC mode is faster, in order to increase the writing speed, a page in the SLC mode is written first, and then a copyback is performed, and certainly, the mode may also be a mode without limitation specifically. After the effective number of pages M and the number of pages N are obtained, extraction may be performed from the data blocks corresponding to the memory according to M and N, so as to obtain a first source data block set. Specifically, the number of data blocks in the first source data block set may be determined by the ratio of the effective number of pages M to the number of pages N, and then extracted from the data blocks corresponding to the memory according to the number of data blocks to obtain the first source data block set, for example, the ratio of M to N is 5, then 5 data blocks may be extracted from the data blocks corresponding to the memory as the first source data block set, and the extraction may be random extraction, or may be performed according to a certain rule, and is not particularly limited as long as 5 data blocks can be extracted.
It should be noted that, when M cannot be divided by N, the ratio of M/N is an integer, for example, M/N =3.6, the number of data blocks is 3, and when M/N is smaller than 1, the number of data blocks is M/N +1, and the number of data blocks is 1.
When the data blocks corresponding to the memory are extracted according to the number of the data blocks, an erroneous data block may be determined from the initial data block set by reading and writing data from and into the extracted initial data block set, and then a data block set other than the erroneous data block in the initial data block set may be determined as the first data block set. That is to say, after the data block corresponding to the memory is extracted, a full block scan may be performed on the extracted data block once, data is simply written and read for comparison, an erroneous data block in the extracted data block is found out, and an error-free data block is used as a source data block, so that it is ensured that, when a copy back is performed subsequently according to the source data block, an error-free data block in the data blocks in the memory other than the first source data block set can be found more accurately.
It should be noted that, the above-mentioned determination of the number of data blocks in the first source data block set is only an example, and of course, other manners may also be adopted, for example, the number may be directly selected according to an instruction of a user, or the number may be selected according to an actual situation, which is not limited specifically.
102. And writing each data block in the erased first source data block set with random data to obtain a second source data block set.
In this embodiment, after obtaining the first source data block set, the detection apparatus for the data blocks in the memory may perform an erasing operation on each data block in the first source data block set, and then write random data into each data block in the erased first source data block set, so as to obtain the second source data block set. It is to be understood that, here, each data block in the first source data block set may be written with random data, and certainly, other data may also be written with other data, which is not limited specifically, as long as the data written into each data block in the first source data block set is prevented from being all 0 xffs (that is, natural number 255), because the Nand flash needs to erase the block where the writing position is located before writing, and the initial data of the entire block after erasing is all 0 xffs. In practical application, writing each data block in the first source data block set into a random number can better fit the situation that a user writes data in practical use. It is to be understood that, when writing random data to each data block in the first source data block set, the random data is written in a page-by-page manner in the source data block.
103. And writing the data of each data block in the second source data block set into the first data block set to obtain a second data block set.
In this embodiment, the detection apparatus for data blocks in the memory may write data of each data block in the second source data set full of random data into the first data block set to obtain the second data block set, where the first data block set is a set of data blocks in the memory except for the first source data block set. That is to say, the apparatus for detecting a data block in a memory may traverse other first data block sets that are not extracted as source data blocks in the data blocks corresponding to the memory, and write the random data written in step 102 into each data block in the first data block sets again in a copyback manner, so as to obtain a second data block set.
It can be understood that, the data in the source data block is written into each data block in the first data block set in a copy back manner, but may also be written in other manners, for example, a direct page programming operation manner of NandFlash may be used for writing, that is, the data in the source data block (that is, the data in each data block in the second source data block) is directly read out by a NandFlash read command, and then the read data in the source data block is written into each data block in the first data block set by a write command. However, the NandFlash supporting copyback operation reads data from a data block in a copyback mode and then writes the data into another data block, so that the writing speed can be increased, because garbage recovery is involved when data is written in a user using process, in an actual using process, when a page of data is possibly written in, other data need to be moved to recover a complete data block, and the moving speed can be increased by using the copyback mode during moving, so that the user experience of a product is enhanced. However, when a bad block is detected, a copyback mode is not used, and when a copyback mode is used in an actual use process, detection is different from an actual use mode, and a detection result is inaccurate, so that the same writing mode is only used when data is written to a data block and the bad block is detected in the actual use process.
104. And performing data verification on each data block in the second data block set to determine a third data block set with correct data verification in the second data block set.
In this embodiment, the apparatus for detecting a data block in the memory may perform data verification on each data block in the second data block set, so as to determine a third data block set with correct data verification in the second data block set. For example, the data block a is any data block in the second data block set, where the data written in the data block a is the data of the data block A1 in the second source data block set, during data verification, the data is read from the data block a, the read data is compared with the data of the data block A1, if the data match or the difference does not reach a preset value, it is determined that the verification passes, the data block a is determined to be the data block with correct data verification, and if the data do not match, it is determined that the verification fails, and the data block a is determined to be the data block with data verification error. By analogy, whether each data block in the second data block set is correct or not can be checked, and a third data block set with correct data check is obtained. It can be understood that, for simple operation, the data blocks in the memory may also be numbered, and when checking the data, the correct data block number is recorded directly.
105. A third set of source data blocks in a third set of data blocks is determined.
In this embodiment, after determining a third data block set with correct data verification in the second data block set, the detection apparatus for data blocks in the memory may extract a third source data block set from the third data block set, where the number of data blocks in the third source data block set is the same as the number of data blocks in the first source data block set. It is to be understood that, the manner of extracting the first source data block set from the memory in step 101 has been described in detail above, and the manner of extracting the third source data block set from the third data block set is similar to this, and details are not described herein again.
106. And writing each data block in the erased third source data block set with random data to obtain a fourth source data block set.
In this embodiment, after obtaining the third source data block set, the detection apparatus for the data blocks in the memory may perform an erasing operation on each data block in the third source data block set, and then write all the data blocks in the erased third source data block set with the random data to obtain a fourth source data block set, that is, write all the random data in each source data block in the fourth source data block set. It is to be understood that, here, each data block in the third source data block set may be written with random data, and certainly, other data may also be written with other data, which is not limited specifically, as long as the data written into each data block in the third source data block set is prevented from being all 0 xffs (i.e. natural number 255), because the Nand flash needs to erase the block where the writing position is located before writing, and the initial data of the entire block after erasing is all 0 xffs. In practical application, writing each data block in the third source data block set into a random number can better fit the situation that a user writes data in practical use.
107. And writing the data of each data block in the fourth source data block set into the first source data block set to obtain a fifth source data block set.
In this embodiment, the apparatus for detecting data blocks in the memory may write data of each data block in the fourth source data block set in which random data is written into the first source data block set, so as to obtain a fifth source data block set. That is to say, the detection apparatus for the data block in the memory may traverse each source data block in the first source data block set, and write the data block in which the random data is written in step 106 into each data block in the first source data block set again in a copyback manner, so as to obtain a fifth source data block set.
108. And performing data check on each data block in the fifth source data block set to determine a fourth data block set with correct data check in the fifth source data block set.
In this embodiment, the detection apparatus for the data block in the memory may perform data check on each data block in the fifth source data block set, so as to determine a fourth data block set with correct data check in the fifth source data block set. For example, the B data block is any one data block in the fifth source data block set, where the data written in the B data block is data of a B1 data block in the fourth source data block set, when data verification is performed, data is read from the B data block, the read data is compared with the data of the B1 data block, if data match or data difference does not reach a preset value, it is determined that the verification passes, the B data block is determined to be a data block with correct data verification, and if data do not match or data difference reaches the preset value, it is determined that the verification fails, and the B data block is determined to be a data block with data verification error. By analogy, whether each data block in the fifth source data block set is correct or not can be checked, and a fourth data block set with correct data check is obtained. It can be understood that, for simple operation, the data blocks in the memory may also be numbered, and when checking the data, the correct data block number is recorded directly.
In one embodiment, the detecting device of the data blocks in the memory may mark the data blocks in the memory except for the third set of data blocks and the fourth set of data blocks as bad blocks after obtaining the fourth set of data blocks;
receiving a target operation instruction aiming at the memory, wherein the target operation instruction is an instruction for writing target data into the memory;
and responding to the target operation instruction, and writing target data into the data blocks in the third data block set and/or the data blocks in the fourth data block set.
In this embodiment, after determining the correct data block in the memory, the apparatus for detecting a data block in the memory may mark the data block in the memory except the correct data block as a bad block, and in an actual use process, the data may be written into the correct data block. That is, a target operation instruction for the memory may be received, the target operation instruction being an instruction to write target data to the memory, and then the target data may be written to a data block in the third set of data blocks and/or a data block in the fourth set of data blocks.
In summary, it can be seen that, in the embodiment provided by the present application, a small number of data blocks in a memory are selected as source data blocks, random data are written into the source data blocks page by page, data in the source data blocks in which the random data are written into other data blocks in the memory except the source data blocks one by one, and then the data are read out for verification, so as to obtain a data block in the memory with correct data verification, so that when data are written into the memory, the data can be written into the data block with correct data verification, thereby avoiding bad blocks in the memory, and solving the problem of data writing errors.
The present application is described above from the perspective of a method for detecting a block of data in a memory, and the present application is described below from the perspective of an apparatus for detecting a block of data in a memory.
Referring to fig. 2, fig. 2 is a schematic view of a virtual structure of an apparatus for detecting a data block in a memory according to an embodiment of the present disclosure, including:
a determining unit 201, configured to determine a first source data block set in a memory;
a writing unit 202, configured to write each erased data block in the first source data block set with random data to obtain a second source data block set;
the writing unit 202 is further configured to write data of each data block in the second source data block set into a first data block set to obtain a second data block set, where the first data block set is a set of data blocks in the memory except for the first source data block set;
a checking unit 203, configured to perform data check on each data block in the second data block set, so as to determine a third data block set in the second data block set, where the data check is correct;
the determining unit 201 is further configured to determine a third source data block set in the third source data block set, where the number of data blocks in the third source data block set is the same as the number of data blocks in the first source data block set;
the writing unit 202 is further configured to write each data block in the erased third source data block set with random data to obtain a fourth source data block set;
the writing unit 202 is configured to write data of each data block in the fourth source data block set into the first source data block set, so as to obtain a fifth source data block set;
the checking unit 203 is configured to perform data check on each data block in the fifth source data block set, so as to determine a fourth data block set with correct data check in the fifth source data block set.
Optionally, the determining unit 201 includes:
an obtaining module 2011, configured to obtain an effective number M of pages of a data block in the memory and a number N of pages of the memory in the SLC mode;
an extracting module 2012, configured to extract from the data blocks corresponding to the memory according to the effective number of pages M and the number of pages N to obtain the first source data block set.
Optionally, the extracting module 2012 is specifically configured to:
determining the number of data blocks in the first source data block set according to the ratio of the effective page number M to the page number N;
and extracting the data blocks corresponding to the memory based on the number of the data blocks to obtain the first source data block set.
Optionally, the extracting module 2012 extracts, based on the number of data blocks, data blocks corresponding to the storage to obtain the first source data block set, including:
extracting the data blocks corresponding to the memory based on the number of the data blocks to obtain an initial data block set;
determining an error data block from the initial data block set in a data reading and writing mode;
determining a set of data blocks in the initial set of data blocks, except the erroneous data block, as the first set of source data blocks.
Optionally, the apparatus further comprises:
a processing unit 204, the processing unit 204 to:
marking data blocks in the memory other than the third set of data blocks and the fourth set of data blocks as bad blocks;
receiving a target operation instruction for the memory;
and responding to the target operation instruction, and writing target data into a data block in the third data block set and/or a data block in the fourth data block set, wherein the target data is data to be written into the memory corresponding to the target operation instruction.
In summary, it can be seen that, in the embodiment provided by the present application, a small number of data blocks in a memory are selected as a source data block, random data is written into the source data block page by page, data in the source data block into which the random data is written into other data blocks in the memory except the source data block one by one, and then the data is read out and verified to obtain a data block with correct data verification in the memory, so that when data is written into the memory, the data can be written into the data block with correct data verification, a bad block in the memory is avoided, and the problem of data writing errors is solved.
Fig. 3 is a schematic diagram of a server 300 according to an embodiment of the present application, where the server 300 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) for storing applications 342 or data 344. Memory 332 and storage media 330 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 330 may include one or more modules (not shown), each of which may include a series of instructions operating on a server. Still further, the central processor 322 may be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.
The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, and the like.
The steps performed by the means for detecting data blocks in memory in the above-described embodiments may be based on the server structure shown in fig. 3.
The embodiment of the present application further provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the method for detecting the data block in the memory is implemented.
The embodiment of the present application further provides a processor, where the processor is configured to execute a program, where the program executes the steps of the method for detecting the data block in the memory when running.
The embodiment of the present application further provides a terminal device, where the device includes a processor, a memory, and a program stored in the memory and capable of running on the processor, and the program code is loaded and executed by the processor to implement the steps of the method for detecting the data block in the memory.
The present application also provides a computer program product adapted to perform the steps of the method for detecting data blocks in a memory as described above when executed on a data processing device.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the apparatus and the module described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art to which the present application pertains. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for detecting a data block in a memory, comprising:
determining a first set of source data blocks in memory;
writing each data block in the erased first source data block set with random data to obtain a second source data block set;
writing data of each data block in the second source data block set into a first data block set to obtain a second data block set, where the first data block set is a set of data blocks in the memory except for the first source data block set;
performing data verification on each data block in the second data block set to determine a third data block set with correct data verification in the second data block set;
determining a third source data block set in the third source data block set, where the number of data blocks in the third source data block set is the same as the number of data blocks in the first source data block set;
writing each data block in the erased third source data block set with random data to obtain a fourth source data block set;
writing data of each data block in the fourth source data block set into the first source data block set to obtain a fifth source data block set;
and performing data check on each data block in the fifth source data block set to determine a fourth data block set with correct data check in the fifth source data block set.
2. The method of claim 1, wherein the determining the first set of source data blocks in the memory comprises:
acquiring the effective page number M of the data block in the memory and the page number N of the memory in an SLC mode;
and extracting from the data blocks corresponding to the memory according to the effective page number M and the page number N to obtain the first source data block set.
3. The method of claim 2, wherein the extracting from the data blocks corresponding to the memory according to the effective number of pages M and the number of pages N to obtain the first source data block set comprises:
determining the number of data blocks in the first source data block set according to the ratio of the effective page number M to the page number N;
and extracting the data blocks corresponding to the memory based on the number of the data blocks to obtain the first source data block set.
4. The method of claim 3, wherein the extracting, from the data blocks corresponding to the storage based on the number of data blocks, the first source data block set comprises:
extracting data blocks corresponding to the memory based on the number of the data blocks to obtain an initial data block set;
determining error data blocks from the initial data block set in a data reading and writing mode;
determining a set of data blocks in the initial set of data blocks except the erroneous data block as the first source data block set.
5. The method according to any one of claims 1 to 4, further comprising:
marking data blocks in the memory other than the third set of data blocks and the fourth set of data blocks as bad blocks;
receiving a target operation instruction for the memory;
and responding to the target operation instruction, and writing target data into a data block in the third data block set and/or a data block in the fourth data block set, wherein the target data is data to be written into the memory corresponding to the target operation instruction.
6. An apparatus for detecting a block of data in a memory, comprising:
a determining unit, configured to determine a first source data block set in a memory;
a writing unit, configured to write random data into each data block in the erased first source data block set to obtain a second source data block set;
the writing unit is further configured to write data of each data block in the second source data block set into a first data block set to obtain a second data block set, where the first data block set is a set of data blocks in the memory except for the first source data block set;
the checking unit is used for performing data checking on each data block in the second data block set to determine a third data block set with correct data checking in the second data block set;
the determining unit is further configured to determine a third source data block set in the third source data block set, where a number of data blocks in the third source data block set is the same as a number of data blocks in the first source data block set;
the writing unit is further configured to write each data block in the erased third source data block set with random data to obtain a fourth source data block set;
the writing unit is configured to write data of each data block in the fourth source data block set into the first source data block set, so as to obtain a fifth source data block set;
the checking unit is configured to perform data check on each data block in the fifth source data block set, so as to determine a fourth data block set in the fifth source data block set, where the data check is correct.
7. The apparatus of claim 6, wherein the determining unit comprises:
an obtaining module, configured to obtain an effective number M of pages of a data block in the memory and a number N of pages of the memory in an SLC mode;
and the extraction module is used for extracting the data blocks corresponding to the memory according to the effective page number M and the page number N to obtain the first source data block set.
8. The apparatus of claim 7, wherein the extraction module is specifically configured to:
determining the number of data blocks in the first source data block set according to the ratio of the effective page number M to the page number N;
and extracting the data blocks corresponding to the memory based on the number of the data blocks to obtain the first source data block set.
9. The apparatus of claim 8, wherein the extracting module extracts, based on the number of data blocks, data blocks corresponding to the memory, and the obtaining the first source data block set comprises:
extracting the data blocks corresponding to the memory based on the number of the data blocks to obtain an initial data block set;
determining error data blocks from the initial data block set in a data reading and writing mode;
determining a set of data blocks in the initial set of data blocks, except the erroneous data block, as the first set of source data blocks.
10. A computer-readable storage medium, comprising instructions which, when executed on a computer, cause the computer to carry out the steps of the method for detecting a data block in a memory according to any one of claims 1 to 5.
CN202011002456.3A 2020-09-22 2020-09-22 Method for detecting data block in memory and related equipment Active CN112083891B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011002456.3A CN112083891B (en) 2020-09-22 2020-09-22 Method for detecting data block in memory and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011002456.3A CN112083891B (en) 2020-09-22 2020-09-22 Method for detecting data block in memory and related equipment

Publications (2)

Publication Number Publication Date
CN112083891A CN112083891A (en) 2020-12-15
CN112083891B true CN112083891B (en) 2022-12-06

Family

ID=73739533

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011002456.3A Active CN112083891B (en) 2020-09-22 2020-09-22 Method for detecting data block in memory and related equipment

Country Status (1)

Country Link
CN (1) CN112083891B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112802530B (en) * 2021-01-12 2023-11-21 成都佰维存储科技有限公司 NAND test method and device, readable storage medium and electronic equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7012835B2 (en) * 2003-10-03 2006-03-14 Sandisk Corporation Flash memory data correction and scrub techniques
US8612777B2 (en) * 2009-01-09 2013-12-17 Infineon Technologies Ag Apparatus and method for writing data to be stored to a predetermined memory area
US20100250875A1 (en) * 2009-03-25 2010-09-30 Silicon Laboratories Inc. Eeprom emulation using flash memory
CN101923900B (en) * 2009-06-09 2014-06-11 北京兆易创新科技股份有限公司 Erasing method and device for non-volatile memory
WO2012022024A1 (en) * 2010-08-17 2012-02-23 成都市华为赛门铁克科技有限公司 Method and apparatus for moving data in memory device and memory device
CN104091617B (en) * 2014-06-17 2017-05-03 深圳市江波龙电子有限公司 Flash memory equipment detection method and apparatus thereof
CN109087676B (en) * 2017-06-14 2020-10-20 北京兆易创新科技股份有限公司 Programming method and device of nonvolatile memory
CN110459259A (en) * 2019-07-31 2019-11-15 至誉科技(武汉)有限公司 Store test method, system and the storage medium of equipment write error error correcting capability
CN111221747B (en) * 2020-01-10 2022-02-18 深圳市德明利光电有限公司 Random seed storage method and device, storage medium and computer equipment

Also Published As

Publication number Publication date
CN112083891A (en) 2020-12-15

Similar Documents

Publication Publication Date Title
CN107743617B (en) Zone mapping in memory
CN100458693C (en) BIOS read-write memory SPD based computer system information conservation and read method
WO2019174205A1 (en) Trash recovery method and device and storage equipment
US9727411B2 (en) Method and processor for writing and error tracking in a log subsystem of a file system
CN103823642A (en) Method and system used for Flash balance storage
US10649672B1 (en) Offloading device maintenance to an external processor in low-latency, non-volatile memory
TWI486957B (en) Method, device and operating system for processing, using a nand flash memory burn data
WO2017143843A1 (en) Metadata recovery method and device
CN111933199B (en) Data read-write method and device based on memory and storage medium
CN112083891B (en) Method for detecting data block in memory and related equipment
CN105302679A (en) Detection method and system for intelligent terminal storage stability
CN110727597B (en) Method for checking invalid code completion case based on log
US11947819B2 (en) Method and system for testing conversion relationship between block reading and page reading in flash memory chip
CN111367710A (en) eMMC problem reduction method and device
CN110989919B (en) Log recording mechanism for memory systems
US10754566B2 (en) Data storage device and data storage method
CN113050888A (en) Method, system, device and storage medium for quickly eliminating Flash unstable blocks
CN111309361A (en) Data reading and writing method and device, electronic equipment and storage medium
CN105528932A (en) Method and device for evaluating user recognized character amount
CN111949426A (en) Firmware program error detection method and device and storage equipment
CN111367697A (en) Error processing method and device
CN111179997B (en) Method and device for storing test data of semiconductor memory
CN102541668A (en) Method for analyzing reliability of flash file system
CN109542359B (en) Data reconstruction method, device, equipment and computer readable storage medium
CN106601303B (en) A kind of bad block management method of flash memory, device and a kind of storage device

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
GR01 Patent grant
GR01 Patent grant