Dynamic randomized storage method, system and device based on UBIFS
Through the dynamic randomized storage method based on UBIFS, the dynamic random sequence and Xorshift algorithm are used to generate randomized data, which solves the problem of lack of flexibility and dynamicity in SLC NAND FLASH erase life, and achieves the life of the storage device and improves the adaptability.
Patent Information
- Application Number
- CN202510323133.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-03-18
AI Technical Summary
In the prior art, the rewritten life extension method of SLC NAND FLASH lacks flexibility and dynamicity, and cannot effectively adapt to process differences and the complexity of distributed scenarios.
UBIFS-based dynamic randomized storage method is adopted to generate randomized data by receiving upper computer data and obtaining dynamic randomized sequences, and dynamically adjust the randomization level according to the status of the storage module, balance the number of erases, and use the Xorshift algorithm to generate dynamic randomized sequences for data storage.
It extends the erase life of SLC NAND FLASH, improves the flexibility and adaptability of storage devices, and effectively extends the service life of storage devices.
Smart Images

Figure CN120335713A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and particularly relates to a dynamic randomization storage method, system and device based on UBIFS. Background Art
[0002] SLC NAND FLASH (Single-Level Cell NAND FLASH) is widely used in embedded systems due to its high reliability. The erase / write life of SLC NAND FLASH is limited by the write / erase cycle. The erase / write life of SLC NAND FLASH is usually more than 100,000 times, but there are significant differences in the erase / write life of SLC NAND FLASH with different manufacturing processes. For example, the erase / write life of SLC NAND FLASH with a manufacturing process of 32 nm and above is 120,000 times and above; the erase / write life of SLC NAND FLASH with a manufacturing process of 24 nm and below is 60,000 - 80,000 times. The wear of SLC NAND FLASH is mainly caused by the erase operation, and specific data patterns (such as 0x55, 0xAA) may also increase the interference or error rate between physical erase blocks, thereby indirectly accelerating the consumption of the erase / write life.
[0003] Existing erase / write life extension methods include wear leveling, bad block management, and hardware randomization. Wear leveling means evenly distributing data for writing; bad block management means masking bad blocks, and hardware randomization means randomizing data at the controller level. However, these methods do not fully consider the manufacturing process differences of SLC NAND FLASH, user requirements, and the complexity of distributed scenarios, resulting in the problem that the erase / write life extension method lacks flexibility and dynamics.
[0004] Therefore, there is still an urgent need for a storage method that can improve the flexibility and dynamics of extending the erase / write life of SLC NAND FLASH. Summary of the Invention
[0005] The main object of the present invention is to propose a dynamic randomization storage method, system and device based on UBIFS to solve the problem that the existing defective erase / write life extension method lacks flexibility and dynamics.
[0006] To achieve the above object, the present invention proposes a dynamic randomization storage method based on UBIFS, and the dynamic randomization storage method based on UBIFS includes:
[0007] Receiving the data to be stored sent by the host computer and obtaining a dynamic random sequence;
[0008] Obtaining randomized data according to the dynamic random sequence and the data to be stored;
[0009] Store the randomized data into the storage module of the flash memory.
[0010] In some embodiments, before obtaining the randomized data according to the dynamic random sequence and the data to be stored, it further includes:
[0011] Obtain the flash memory data corresponding to the current state of the storage module;
[0012] Generate a multi-dimensional seed according to the flash memory data;
[0013] Generate a dynamic random sequence according to a preset random algorithm and the multi-dimensional seed.
[0014] In some embodiments, the storage module includes a plurality of physical erase blocks, and the flash memory data includes a logical erase block address, the number of erase and write cycles, a timestamp, a temperature, and voltage noise, wherein the logical erase block address, the number of erase and write cycles, the timestamp, the temperature, and the voltage noise are all associated with the corresponding physical erase block.
[0015] In some embodiments, before obtaining the randomized data according to the dynamic random sequence and the data to be stored, it further includes:
[0016] Obtain the average number of erase and write cycles of the storage module;
[0017] Determine whether the average number of erase and write cycles is greater than a first preset number of erase and write cycles;
[0018] If the average number of erase and write cycles is less than or equal to the first preset number of erase and write cycles, start the first-level randomization;
[0019] If the average number of erase and write cycles is greater than the first preset number of erase and write cycles, start the second-level randomization.
[0020] In some embodiments, when starting the first-level randomization, generating the multi-dimensional seed according to the flash memory data includes:
[0021] The generation formula of the multi-dimensional seed is:
[0022]
[0023] Where S represents the multi-dimensional seed, A represents the logical erase block address, C represents the number of erase and write cycles, T represents the timestamp, Temp represents the temperature, V represents the voltage noise, represents the exclusive OR operator, and mod represents the modulo operator.
[0024] In some embodiments, when starting the second-level randomization, generating the multi-dimensional seed according to the flash memory data includes:
[0025] The generation formula of the multi-dimensional seed is:
[0026]
[0027]
[0028] Among them, S represents the initial seed, A represents the logical erase block address, C represents the number of erase / write cycles, T represents the timestamp, Temp represents the temperature, and V represents the voltage noise. represents the exclusive OR operator, mod represents the modulo operator, and S Page represents the multi-dimensional seed, and page_offset represents the page offset.
[0029] In some embodiments, before determining whether the average number of erase / write cycles is greater than a first preset number of erase / write cycles, the method further includes:
[0030] Determining whether the average number of erase / write cycles is greater than a second preset number of erase / write cycles, where the first preset number of erase / write cycles is greater than the second preset number of erase / write cycles;
[0031] If the average number of erase / write cycles is greater than the second preset number of erase / write cycles, start randomization and perform the step of obtaining randomized data according to the dynamic random sequence and the data to be stored;
[0032] If the average number of erase / write cycles is less than or equal to the second preset number of erase / write cycles, do not start randomization and store the data to be stored into the storage module.
[0033] In some embodiments, before determining whether the average number of erase / write cycles is greater than the second preset number of erase / write cycles, the method further includes:
[0034] Obtaining the erase error rate corresponding to the average number of erase / write cycles of the storage module;
[0035] Determining whether the erase error rate is greater than a preset error rate;
[0036] If the erase error rate is greater than the preset error rate, reduce the second preset number of erase / write cycles;
[0037] If the erase error rate is less than or equal to the preset error rate, keep the second preset number of erase / write cycles unchanged.
[0038] The present invention also provides a dynamic randomization storage system based on UBIFS. The dynamic randomization storage system based on UBIFS includes a flash memory and a host computer, and the flash memory is configured with UBIFS. The dynamic randomization storage system based on UBIFS can execute the dynamic randomization storage method based on UBIFS described in any one of the above.
[0039] The present invention also provides a dynamic randomization storage device based on UBIFS, including:
[0040] At least one processor; and,
[0041] A memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores instructions executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the UBIFS-based dynamic randomization storage method described in any one of the above.
[0043] By setting UBIFS in the flash memory, UBIFS can obtain flash data that records the state of the flash memory in real time, and then dynamically generate a dynamic random sequence through the flash data, thereby randomly generating randomized data, and then storing the randomized data into the storage module; since the flash data is dynamically changing, the generated randomized data has dynamics. At the same time, it can also determine whether to start randomization and what level of randomization to start through the average number of erase cycles, making the start and use of randomization flexible. Through the present invention, the erase life of SLC NAND FLASH can be dynamically and flexibly extended. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic flowchart of the UBIFS-based dynamic randomization storage method in an embodiment of the present invention;
[0045] Figure 2 It is another schematic flowchart of the UBIFS-based dynamic randomization storage method in an embodiment of the present invention;
[0046] Figure 3 It is another schematic flowchart of the UBIFS-based dynamic randomization storage method in an embodiment of the present invention;
[0047] Figure 4 It is another schematic flowchart of the UBIFS-based dynamic randomization storage method in an embodiment of the present invention;
[0048] Figure 5 It is another schematic flowchart of the UBIFS-based dynamic randomization storage method in an embodiment of the present invention;
[0049] Figure 6 It is a schematic structural diagram of the UBIFS-based dynamic randomization storage system according to the embodiment of the present invention;
[0050] Figure 7 It is a schematic structural diagram of the UBIFS-based dynamic randomization storage device according to the embodiment of the present invention.
[0051] The implementation, functional features and advantages of the present invention will be further described with reference to the embodiments and the accompanying drawings. Specific embodiments
[0052] The following will clearly and completely describe the solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0053] It should be noted that all directional indications (such as up, down, left, right, front, back...) in the embodiments of the present invention are only used to explain the relative positional relationship and movement conditions between components in a specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indications will also change accordingly.
[0054] It should also be noted that when an element is referred to as "fixed to" or "disposed on" another element, it can be directly on the other element or there may be an intermediate element at the same time. When an element is referred to as "connected" to another element, it can be directly connected to the other element or there may be an intermediate element at the same time.
[0055] In addition, the descriptions involving "first", "second", etc. in the present invention are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between various embodiments can be combined with each other, but it must be based on the fact that those of ordinary skill in the art can implement them. When the combination of technical solutions appears to be contradictory or unable to be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0056] To achieve the above object, the present invention proposes a dynamic randomization storage method based on UBIFS. The dynamic randomization storage method based on UBIFS includes:
[0057] Step S110: Receive the data to be stored sent by the host computer and obtain a dynamic random sequence;
[0058] Step S120: Obtain randomized data according to the dynamic random sequence and the data to be stored;
[0059] Step S130: Store the randomized data into the storage module of the flash memory.
[0060] In this embodiment, with reference to Figure 1 andFigure 6 , the UBIFS-based dynamic randomization storage method can be applied to a UBIFS-based dynamic randomization storage system. The UBIFS-based dynamic randomization storage system includes a flash memory and a host computer, and the flash memory is configured with UBIFS. Among them, the flash memory can be SLC NAND FLASH (Single-Level Cell NAND FLASH, flash memory with single-level cells). The flash memory can be connected to the host computer to perform data interaction. The data interaction can be that the host computer writes (stores) data into the flash memory; it can also be that the host computer erases the data stored in the flash memory. UBIFS (Unsorted Block Image File System) is a log-based file system. In this embodiment, the execution subject of the method steps is UBIFS in the flash memory.
[0061] It can be understood that UBI (Unsorted Block Image) will also be configured in the flash memory. UBI can provide underlying flash memory management services for UBIFS, such as bad block management, wear leveling, and logical block management. UBIFS is built on top of UBI and uses the logical blocks provided by UBI to store the data and metadata of the file system. That is, UBIFS can manage the storage module based on UBI.
[0062] Due to its non-volatile, high-reliability, and low-power consumption characteristics, flash memory has become the mainstream choice for host computer storage, covering the entire scenario from consumer electronics to industrial control. Therefore, the host computer can send the data to be stored to the flash memory and let the flash memory store these data to be stored. When the host computer sends the data to be stored to the flash memory, UBIFS in the flash memory can receive the data to be stored sent by the host computer. At this time, UBIFS can not directly store the data to be stored into the storage module of the flash memory, but first perform dynamic randomization processing on the data to be stored, and then store it into the storage module.
[0063] When UBIFS receives the data to be stored from the host computer, it will also obtain a dynamic random sequence. Among them, the dynamic random sequence can be obtained according to the data corresponding to the flash memory management service provided by UBI; the dynamic random sequence means that the random sequence is dynamically generated. After UBIFS obtains the data to be stored and the dynamic random sequence, it can perform randomization processing on the data to be stored according to the dynamic random sequence, so as to randomly allocate storage addresses for the data to be stored to prevent the data to be stored from using the storage addresses.
[0064] After UBIFS randomizes the data to be stored according to a dynamic random sequence, randomized data can be obtained. At this time, UBIFS can store the randomized data into the storage module. Since the randomized data is the data to be stored with randomly assigned storage addresses, storing the randomized data into the storage module can randomly store the randomized data in different physical erase blocks in the storage module, preventing some physical erase blocks from being used multiple times while some physical erase blocks are hardly used, effectively balancing the number of erase / write cycles between physical erase blocks, and thus extending the lifespan of the flash memory.
[0065] By setting UBIFS in the flash memory in this embodiment, UBIFS can generate randomized data randomly according to a dynamic random sequence and then store the randomized data into the storage module; it can effectively balance the number of erase / write cycles of the storage module, thus extending the lifespan of the flash memory.
[0066] In some embodiments, the foregoing obtaining of the dynamic random sequence includes:
[0067] Step S140, obtaining the flash memory data corresponding to the current state of the storage module;
[0068] Step S141, generating a multi-dimensional seed according to the flash memory data;
[0069] Step S142, generating a dynamic random sequence according to a preset random algorithm and the multi-dimensional seed.
[0070] In this embodiment, referring to Figure 2 , when UBIFS executes the obtaining of the dynamic random sequence in step S110, it first obtains the flash memory data corresponding to the current state of the storage module. UBI can provide the underlying flash memory management service for UBIFS, and among them, the underlying flash memory management service provided by UBI can be the flash memory data corresponding to the current state of the storage module. UBIFS can obtain the flash memory data corresponding to the current state of the storage module from UBI. Since the state of the storage module changes dynamically and the current state can uniquely correspond to a flash memory data, the flash memory data obtained by UBIFS at different times is different, and the flash memory data changes dynamically.
[0071] After UBIFS obtains the flash memory data, it can generate a multi-dimensional seed according to the flash memory data. Among them, the flash memory data can include various different flash memory parameters, and with various different flash memory parameters, there are various different dimensions. At this time, the seed generated according to the flash memory data will be a seed of various dimensions (i.e., a multi-dimensional seed).
[0072] Among them, the preset random algorithm can be the Xorshift algorithm. The Xorshift algorithm is an efficient pseudo-random number generation algorithm that can shuffle the seed through shifting and exclusive OR operations to generate a random sequence. That is, UBIFS can perform shifting and exclusive OR operations on the multi-dimensional seed according to the Xorshift algorithm to generate a dynamic random sequence. Since the flash memory data is dynamically changing, the generated random sequence is also dynamically changing, that is, a dynamic random sequence.
[0073] In some embodiments, the storage module includes a plurality of physical erase blocks, and the flash memory data includes logical erase block addresses, the number of erase / write cycles, timestamps, temperature, and voltage noise. Among them, the logical erase block addresses, the number of erase / write cycles, timestamps, temperature, and voltage noise are all associated with the corresponding physical erase blocks.
[0074] In this embodiment, due to the inherent characteristics of the flash memory hardware design, the flash memory must be erased in units of entire blocks and cannot erase a single page or byte separately. Therefore, the minimum unit of flash memory erasure is the physical erase block. The storage module may include a plurality of physical erase blocks. Each physical erase block has its corresponding flash memory data. The flash memory data may include logical erase block addresses, the number of erase / write cycles, timestamps, temperature, and voltage noise.
[0075] Therefore, UBIFS can obtain the corresponding flash memory data (logical erase block addresses, the number of erase / write cycles, timestamps, temperature, and voltage noise) according to the current state of each physical erase block, then generate a multi-dimensional seed based on the logical erase block addresses, the number of erase / write cycles, timestamps, temperature, and voltage noise, and finally perform shifting and exclusive OR operations on the multi-dimensional seed according to the Xorshift algorithm to generate a dynamic random sequence.
[0076] In some embodiments, before obtaining the randomized data based on the dynamic random sequence and the data to be stored, it further includes:
[0077] Step S150, obtaining the average number of erase / write cycles of the storage module;
[0078] Step S151, determining whether the average number of erase / write cycles is greater than a first preset number of erase / write cycles;
[0079] Step S152, if the average number of erase / write cycles is less than or equal to the first preset number of erase / write cycles, then start the first-level randomization;
[0080] Step S153, if the average number of erase / write cycles is greater than the first preset number of erase / write cycles, then start the second-level randomization.
[0081] In this embodiment, refer to Figure 3, before UBIFS executes step S120, it will also initiate randomizations at different levels based on the average number of erase / write cycles. Among them, the first-level randomization can be LEB (Logical Erase Block) - level randomization, and the second-level randomization can be Page (logical page) - level randomization. LEB - level randomization means randomly mapping consecutive logical erase blocks to different physical erase blocks; Page - level randomization means that when writing data, randomize the data content of each logical page. Therefore, Page - level randomization is stronger than LEB - level randomization because Page - level randomization can further refine the degree of randomization and can effectively reduce interference between cells and the error rate.
[0082] UBIFS can obtain the average number of erase / write cycles of the storage module through the number of erase / write cycles corresponding to the physical erase blocks in the flash memory data. For example: each physical erase block has its corresponding number of erase / write cycles. Add up the number of erase / write cycles of each physical erase block, and then divide by the number of physical erase blocks to obtain the average number of erase / write cycles of the storage module. Then determine whether the average number of erase / write cycles is greater than the first preset number of erase / write cycles.
[0083] If it is determined that the average number of erase / write cycles is less than or equal to the first preset number of erase / write cycles, UBIFS will use the first - level randomization to process the data to be stored.
[0084] If it is determined that the average number of erase / write cycles is greater than the first preset number of erase / write cycles, UBIFS will use the second - level randomization to process the data to be stored.
[0085] Among them, the first preset number of erase / write cycles can be determined according to the total number of erase / write cycles (lifetime) of the physical erase blocks. For example: the first preset number of erase / write cycles can be 80% of the total number of erase / write cycles. If the total number of erase / write cycles of the physical erase block is 80,000 times, then the first preset number of erase / write cycles is 80,000 times multiplied by 80% which is equal to 64,000 times, that is, the first preset number of erase / write cycles is 64,000 times.
[0086] In this embodiment, different levels of randomization can be initiated through the average number of erase / write cycles. When the flash memory life is about to expire, the randomness can be further enhanced to extend the life of the flash memory.
[0087] In some embodiments, when initiating the first - level randomization, the generation of the aforementioned multi - dimensional seed based on the flash memory data includes:
[0088] The generation formula of the multi - dimensional seed is:
[0089]
[0090] Among them, S represents the multi - dimensional seed, A represents the logical erase block address, C represents the number of erase / write cycles, T represents the timestamp, Temp represents the temperature, V represents the voltage noise, The exclusive OR operator is represented by, and the modulo operator is represented by mod.
[0091] In this embodiment, when starting the first-level randomization (i.e., LEB-level randomization), the generation formula for the multi-dimensional seed is:
[0092]
[0093] Where S represents the multi-dimensional seed, A represents the logical erase block address, C represents the number of erase / write cycles, T represents the timestamp, Temp represents the temperature, and V represents the voltage noise. The exclusive OR operator is represented by, and the modulo operator is represented by mod. It is understood as: means performing a bitwise exclusive OR on the logical erase block address and the number of erase / write cycles; T mod 256 means taking the modulo 256 of the timestamp (i.e., dividing the timestamp by 256 and then taking the remainder); Temp mod 16 means taking the modulo 16 of the temperature (i.e., dividing the temperature by 16 and then taking the remainder); V mod 8 means taking the modulo 8 of the voltage noise (i.e., dividing the voltage noise by 8 and then taking the remainder); finally, performing a bitwise exclusive OR on these four results in sequence to obtain the multi-dimensional seed. Among them, the modulo operation represents finding the remainder after dividing two numbers.
[0094] For example: First, perform a bitwise exclusive OR on the logical erase block address and the number of erase / write cycles (for example: comparing bit by bit, the same is 0, different is 1) to obtain the first result. Then divide the timestamp by 256 and take the remainder, and perform a bitwise exclusive OR on the first result and this remainder to obtain the second result. Then divide the temperature by 16 and take the remainder, and perform a bitwise exclusive OR on the second result and this remainder to obtain the third result. Finally, divide the voltage noise by 8 and take the remainder, and perform a bitwise exclusive OR on the third result and this remainder to finally obtain the multi-dimensional seed.
[0095] In some embodiments, when starting the second-level randomization, the generation of the multi-dimensional seed according to the flash memory data as described above includes:
[0096] The generation formula for the multi-dimensional seed is:
[0097]
[0098] Where S represents the initial seed, A represents the logical erase block address, C represents the number of erase / write cycles, T represents the timestamp, Temp represents the temperature, and V represents the voltage noise. The exclusive OR operator is represented by, and the modulo operator is represented by mod, S Page represents the multi-dimensional seed, and page_offset represents the page offset.
[0099] In this embodiment, when starting the second-level randomization (i.e., Page-level randomization), the generation formula for the multi-dimensional seed is:
[0100]
[0101] Among them, S represents the initial seed, A represents the logical erase block address, C represents the number of erases, T represents the timestamp, Temp represents the temperature, and V represents the voltage noise. represents the XOR operator, mod represents the modulus operator, S Page Indicates multi-dimensional seed, and page_offset indicates page offset. It is understood as: It refers to the bitwise XOR of the logical erase block address and the number of erases; Tmod 256 refers to the modulo 256 of the timestamp (i.e., divide the timestamp by 256 and take the remainder); Temp mod 16 refers to the modulo 16 of the temperature (i.e., divide the temperature by 16 and take the remainder); V mod 8 refers to the modulo 8 of the voltage noise (i.e., divide the voltage noise by 8 and take the remainder); finally, the four results are bitwise XORed in sequence to obtain the initial seed. Among them, the modulo operation means to find the remainder after dividing two numbers.
[0102] After obtaining the initial seed, the initial seed and the page offset are bitwise XORed to obtain a multi-dimensional seed. The page offset refers to the relative position of a logical page in the logical erase block to which it belongs. The page offset usually exists in the form of a logical page index or byte offset. For example, a logical erase block contains multiple logical pages, and the page offset is used to identify the order of each logical page in this logical erase block.
[0103] For example: first perform bitwise XOR on the logical erase block address and the number of erases (for example: compare bit by bit, the same is 0, and the different is 1) to obtain the first result. Then divide the timestamp by 256 and take the remainder, and perform bitwise XOR on the first result and the remainder to obtain the second result. Then divide the temperature by 16 and take the remainder, and perform bitwise XOR on the second result and the remainder to obtain the third result. Finally, divide the voltage noise by 8 and take the remainder, and perform bitwise XOR on the third result and the remainder to obtain the initial seed. After obtaining the initial seed, perform bitwise XOR on the initial seed and the page offset to obtain a multi-dimensional seed.
[0104] In this embodiment, the initial seed obtained by randomizing the entire LEB level is bitwise XORed with the page offset unique to each logical page, so that each logical page can obtain a multi-dimensional seed different from other logical pages. This ensures that the random sequence used for randomization of each logical page is independent, avoiding the same data being randomized into the same pattern in different logical pages, thereby improving the effect of data randomization. The LEB-level randomization is processed in units of the entire logical erase block, while the Page-level randomization refines the granularity of randomization to each logical page (wherein, a logical erase block includes multiple logical pages). This more refined processing method can better adapt to the physical characteristics of the flash memory, reduce the interference between cells and the error rate, and can further extend the life of the flash memory in high wear scenarios.
[0105] In another embodiment, generating a dynamic random sequence according to a preset random algorithm and a multi-dimensional seed includes:
[0106] Initializing the Xorshift algorithm according to the multi-dimensional seed to generate a dynamic random sequence.
[0107] In this embodiment, if LEB-level randomization is used, then the Xorshift algorithm is initialized with the multi-dimensional seed to generate a dynamic random sequence with a length equal to the LEB data length. If Page-level randomization is used, then the Xorshift algorithm is initialized with the multi-dimensional seed to generate a dynamic random sequence with a length equal to the Page data length.
[0108] In another embodiment, obtaining randomized data according to the dynamic random sequence and the data to be stored includes:
[0109] Performing shift and XOR processing on the dynamic random sequence and the data to be stored to obtain the randomized data.
[0110] In this embodiment, regardless of which randomization is used, the dynamic random sequence and the data to be stored are subjected to shift and XOR processing to obtain the randomized data.
[0111] In some embodiments, before the foregoing determination of whether the average number of erase cycles is greater than the first preset number of erase cycles, it further includes:
[0112] Step S160, determining whether the average number of erase cycles is greater than the second preset number of erase cycles, wherein the first preset number of erase cycles is greater than the second preset number of erase cycles;
[0113] Step S161, if the average number of erase cycles is greater than the second preset number of erase cycles, then start randomization and execute the step of obtaining randomized data according to the dynamic random sequence and the data to be stored;
[0114] Step S162: If the average number of erase / write cycles is less than or equal to the second preset number of erase / write cycles, randomization is not started, and the data to be stored is stored in the storage module.
[0115] In this embodiment, referring to Figure 4 , before UBIFS executes step S151, it also determines whether to start randomization based on the average number of erase / write cycles. Before UBIFS determines whether the average number of erase / write cycles is greater than the first preset number of erase / write cycles, it also first determines whether the average number of erase / write cycles is greater than the second preset number of erase / write cycles, where the first preset number of erase / write cycles is greater than the second preset number of erase / write cycles.
[0116] Among them, both the first preset number of erase / write cycles and the second preset number of erase / write cycles can be determined according to the total number of erase / write cycles (lifetime) of the physical erase block. For example: The first preset number of erase / write cycles can be 80% of the total number of erase / write cycles; the second preset number of erase / write cycles can be 60% of the total number of erase / write cycles. If the total number of erase / write cycles of the physical erase block is 80,000 times, then the first preset number of erase / write cycles is 80,000 times multiplied by 80% which is equal to 64,000 times, that is, the first preset number of erase / write cycles is 64,000 times; then the second preset number of erase / write cycles is 80,000 times multiplied by 60% which is equal to 48,000 times, that is, the second preset number of erase / write cycles is 48,000 times. And the first preset number of erase / write cycles and the second preset number of erase / write cycles can also be freely set by the user.
[0117] If it is determined that the average number of erase / write cycles is greater than the second preset number of erase / write cycles, UBIFS will start randomization, and thus execute the step of obtaining the randomized data according to the dynamic random sequence and the data to be stored. If it is determined that the average number of erase / write cycles is less than or equal to the second preset number of erase / write cycles, UBIFS will not start randomization and directly store the data to be stored in the storage module.
[0118] For example: When the average number of erase / write cycles is greater than 48,000 times, UBIFS will start randomization; when the average number of erase / write cycles is less than or equal to 48,000 times, UBIFS will not start randomization. By setting the second preset number of erase / write cycles to determine whether to start randomization, when the average number of erase / write cycles is small, randomization is not started to meet the user's requirements for high performance; when the average number of erase / write cycles is large, randomization is started to extend the life of the flash memory.
[0119] In some embodiments, before the foregoing determination of whether the average number of erase / write cycles is greater than the second preset number of erase / write cycles, it further includes:
[0120] Step S170: Obtain the erase error rate corresponding to the average number of erase / write cycles of the storage module;
[0121] Step S171: Determine whether the erase error rate is greater than the preset error rate;
[0122] Step S172: If the erase error rate is greater than the preset error rate, reduce the second preset number of erase / write cycles;
[0123] Step S173, if the erase-write error rate is less than or equal to the preset error rate, then keep the second preset number of erase-write times unchanged.
[0124] In this embodiment, referring to Figure 5 , before executing step S160, UBIFS will first judge the erase-write error rate. UBIFS can obtain the erase-write error rate corresponding to the average number of erase-write times of the storage module, that is, the average value of the erase-write error rates corresponding to the number of erase-write times of each physical erase block. For example: UBIFS can first determine how many erase-write operations (number of erase-write times) have been performed on the physical erase block in total, then determine how many erase-write errors have occurred in so many erase-write operations, and finally divide the number of errors by the number of erase-write times to obtain the erase-write error rate. Then find the average value of the erase-write error rates corresponding to all physical erase blocks to obtain the erase-write error rate corresponding to the average number of erase-write times of the storage module.
[0125] After UBIFS obtains the erase-write error rate, it will judge the erase-write error rate to determine whether the erase-write error rate is greater than the preset error rate.
[0126] If it is determined that the erase-write error rate is greater than the preset error rate, UBIFS will reduce the second preset number of erase-write times, so as to start randomization in advance. If it is determined that the erase-write error rate is less than or equal to the preset error rate, UBIFS will keep the second preset number of erase-write times unchanged and does not need to start randomization in advance.
[0127] For example: the preset error rate can be set to 1%. If the erase-write error rate is greater than 1%, the second preset number of erase-write times can be reduced. The second preset number of erase-write times can be 60% of the total number of erase-write times and reduced to 50% of the total number of erase-write times, so as to start randomization in advance. By judging the erase-write error rate, if the error rate exceeds the benchmark, randomization is started in advance to achieve dynamic adjustment.
[0128] In the present invention, by setting UBIFS in the flash memory, UBIFS can obtain the flash memory data that records the state of the flash memory in real time, and then dynamically generate a dynamic random sequence through the flash memory data, so as to randomly generate randomized data, and then store the randomized data into the storage module; since the flash memory data is dynamically changing, the generation of randomized data has dynamics. At the same time, it can also determine whether to start randomization and what level of randomization to start through the average number of erase-write times, making the start and use of randomization flexible. Through the present invention, the erase-write life of SLC NAND FLASH can be dynamically and flexibly extended.
[0129] The present invention further provides a dynamic randomization storage system based on UBIFS. The dynamic randomization storage system based on UBIFS includes a flash memory and a host computer, and the flash memory is configured with UBIFS. The dynamic randomization storage system based on UBIFS can execute the dynamic randomization storage method based on UBIFS described in any one of the above.
[0130] In this embodiment, referring to Figure 6 , the dynamic randomization storage system based on UBIFS includes a flash memory and a host computer. The flash memory is configured with UBIFS. Among them, the flash memory can be SLC NAND FLASH (Single-Level Cell NAND FLASH). The flash memory can be connected to the host computer for data interaction. The data interaction can be that the host computer writes (stores) data into the flash memory; it can also be that the host computer erases the data stored in the flash memory. UBIFS (Unsorted Block Image FileSystem) is a log-based file system.
[0131] Among them, the flash memory is also configured with UBI (Unsorted Block Image). UBI can provide underlying flash memory management services for UBIFS, such as bad block management, wear leveling, and logical block management. UBIFS is built on top of UBI and uses the logical blocks provided by UBI to store the data and metadata of the file system. That is, UBIFS can manage the storage module in the flash memory based on UBI.
[0132] The dynamic randomization storage device based on UBIFS in the embodiment of the present invention can be a controller capable of running the dynamic randomization storage method based on UBIFS; there is at least one controller. As Figure 7 shown, the dynamic randomization storage device based on UBIFS can include: a controller 1001 (such as a CPU), a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 can include a display screen (Display) and an input unit, such as a keyboard (Keyboard). Optionally, the user interface 1003 can also include a standard wired interface and a wireless interface. The network interface 1004 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 can be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Optionally, the memory 1005 can also be a storage device independent of the aforementioned controller 1001.
[0133] Those skilled in the art can understand that Figure 7 The structure of the UBIFS-based dynamic randomization storage device shown in Figure 7 does not constitute a limitation on the UBIFS-based dynamic randomization storage device, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0134] As Figure 7 shown, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a computer program.
[0135] In Figure 7 the UBIFS-based dynamic randomization storage device shown in Figure 7 , the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user side) and communicate data with the client; and the controller 1001 can be used to call the computer program stored in the memory 1005, and when the computer program is called and executed by the controller 1001, the steps of the above-mentioned UBIFS-based dynamic randomization storage method are implemented.
[0136] The above are only partial or preferred embodiments of the present invention. Neither the text nor the drawings can limit the scope of protection of the present invention. Any equivalent structural transformation made using the content of the specification and drawings of the present invention under the overall concept of the present invention, or any direct / indirect application in other related technical fields, is included in the scope of protection of the present invention.
Claims
1. A dynamic randomization storage method based on UBIFS, characterized in that, The UBIFS-based dynamic randomization storage method includes: Receiving the data to be stored sent by the host computer and obtaining a dynamic random sequence; Obtaining randomized data according to the dynamic random sequence and the data to be stored; Storing the randomized data into the storage module of the flash memory.
2. The dynamic randomization storage method based on UBIFS according to claim 1, wherein The obtaining of the dynamic random sequence includes: Obtaining the flash memory data corresponding to the current state of the storage module; Generating a multi-dimensional seed according to the flash memory data; Generating a dynamic random sequence according to a preset random algorithm and the multi-dimensional seed.
3. The dynamic randomization storage method based on UBIFS according to claim 2, wherein, The storage module includes a plurality of physical erase blocks, and the flash memory data includes a logical erase block address, the number of erase / write cycles, a timestamp, temperature, and voltage noise, wherein the logical erase block address, the number of erase / write cycles, the timestamp, the temperature, and the voltage noise are all associated with the corresponding physical erase block.
4. The UBIFS-based dynamic randomization storage method according to any one of claims 1-3, characterized in that Before obtaining the randomized data according to the dynamic random sequence and the data to be stored, it further includes: Obtaining the average number of erase / write cycles of the storage module; Judging whether the average number of erase / write cycles is greater than a first preset number of erase / write cycles; If the average number of erase / write cycles is less than or equal to the first preset number of erase / write cycles, then start the first-level randomization; If the average number of erase / write cycles is greater than the first preset number of erase / write cycles, then start the second-level randomization.
5. The dynamic randomization storage method based on UBIFS according to claim 4, characterized in that, When starting the first-level randomization, the generating of the multi-dimensional seed according to the flash memory data includes: The generating formula of the multi-dimensional seed is: Among them, S represents a multi-dimensional seed, A represents the logical erasure block address, C represents the number of erase / write cycles, T represents the timestamp, Temp represents the temperature, V represents the voltage noise, represents the exclusive OR operator, and mod represents the modulo operator.
6. The method for dynamically randomizing storage based on UBIFS according to claim 4, characterized in that When starting the second-level randomization, the generating of the multi-dimensional seed according to the flash memory data includes: The generating formula of the multi-dimensional seed is: Among them, S represents the initial seed, A represents the logical erase block address, C represents the number of erase / write cycles, T represents the timestamp, Temp represents the temperature, and V represents the voltage noise. represents the exclusive OR operator, mod represents the modulo operator, and S Page represents the multi-dimensional seed, and page_offset represents the page offset.
7. The method for dynamically randomizing storage based on UBIFS according to claim 4, characterized in that, Before judging whether the average number of erase / write cycles is greater than the first preset number of erase / write cycles, it further includes: Judging whether the average number of erase / write cycles is greater than a second preset number of erase / write cycles, wherein the first preset number of erase / write cycles is greater than the second preset number of erase / write cycles; If the average number of erase / write cycles is greater than the second preset number of erase / write cycles, then start randomization and execute the step of obtaining the randomized data according to the dynamic random sequence and the data to be stored; If the average number of erase / write cycles is less than or equal to the second preset number of erase / write cycles, then do not start randomization and store the data to be stored into the storage module.
8. The method for dynamically randomizing storage based on UBIFS according to claim 7, characterized in that, Before judging whether the average number of erase / write cycles is greater than the second preset number of erase / write cycles, it further includes: Obtaining the erase error rate corresponding to the average number of erase / write cycles of the storage module; Judging whether the erase error rate is greater than a preset error rate; If the erase error rate is greater than the preset error rate, then reduce the second preset number of erase / write cycles; If the erase error rate is less than or equal to the preset error rate, then keep the second preset number of erase / write cycles unchanged.
9. A dynamic randomization storage system based on UBIFS, characterized in that, The UBIFS-based dynamic randomization storage system includes a flash memory and a host computer, and the flash memory is configured with UBIFS; the UBIFS-based dynamic randomization storage system can execute the UBIFS-based dynamic randomization storage method according to any one of claims 1 to 8.
10. A dynamic randomization storage device based on UBIFS, characterized in that, It includes: At least one processor; And, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that are executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the UBIFS-based dynamic randomization storage method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for erasure balance of Nand Flash
CN101740110A
Randomization circuit, memory control unit, memory, communicating system and method
CN102543182A
Data Storage Device And Operating Method Thereof
CN105930093A
Random sequence seed generation method and system for NAND Flash randomization
CN115878048A
Flash memory device and memory system including the same
KR1020120117612A