A method, apparatus, and medium for cold and hot data storage
By obtaining the timestamp and logical block address from the solid-state drive and querying the hot and cold attribute table, the cold and hot data can be stored separately, solving the write amplification and wear problems and improving garbage collection efficiency.
Patent Information
- Application Number
- CN202310232061.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-03-10
AI Technical Summary
In existing technologies, solid-state drives (SSDs) suffer from severe write amplification and NAND flash wear when storing hot and cold data together, resulting in low garbage collection efficiency.
By obtaining the timestamp and logical block address of the solid-state drive, querying the hot/cold attribute table, and storing user data in the corresponding storage location according to the hot/cold attribute, the separation of hot and cold data is achieved.
It reduces write amplification, decreases NAND Flash wear, and improves garbage collection efficiency.
Smart Images

Figure CN116225334B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, in particular to a hot and cold data storage method and device and medium. BACKGROUND
[0002] Solid State Disk or Solid State Drive (SSD) is a hard disk made of solid-state electronic storage chip array. It usually stores data with NAND Flash. NAND Flash memory block must be erased as a whole before writing data. After erasing, additional writing can be processed. The minimum granularity of NAND Flash writing is Page. Each flash memory block is composed of a series of pages. When the block is erased, it is in an empty state (Empty). When all the pages in the block are written, the flash memory block is full (Full). If the flash memory block is full, it cannot receive new writing. It must be erased as a whole before it can receive new writing.
[0003] The FTL of SSD uses the L2P mapping table to map the LBA (Logic Block Address) into the PPA (Physical Page Address). Because the flash memory block itself cannot overwrite, when an overwrite of LBA occurs, the FTL marks the old data as invalid and appends the new data to the flash memory block, and then modifies the L2P mapping table of the FTL. The access to LBA has randomness, which will cause all flash memory blocks of the SSD to contain both valid data and invalid data. When there is new writing, the valid data pages in a data block must be read out, then the selected data block is erased to release space, and then the valid data and new data are written to a new block. This process is the garbage collection (GC) of the SSD. In order to write user data, the SSD must use additional writing, which produces write amplification. Especially when cold data and hot data are mixed, the frequent writing of hot data will produce write amplification and cause wear and tear to the NAND Flash.
[0004] Therefore, how to separate cold and hot data, reduce the write amplification of the SSD, reduce the wear and tear of the NAND Flash, and improve the garbage collection efficiency is a problem that needs to be solved by those skilled in the art. SUMMARY
[0005] The purpose of the present application is to provide a hot and cold data storage method and device and medium for separating cold and hot data, reducing the write amplification of the SSD, reducing the wear and tear of the NAND Flash, and improving the garbage collection efficiency.
[0006] To solve the above technical problems, the application provides a cold and hot data storage method, comprising:
[0007] When a write command is received, a timestamp of the current solid state disk is obtained;
[0008] The timestamp, the logical block address corresponding to the write command and the user data in the write command are saved together;
[0009] The cold and hot attribute of the user data is obtained by querying the logical block address cold and hot attribute table;
[0010] The user data is stored in the corresponding storage location according to the cold and hot attribute.
[0011] Preferably, the method further comprises:
[0012] When valid data needing to be recycled is read, the timestamp and the logical block address corresponding to the write command saved at the same time as the valid data are obtained;
[0013] The timestamp is compared with the current timestamp;
[0014] It is judged whether the calculated time difference value is greater than a threshold value;
[0015] If yes, the valid data is confirmed as cold data;
[0016] If no, the valid data is confirmed as hot data.
[0017] Preferably, the logical block address cold and hot attribute table is an attribute table created when the solid state disk is powered on for the first time, and the storage data corresponding to the logical block address cold and hot attribute table are all hot data; when not powered on for the first time, the logical block address cold and hot attribute table saved when powered off last time is restored.
[0018] Preferably, the method further comprises:
[0019] Data with the same cold and hot attribute are moved to the same block.
[0020] Preferably, the method of storing the user data in the corresponding storage location according to the cold and hot attribute comprises:
[0021] According to the cold and hot attribute, a cache management block with a corresponding attribute is applied;
[0022] The user data is sent to a write processing unit through the cache management block;
[0023] The user data is written into the memory through the write processing unit.
[0024] Preferably, the time difference value is calculated as follows: the time difference is calculated in the unit of the time required to fill the disk once.
[0025] Further, the judging whether the calculated time difference value is greater than a threshold value comprises: judging whether a granularity of calculating the time difference is greater than two unit granularities, if yes, confirming that the valid data is cold data;
[0026] if no, confirming that the valid data is hot data.
[0027] Preferably, when confirming that the valid data is cold data, setting a logical block address cold and hot attribute table;
[0028] when confirming that the valid data is hot data, clearing the logical block address cold and hot attribute table.
[0029] To solve the above technical problems, the present application further provides a cold and hot data storage device, comprising:
[0030] an acquisition module, configured to acquire a time stamp of a current solid state disk when receiving a write command;
[0031] a saving module, configured to save the time stamp and a logical block address corresponding to the write command and user data in the write command together;
[0032] a query module, configured to query a logical block address cold and hot attribute table to acquire a cold and hot attribute of the user data;
[0033] a storage module, configured to store the user data into a corresponding storage location according to the cold and hot attribute.
[0034] To solve the above technical problems, the present application further provides another cold and hot data storage device, comprising a memory, configured to store a computer program;
[0035] a processor, configured to execute the computer program to realize steps of the cold and hot data storage method as described above.
[0036] To solve the above technical problems, the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize steps of the cold and hot data storage method as described above.
[0037] The cold and hot data storage method provided in the application, when receiving a write command, acquires a timestamp of a current solid state disk; saves the timestamp, a logical block address corresponding to the write command and user data in the write command together; queries a logical block address cold and hot attribute table to acquire a cold and hot attribute of the user data; and stores the user data into a corresponding storage location according to the cold and hot attribute. Compared with the current technology, the mixed storage of cold and hot data in the memory causes the generation of write amplification. By using the technical solution, when writing data, the timestamp, the logical block address corresponding to the write command and the user data in the write command are saved together, the cold and hot attribute of the user data in the write command is confirmed by querying the logical block address cold and hot attribute table, and the user data is stored into the corresponding storage location according to the cold and hot attribute, thereby reducing the write amplification. Moreover, the cold and hot data are stored separately, which can also reduce the memory wear and improve the garbage collection efficiency when performing garbage collection.
[0038] In addition, the cold and hot data storage device and medium provided in the application, when receiving a write command, acquires a timestamp of a current solid state disk; saves the timestamp, a logical block address corresponding to the write command and user data in the write command together; queries a logical block address cold and hot attribute table to acquire a cold and hot attribute of the user data; and stores the user data into a corresponding storage location according to the cold and hot attribute. Compared with the current technology, the mixed storage of cold and hot data in the memory causes the generation of write amplification. By using the technical solution, when writing data, the timestamp, the logical block address corresponding to the write command and the user data in the write command are saved together, the cold and hot attribute of the user data in the write command is confirmed by querying the logical block address cold and hot attribute table, and the user data is stored into the corresponding storage location according to the cold and hot attribute, thereby reducing the write amplification. Moreover, the cold and hot data are stored separately, which can also reduce the memory wear and improve the garbage collection efficiency when performing garbage collection. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0040] Figure 1 A flow chart of a cold and hot data storage method provided for the embodiments of the application;
[0041] Figure 2 A structure diagram of a cold and hot data storage device provided for the embodiments of the application;
[0042] Figure 3 A structure diagram of another cold and hot data storage device provided for the embodiments of the application. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative effort belong to the protection scope of the present application.
[0044] A solid state disk (SSD) is a hard disk made of an array of solid state electronic storage chips. It usually stores data by using NAND Flash. A NAND Flash memory block must be erased as a whole before writing data. After erasing, the block can process additional writing. The minimum granularity of NAND Flash writing is a page. Each memory block is composed of a series of pages. When the block is erased, it is in an empty state. When all the pages in the block are written, the block is full. If the block is full, it cannot receive new writing. After erasing the block as a whole, it can receive new writing.
[0045] The FTL of the SSD maps an LBA (Logic Block Address) into a PPA (Physical Page Address) by using an L2P mapping table. Because the memory block itself cannot overwrite, when an LBA is overwritten, the FTL marks the old data as invalid, appends new data to the memory block, and then modifies the L2P mapping table of the FTL. The access to the LBA has randomness, which causes all the memory blocks of the SSD to contain both valid data and invalid data. When there is new writing, a data block must be selected, the valid data pages in the data block are read out, the selected data block is erased to release space, and the valid data and new data are written to a new block. This process is garbage collection (GC) of the SSD. In order to write user data, the SSD must use additional writing, which causes write amplification. Especially when cold data and hot data are mixed, the frequent writing of the hot data causes write amplification and wears the NAND Flash.
[0046] Therefore, how to separate cold data and hot data, reduce the write amplification of the SSD, reduce the wear of the NAND Flash, and improve the garbage collection efficiency is a problem to be solved by those skilled in the art.
[0047] The core of the present application is to provide a hot and cold data storage method, device and medium, for realizing the separation of hot and cold data, reducing the write amplification of SSD, reducing the wear of Nansdflash, and improving the garbage collection efficiency.
[0048] In order to make the person skilled in the art better understand the scheme of the present application, the present application will be further described in detail below in combination with the drawings and specific embodiments.
[0049] Figure 1 A flowchart of a hot and cold data storage method provided by an embodiment of the present application is shown in Figure 1 The method comprises the following steps.
[0050] S10: When a write command is received, obtaining the timestamp of the current solid state disk;
[0051] S11: Saving the timestamp, the logical block address corresponding to the write command, and the user data in the write command together;
[0052] S12: Querying the logical block address cold and hot attribute table to obtain the cold and hot attribute of the user data;
[0053] S13: Storing the user data in the corresponding storage location according to the cold and hot attribute.
[0054] Cold data is simply data that is accessed less frequently over a period of time and has a relatively small probability of being accessed in the next period of time. On the contrary, hot data is data that is accessed more frequently over a period of time and has a relatively large probability of being accessed in the next period of time. The judgment of cold and hot data is mostly based on two standards, the frequency of access and the timeliness of access. The more frequently a data is accessed in a period of time, the more we logically consider it as hot data. The more close to the current time point the accessed data is, the more we can consider it as hot data to some extent. Because most application scenarios have temporal and spatial locality (especially for the computer field), the current accessed data has a relatively large probability of being accessed next.
[0055] In the present application, the logical block address cold and hot attribute table is an attribute table created when the solid state disk is powered on for the first time, and the storage data corresponding to the logical block address cold and hot attribute table are all hot data; when not powered on for the first time, the logical block address cold and hot attribute table saved last time when powered off is restored. When the solid state disk is powered on for the first time, the LBA cold and hot attribute table is created, one LBA uses 1 bit to represent, 1b represents cold data, and 0b represents hot data. When powered on for the first time, the table item content is assigned an initial value of 0, that is, all LBAs are hot data. When powered off, the table is saved. When powered on for the first time, the LBA cold and hot attribute table saved last time when powered off is restored.
[0056] A logical block address is a universal mechanism for describing the location of data on a computer storage device, typically used with secondary storage devices such as hard disks. LBA can mean either the address of a block of data or the block of data to which an address refers. A so-called logical block on a computer today is usually 512 or 1024 bytes. A standard CD in ISO-9660 format has a logical block size of 2048 bytes.
[0057] When using a mechanical hard disk, the file system can directly write new data to the location where old data is stored, i.e. directly overwriting the old data. In a solid state disk, the situation is different. If you want to write new data to a block storing useless data, you need to delete the entire block first, and then write new data, i.e. the solid state disk does not have the ability to directly overwrite old data. For a solid state disk, garbage collection refers to the process of moving existing data to other flash memory locations and completely deleting some useless data. Data is written in units of pages, but to delete data requires units of blocks. Therefore, to delete useless data, the solid state disk first needs to copy and paste the useful data in a block to the pages in a brand new block, so that the useless data contained in the original block can be deleted in units of blocks. After deletion, new data can be written, but new data cannot be written before erasure.
[0058] When writing new data, if the SSD controller cannot find a page to write, it will perform a GC process, and then the GC mechanism will merge the valid data in some blocks and write them to other blocks, then erase the invalid data in these blocks, and then write new data to these blocks. During the entire process, in addition to writing the user's data, the SSD also writes some other block-merged data, so this is called write amplification.
[0059] When a file is deleted in an operating system (such as Windows), the operating system only marks the file as deleted in its internal file table. Since NAND flash devices cannot overwrite existing data, on a solid state disk SSD, the current invalid data is still retained on the hard disk.
[0060] This will generate a large amount of invalid data, also known as data garbage. In order to improve the utilization efficiency of the SSD, it is time to "garbage collection" (Garbage Collection, GC).
[0061] The GC process is that the SSD controller first copies all valid data (data still in use) and writes it to the blank pages of a different data area, erases all data units in the current data area, and then starts writing new data to the data area just erased.
[0062] In the embodiment, when the garbage collection mechanism is triggered, the LBA and the timestamp of the data to be collected are obtained while reading the valid data to be collected, the timestamp is compared with the current SSD timestamp, and the granularity of the time difference is calculated in units of the time for writing a full disk once. When the time difference is greater than two unit granularities, the data is considered to be cold data, and the LBA hot and cold attribute table is set. Otherwise, the LBA hot and cold attribute table is cleared.
[0063] The cold and hot data storage method provided in the embodiment receives a write command, obtains a timestamp of a solid state disk, saves the timestamp, a logical block address corresponding to the write command, and user data in the write command together, queries an LBA hot and cold attribute table to obtain a hot and cold attribute of the user data, and stores the user data in a corresponding storage location according to the hot and cold attribute. In the prior art, the mixed storage of cold and hot data in a memory causes write amplification. In the technical solution, the timestamp, the logical block address corresponding to the write command, and the user data in the write command are saved together when writing data, the hot and cold attribute of the user data in the write command is confirmed by querying the LBA hot and cold attribute table, and the user data is stored in the corresponding storage location according to the hot and cold attribute, thereby reducing write amplification. In addition, the cold and hot data are stored separately, which can also reduce memory wear and improve garbage collection efficiency.
[0064] In a specific implementation, when the garbage collection mechanism is triggered, the cold and hot data storage method provided in the embodiment further includes: obtaining a timestamp and a logical block address corresponding to a write command saved at the same time as valid data when the valid data to be collected is read; comparing the timestamp with a current timestamp; determining whether a calculated time difference value is greater than a threshold value; if yes, confirming that the valid data is cold data and setting an LBA hot and cold attribute table; if no, confirming that the valid data is hot data and clearing the LBA hot and cold attribute table. In addition, when the valid data is confirmed to be cold data, the LBA hot and cold attribute table is set; and when the valid data is confirmed to be hot data, the LBA hot and cold attribute table is cleared. Specifically, the time difference value is calculated in units of the time for writing a full disk once, and the granularity of the time difference is calculated. Further, determining whether the calculated time difference value is greater than the threshold value includes: determining whether the granularity of the time difference is greater than two unit granularities, if yes, confirming that the valid data is cold data; and if no, confirming that the valid data is hot data.
[0065] On the basis of the above-mentioned embodiments, in the present embodiment, data with the same cold and hot attribute is moved to the same block. The storing the user data into the corresponding storage location according to the cold and hot attribute comprises: applying a cache management block of the corresponding attribute according to the cold and hot attribute; sending the user data to the write processing unit through the cache management block; and writing the user data into the memory through the write processing unit. When moving the data, the data with the same cold and hot attribute is written into the same block, and only the data with the same attribute is saved in the same block, so as to ensure the separation of cold and hot data. When storing the data, the LBA cold and hot attribute table is queried to obtain the cold and hot attribute, and a cache management block (CCB) of the corresponding attribute is applied, and the data in one CCB can only be of the same cold and hot attribute, and then sent to the write processing module (WM) for writing into the Nandflash.
[0066] In the above-mentioned embodiments, the cold and hot data storage method is described in detail, and the present application also provides a corresponding embodiment of the cold and hot data storage device. It should be noted that the embodiments of the device part are described from two angles, one is based on the functional module, and the other is based on the hardware.
[0067] Figure 2 A structure diagram of a cold and hot data storage device provided in the embodiments of the present application is shown in FIG. 1, which comprises: Figure 2
[0068] The obtaining module 10 is configured to obtain the time stamp of the current solid state disk when receiving the write command.
[0069] The saving module 11 is configured to save the time stamp, the logical block address corresponding to the write command and the user data in the write command together.
[0070] The querying module 12 is configured to query the LBA cold and hot attribute table to obtain the cold and hot attribute of the user data.
[0071] The storage module 13 is configured to store the user data into the corresponding storage location according to the cold and hot attribute.
[0072] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part are described in the description of the embodiments of the method part, which will not be described here.
[0073] The cold and hot data storage device provided by the embodiments of the present application acquires the timestamp of the current solid state disk when receiving a write command; saves the timestamp, the logical block address corresponding to the write command and the user data in the write command together; queries the cold and hot attribute table of the logical block address to acquire the cold and hot attribute of the user data; and stores the user data into the corresponding storage location according to the cold and hot attribute. In the current technology, the mixed storage of the cold and hot data in the memory causes the generation of write amplification. In the present technical solution, when writing data, the timestamp, the logical block address corresponding to the write command and the user data in the write command are saved together, the cold and hot attribute of the user data in the write command is confirmed by querying the cold and hot attribute table of the logical block address, and the user data is stored into the corresponding storage location according to the cold and hot attribute, thereby reducing the write amplification. In addition, the cold and hot data are stored separately, which can also reduce the memory wear and improve the garbage collection efficiency when performing garbage collection.
[0074] Figure 3 The structure diagram of another cold and hot data storage device provided by the embodiments of the present application is shown in FIG. 2, which comprises a memory 20 for storing a computer program. Figure 3
[0075] A processor 21 is used to execute the computer program to realize the steps of the cold and hot data storage method of the above embodiments.
[0076] The cold and hot data storage device provided by the embodiments of the present application can include but is not limited to a smart phone, a tablet computer, a notebook computer or a desktop computer, etc.
[0077] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0078] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the cold and hot data storage method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, user data.
[0079] In some embodiments, the cold and hot data storage device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0080] Those skilled in the art will understand that Figure 3 The structure shown does not constitute a limitation on cold and hot data storage devices and may include more or fewer components than shown.
[0081] The cold and hot data storage device provided by the embodiments of the present application comprises a memory and a processor. When the processor executes the program stored in the memory, the following method can be implemented: when a write command is received, a timestamp of a current solid state disk is acquired; the timestamp, a logical block address corresponding to the write command and user data in the write command are saved together; a cold and hot attribute table of the logical block address is queried to acquire a cold and hot attribute of the user data; and the user data is stored in a corresponding storage location according to the cold and hot attribute.
[0082] The cold and hot data storage device provided by the embodiments of the present application comprises a memory and a processor. When the processor executes the program stored in the memory, the following method can be implemented: when a write command is received, a timestamp of a current solid state disk is acquired; the timestamp, a logical block address corresponding to the write command and user data in the write command are saved together; a cold and hot attribute table of the logical block address is queried to acquire a cold and hot attribute of the user data; and the user data is stored in a corresponding storage location according to the cold and hot attribute. Compared with the current technology, the mixed storage of cold and hot data in the memory causes the generation of write amplification. In the present technical solution, when data is written, the timestamp, the logical block address corresponding to the write command and the user data in the write command are saved together. The cold and hot attribute of the user data in the write command is confirmed by querying the cold and hot attribute table of the logical block address. The user data is stored in a corresponding storage location according to the cold and hot attribute, thereby reducing the write amplification. In addition, the cold and hot data is stored separately, which can also reduce the wear of the memory and improve the garbage collection efficiency when garbage collection is performed.
[0083] Finally, the present application also provides an embodiment corresponding to a computer readable storage medium. The computer readable storage medium stores a computer program. When the computer program is executed by a processor, the steps recorded in the above method embodiments are implemented.
[0084] It can be understood that if the method in the above embodiments is implemented in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk and various media that can store program codes.
[0085] The computer readable storage medium provided by the embodiments of the present application, when receiving a write command, acquires a timestamp of a current solid state disk; saves the timestamp, a logical block address corresponding to the write command and user data in the write command together; queries a logical block address hot and cold attribute table to acquire a hot and cold attribute of the user data; and stores the user data into a corresponding storage location according to the hot and cold attribute. In the current technology, the mixed storage of hot and cold data in the memory causes the generation of write amplification. In the present technical solution, when writing data, the timestamp, the logical block address corresponding to the write command and the user data in the write command are saved together, the hot and cold attribute of the user data in the write command is confirmed by querying the logical block address hot and cold attribute table, and the user data is stored into the corresponding storage location according to the hot and cold attribute, thereby reducing the write amplification. In addition, the hot and cold data are stored separately, which can also reduce the memory wear and improve the garbage collection efficiency when performing garbage collection.
[0086] The hot and cold data storage method, device and medium provided by the present application are described in detail above. The embodiments in the specification are described in a progressive manner, and each embodiment mainly describes the difference from other embodiments. The same or similar parts of each embodiment can be referred to. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the related parts can be referred to the method part. It should be pointed out that, for ordinary skilled in the art, without departing from the principles of the present application, the present application can be improved and modified in several ways, and these improvements and modifications also fall within the protection scope of the claims of the present application.
[0087] It should also be noted that in the present specification, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
Claims
1. A method for storing cold and hot data, characterized in that, include: When a write command is received, obtain the current timestamp of the solid-state drive; Save the timestamp, the logical block address corresponding to the write command, and the user data in the write command together; Query the logical block address hot / cold attribute table to obtain the hot / cold attribute of the user data; The user data is stored in the corresponding storage location according to the hot / cold attribute. The logical block address hot / cold attribute table is an attribute table created when the solid-state drive is first powered on. One LBA is represented by 1 bit, where 1b represents cold data and 0b represents hot data. When the solid-state drive is first powered on, the stored data corresponding to the logical block address hot / cold attribute table is all hot data. The logical block address hot / cold attribute table is saved when the solid-state drive is powered off. When the solid-state drive is powered on normally for the first time, the logical block address hot / cold attribute table saved when the solid-state drive was powered off is restored.
2. The cold and hot data storage method according to claim 1, characterized in that, Also includes: When valid data that needs to be reclaimed is read, the timestamp and the logical block address corresponding to the write command, which are saved at the same time as the valid data, are obtained. Compare the timestamp with the current timestamp; Determine whether the calculated time difference is greater than the threshold. If so, then the valid data is confirmed to be cold data; If not, then the valid data is confirmed to be hot data.
3. The cold and hot data storage method according to claim 1, characterized in that, Also includes: Move data with the same hot / cold properties into the same block.
4. The cold and hot data storage method according to claim 1, characterized in that, The step of storing the user data into the corresponding storage location according to the hot / cold attribute includes: Request a cache management block with the corresponding attribute based on the hot / cold attribute; The user data is sent to the write processing unit through the cache management block; The user data is written to the memory through the write processing unit.
5. The cold and hot data storage method according to claim 2, characterized in that, The calculation of time difference is based on the granularity of the time taken to write a full disk. Furthermore, determining whether the calculated time difference value is greater than the threshold includes: determining whether the granularity of the calculated time difference is greater than two unit granularities; if it is greater, then the valid data is confirmed to be cold data. If the value is not greater than the specified value, then the valid data is confirmed as hot data.
6. The cold and hot data storage method according to claim 2, characterized in that, When the valid data is confirmed to be cold data, the logical block address cold / hot attribute table is set. When the valid data is confirmed to be hot data, the logical block address hot / cold attribute table is cleared.
7. A cold and hot data storage device, characterized in that, include: The acquisition module is used to obtain the current timestamp of the solid-state drive when a write command is received; The storage module is used to save the timestamp, the logical block address corresponding to the write command, and the user data in the write command together. The query module is used to query the logical block address hot / cold attribute table to obtain the hot / cold attributes of the user data; The storage module is used to store the user data into the corresponding storage location according to the hot / cold attribute; The logical block address hot / cold attribute table is an attribute table created when the solid-state drive is first powered on. One LBA is represented by 1 bit, where 1b represents cold data and 0b represents hot data. When the solid-state drive is first powered on, the stored data corresponding to the logical block address hot / cold attribute table is all hot data. The logical block address hot / cold attribute table is saved when the solid-state drive is powered off. When the solid-state drive is powered on normally for the first time, the logical block address hot / cold attribute table saved when the solid-state drive was powered off is restored.
8. A cold and hot data storage device, characterized in that, Includes memory used to store computer programs; A processor, configured to implement the steps of the cold and hot data storage method as described in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the cold and hot data storage method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for cold-hot data discrimination management in flash memory device
CN103246609A