Dynamic randomized storage method, system and device based on UBIFS

Through a dynamic randomized storage method based on UBIFS, using a dynamic random sequence and a multi-dimensional seed generation algorithm, the problem of lack of flexibility and dynamism in the existing SLC NAND FLASH erase and write life extension method is solved, achieving a longer erase and write life and better storage device adaptability.

CN120335713BActive Publication Date: 2025-09-19LIANHE STORAGE (BEIJING) TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510323133.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-18
Publication Date
2025-09-19
Estimated Expiration
2045-03-18

AI Technical Summary

Technical Problem

Existing methods for extending erase and write lifespan lack flexibility and dynamism, and cannot effectively adapt to SLC NAND FLASH process differences and the complexity of distributed scenarios.

Method used

A dynamic randomized storage method based on UBIFS is adopted. By receiving data from the host computer and generating a dynamic random sequence, a multi-dimensional seed is generated according to the flash memory data, and the randomized data is generated using the Xorshift algorithm. The data is randomly stored in the storage module, and the randomization level is dynamically adjusted to balance the number of erase and write times.

Benefits of technology

It effectively extends the erase and write life of SLC NAND FLASH, improves the flexibility and dynamism of storage devices, and adapts to different processes and usage scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335713B_ABST
    Figure CN120335713B_ABST
Patent Text Reader

Abstract

The present invention discloses a UBIFS-based dynamic randomized storage method, system, and device. The method comprises: receiving data to be stored from a host computer and obtaining a dynamic random sequence; obtaining randomized data based on the dynamic random sequence and the data to be stored; and storing the randomized data in a flash memory storage module. The present invention processes the data to be stored using a dynamic random sequence to generate dynamic randomized data. This allows the present invention to extend the erase and write life of SLC NAND FLASH through the dynamic nature of randomization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data storage technology, and in particular to a UBIFS-based dynamic randomized storage method, system, and device. Background Art

[0002] SLC NAND FLASH (Single-Level Cell NAND FLASH) is widely used in embedded systems due to its high reliability. The erase and write life of SLC NAND FLASH is limited by the write / erase cycle. The erase and write life of SLC NAND FLASH is usually more than 100,000 times, but the erase and write life of SLC NAND FLASH with different processes varies significantly. For example: the erase and write life of SLC NAND FLASH with a process of 32nm and above is 120,000 times or more; the erase and write life of SLC NAND FLASH with a process of 24nm 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 and write life.

[0003] Existing methods for extending write and erase lifespan include wear leveling, bad block management, and hardware randomization. Wear leveling distributes data evenly across writes; bad block management masks bad blocks; and hardware randomization randomizes data at the controller level. However, these methods fail to fully account for SLC NAND FLASH process variations, user needs, and the complexity of distributed scenarios, resulting in a lack of flexibility and dynamism in these methods.

[0004] Therefore, there is still an urgent need for a storage method that can improve flexibility and dynamics and extend the erase and write life of SLC NAND FLASH. Summary of the Invention

[0005] The main purpose of the present invention is to propose a dynamic random storage method, system and device based on UBIFS to solve the problem that the existing defect erasure life extension method lacks flexibility and dynamism.

[0006] To achieve the above objectives, the present invention proposes a dynamic random storage method based on UBIFS, which includes:

[0007] Receive the data to be stored sent by the host computer and obtain the dynamic random sequence;

[0008] Obtain randomized data according to a dynamic random sequence and the data to be stored;

[0009] The randomized data is stored in a storage module of a flash memory.

[0010] In some embodiments, before obtaining randomized data according to the dynamic random sequence and the data to be stored, the method further includes:

[0011] Obtaining flash memory data corresponding to the current state of the storage module;

[0012] generating a multidimensional seed according to the flash memory data;

[0013] A dynamic random sequence is generated according to a preset random algorithm and the multidimensional seed.

[0014] In some embodiments, the storage module includes multiple physical erase blocks, and the flash memory data includes a logical erase block address, a number of erase and write cycles, a timestamp, a temperature, and a 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 randomized data according to the dynamic random sequence and the data to be stored, the method further includes:

[0016] Obtaining an average number of erase and write times of the storage module;

[0017] Determining whether the average number of erasures and writes is greater than a first preset number of erasures and writes;

[0018] If the average number of erasures is less than or equal to the first preset number of erasures, the first level randomization is initiated;

[0019] If the average erasure and programming times are greater than the first preset erasure and programming times, the second level randomization is started.

[0020] In some embodiments, when the first level randomization is started, generating a multi-dimensional seed according to the flash memory data includes:

[0021] The generation formula of the multidimensional seed is:

[0022]

[0023] Among them, S represents the multidimensional 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 exclusive OR operator, and mod represents the modulo operator.

[0024] In some embodiments, when the second level randomization is started, generating a multi-dimensional seed according to the flash memory data includes:

[0025] The generation formula of the multidimensional seed is:

[0026]

[0027]

[0028] 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 exclusive OR operator, mod represents the modulo operator, S Page Represents a multidimensional seed, and page_offset represents a page offset.

[0029] In some embodiments, before determining whether the average number of erasure times is greater than a first preset number of erasure times, the method further includes:

[0030] Determining whether the average number of erasures and writes is greater than a second preset number of erasures and writes, wherein the first preset number of erasures and writes is greater than the second preset number of erasures and writes;

[0031] If the average number of erasures and writes is greater than the second preset number of erasures and writes, randomization is initiated, and a step of obtaining randomized data according to a dynamic random sequence and the data to be stored is executed;

[0032] If the average erasure and programming times are less than or equal to the second preset erasure and programming times, randomization is not started, and the data to be stored is stored in the storage module.

[0033] In some embodiments, before determining whether the average number of erasure times is greater than a second preset number of erasure times, the method further includes:

[0034] Obtaining an erase error rate corresponding to an average number of erase and write times of the storage module;

[0035] Determining whether the write-erase error rate is greater than a preset error rate;

[0036] If the erasure error rate is greater than the preset error rate, reducing the second preset erasure times;

[0037] If the erasure error rate is less than or equal to the preset error rate, the second preset erasure number is maintained unchanged.

[0038] The present invention also proposes a UBIFS-based dynamic randomization storage system, which includes a flash memory and a host computer, wherein the flash memory is configured with UBIFS; the UBIFS-based dynamic randomization storage system can execute any of the above-mentioned UBIFS-based dynamic randomization storage methods.

[0039] The present invention also proposes a UBIFS-based dynamic random storage device, comprising:

[0040] at least one processor; and,

[0041] a memory communicatively connected to the at least one processor; wherein,

[0042] The memory stores instructions to be 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 any one of the above-mentioned UBIFS-based dynamic randomized storage methods.

[0043] The present invention establishes a UBIFS in the flash memory. The UBIFS can obtain flash memory data that records the flash memory status in real time. It then uses the flash memory data to dynamically generate a dynamic random sequence, thereby randomly generating randomized data, which is then stored in the storage module. Because the flash memory data changes dynamically, the generation of randomized data is dynamic. Furthermore, the average number of erase and write cycles can be used to determine whether to enable randomization and the level of randomization to enable, allowing flexibility in the activation and use of randomization. The present invention can dynamically and flexibly extend the erase and write life of SLC NAND FLASH. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 Schematic diagram of the process of a dynamic random storage method based on UBIFS in an embodiment of the present invention;

[0045] Figure 2 FIG2 is another flow chart of a dynamic random storage method based on UBIFS according to an embodiment of the present invention;

[0046] Figure 3 FIG2 is another flow chart of a dynamic random storage method based on UBIFS according to an embodiment of the present invention;

[0047] Figure 4 FIG2 is another flow chart of a dynamic random storage method based on UBIFS according to an embodiment of the present invention;

[0048] Figure 5 FIG2 is another flow chart of a dynamic random storage method based on UBIFS according to an embodiment of the present invention;

[0049] Figure 6 Schematic diagram of the structure of a dynamic randomized storage system based on UBIFS according to an embodiment of the present invention;

[0050] Figure 7 FIG. 1 is a schematic structural diagram of a UBIFS-based dynamic random storage device according to an embodiment of the present invention.

[0051] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0052] The following will be combined with the accompanying drawings to clearly and completely describe the solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of the present invention.

[0053] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the various components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0054] It should also be noted that when an element is referred to as being "fixed on" or "disposed on" another element, it may be directly on the other element or there may be an intermediate element. When an element is referred to as being "connected to" another element, it may be directly connected to the other element or there may be an intermediate element.

[0055] In addition, the descriptions of "first", "second", etc. in the present invention are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such 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 objectives, the present invention proposes a dynamic random storage method based on UBIFS, which includes:

[0057] Step S110, receiving the data to be stored sent by the host computer and obtaining a dynamic random sequence;

[0058] Step S120, obtaining randomized data according to the dynamic random sequence and the data to be stored;

[0059] Step S130: storing the randomized data into a storage module of the flash memory.

[0060] In this embodiment, referring to Figure 1 and Figure 6 , the dynamic randomized storage method based on UBIFS can be applied to a dynamic randomized storage system based on UBIFS. The dynamic randomized storage system based on UBIFS 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, single-layer unit flash memory). The flash memory can be connected to the host computer to perform data interaction. Data interaction can be the host computer writing (storing) data into the flash memory; it can also be the host computer erasing data stored in the flash memory. UBIFS (Unsorted Block Image File System) is a log-type file system. In this embodiment, the execution body of the method steps is UBIFS in the flash memory.

[0061] As you can understand, flash memory also includes an Unsorted Block Image (UBI). UBI provides underlying flash management services for UBIFS, such as bad block management, wear leveling, and logical block management. UBIFS is built on top of UBI, using the logical blocks provided by UBI to store file system data and metadata. This means that UBIFS can manage storage modules based on UBI.

[0062] Flash memory, due to its non-volatility, high reliability, and low power consumption, has become a mainstream choice for host computer storage, covering a wide range of scenarios from consumer electronics to industrial control. Therefore, the host computer can send data to the flash memory, which then stores it. When the host computer sends the data to the flash memory, the UBIFS in the flash memory receives the data sent by the host computer. In this case, UBIFS does not directly store the data in the flash memory's storage module. Instead, it dynamically randomizes the data before storing it in the storage module.

[0063] When UBIFS receives data to be stored from the host computer, it also obtains a dynamic random sequence. This dynamic random sequence can be obtained based on the data corresponding to the flash memory management service provided by UBI; a dynamic random sequence is a dynamically generated random sequence. After receiving the data to be stored and the dynamic random sequence, UBIFS randomizes the data to be stored based on the dynamic random sequence, thereby randomly assigning storage addresses to the data to be stored, preventing the data to be stored from using the same storage address.

[0064] After UBIFS randomizes the data to be stored according to a dynamic random sequence, it generates randomized data. At this point, UBIFS can store the randomized data in the storage module. Since randomized data is data to be stored with randomly assigned storage addresses, storing the randomized data in the storage module allows it to be randomly stored in different physical erase blocks within the storage module. This prevents some physical erase blocks from being used multiple times while others are barely used. This effectively balances the number of erases and writes between physical erase blocks, thereby extending the life of the flash memory.

[0065] By setting UBIFS in the flash memory according to this embodiment, UBIFS can randomly generate randomized data according to a dynamic random sequence, and then store the randomized data in the storage module; it can effectively balance the number of erase and write times of the storage module, thereby extending the life of the flash memory.

[0066] In some embodiments, the aforementioned obtaining of a dynamic random sequence includes:

[0067] Step S140, obtaining 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: Generate a dynamic random sequence according to a preset random algorithm and a multi-dimensional seed.

[0070] In this embodiment, referring to Figure 2 When UBIFS obtains the dynamic random sequence in step S110, it first obtains the flash memory data corresponding to the current state of the storage module. UBI provides UBIFS with underlying flash memory management services, where the underlying flash memory management services 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. Because the state of the storage module changes dynamically, and the current state can uniquely correspond to a piece of 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 data, it can generate a multi-dimensional seed based on the flash data. The flash data can include a variety of different flash parameters, and different flash parameters have different dimensions. In this case, the seed generated based on the flash data will be a multi-dimensional seed (i.e., a multi-dimensional seed).

[0072] The preset random algorithm can be the Xorshift algorithm. The Xorshift algorithm is an efficient pseudo-random number generation algorithm that generates a random sequence by shifting and XORing a seed. UBIFS can use the Xorshift algorithm to shift and XOR a multidimensional seed to generate a dynamic random sequence. Because flash memory data changes dynamically, the generated random sequence also changes dynamically, i.e., a dynamic random sequence.

[0073] In some embodiments, the storage module includes multiple physical erase blocks, and the flash memory data includes a logical erase block address, erase and write counts, a timestamp, a temperature, and a voltage noise, wherein the logical erase block address, erase and write counts, a timestamp, a temperature, and a voltage noise are all associated with the corresponding physical erase block.

[0074] In this embodiment, due to the inherent characteristics of flash memory hardware design, flash memory must be erased in entire blocks; individual pages or bytes cannot be erased individually. Therefore, the smallest unit of flash memory erase is the physical erase block. A storage module may include multiple physical erase blocks. Each physical erase block has corresponding flash memory data. This flash memory data may include the logical erase block address, erase counts, timestamps, temperature, and voltage noise.

[0075] Therefore, UBIFS can obtain the corresponding flash memory data (logical erase block address, erase count, timestamp, temperature, and voltage noise) of each physical erase block according to its current state, and then generate a multi-dimensional seed based on the logical erase block address, erase count, timestamp, temperature, and voltage noise. Finally, the multi-dimensional seed is shifted and XORed according to the Xorshift algorithm to generate a dynamic random sequence.

[0076] In some embodiments, before obtaining randomized data according to the dynamic random sequence and the data to be stored, the method further includes:

[0077] Step S150, obtaining the average erase and write times of the storage module;

[0078] Step S151, determining whether the average number of erasure times is greater than a first preset number of erasure times;

[0079] Step S152: if the average erase / write times is less than or equal to the first preset erase / write times, the first level randomization is started;

[0080] Step S153: If the average number of erasures and writes is greater than the first preset number of erasures and writes, the second level randomization is started.

[0081] In this embodiment, referring to Figure 3Before executing step S120, UBIFS will also start different levels of randomization based on the average number of erases and writes. Among them, the first level of randomization can be LEB (Logical Erase Block) level randomization, and the second level of randomization can be Page (logical page) level randomization. LEB-level randomization refers to the random mapping of consecutive logical erase blocks to different physical erase blocks; Page-level randomization refers to randomizing the data content of each logical page when writing data. Therefore, Page-level randomization is stronger than LEB-level randomization because Page-level randomization can further refine the degree of randomization and effectively reduce inter-unit interference and error rate.

[0082] UBIFS can calculate the average erase count of a storage module based on the erase counts corresponding to the physical erase blocks in the flash memory data. For example, each physical erase block has a corresponding erase count. The average erase count of the storage module can be calculated by summing the erase counts of each physical erase block and dividing it by the number of physical erase blocks. The average erase count of the storage module can then be determined to determine whether the average erase count is greater than a first preset erase count.

[0083] If it is determined that the average erase / write times is less than or equal to the first preset erase / write times, UBIFS uses the first level randomization to process the data to be stored.

[0084] If it is determined that the average number of erase / write times is greater than the first preset number of erase / write times, UBIFS will use the second level of randomization to process the data to be stored.

[0085] The first preset number of erase / write times can be determined based on the total number of erase / write times (lifespan) of the physical erase block. For example, the first preset number of erase / write times can be 80% of the total number of erase / write times. If the total number of erase / write times of the physical erase block is 80,000, then the first preset number of erase / write times is 80,000 times multiplied by 80%, which equals 64,000 times.

[0086] In this embodiment, different levels of randomization can be enabled by averaging the number of erase and write times. When the life of the flash memory is about to be exhausted, the randomness can be further enhanced, thereby extending the life of the flash memory.

[0087] In some embodiments, when the first level randomization is enabled, the aforementioned generation of a multi-dimensional seed based on the flash memory data includes:

[0088] The formula for generating multidimensional seeds is:

[0089]

[0090] Among them, S represents the multidimensional 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 exclusive OR operator, and mod represents the modulo operator.

[0091] In this embodiment, when the first level randomization (ie, LEB level randomization) is started, the formula for generating the multidimensional seed is:

[0092]

[0093] Among them, S represents the multidimensional 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 exclusive OR operator, and mod represents the modulo operator. It is understood as: This refers to the bitwise XOR operation of the logical erase block address and the erase count; Tmod 256 refers to the modulo 256 operation of the timestamp (i.e., dividing the timestamp by 256 and taking the remainder); Temp mod 16 refers to the modulo 16 operation of the temperature (i.e., dividing the temperature by 16 and taking the remainder); and V mod 8 refers to the modulo 8 operation of the voltage noise (i.e., dividing the voltage noise by 8 and taking the remainder). Finally, these four results are sequentially bitwise XORed to obtain the multidimensional seed. The modulo operation refers to finding the remainder after dividing two numbers.

[0094] For example, first perform a bitwise XOR operation on the logical erase block address and the erase count (e.g., compare them bit by bit, with identical values ​​set to 0 and different values ​​set to 1) to obtain the first result. Then, divide the timestamp by 256 and take the remainder. This is then XORed with the first result and the remainder to obtain the second result. Then, divide the temperature by 16 and take the remainder. This is then XORed with the remainder to obtain the third result. Finally, divide the voltage noise by 8 and take the remainder. This is then XORed with the remainder to obtain the multidimensional seed.

[0095] In some embodiments, when the second level randomization is enabled, the aforementioned generation of a multi-dimensional seed based on the flash memory data includes:

[0096] The formula for generating multidimensional seeds is:

[0097]

[0098] 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 exclusive OR operator, mod represents the modulo operator, S Page Represents a multidimensional seed, and page_offset represents a page offset.

[0099] In this embodiment, when the second level randomization (ie, Page level randomization) is started, the formula for generating 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 exclusive OR operator, mod represents the modulo operator, S Page Represents a multi-dimensional seed, and page_offset represents a page offset. It is understood as: This refers to the bitwise XOR of the logical erase block address and the erase count; Tmod 256 refers to the modulo 256 operation of the timestamp (i.e., dividing the timestamp by 256 and taking the remainder); Temp mod 16 refers to the modulo 16 operation of the temperature (i.e., dividing the temperature by 16 and taking the remainder); and V mod 8 refers to the modulo 8 operation of the voltage noise (i.e., dividing the voltage noise by 8 and taking the remainder). Finally, these four results are sequentially bitwise XORed to obtain the initial seed. The modulo operation refers to finding the remainder after dividing two numbers.

[0102] After obtaining the initial seed, the multidimensional seed is generated by performing a bitwise XOR operation on the initial seed and the page offset. The page offset refers to the relative position of a logical page within its logical erase block. The page offset is typically expressed as a logical page index or byte offset. For example, if a logical erase block contains multiple logical pages, the page offset identifies the order of each logical page within the logical erase block.

[0103] For example, first perform a bitwise XOR on the logical erase block address and the erase count (e.g., compare bit by bit, with identical values ​​set to 0 and different values ​​set to 1) to obtain a first result. Then, divide the timestamp by 256 and take the remainder. Perform a bitwise XOR on the first result and the remainder to obtain a second result. Then, divide the temperature by 16 and take the remainder. Perform a bitwise XOR on the second result and the remainder to obtain a third result. Finally, divide the voltage noise by 8 and take the remainder. Perform a bitwise XOR on the third result and the remainder to obtain an initial seed. After obtaining the initial seed, perform a bitwise XOR on the initial seed and the page offset to obtain a multidimensional seed.

[0104] This embodiment performs a bitwise XOR operation on the initial seed obtained by randomizing the entire LEB level with the page offset unique to each logical page, so that each logical page can obtain a multi-dimensional seed that is 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. LEB-level randomization is processed in units of the entire logical erase block, while Page-level randomization refines the granularity of randomization to each logical page (wherein the logical erase block includes multiple logical pages). This more refined processing method can better adapt to the physical characteristics of flash memory, reduce inter-unit interference and error rate, and further extend the life of 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] Initialize the Xorshift algorithm based on a multidimensional seed to generate a dynamic random sequence.

[0107] In this embodiment, if LEB-level randomization is used, a multidimensional seed is used to initialize the Xorshift algorithm to generate a dynamic random sequence with a length equal to the LEB data length. If Page-level randomization is used, a multidimensional seed is used to initialize the Xorshift algorithm 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] The dynamic random sequence and the data to be stored are shifted and XORed to obtain randomized data.

[0110] In this embodiment, no matter which randomization method is used, the dynamic random sequence and the data to be stored are shifted and XORed to obtain randomized data.

[0111] In some embodiments, before determining whether the average number of erasures is greater than the first preset number of erasures, the process further includes:

[0112] Step S160, determining whether the average erase / write times is greater than a second preset erase / write times, wherein the first preset erase / write times is greater than the second preset erase / write times;

[0113] Step S161: If the average number of erasures and writes is greater than a second preset number of erasures and writes, randomization is initiated, and a step of obtaining randomized data according to a dynamic random sequence and the data to be stored is executed;

[0114] Step S162: If the average erase / write times is less than or equal to the second preset erase / write times, 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 executing step S151, UBIFS also determines whether to enable randomization based on the average number of erase / write times. Before determining whether the average number of erase / write times is greater than a first preset number of erase / write times, UBIFS also determines whether the average number of erase / write times is greater than a second preset number of erase / write times, where the first preset number of erase / write times is greater than the second preset number of erase / write times.

[0116] The first preset erase count and the second preset erase count can both be determined based on the total erase count (lifespan) of the physical erase block. For example, the first preset erase count can be 80% of the total erase count; the second preset erase count can be 60% of the total erase count. If the total erase count of the physical erase block is 80,000, then the first preset erase count is 80,000 times multiplied by 80%, which equals 64,000 times, i.e., the first preset erase count is 64,000 times; then the second preset erase count is 80,000 times multiplied by 60%, which equals 48,000 times, i.e., the second preset erase count is 48,000 times. The first preset erase count and the second preset erase count can also be freely set by the user.

[0117] If the average number of erase / write cycles is greater than the second preset number of erase / write cycles, UBIFS initiates randomization, thereby executing the step of generating randomized data based on 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, UBIFS does not initiate randomization and directly stores the data to be stored in the storage module.

[0118] For example, UBIFS will only initiate randomization when the average erase / write cycle exceeds 48,000; it will not initiate randomization when the average erase / write cycle is less than or equal to 48,000. By setting a second preset erase / write cycle to determine whether to initiate randomization, randomization can be disabled when the average erase / write cycle is low, meeting user requirements for high performance; while randomization can be enabled when the average erase / write cycle is high, extending the life of the flash memory.

[0119] In some embodiments, before determining whether the average number of erasures is greater than the second preset number of erasures, the process further includes:

[0120] Step S170, obtaining an erase error rate corresponding to an average erase and write count of the storage module;

[0121] Step S171, determining whether the erase / write error rate is greater than a preset error rate;

[0122] Step S172: if the erasure error rate is greater than the preset error rate, reducing the second preset erasure times;

[0123] In step S173, if the erasure error rate is less than or equal to the preset error rate, the second preset erasure count is maintained unchanged.

[0124] In this embodiment, referring to Figure 5 Before executing step S160, UBIFS will also determine the erase error rate. UBIFS can obtain the erase error rate corresponding to the average erase count of the storage module, that is, the average of the erase error rates corresponding to the erase count of each physical erase block. For example, UBIFS can first determine the total number of erase operations (erase count) performed on the physical erase block, then determine the number of erase errors that occurred during these erase operations, and finally divide the number of errors by the erase count to obtain the erase error rate. The average of the erase error rates corresponding to all physical erase blocks is then calculated to obtain the erase error rate corresponding to the average erase count 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 the error rate is greater than the preset error rate, UBIFS will reduce the second preset number of erase times, allowing randomization to start early. If the error rate is less than or equal to the preset error rate, UBIFS will maintain the second preset number of erase times, eliminating the need to start randomization early.

[0127] For example, the preset error rate can be set to 1%. If the write / erase error rate exceeds 1%, the second preset write count can be reduced. This second preset write count can be reduced from 60% of the total write / erase count to 50%, allowing for early randomization. By determining the write / erase error rate and initiating randomization early if it exceeds a threshold, dynamic adjustment can be achieved.

[0128] The present invention establishes a UBIFS in the flash memory. The UBIFS can obtain flash memory data that records the flash memory status in real time. It then uses the flash memory data to dynamically generate a dynamic random sequence, thereby randomly generating randomized data, which is then stored in the storage module. Because the flash memory data changes dynamically, the generation of randomized data is dynamic. Furthermore, the average number of erase and write cycles can be used to determine whether to enable randomization and the level of randomization to enable, allowing flexibility in the activation and use of randomization. The present invention can dynamically and flexibly extend the erase and write life of SLC NAND FLASH.

[0129] The present invention also proposes a UBIFS-based dynamic randomization storage system, which includes a flash memory and a host computer, wherein the flash memory is configured with UBIFS; the UBIFS-based dynamic randomization storage system can execute any of the above-mentioned UBIFS-based dynamic randomization storage methods.

[0130] In this embodiment, referring to Figure 6 The UBIFS-based dynamic randomized storage system includes a flash memory and a host computer. The flash memory is configured with UBIFS. The flash memory can be SLC NAND FLASH (Single-Level Cell NAND FLASH). The flash memory can be connected to the host computer to exchange data. Data interaction can be the host computer writing (storing) data into the flash memory; it can also be the host computer erasing data stored in the flash memory. UBIFS (Unsorted Block Image File System) is a log-type file system.

[0131] The flash memory also includes an Unsorted Block Image (UBI). UBI provides underlying flash management services for UBIFS, such as bad block management, wear leveling, and logical block management. UBIFS, built on top of UBI, uses the logical blocks provided by UBI to store file system data and metadata. This means that UBIFS can manage the storage modules in the flash memory based on UBI.

[0132] The UBIFS-based dynamic random storage device of the embodiment of the present invention may be a controller capable of running a UBIFS-based dynamic random storage method; the controller has at least one. Figure 7 As shown, the UBIFS-based dynamic random storage device may 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 may include a display screen (Display), an input unit, such as a keyboard (Keyboard), and the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned controller 1001.

[0133] Those skilled in the art will understand that Figure 7 The structure of the UBIFS-based dynamic random storage device shown in the figure does not constitute a limitation on the UBIFS-based dynamic random storage device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0134] like Figure 7 As 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] exist Figure 7 In the UBIFS-based dynamic randomization storage device shown, the network interface 1004 is mainly used to connect to the backend server and communicate data with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the controller 1001 can be used to call the computer program stored in the memory 1005. 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 description is only a partial or preferred embodiment of the present invention. Neither the text nor the drawings can limit the scope of protection of the present invention. All equivalent structural transformations made by using the contents of the present invention description and drawings under the overall concept of the present invention, or direct / indirect application in other related technical fields are included in the scope of protection of the present invention.

Claims

1. A dynamic random storage method based on UBIFS, characterized in that: The UBIFS-based dynamic random storage method includes: Receive the data to be stored sent by the host computer and obtain the dynamic random sequence; Obtain randomized data according to a dynamic random sequence and the data to be stored; storing the randomized data into a storage module of a flash memory; Before obtaining randomized data according to the dynamic random sequence and the data to be stored, the method further includes: Obtaining an average number of erase and write times of the storage module; Determining whether the average number of erasures and writes is greater than a first preset number of erasures and writes; If the average number of erasures is less than or equal to the first preset number of erasures, the first level randomization is initiated; If the average number of erasures and writes is greater than the first preset number of erasures and writes, the second level randomization is initiated; The first level randomization refers to randomly mapping consecutive logical erase blocks to different physical erase blocks, and the second level randomization refers to randomizing the data content of each logical page when writing data.

2. The UBIFS-based dynamic random storage method according to claim 1, characterized in that: The obtaining of a dynamic random sequence comprises: Obtaining flash memory data corresponding to the current state of the storage module; generating a multidimensional seed according to the flash memory data; A dynamic random sequence is generated according to a preset random algorithm and the multidimensional seed.

3. The UBIFS-based dynamic random storage method according to claim 2, characterized in that: The storage module includes multiple physical erase blocks, and the flash memory data includes a logical erase block address, a number of erase and write cycles, a timestamp, a temperature, and a 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.

4. The UBIFS-based dynamic random storage method according to claim 3, characterized in that: When the first level randomization is started, generating a multi-dimensional seed according to the flash memory data includes: The generation formula of the multidimensional seed is: S=(A⊕C)⊕(T mod 256)⊕(Temp mod 16)⊕(V mod 8); Where S represents a multidimensional seed, A represents a logical erase block address, C represents the number of erases and writes, T represents a timestamp, Temp represents temperature, V represents voltage noise, ⊕ represents an exclusive-OR operator, and mod represents a modulo operator.

5. The UBIFS-based dynamic random storage method according to claim 3, characterized in that: When the second level randomization is started, generating a multi-dimensional seed according to the flash memory data includes: The generation formula of the multidimensional seed is: S=(A⊕C)⊕(T mod 256)⊕(Temp mod 16)⊕(V mod 8); S Page =S⊕page_offset; 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, V represents the voltage noise, ⊕ represents the XOR operator, mod represents the modulus operator, S Page Represents a multidimensional seed, and page_offset represents a page offset.

6. The UBIFS-based dynamic random storage method according to claim 3, characterized in that: Before determining whether the average number of erasure times is greater than a first preset number of erasure times, the method further includes: Determining whether the average number of erasures and writes is greater than a second preset number of erasures and writes, wherein the first preset number of erasures and writes is greater than the second preset number of erasures and writes; If the average number of erasures and writes is greater than the second preset number of erasures and writes, randomization is initiated, and a step of obtaining randomized data according to a dynamic random sequence and the data to be stored is executed; If the average erasure and programming times are less than or equal to the second preset erasure and programming times, randomization is not started, and the data to be stored is stored in the storage module.

7. The UBIFS-based dynamic random storage method according to claim 6, characterized in that: Before determining whether the average number of erasure times is greater than a second preset number of erasure times, the method further includes: Obtaining an erase error rate corresponding to an average number of erase and write times of the storage module; Determining whether the write-erase error rate is greater than a preset error rate; If the erasure error rate is greater than the preset error rate, reducing the second preset erasure times; If the erasure error rate is less than or equal to the preset error rate, the second preset erasure number is maintained unchanged.

8. A dynamic random storage system based on UBIFS, characterized in that: The UBIFS-based dynamic randomization storage system includes a flash memory and a host computer, wherein 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 7.

9. A dynamic random storage device based on UBIFS, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executed by the at least one processor, where the instructions are executed by the at least one processor so as to enable the at least one processor to execute the UBIFS-based dynamic randomization storage method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Memory system

    US20140068149A1

  • Performing scrambling operations based on a physical block address of a memory sub-system

    US20220100416A1