CN119806435B - Data storage method, device, storage medium and electronic device - Google Patents
Data storage method, device, storage medium and electronic device Download PDFInfo
- Publication number
- CN119806435B CN119806435B CN202510297024.6A CN202510297024A CN119806435B CN 119806435 B CN119806435 B CN 119806435B CN 202510297024 A CN202510297024 A CN 202510297024A CN 119806435 B CN119806435 B CN 119806435B
- Authority
- CN
- China
- Prior art keywords
- block
- target
- data
- linked list
- unused
- 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
Links
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
The embodiment of the invention provides a data storage method, a device, a storage medium and an electronic device, wherein the method comprises the steps of determining the first times of data overturn of data in each target page included in a target block under the condition that the access times of the target block included in an access frequency information linked list of the target flash memory are larger than a first preset threshold value, determining a substitute block from an unused block linked list of the target flash memory under the condition that the first times are larger than a second preset threshold value, copying the data in the target block into the substitute block, deleting a node corresponding to the substitute block from the unused block linked list, and establishing a mapping relation between a target access address and the substitute block, wherein the target access address is an address establishing the mapping relation with the target block. The method solves the problem that read interference caused by frequent read access to the read-only partition is difficult to solve, and achieves the technical effect of effectively solving the problem of read interference caused by frequent read access to the read-only partition.
Description
Technical Field
The embodiment of the invention relates to the field of data storage, in particular to a data storage method, a data storage device, a data storage medium and an electronic device.
Background
In the related art, NAND FLASH has a problem of read disturb (read disturb) due to its own structural characteristics, that is, electrons enter the floating gate when reading and writing the flash memory, and abnormal change of charges in the floating gate means data loss.
As can be seen from the above, the related art has a technical problem that it is difficult to solve the read interference caused by the frequent read access to the read-only partition.
In view of the above problems in the related art, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a data storage method, a data storage device, a data storage medium and an electronic device, which are used for at least solving the problem that read interference caused by frequent read access to a read-only partition is difficult to solve in the related art.
According to one embodiment of the invention, a data storage method is provided, and the method comprises the steps of determining the first times of data turnover of data in each target page included in a target block under the condition that the access times of the target block included in an access frequency information linked list of the target flash memory are larger than a first preset threshold value, determining a substitute block from an unused block linked list of the target flash memory under the condition that the times larger than a second preset threshold value exist in the first times, copying the data in the target block into the substitute block, deleting a node corresponding to the substitute block from the unused block linked list, and establishing a mapping relation between a target access address and the substitute block, wherein the target access address is an address establishing the mapping relation with the target block.
In one exemplary embodiment, before determining the replacement block from the unused block chain table of the target flash memory, the method further includes determining an error correction capability of an error correction algorithm of the target flash memory, obtaining a predetermined number of fault tolerances, and determining the second predetermined threshold based on the error correction capability and the number of fault tolerances.
In one exemplary embodiment, determining the second preset threshold based on the error correction capability and the fault tolerance amount includes determining a first product of the fault tolerance amount and the error correction capability, determining a first sum of the first product and a first constant, determining a target difference value of the first sum and a second constant, and determining a first upward-taking integer value of a ratio of the target difference value and the first constant as the second preset threshold.
In one exemplary embodiment, determining a replacement block from the unused block linked list of the target flash memory includes determining a data block included in the unused block linked list that is located at a predetermined location and determining the data block as the replacement block.
In an exemplary embodiment, after copying the data in the target block into the substitute block, the method further comprises determining a second number of times that the target block included in the access frequency information linked list is subjected to data refreshing, erasing the target block if the second number of times is greater than a third preset threshold value, deleting the node of the target block included in the access frequency information linked list from the access frequency information linked list, adding the node corresponding to the target block in the unused block linked list, erasing the target block if the second number of times is less than or equal to the third preset threshold value, copying the data stored in the substitute block into the target block, and adding the node corresponding to the substitute block in the unused block linked list.
In an exemplary embodiment, before determining the first time of data flip of data in each target page included in the target block, the method further comprises determining a data storage block and an unused block included in the target flash memory, creating the access frequency information linked list, wherein the access frequency information linked list comprises a physical block number, access times and data refreshing times of each data storage block, and creating the unused block linked list, wherein the unused block linked list comprises the physical block number of the unused block.
In an exemplary embodiment, before determining the first time of data flip of data in each target page included in the target block, the method further comprises determining a page number of pages to be accessed, determining a target number of pages included in the target block, determining a second downward integer value of a ratio of the page number to the target number, adding 1 to the number of accesses of the target physical block number included in the access frequency information link list if a target physical block number corresponding to the second downward integer value exists in the access frequency information link list, and creating a block with a physical block number being the second downward integer value in the unused block link list if a target physical block number corresponding to the second downward integer value does not exist in the access frequency information link list.
In an exemplary embodiment, before determining the first time of data flip of data in each target page included in the target block, the method further includes determining a usage rate of a processor of a device in which the target flash memory is located, and determining a size relationship between the number of accesses of the target block included in the access frequency information link table of the target flash memory and the first preset threshold value if the usage rate is less than a fourth preset threshold value.
According to another embodiment of the invention, a data storage device is provided, which comprises a first determining module, a second determining module and a deleting module, wherein the first determining module is used for determining the first times of data overturn of data in each target page included in a target block when the access frequency of the target block included in an access frequency information linked list of the target flash memory is larger than a first preset threshold value, the second determining module is used for determining a substitute block from an unused block linked list of the target flash memory when the times larger than a second preset threshold value exist in the first times, the deleting module is used for copying the data in the target block into the substitute block and deleting a node corresponding to the substitute block from the unused block linked list, and the establishing module is used for establishing a mapping relation between a target access address and the substitute block, wherein the target access address is an address for establishing the mapping relation with the target block.
According to a further embodiment of the invention, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
According to a further embodiment of the invention, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to yet another embodiment of the present application, there is also provided a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method described in the various embodiments of the application.
According to the method and the device for determining the access frequency information of the target flash memory, when the access times of the target blocks in the access frequency information linked list of the target flash memory are larger than the first preset threshold, the first times of data turning of the data in each target page included in the target blocks are determined, and when the times larger than the second preset threshold exist in the first times, the substitute blocks can be determined from the unused block linked list of the target flash memory. Copying the data in the target block into the substitute block, deleting the node corresponding to the substitute block from the unused block linked list, and establishing the mapping relation between the target access address and the substitute block. Because the data in the target block can be copied into the substitute block, the data is not lost or the file system is damaged when power failure occurs in the process of data refreshing or migration, the problem that read interference caused by frequent read access to the read-only partition is difficult to solve in the related art can be solved, and the technical effect of effectively solving the problem of read interference caused by frequent read access to the read-only partition is achieved.
Drawings
Fig. 1 is a block diagram of a hardware structure of a mobile terminal according to a data storage method of an embodiment of the present invention;
FIG. 2 is a flow chart of a method of storing data according to an embodiment of the invention;
FIG. 3 is a flow chart of read-only partition flash block read information monitoring and management according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a read-only partition according to an embodiment of the present invention;
FIG. 5 is a block diagram of a free_block_list linked list according to an embodiment of the present invention;
FIG. 6 is a block diagram of a read-only partition flash block access frequency information linked list according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a read-only partition flash block access frequency information node construction according to an embodiment of the present invention;
Fig. 8 is a block diagram of a data storage device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of the mobile terminal according to a data storage method according to an embodiment of the present application. As shown in fig. 1, the mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 103 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 103 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a method of storing data in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 103, thereby performing various functional applications and data processing, that is, implementing the above-described method. Memory 103 may include high-speed random access memory, but may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 103 may further include memory located remotely from processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as a NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In this embodiment, a method for storing data is provided, fig. 2 is a flowchart of a method for storing data according to an embodiment of the present invention, and as shown in fig. 2, the flowchart includes the following steps:
Step S202, determining the first times of data turning of data in each target page included in a target block under the condition that the access times of the target block included in an access frequency information linked list of the target flash memory are greater than a first preset threshold;
step S203, determining a substitute block from an unused block linked list of the target flash memory under the condition that the first times are more than a second preset threshold value;
Step S206, copying the data in the target block into the substitute block, and deleting the node corresponding to the substitute block from the unused block linked list;
and step S208, establishing a mapping relation between a target access address and the replacement block, wherein the target access address is an address establishing the mapping relation with the target block.
In the above embodiment, since the size of the read-only partition is generally set to be larger than the actual size of the program based on the program expansion or the reservation of the bad blocks during the NAND FLASH partition planning, the device will not access the reserved space during the actual use process, and may be referred to as an unused area, and the unused area may be managed by constructing a free_block_list linked list (i.e. the unused block linked list) and may be used when refreshing or migrating in the flash data block.
In the above embodiment, the read-only partition flash block read information monitoring and management may be completed by the read-only partition flash block read information monitoring thread, and fig. 3 is a flow chart of the read-only partition flash block read information monitoring and management according to an embodiment of the present invention, as shown in fig. 3, where the flow includes:
step S302, starting;
step S304, judging whether the current cpu of the flash block read information monitoring thread is busy, executing step S302 if yes, and executing step S306 if no;
Step S306, traversing a block access frequency information linked list;
Step S308, judging whether the number of times of N reading of the current block reaches a threshold value, if yes, executing step S310, and if no, executing step S328;
Step S310, traversing pages contained in the current block N;
step S312, judging whether the current page bit flip is larger than bitfilp threshold, if yes, executing step S316, and if no, executing step S314;
Step S314, traversing the next element of the block access frequency information linked list;
step S316, finding a free block M in a first node of a free block list linked list, copying data of a block N to the block M, establishing a mapping, and deleting the node in the linked list;
Step S318, determining whether the block N reflush _num information is greater than max_ reflush _num, if yes, executing step S320, and if no, executing step S322;
Step S320, erasing the block N, deleting the node of the block N from the block access frequency information linked list, inserting the node of the block N into the tail of the free_block_list linked list, and maintaining the information of the block M into the block access frequency information linked list;
Step S322, erasing the block N, copying the data in the block M back to the block N, reestablishing the mapping, adding 1 to the block N reflush _num, and reinserting the block M into the tail of the free_block_list linked list;
Step S324, judge whether all pages of block N are traversed and finish, if yes, go to step S328, if not, go to step S326;
step S326, traversing the next page included in the current block N;
step S328, determining whether the block access frequency information linked list is traversed, if yes, executing step S302, and if no, executing step S330;
step S330, traversing the next element of the block access frequency information linked list;
In the above embodiment, the frequency information linked list may be understood as a linked list recording the number of read accesses occurring in the block, and whether the number of read accesses occurring in the target block in the linked list reaches the first preset threshold may be determined by traversing the read-only partition flash block to access the frequency information linked list. The direct influence of frequent read access times is that unstable data in the flash can be caused, and the unstable data in the flash can cause bit overturning of the data. Therefore, when the access times of the target block are greater than the first preset threshold, the first times of bit flipping of the data in each target page in the target block can be determined. The number of read accesses is larger, the probability of data errors is larger, the specific number of read accesses is not in fixed relation with the occurrence of data errors, differences exist among flash of different factories, and differences exist among different blocks of the same flash of the same manufacturer, so that the first preset threshold can be set based on the flash, and the invention is not limited to the situation.
In the above embodiment, when the number of times greater than the second preset threshold exists in the first number of times of bit flip in each target page in the target block, it may be indicated that the risk of subsequent data errors of page data corresponding to the number of times is greater, and refreshing or migration of block data is required. And a free block M (namely the above-mentioned alternative block) can be found from the free block list unused block chain table of the target flash memory, and the data in the target block is copied into the free block M, and the node corresponding to the free block M in the free block list unused block chain table is deleted and the mapping relation between the alternative block and the target block is established. The second preset threshold may be understood as a bit flipped threshold bitflip threshold, which may be 10 times, 50 times, 100 times, etc., but is not limited thereto.
According to the method and the device for determining the access frequency information of the target flash memory, when the access times of the target blocks in the access frequency information linked list of the target flash memory are larger than the first preset threshold, the first times of data turning of the data in each target page included in the target blocks are determined, and when the times larger than the second preset threshold exist in the first times, the substitute blocks can be determined from the unused block linked list of the target flash memory. Copying the data in the target block into the substitute block, deleting the node corresponding to the substitute block from the unused block linked list, and establishing the mapping relation between the target access address and the substitute block. Because the data in the target block can be copied into the substitute block, the data is not lost or the file system is damaged when power failure occurs in the process of data refreshing or migration, the problem that read interference caused by frequent read access to the read-only partition is difficult to solve in the related art can be solved, and the technical effect of effectively solving the problem of read interference caused by frequent read access to the read-only partition is achieved.
Alternatively, the execution subject of the above steps may be a background processor, a server, a terminal, or the like, but is not limited thereto.
In one exemplary embodiment, before determining the replacement block from the unused block chain table of the target flash memory, the method further includes determining an error correction capability of an error correction algorithm of the target flash memory, obtaining a predetermined number of fault tolerances, and determining the second predetermined threshold based on the error correction capability and the number of fault tolerances.
In the above embodiment, the error correction capability of the ECC (Error Correction Code ) algorithm used by the device may be determined first, and then a predetermined fault tolerance amount may be determined according to the value determined by experience or test, so as to define the maximum number of bit flip errors that can be tolerated during the reading operation. Among them, the ECC algorithm is a key technology for detecting and correcting bit errors due to storage medium defects or aging. Different NAND FLASH chips may have different ECC correction capabilities, for example, some NAND FLASH chips may have the capability to correct 1 bit errors, while others may have the capability to correct 4 bit errors. The fault tolerance amount can be set according to the actual use condition of the flash memory and the error correction capability of the ECC algorithm to balance the data reliability and the storage efficiency.
In the above embodiment, based on the ECC error correction capability of the target flash memory and the preset fault tolerance amount, a second more accurate preset threshold may be calculated, and may be used to determine whether the bit flip error in the block is beyond an acceptable range, so as to determine whether the data needs to be migrated to an alternative block. By the method, when the replacement block is selected from the unused block linked list of the target flash memory, the selected block can effectively bear data without encountering bit flip errors prematurely, and in addition, the strategy of data migration can be ensured to be carried out based on the current flash memory condition and a preset fault-tolerant strategy, so that the pertinence and the efficiency of data protection are improved.
In one exemplary embodiment, determining the second preset threshold based on the error correction capability and the fault tolerance amount includes determining a first product of the fault tolerance amount and the error correction capability, determining a first sum of the first product and a first constant, determining a target difference value of the first sum and a second constant, and determining a first upward-taking integer value of a ratio of the target difference value and the first constant as the second preset threshold.
In the above embodiment, the second preset threshold bitflip threshold may be calculated by the formula bitflip threshold = div_round_up (eccjstrength 3, 4), where div_round_up may be understood as a variant of the division operation, may ensure that when the division result has a fractional part, it is always rounded UP to the nearest integer, may be referred to as rounding UP or rounding UP, and eccjstrength may be understood as the error correction capability described above. Div_round_up (n, d) may be understood as (((n) + (d) -1)/(d)), n may be understood as a first product of error correction capability and error tolerance amount 3, 1 is the above second constant, d may be understood as a first constant, which may be 4, but is not limited thereto, n+d is the above first sum, and n+d-1 is the above target difference. For example, when the error correction capability ecc_strength is 8, the second preset threshold bitflip threshold = (((8×3) + (4) -1)/(4))=6.
In one exemplary embodiment, determining a replacement block from the unused block linked list of the target flash memory includes determining a data block included in the unused block linked list that is located at a predetermined location and determining the data block as the replacement block.
In the above embodiment, when determining the substitute block, a free block (i.e., the data block) may be found from the first node (i.e., the predetermined location) of the free_block_list unused block list, and the data block is determined as the substitute block. If the first node does not have the free block M, the free block M is determined from the second node in the free_block_ lis unused block t chain table, and so on.
In an exemplary embodiment, after copying the data in the target block into the substitute block, the method further comprises determining a second number of times that the target block included in the access frequency information linked list is subjected to data refreshing, erasing the target block if the second number of times is greater than a third preset threshold value, deleting the node of the target block included in the access frequency information linked list from the access frequency information linked list, adding the node corresponding to the target block in the unused block linked list, erasing the target block if the second number of times is less than or equal to the third preset threshold value, copying the data stored in the substitute block into the target block, and adding the node corresponding to the substitute block in the unused block linked list.
In the above embodiment, with continued reference to fig. 3, the number of times reflush _num occurs in the target block (i.e., the second number of times data refresh occurs) may also be determined from the access frequency information linked list, and when the second number of times is greater than the maximum refresh number max_ reflush _num (i.e., the third preset threshold), it may be indicated that the target block has performed multiple refresh operations but the data is still unstable and has a risk of becoming a bad block, so that the use needs to be reduced. The target block may be deleted from the block access frequency information link list and inserted into a node corresponding to the tail of the free_block_list link list. When the second number of times is smaller than the maximum refresh number of times max_ reflush _num, the data in the target block can be refreshed, namely the target block is erased, the data stored in the substitute block is copied back into the target block, the mapping of the target block is reestablished, meanwhile, the value of reflush _num of the target block can be increased by 1, the fact that the data refreshing operation is completed on the target block at the time can be indicated, and then the substitute block is reintroduced into the node corresponding to the tail of the free_block_list linked list.
In the above embodiments, the operations of copying, mapping, remapping of block data are critical. When the data refreshing or migration is executed, the problem of file system damage caused by data loss when the block data refreshing or the block data migration is abnormally powered down can be avoided through a data copying and mapping mode. For example, when the data is powered down during the refresh operation, the data in the target block is incomplete, but because the data in the target block is already copied to the replacement block and the mapping of the replacement block is already established, when the next time the upper layer software is powered on again to access the target block, the next time the device accesses the replacement block, the data of the replacement block is complete, so that the problems of data loss and the like do not exist. If power failure occurs in the process of data migration of the target block, as the mapping relation of the original target block is not modified, the normal data in the target block is actually accessed when the next time the device is powered on again to access the target block, and the problem does not exist.
In an exemplary embodiment, before determining the first time of data flip of data in each target page included in the target block, the method further comprises determining a data storage block and an unused block included in the target flash memory, creating the access frequency information linked list, wherein the access frequency information linked list comprises a physical block number, access times and data refreshing times of each data storage block, and creating the unused block linked list, wherein the unused block linked list comprises the physical block number of the unused block.
In the above embodiment, the read-only partition may include a data storage block and an unused block, and the structure diagram of the read-only partition may be referred to in fig. 4, where fig. 4 is a schematic structural diagram of the read-only partition according to an embodiment of the present invention, as shown in fig. 4, block 1 to block m are actual data areas of a program (i.e., the above data storage blocks), block m+1 to block k are unused blocks, and a free_block_list chain table structure may be constructed based on the unused blocks of block m+1 to block k, and fig. 5 is a structure diagram of the free_block_list chain table according to an embodiment of the present invention, as shown in fig. 5, where the unused block List includes a physical block number list_head of the unused block. A read-only partition flash block access frequency information linked list can be established, and FIG. 6 is a block diagram of the read-only partition flash block access frequency information linked list according to an embodiment of the present invention, and as shown in FIG. 6, each linked list node may include three data, namely, block_num data for recording a physical block number of a flash block in which a read access occurs, read_num data for recording the number of times that a read access occurs for the block, and number of times reflush _num for recording the number of times that a data refresh occurs for the block.
In an exemplary embodiment, before determining the first time of data flip of data in each target page included in the target block, the method further comprises determining a page number of pages to be accessed, determining a target number of pages included in the target block, determining a second downward integer value of a ratio of the page number to the target number, adding 1 to the number of accesses of the target physical block number included in the access frequency information link list if a target physical block number corresponding to the second downward integer value exists in the access frequency information link list, and creating a block with a physical block number being the second downward integer value in the unused block link list if a target physical block number corresponding to the second downward integer value does not exist in the access frequency information link list.
In the above embodiment, the initialization of the linked list may be performed before the node information is constructed, which may include the initialization of the read-only partition flash block access frequency information linked list and the initialization of the free_block_list linked list, where the maintained data blocks in the free_block_list linked list all need to be erased, and may be used for the subsequent block data copying. The flash block read information monitoring thread can be constructed, and preparation can be made for processing the flash block read information.
In the above embodiment, since NAND FLASH is read-write access is performed in units of pages, a building block access frequency information node may be implemented in a page read interface, and fig. 7 is a schematic building diagram of a read-only partition flash block access frequency information node according to an embodiment of the present invention, as shown in fig. 7, a page number of a page (i.e. the above-mentioned access page) may be converted into a block number of a corresponding flash physical block (a block number of the flash physical block (i.e. the above-mentioned target block number) may be determined by a ratio of the page number to the number of pages (i.e. the above-mentioned target block number) included in each block). Before the block access frequency information node is constructed, a read-only partition flash block access frequency information linked list can be traversed, and whether the target block number is in the linked list node or not is judged. If the target block number does not exist, a block access frequency information node can be created and initialized, the target physical block number is assigned to the block_num, and the block_num needs to be assigned with 1 because of one read access, and reflush _num of the created block access frequency information node can be initialized to 0. After the node is created, a new node can be inserted into the head of the read-only partition flash block access frequency information linked list.
In an exemplary embodiment, before determining the first time of data flip of data in each target page included in the target block, the method further includes determining a usage rate of a processor of a device in which the target flash memory is located, and determining a size relationship between the number of accesses of the target block included in the access frequency information link table of the target flash memory and the first preset threshold value if the usage rate is less than a fourth preset threshold value.
In the above embodiment, since the operation of the flash block read monitoring thread may involve linked list access, page access, block data erasing and copying, which may bring about a certain performance overhead, and the operation needs to be performed when the cpu is idle, the flash block read monitoring thread may first determine whether the processor cpu is busy. When the utilization rate of the cpu is smaller than a fourth preset threshold, the cpu is idle, and then the flash block reading monitoring thread can be started, namely, the relationship between the access times of the target block included in the access frequency information linked list of the target flash memory and the first preset threshold is judged, and when the utilization rate of the cpu is larger than the fourth preset threshold, the cpu is in a busy state, and the flash block reading monitoring thread continues to be in a dormant state. The fourth preset threshold may be 50% or 60% of cpu usage, which is not limited in the present invention.
In the above embodiment, through the data protection policy of NAND FLASH read-only partition, the read interference problem of read-only partition can be effectively solved, and under the condition of ensuring the safety and reliability of the read-only partition data, the occurrence of power failure in the data refreshing or migration process can not cause data loss or file system damage. In addition, the unused space of the flash read-only partition is utilized, so that the utilization rate of the flash space can be improved, normal service of equipment can be ensured not to be influenced, and performance problems can not be caused when a data protection mechanism works.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiment also provides a data storage device, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 8 is a block diagram of a data storage device according to an embodiment of the present invention, as shown in fig. 8, the device includes:
A first determining module 802, configured to determine, when the number of accesses of a target block included in an access frequency information linked list of a target flash memory is greater than a first preset threshold, a first number of data flip occurrences of data in each target page included in the target block;
a second determining module 803, configured to determine, if there is a number of times greater than a second preset threshold in the first number of times, a substitute block from an unused block linked list of the target flash memory;
a deleting module 806, configured to copy the data in the target block to the substitute block, and delete a node corresponding to the substitute block from the unused block linked list;
And a building module 808, configured to build a mapping relationship between a target access address and the replacement block, where the target access address is an address for building a mapping relationship with the target block.
In an exemplary embodiment, the apparatus may be configured to determine an error correction capability of an error correction algorithm of the target flash memory, obtain a predetermined number of fault tolerances, and determine the second predetermined threshold based on the error correction capability and the number of fault tolerances before determining a replacement block from a linked list of unused blocks of the target flash memory.
In an exemplary embodiment, the apparatus may implement determining the second preset threshold based on the error correction capability and the fault tolerance amount by determining a first product of the fault tolerance amount and the error correction capability, determining a first sum of the first product and a first constant, determining a target difference value of the first sum and a second constant, and determining a first upward integer value of a ratio of the target difference value and the first constant as the second preset threshold.
In an exemplary embodiment, the second determining module 803 may determine the replacement block from the unused block linked list of the target flash memory by determining a data block included in the unused block linked list and located at a predetermined position, and determining the data block as the replacement block.
In an exemplary embodiment, the apparatus may be further configured to determine, after copying data in the target block into the substitute block, a second number of times that the target block included in the access frequency information link table has been subjected to data refreshing, erase the target block if the second number of times is greater than a third preset threshold, delete a node of the target block included in the access frequency information link table from the access frequency information link table, and add a node corresponding to the target block in the unused block link table, erase the target block if the second number of times is less than or equal to a third preset threshold, copy data stored in the substitute block into the target block, and add a node corresponding to the substitute block in the unused block link table.
In an exemplary embodiment, the apparatus may be further configured to determine a data storage block and an unused block included in the target flash memory before determining a first number of data flip occurrences for data in each target page included in the target block, create the access frequency information linked list, wherein the access frequency information linked list includes a physical block number, a number of accesses, and a number of data refreshes for each of the data storage blocks, and create the unused block linked list, wherein the unused block linked list includes a physical block number for the unused block.
In an exemplary embodiment, the apparatus may be further configured to determine a page number of a page to be accessed before determining a first number of data flip occurrences for data in each target page included in the target block, determine a target number of pages included in the target block, determine a second downward integer value of a ratio of the page number to the target number, add 1 to a number of accesses of the target physical block number included in the access frequency information link list if a target physical block number corresponding to the second downward integer value exists in the access frequency information link list, and create a block of physical block number that is the second downward integer value in the unused block link list if a target physical block number corresponding to the second downward integer value does not exist in the access frequency information link list.
In an exemplary embodiment, the apparatus may be further configured to determine, before determining a first number of data flip occurrences for data in each target page included in the target block, a usage rate of a processor of a device in which the target flash memory is located, and determine, if the usage rate is less than a fourth preset threshold, a size relationship between a number of accesses of the target block included in an access frequency information link table of the target flash memory and the first preset threshold.
It should be noted that each of the above modules may be implemented by software or hardware, and the latter may be implemented by, but not limited to, the above modules all being located in the same processor, or each of the above modules being located in different processors in any combination.
Embodiments of the present invention also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In an exemplary embodiment, the computer readable storage medium may include, but is not limited to, a U disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, etc. various media in which a computer program may be stored.
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Embodiments of the application also provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of the various embodiments of the application.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention should be included in the protection scope of the present invention.
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202510297024.6A CN119806435B (en) | 2025-03-13 | 2025-03-13 | Data storage method, device, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202510297024.6A CN119806435B (en) | 2025-03-13 | 2025-03-13 | Data storage method, device, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN119806435A CN119806435A (en) | 2025-04-11 |
CN119806435B true CN119806435B (en) | 2025-06-10 |
Family
ID=95278077
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202510297024.6A Active CN119806435B (en) | 2025-03-13 | 2025-03-13 | Data storage method, device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN119806435B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117742600A (en) * | 2023-12-18 | 2024-03-22 | 深圳市硅格半导体有限公司 | Data processing method and device of storage device, terminal device and storage medium |
CN119166072A (en) * | 2024-09-24 | 2024-12-20 | 山东云海国创云计算装备产业创新中心有限公司 | A data processing method, device, equipment and storage medium |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7849253B2 (en) * | 2005-04-04 | 2010-12-07 | Standard Microsystems Corporation | Method for fast access to flash-memory media |
TWI298836B (en) * | 2005-10-12 | 2008-07-11 | Sunplus Technology Co Ltd | Apparatus for controlling flash memory and method thereof |
JP2009129070A (en) * | 2007-11-21 | 2009-06-11 | Hitachi Ltd | Control method of flash memory storage device, flash memory storage device and storage system using the method |
CN111880990B (en) * | 2020-07-20 | 2023-10-27 | 北京三快在线科技有限公司 | Exception handling method and device |
US11748195B2 (en) * | 2022-01-05 | 2023-09-05 | International Business Machines Corporation | Detect multifold disturbance and minimize read-disturb errors in NAND flash |
CN114625579A (en) * | 2022-03-23 | 2022-06-14 | 重庆紫光华山智安科技有限公司 | Disk management method, device, equipment and storage medium |
CN116467225A (en) * | 2023-03-31 | 2023-07-21 | 合肥大唐存储科技有限公司 | Bad block management method of flash memory, storage medium, electronic device and solid state disk |
CN116893981A (en) * | 2023-07-24 | 2023-10-17 | 浙江大华技术股份有限公司 | Memory operation method and device, storage medium and electronic device |
-
2025
- 2025-03-13 CN CN202510297024.6A patent/CN119806435B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117742600A (en) * | 2023-12-18 | 2024-03-22 | 深圳市硅格半导体有限公司 | Data processing method and device of storage device, terminal device and storage medium |
CN119166072A (en) * | 2024-09-24 | 2024-12-20 | 山东云海国创云计算装备产业创新中心有限公司 | A data processing method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN119806435A (en) | 2025-04-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7840662B1 (en) | Dynamically managing a network cluster | |
JP5629391B2 (en) | Semiconductor memory device and method for controlling semiconductor memory device | |
US12050778B2 (en) | Data restoration method and related device | |
CN115878052B (en) | RAID array inspection method, inspection device and electronic equipment | |
CN118098320A (en) | Storage block replacement method and device based on solid state disk | |
CN106775481B (en) | Method for reading data and equipment | |
CN119806435B (en) | Data storage method, device, storage medium and electronic device | |
CN119127251A (en) | Firmware refreshing method, device, electronic device and storage medium | |
CN119088298A (en) | Storage pool management method, device, storage system, computer equipment and medium | |
CN110865901B (en) | Method and device for building EC (embedded control) strip | |
CN111597066A (en) | SSD (solid State disk) repairing method and device, computer equipment and storage medium | |
CN115499426B (en) | Method, device, equipment and medium for transmitting massive small files | |
CN114138566B (en) | Data storage method and device of virtual machine, virtual machine and storage medium | |
CN119149290A (en) | Data processing method, device, equipment and storage medium | |
WO2024113543A1 (en) | Data processing method, system, and apparatus, non-volatile readable storage medium, and electronic device | |
CN115878381A (en) | Data recovery method and device based on SRM disc, storage medium and electronic device | |
CN115454711A (en) | Method, device and medium for recovering erasure correction data in distributed storage system | |
US20070061613A1 (en) | Restart method for operating system | |
CN115599315A (en) | Data processing method, device, system, equipment and medium | |
CN116048878A (en) | Business service recovery method, device and computer equipment | |
JP4239754B2 (en) | Nonvolatile memory system | |
CN107305582B (en) | Method and device for processing metadata | |
CN120066423B (en) | Data reading and writing method, device and equipment for EEPROM | |
CN114374707B (en) | Management method, device, equipment and medium for storage cluster | |
CN113821176B (en) | Data migration processing method, device and storage medium |
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 |