A data storage method, device, medium and storage device for flash memory cells
By using storage units with different service life in flash memory units and transferring data according to file update frequency, the problem of short life of QLC or PLC storage units is solved, and efficient use and life extension of storage devices are achieved.
Patent Information
- Application Number
- CN202410563700.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-08
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2044-05-08
AI Technical Summary
In the prior art, the erase life of the QLC or PLC flash memory unit is short, resulting in the service life of the storage device being not secure enough. The existing solution requires additional process overhead to determine the data type, and the computing resource occupies a large amount.
Two storage units with different erase lifespans are adopted. The write operation is performed in the first storage unit with a longer lifespan, and the reading operation is performed in the second storage unit with a shorter lifespan but large capacity. The file data is judged based on the update frequency and capacity of the file data to use the time difference value to reduce the number of erasings to the second storage unit.
It extends the service life of the storage device, meets the user's requirements for write speed and life, reduces the number of times of erasing the storage unit with a shorter erasing life, and improves the market competitiveness of the storage device.
Smart Images

Figure CN118426698B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields related to flash memory cells, solid-state memories, and data storage, and in particular, to a data storage method, device, medium, and storage device for flash memory cells. Background Art
[0002] Non-Volatile Memory (NVM) is a new type of storage technology. Compared with traditional SRAM / DRAM, it has the advantages of non-volatility, byte-level access, high storage density, and low static power consumption. Its read and write performance is close to that of DRAM, but it can retain data permanently. However, there are also problems such as asymmetric read and write performance (read is much faster than write) and limited write lifespan.
[0003] Flash Memory is a long-lifespan non-volatile memory, that is, a memory that can still store the stored data information even when powered off. It is usually used to store information, such as storing data in electronic products such as mobile phones, digital video cameras, game consoles, MP3 players, computers, digital cameras, etc.
[0004] Flash Memory is an electronically erasable programmable non-volatile storage device. Structurally, flash memory is composed of many blocks, each block contains many pages, and the basic storage unit of each page is a bit. Flash memory is erased in units of blocks and read and written in units of pages. As the number of Program / Erase (P / E) cycles increases, the ability of flash memory cells to store electrons weakens, reducing the reliability of data storage. Therefore, the number of programming and erasing cycles of flash memory is limited, and this problem is also known as the lifespan problem of flash memory.
[0005] Among them, NAND Flash memory uses a serial read and write method, and each read and write operation is performed in units of pages. It has a large capacity and is inexpensive, and is suitable for storing large amounts of data, such as mobile devices, SSD drives, and USB flash drives. According to its different process technologies, NAND has evolved from the earliest SLC to the current MLC, TLC, QLC, and PLC.
[0006] Sorted by speed-price ratio: SLC > MLC > TLC > QLC > PLC.
[0007] Sorted by capacity: PLC > QLC > TLC > MLC > SLC.
[0008] 1. SLC, short for Single-Level Cell, is a single-layer storage cell. One unit of space (cell) can store 1 bit of data, that is, 1 bit / cell. Its structure is relatively simple, which means that the capacity of SSDs using SLC particles is doomed not to be too large. However, the theoretical number of program / erase cycles (P / E) of a single particle is more than 100,000 times. It is also the type of particle with the fastest read / write speed, the most accurate read / write data, the best quality, the longest lifespan, and the highest cost among the five types of particles. It is generally used in enterprise-level usage scenarios.
[0009] 2. MLC, short for Multi Level Cell, has become 2 bits / cell compared to SLC. One of the major advantages of this is cost reduction. For consumer SSDs, with a relatively reasonable capacity / price ratio, MLC flash particles are the first choice for personal or home computers, and the program / erase lifespan (P / E) is about 10,000 times.
[0010] 3. TLC, short for Triple Level Cell, reaches 3 bits / cell, that is, each cell can store 3 bits of data (3 bit / cell). Although high storage density enables a relatively inexpensive large-capacity format, its read / write lifecycle is greatly shortened. TLC is the most commonly seen flash particle at present and is widely used. Its program / erase lifespan (P / E) is about 1,000 times. Although in terms of data, TLC's read / write speed, particle quality, and lifespan are all inferior to SLC and MLC, its cost is much lower. If used for daily use, it can actually fully meet the needs of ordinary consumers.
[0011] 4. QLC, short for Quad-Level Cell, is a four-layer storage cell (4 bit / cell). QLC particles have a higher storage density than TLC and are also lower in cost than TLC. The advantage is a larger capacity, but it has a fatal disadvantage of a shorter service life. The program / erase lifespan (P / E) can only reach about 150 times. Currently, it is mainly used in low-end large-capacity SSDs.
[0012] 5. PLC, short for Penta-level cell, also known as five-layer storage, that is, each cell can store 5 bits of data (5 bit / cell). This flash particle technology is not yet very mature, but it is expected to become popular in the next few years, which can bring larger storage space and lower unit storage cost to SSD products. However, the promotion of PLC may be limited by its speed and lifespan, and its program / erase lifespan (P / E) is only a few dozen times.
[0013] Therefore, when manufacturing storage devices using only SLC or MLC, although they have a long lifespan, their high price is not conducive to promotion. When manufacturing storage devices using only TLC or QLC, although they are inexpensive, their relatively short erase / write lifespan makes data storage less secure and easily causes users to worry about the device's service life.
[0014] Chinese patent document with publication (announcement) number CN103677654B discloses a method for storing data and an electronic device. The electronic device includes a first storage unit for storing data of a first data type and a second storage unit for storing data of a second data type different from the first data type. The method includes: obtaining data to be stored; determining the data type of the data to be stored; judging whether the data type is the first data type or the second data type to obtain a judgment result; when the judgment result indicates that the data type is the first data type, storing the data to be stored in the first storage unit; and when the judgment result indicates that the data type is the second data type, storing the data to be stored in the second storage unit.
[0015] Chinese patent document with publication (announcement) number CN103902226B discloses a data writing method and system. The data writing method is used to write data from a host system to a storage device having a first storage unit and a second storage unit. The data writing method includes providing an application program characteristic database. Receiving a write instruction for an application program executing on the host system to write data to the storage device. Obtaining the data access type corresponding to the application program from the application program characteristic database. And selecting to write the data to the first storage unit or the second storage unit according to the data access type and the access management policy.
[0016] In the prior art, there are also methods of using the data type of data files to perform storage in different storage units, but additional process overhead is required to judge the data type, which easily occupies the computing resources of the processor. Moreover, the judgment based on the data type is very inaccurate. For example, a text file may be identified as a highly modified type, but many text files may never be modified again after being edited. Additionally, the above patent documents were mainly designed for the usage scenarios where the storage capacity of storage devices was generally low at that time. Currently, the storage capacity of storage devices has been greatly improved, but the erase / write lifespan (P / E) of QLC or PLC is too short, resulting in insecure user data usage.
[0017] Therefore, how to extend the service life of existing large-capacity storage units such as QLC or PLC requires research and design of more optimized storage solutions. Summary of the Invention
[0018] To overcome the above deficiencies, the present invention aims to provide a technical solution to solve the above problems.
[0019] The present invention provides a data storage method for flash memory cells to extend the service life of solid-state memories, including the following steps:
[0020] S1, Receive the file data to be written incoming from an external host, write it into the first storage unit to form first data, record the write time, and at the same time point the mapping relationship of the file data to the first data;
[0021] S2, According to the mapping relationship of the file data, read the first data from the first storage unit to form the file data to be read, and send it to the external host for use;
[0022] S3, Calculate the time difference between the current time when reading the first data and the write time, and determine whether the time difference reaches a certain threshold;
[0023] S4, If the time difference reaches a certain threshold, write the first data into the second storage unit to form second data, and update the mapping relationship of the file data to point it to the second data, so that subsequent read operations on the file data are performed from the second data in the second storage unit.
[0024] As a further aspect of the present invention: The following steps are also included: S5, Receive the update and modification of the file data from the external host, write the modified file data into the first storage unit to form third data, and update and modify its write time. At the same time, update the mapping relationship of the file data to point to the third data, so that subsequent read operations on the file data are performed from the third data in the first storage unit.
[0025] As a further aspect of the present invention: When the remaining available capacity of the first storage unit is less than the first threshold, write the file data that was written into the first storage unit earliest into the second storage unit to form second data, and at the same time update the mapping relationship of the file data to point to the second data, so that subsequent read operations on the file data are performed from the second data in the second storage unit.
[0026] As a further aspect of the present invention: In step S3, the calculation of the time difference is performed in units of days, and its calculation formula is:
[0027] P = DATEDIF(A1, TODAY(), "D"),
[0028] where A1 is the write time of the file data, TODAY() is the current time when reading the file data, and "D" is calculated in units of the number of days in the time period.
[0029] As a further solution of the present invention: in step S3, the calculation of the time difference is carried out in units of months, and its calculation formula is:
[0030] P = DATEDIF(A1, TODAY(), "M"),
[0031] where A1 is the writing time of the file data, TODAY() is the current time when reading the file data, and "M" is to calculate in units of the number of months in the time period.
[0032] The present invention also provides a data storage device for flash memory cells, which is used to extend the service life of a solid-state memory, and includes the following modules:
[0033] A writing module, which is used to receive the file data to be written incoming from an external host, write it into the first storage unit to form first data, record the writing time, and at the same time point the mapping relationship of the file data to the first data;
[0034] A reading module, which is used to read the first data from the first storage unit according to the mapping relationship of the file data to form the file data to be read, and send it to the external host for use;
[0035] A judging module, which is used to calculate the time difference between the current time when reading the first data and the writing time, and judge whether the time difference reaches a certain threshold;
[0036] A transfer module, which is used to, if the time difference reaches a certain threshold, write the first data into the second storage unit to form second data, and update the mapping relationship of the file data to point it to the second data, so that subsequent reading operations on the file data are carried out from the second data in the second storage unit.
[0037] As a further solution of the present invention: it further includes an updating module, which is used to receive the update modification of the file data from the external host, write the modified file data into the first storage unit to form third data, update and modify its writing time, and at the same time update the mapping relationship of the file data to point to the third data, so that subsequent reading operations on the file data are carried out from the third data in the first storage unit.
[0038] As a further solution of the present invention: it further includes an expansion module, which is used to, when the remaining available capacity of the first storage unit is less than the first threshold, write the file data written into the first storage unit earliest into the second storage unit to form second data, and at the same time update the mapping relationship of the file data to point to the second data, so that subsequent reading operations on the file data are carried out from the second data in the second storage unit.
[0039] The present invention also provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements a data storage method for a flash memory cell described in any one of the above.
[0040] The present invention also provides a solid-state storage device, including:
[0041] A flash memory chip, in which at least two types of memory cells with different P / E numbers are used to store data respectively;
[0042] A transmission interface, used to connect the storage device to an external host system and transmit data;
[0043] And a controller, electrically connected to the flash memory chip and the transmission interface respectively, and executing a data storage method for a flash memory cell described in any one of the above on the flash memory chip.
[0044] Compared with the prior art, the beneficial effects of the present invention are:
[0045] 1. By installing memory cells with different erasing and writing lifetimes (P / E) inside the storage device, all read operations and write operations of all files are respectively operated with memory cells of different erasing and writing lifetimes. That is, the write operation is only performed on the first memory cell with a relatively long erasing and writing lifetime, while the read operation can be performed on the first memory cell or the second memory cell. All write operations of all files are first written to the first memory cell, and subsequent updates and modifications are also performed on the first memory cell. Only after a long time without updating or modifying the file data, the file data in the first memory cell is transferred to the second memory cell for long-term non-updated or non-modified long-term storage operations. Thus, the erasing and writing times of the second memory cell with a relatively short erasing and writing lifetime can be minimized to the greatest extent, thereby improving the service life of the second memory cell with a relatively large capacity.
[0046] 2. Even if it is necessary to update or modify the file data in the second memory cell, the modified file data is not stored in the second memory cell, but is written to the first memory cell again. Because based on the user's usage habits, when it is necessary to modify a file data, it is usually modified or corrected again within a relatively short interval. Therefore, writing to the first memory cell can ensure the subsequent writing speed and will not cause multiple writes to consume the service life of the second memory cell.
[0047] 3. It can also be set that when the remaining available capacity of the first memory cell is less than a certain threshold, the file data in the first memory cell is actively operated, transferred to the second memory cell, thereby releasing the writable capacity of the first memory cell to facilitate subsequent writing of other file data.
[0048] Therefore, through the above improvements, the present invention can provide a data storage method, device, medium and storage device for flash memory cells. The first storage cells with a longer erase-write lifespan and a smaller capacity are used for writing operations, while the second storage cells with a shorter erase-write lifespan and a larger capacity are used for reading operations. Thus, it can not only meet the user's requirement for writing speed but also meet the user's requirement for service life, enhancing the market competitiveness of the storage device.
[0049] Additional aspects and advantages of the present invention will be given in part in the following description, become apparent in part from the following description, or be learned through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0051] Figure 1 is a schematic flowchart of the overall operation of the present invention;
[0052] Figure 2 is a schematic flowchart of the update and modification operation of the present invention;
[0053] Figure 3 is a schematic flowchart of the transfer operation of the present invention;
[0054] Figure 4 is a block diagram of the storage device of the present invention.
[0055] The reference numerals and names in the drawings are as follows:
[0056] 10 Storage device; 20 Controller; 21 Writing module; 22 Reading module; 23 Judgment module; 24 Transfer module; 25 Update module; 26 Expansion module; 30 Flash memory chip; 31 First storage cell; 32 Second storage cell; 33 Blank block; 40 Transmission interface. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all 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.
[0058] Please refer to Figures 1 to 4, in an embodiment of the present invention, a data storage method for a flash memory cell, which is used to extend the service life of a solid-state memory, includes the following steps:
[0059] S1. Receive the file data to be written incoming from an external host, write it into a first storage unit to form first data, record the writing time, and at the same time point the mapping relationship of the file data to the first data;
[0060] S2. According to the mapping relationship of the file data, read the first data from the first storage unit to form the file data to be read, and send it to the external host for use;
[0061] S3. Calculate the time difference between the current time when the first data is read and the writing time, and determine whether the time difference reaches a certain threshold;
[0062] S4. If the time difference reaches a certain threshold, write the first data into a second storage unit to form second data, and update the mapping relationship of the file data to point it to the second data, so that subsequent reading operations on the file data are performed from the second data in the second storage unit.
[0063] Specifically, it should be noted that a flash translation layer (FTL) in the prior art is preset in the firmware program of the storage device of the present invention. And the writing time can be recorded in the flash translation layer or in the feature library of the file data itself. That is, when the controller of the storage device reads the stored file data, the recorded writing time can be read synchronously. FTL is the abbreviation of Flash Translation Layer, which completes the translation (or mapping) from the logical address space of the host (or user) to the physical address space of the flash memory. Every time the SSD writes a piece of user logical data into a flash memory physical block, it records the mapping relationship between the logical address and the physical address. When the host wants to read this data, the SSD will, according to this address mapping table, read this data from the corresponding flash memory physical block and then return it to the user for use.
[0064] Secondly, the storage device in the present invention includes at least two types of storage units with different erase / write lifetimes (P / E). Specifically, for the first storage unit, it is preferably a storage unit with a relatively long erase / write lifetime. For the second storage unit, it is preferably a storage unit with a relatively short erase / write lifetime but a larger capacity. Since the service life of a storage unit mainly depends on the number of times it can be erased and written, in order to extend the service life of the storage device, it is preferred to reduce the number of erase / write operations on the second storage unit with a relatively short erase / write lifetime. Therefore, all file data can be first written into the first storage unit, and then different operations can be performed on the file data according to the update and modification time of the file data. Through investigation and research, according to the actual usage characteristics or usage habits of users for file data, it is known that newly created file data or recently updated and modified file data has a very high probability of being modified and updated again in the near future. After a relatively long period of time has passed, the probability of the file data needing to be modified and updated again is significantly reduced.
[0065] Therefore, files that have not been updated or modified within a certain period of time can be transferred and stored in the second storage unit, and subsequent read operations on the file data can be directly performed from the second storage unit. Because read operations do not consume the erase / write lifetime of the storage unit, and in terms of read speed alone, the read speed of the second storage unit is not much different from that of the first storage unit, but the capacity of the second storage unit is very large. Therefore, it can be used to store a large amount of file data that is not modified frequently and is only read.
[0066] Thirdly, the determination step can perform corresponding transfer and storage operations according to the time difference between the current time when the first data is read in step S2 and the write time recorded in step S1. That is, when the time difference reaches a certain threshold, such as 10 days, 20 days, or 30 days, or for example, two months, three months, or five months, etc., and no update or modification operation has been performed on the file data, the corresponding file data can be transferred and stored in the second storage unit for long-term preservation. Of course, delayed transfer and storage can also be used. After calculation and determination in the determination step, when a file data needs to be transferred and stored in the second storage unit, the storage operation can be performed immediately, or the characteristic information of the file data that needs to be transferred and stored can be marked first, and then, when the solid-state storage device is idle, the marked file data that needs to be transferred and stored can be subjected to the corresponding transfer and storage operation. That is, files that are not frequently modified are transferred and stored in the second storage unit with a slow write speed, a short erase / write lifetime, but a large capacity.
[0067] Finally, after step S4, a deletion step may also be set, that is, the original first data corresponding to the file data that has been transferred to the second storage unit is deleted, so as to release the available capacity of the first storage unit. For the specific deletion operation, the first data in the first storage unit corresponding to the file data can be deleted immediately after the transfer to release the capacity in a timely manner. It can also be only marked as deletable, and wait for the garbage collection mechanism of the controller in the storage device itself to perform unified deletion processing on it. The garbage collection mechanism is the prior art of the storage device and will not be elaborated here.
[0068] In another embodiment, as Figure 2 shown, preferably, the following steps are further included: S5, receiving an update modification of the file data from an external host, writing the modified file data into the first storage unit to form third data, and updating and modifying its writing time. At the same time, update the mapping relationship of the file data to point to the third data, so that subsequent read operations on the file data are performed from the third data in the first storage unit.
[0069] Specifically, when a user needs to use or modify a certain file data, an operation instruction can be sent to the external host, and then the external host sends a read instruction to the storage device. After receiving the read instruction of the file data from the external host, the storage device first searches for the storage location of the file data from the mapping relationship. If it is in the first storage unit, start reading the first data from the first storage unit to form the file data to be read for the external host to use. If it is in the second storage unit, start reading the second data from the second storage unit to form the file data to be read for the external host to use.
[0070] Secondly, after the user makes corresponding update modifications to the read file data, the external host can send the modified file data to the storage device again for storage operations. The storage device first receives the update modification of the file data, and then directly writes it into the first storage unit to form third data, and updates the writing time and the mapping relationship.
[0071] In addition, when the user makes update modifications to the read file data, there may also be the following situation, that is, only a part of the file data is modified, and the other parts are not modified. For this situation, when the storage device performs storage, only the modified part can be written into the first storage unit, and at the same time, update the mapping relationship of this part to the first storage unit. For the unmodified part, continue to maintain the original mapping relationship, that is, do not rewrite it, and still use the file data already stored in the second storage unit for subsequent access. Thereby, the write amount of the storage device can be reduced, and its service life can be further extended.
[0072] Again, if the original file data is read from the first storage unit, the original first data of the first storage unit corresponding to the original file data is deleted. If the original file data is read from the second storage unit, the original second data of the second storage unit corresponding to the original file data is deleted. Of course, for the specific deletion steps, corresponding operations can be performed according to the existing technologies preset inside the storage device. For example, it can be directly deleted, or it can also be only marked as deletable, waiting for the garbage collection mechanism of the memory itself to perform unified deletion processing on it.
[0073] In another embodiment, as Figure 3 shown, preferably, the following steps are further included: when the remaining available capacity of the first storage unit is less than the first threshold, the file data written earliest into the first storage unit is written into the second storage unit to form second data, and at the same time, the mapping relationship of the file data is updated to point to the second data, so that subsequent read operations on the file data are performed from the second data in the second storage unit; and the first data of the corresponding first storage unit is deleted. Continuously perform the above deletion steps until the remaining available capacity of the first storage unit is greater than or equal to the second threshold; where the second threshold is greater than the first threshold.
[0074] Specifically, although the first storage unit has a relatively long erase / write cycle, its cost is also relatively high, and usually a large capacity is not set. Therefore, during the user's use process, the first storage unit may be filled up. So an expansion mechanism needs to be set. When the remaining available capacity of the first storage unit is less than the first threshold, the first storage unit is expanded. For example, when the capacity is less than one-third, it is expanded. For example, if the capacity of the first storage unit is 30 GB, the first threshold can be set to 10 GB, and when 20 GB of the capacity has been used, the expansion process can start. For the determination of the file data written earliest into the first storage unit, the write time can be used for corresponding determination, and the file data with the smallest write time is actually the earliest written. Of course, other methods in the existing technologies can also be used for determination, such as the sorting method, to sort the write times of the written data accordingly, so as to find out the file data written earliest.
[0075] Secondly, the expansion process is preferably carried out when the storage device is relatively idle, or before the user needs to write large-capacity file data. Or custom parameters can also be set in the controller of the storage device, enabling the user to adjust the first threshold through the custom parameters, thereby adjusting the available capacity of the first storage unit and making the use of the storage device more in line with the user's usage habits. In addition, a second threshold can also be set, that is, after the expansion operation starts, more space can be sorted out for the user to use, so as to avoid the frequent activation of the expansion operation. For example, the second threshold is set to 15GB, that is, after 5GB needs to be sorted out, the expansion operation stops. Of course, since the storage device is always running on the external host, the priority of the expansion operation can be set to be relatively low, that is, the storage device preferentially responds to the read and write accesses of the external host to the storage device itself. Only when there is no read and write access to be processed by the storage device currently, the expansion operation program is started, and the expansion operation program can also be interrupted or paused by newly received read and write instructions.
[0076] In addition, for the deletion operation involved in the expansion step, as described above, direct deletion can also be adopted, or after marking, wait for the garbage collection mechanism to perform unified deletion processing on it.
[0077] In another embodiment, preferably, in step S3, the time difference is calculated in units of days, and its calculation formula is:
[0078] P = DATEDIF(A1, TODAY(), "D")
[0079] Wherein, A1 is the writing time of the file data, TODAY() is the current time when reading the file data, and "D" is calculated in units of the number of days in the time period.
[0080] In another embodiment, preferably, in step S3, the time difference is calculated in units of months, and its calculation formula is:
[0081] P = DATEDIF(A1, TODAY(), "M")
[0082] Wherein, A1 is the writing time of the file data, TODAY() is the current time when reading the file data, and "M" is calculated in units of the number of months in the time period.
[0083] Specifically, P is set as the time difference, which can be calculated using the DATEDIF function. Thus, when reading the first data, the time difference between the writing time of the file data and the current time can be obtained. The specific calculation process of the DATEDIF function is to subtract the writing time from the current time, and then divide the obtained value by the calculation unit to get the time difference. For example, if the obtained value is in hours and the calculation unit is days, the number of hours can be divided by 24 and then rounded down to get the number of days of the time difference. For example, if the obtained value is in days and the calculation unit is months, the number of days can be divided by 30 and then rounded down to get the number of months of the time difference.
[0084] In another embodiment, preferably, the present invention further provides a data storage device for flash memory units to extend the service life of solid-state memories, including the following modules:
[0085] A writing module, configured to receive the file data to be written transmitted from an external host, write it into the first storage unit to form the first data, record the writing time, and at the same time point the mapping relationship of the file data to the first data;
[0086] A reading module, configured to read the first data from the first storage unit according to the mapping relationship of the file data to form the file data to be read, and send it to the external host for use;
[0087] A judgment module, configured to calculate the time difference between the current time when the first data is read and the writing time, and judge whether the time difference reaches a certain threshold;
[0088] A transfer module, configured to, if the time difference reaches a certain threshold, write the first data into the second storage unit to form the second data, and update the mapping relationship of the file data to point to the second data, so that subsequent reading operations on the file data are performed from the second data in the second storage unit.
[0089] In another embodiment, preferably, an update module is further included, configured to receive the update and modification of the file data from the external host, write the modified file data into the first storage unit to form the third data, update and modify its writing time, and at the same time update the mapping relationship of the file data to point to the third data, so that subsequent reading operations on the file data are performed from the third data in the first storage unit.
[0090] In another embodiment, preferably, an expansion module is further included, configured to, when the remaining available capacity of the first storage unit is less than the first threshold, write the file data written into the first storage unit earliest into the second storage unit to form the second data, and at the same time update the mapping relationship of the file data to point to the second data, so that subsequent reading operations on the file data are performed from the second data in the second storage unit; and delete the first data in the corresponding first storage unit.
[0091] The present invention also provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the data storage method of a flash memory cell described in any one of the above.
[0092] The present invention also provides a solid-state storage device, including: a flash memory chip, in which at least two types of memory cells with different P / E times are used to store data respectively; a transmission interface for connecting the storage device to an external host system and transmitting data; and a controller, electrically connected to the flash memory chip and the transmission interface respectively, and executing the data storage method of a flash memory cell described in any one of the above on the flash memory chip.
[0093] Specifically, the flash memory chip can use at least two of the SLC, MLC, TLC, QLC or PLC types of memory cells to store data; the P / E cycle is the programming / erasing cycle of the memory cell. In short, P is Program (programming), E is Erease (erasing), and 1 P / E represents that a certain amount of flash memory is erased once. Since flash memory must be erased before it can be rewritten (this is essentially different from a mechanical hard disk), the P / E times can also indicate the lifespan of the flash memory. For example, a very common statement is that TLC has 1000 P / E cycles, which means that the storage blocks in TLC flash memory will become invalid after being written and erased approximately 1000 times. And QLC is approximately 150 P / E cycles.
[0094] For example, in a storage device, 100GB of SLC or MLC flash memory with a high write speed and long lifespan can be set as the first storage unit, and more than 1000GB of TLC, QLC or PLC flash memory with a low write speed and short lifespan can be set as the second storage unit. When a user needs to perform a write operation, the file data is first written to the first storage unit with a high write speed and long lifespan, and within a certain period of time, it is always stored in the first storage unit, that is, the read and write operations of the file data are both performed in the first storage unit.
[0095] Only after a certain period of time, when the user has not changed the file data in the first storage unit again, the file data is transferred to the second storage unit with a low write speed, short lifespan and large capacity. And the file data in the second storage unit only allows the user to perform read operations and cannot be updated or modified. All updates or modifications are performed in the first storage unit. Therefore, the erasing or writing operations on the second storage unit can be minimized, thereby improving the service life of the second storage unit. At the same time, the read speed of the second storage unit is not much different from the read speed of the first storage unit, so it will not affect the user experience when reading file data.
[0096] It can be understood that other existing technologies that are beneficial to improving the reading and writing speed or extending the service life of the storage device itself, such as DRAM caches, etc., can also be set. However, only when storing data inside the storage chip, the storage method provided by the present invention is used to further extend the service life of the storage chip.
[0097] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above-described exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be embraced within the present invention.
Claims
1. A data storage method for flash memory cells, used to extend the service life of a solid-state memory, characterized in that, The solid-state memory includes at least two types of storage units with different erasing and writing lifetimes, and the erasing and writing lifetime of the first storage unit is greater than that of the second storage unit, and the capacity of the second storage unit is greater than that of the first storage unit. The first storage unit is dedicated to receiving write, read, and update modification operations from an external host, and the second storage unit is dedicated to read operations from the external host and transfer operations within the storage device. The data storage method includes the following steps: S1. Receive the file data to be written transmitted by the external host, write it into the first storage unit to form the first data, record the writing time, and at the same time point the mapping relationship of the file data to the first data; S2. According to the mapping relationship of the file data, read the first data from the first storage unit to form the file data to be read, and send it to the external host for use; S3. Calculate the time difference between the current time when reading the first data and the writing time, and determine whether the time difference reaches a certain threshold; S4. If the time difference reaches a certain threshold, write the first data into the second storage unit to form the second data, and update the mapping relationship of the file data to point it to the second data, so that subsequent read operations on the file data are performed from the second data in the second storage unit; S5. Receive the update modification of the file data from the external host, write the modified file data into the first storage unit to form the third data, update and modify its writing time, and at the same time update the mapping relationship of the file data to point it to the third data, so that subsequent read operations on the file data are performed from the third data in the first storage unit.
2. The data storage method of a flash memory cell according to claim 1, characterized in that, When the remaining available capacity of the first storage unit is less than the first threshold, write the file data written into the first storage unit earliest into the second storage unit to form the second data, and at the same time update the mapping relationship of the file data to point it to the second data, so that subsequent read operations on the file data are performed from the second data in the second storage unit.
3. A data storage method for a flash memory cell according to claim 1, characterized in that, In step S3, the calculation of the time difference is carried out in units of days, and its calculation formula is: P = DATEDIF(A1, TODAY(), "D"), where A1 is the writing time of the file data, TODAY() is the current time when reading the file data, and "D" is calculated in units of the number of days in the time period.
4. A data storage method for a flash memory cell according to claim 1, characterized in that, In step S3, the calculation of the time difference is carried out in units of months, and its calculation formula is: P = DATEDIF(A1, TODAY(), "M"), where A1 is the writing time of the file data, TODAY() is the current time when reading the file data, and "M" is calculated in units of the number of months in the time period.
5. A data storage device for a flash memory cell, used to extend the service life of a solid-state memory, characterized in that, The solid-state memory includes at least two types of storage units with different erasing and writing lifetimes, and the erasing and writing lifetime of the first storage unit is greater than that of the second storage unit, and the capacity of the second storage unit is greater than that of the first storage unit. The first storage unit is dedicated to receiving write, read, and update modification operations from an external host, and the second storage unit is dedicated to read operations from the external host and transfer operations within the storage device. The data storage device includes the following modules: A writing module, configured to receive the data of the file to be written transmitted by an external host, write it into a first storage unit to form first data, record the writing time, and at the same time point the mapping relationship of the file data to the first data; A reading module, configured to read the first data from the first storage unit according to the mapping relationship of the file data to form the data of the file to be read, and send it to the external host for use; A judging module, configured to calculate the time difference between the current time when the first data is read and the writing time, and judge whether the time difference reaches a certain threshold; A transfer storage module, configured to, if the time difference reaches a certain threshold, write the first data into a second storage unit to form second data, and update the mapping relationship of the file data to point it to the second data, so that subsequent reading operations on the file data are performed from the second data in the second storage unit; It further includes an updating module, configured to receive the update modification of the file data by the external host, write the modified file data into the first storage unit to form third data, update and modify its writing time, and at the same time update the mapping relationship of the file data to point to the third data, so that subsequent reading operations on the file data are performed from the third data in the first storage unit.
6. A data storage device for a flash memory cell according to claim 5, characterized in that, It further includes an expansion module, configured to, when the remaining available capacity of the first storage unit is less than a first threshold, write the file data written into the first storage unit earliest into the second storage unit to form second data, and at the same time update the mapping relationship of the file data to point to the second data, so that subsequent reading operations on the file data are performed from the second data in the second storage unit.
7. A storage medium, characterized in that, A computer program is stored thereon, and when the computer program is executed by a processor, it implements a data storage method for a flash memory cell according to any one of claims 1 to 4.
8. A solid-state storage device, characterized in that, Comprising: A flash memory chip, in which at least two types of storage units with different P / E times are used to store data respectively; A transmission interface, configured to connect the storage device to an external host system and transmit data; And a controller, electrically connected to the flash memory chip and the transmission interface respectively, and executing a data storage method for a flash memory cell according to any one of claims 1 to 4 on the flash memory chip.
Citation Information
Patent Citations
A method for storing data and an electronic device
CN103677654B
Data writing method and system
CN103902226B
Data storage method, flash memory chip and storage device
CN106598484A
File storage system capable of preventing file fragmentation
CN110609817A