Data storage method, controller and system for nvm and ssd
By combining static address mapping and dynamic request scheduling with NVM-buffer and I/O thread pool, the hybrid storage system of NVM and SSD is optimized, solving the problem that existing technologies cannot simultaneously leverage the performance advantages of both, thus achieving performance improvement and cost reduction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2026-03-27
AI Technical Summary
Existing hybrid storage systems for NVM and SSDs over-utilize NVM, ignoring the advantages of SSDs in high write throughput and cost-effectiveness, and failing to leverage the performance advantages of both simultaneously.
Static address mapping and dynamic request scheduling are used to map data and metadata to NVM and SSD respectively. NVM-buffer is used to cache lowercase requests, and I/O request processing is optimized through I/O thread pool and data migration mechanism. The number of threads accessing NVM concurrently is limited, and the performance characteristics of NVM and SSD are made reasonable.
It improves the overall performance of the hybrid storage system, balances the performance preferences of NVM and SSD, reduces system costs, improves data query efficiency, and avoids the impact of data migration on I/O performance.
Smart Images

Figure CN116009776B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of computer system structure, and more particularly, relates to a data storage method, controller and system for NVM and SSD. BACKGROUND
[0002] Non-volatile memory (NVM) is expected to have performance close to memory, support byte addressing and disk-like persistence ability, but after the first commercial NVM, Intel Optane DC Persistent Memory, it was found that in the persistent mode, the read and write bandwidth and delay were far lower than the memory, and showed significant asymmetry, with read and write bandwidth of 6.6 GB / s and 2.3 GB / s, respectively, and read and write delay of 1.2 us and 1.7 us, respectively. When the I / O size exceeds 128KiB, the write bandwidth of NVM is even lower than the existing SSD, about 3.5GiB / s. In addition, the write parallelism of NVM is limited, and when the data is greater than or equal to 4KiB, the write thread number reaches the peak throughput, and then the throughput will decrease significantly with the increase of the number of threads.
[0003] In recent years, solid state drives (SSD) based on Nand flash particles have made great progress in capacity and performance, especially the recently launched NVMe-SSD using NVMe protocol, which can achieve a delay of ten microseconds and a bandwidth of GB level. Of course, it also has the disadvantages of limited erase life, misalignment update, garbage collection and read-write asymmetry.
[0004] The existing hybrid storage system for NVM and SSD generally has better performance based on NVM, but smaller capacity and higher price, and lower performance of SSD, but larger capacity and cheaper price. Considering the above, the NVM and SSD are used at the same time by redesigning the file system or cache system. For example, the design of Strata is to write all data directly to the upper NVM, and then migrate cold data to the lower large-capacity SSD; Ziggurat further optimizes this basis and selectively sends asynchronous or large write requests to the lower SSD to optimize performance; in addition, FirstResponder adds NVM as cache to the existing file system, and absorbs all file system requests at the top of the I / O stack.
[0005] The above hybrid storage system for NVM and SSD has good performance, but has the problem of overusing the upper NVM, and ignoring the advantages of the lower SSD in large write throughput and cost performance, which cannot simultaneously exert the performance advantages of NVM and SSD. SUMMARY
[0006] In order to overcome the defects of the prior art and improve the performance of the hybrid storage system, the present application provides a data storage method, controller and system for NVM and SSD, which aims to improve the architecture of the hybrid storage system and maximize the performance of NVM and SSD devices, thereby effectively improving the overall performance of the hybrid storage system.
[0007] To achieve the above-mentioned purpose, according to one aspect of the present application, a data storage method for NVM and SSD is provided, comprising: static address mapping and dynamic request scheduling.
[0008] The static address mapping comprises: providing a unified linear logical address space, the linear logical address space is divided into a region NVM-zone mapped to the NVM device and a region SSD-zone mapped to the SSD device; the metadata and the file data are respectively mapped to the region NVM-zone and the region SSD-zone.
[0009] The dynamic request scheduling comprises: dividing a space from the NVM device as a NVM-buffer, and for the file data mapped to the region SSD-zone, performing the following operations:
[0010] If the system is not currently in a small write-intensive load scenario, and the request is a small write request, the data is cached in the NVM-buffer, and the target address of the data in the SSD device and the cache address are recorded; otherwise, the data is directly written into the SSD device.
[0011] Wherein, the data requested to be written by the large write request is greater than a preset threshold, and the data written by the small write request does not exceed the threshold.
[0012] Further, the target address of the data cached in the NVM-buffer in the SSD device and the cache address thereof in the NVM-buffer are recorded in the form of a key-value pair, and the target address and the cache address are the key and the value of the key-value pair, respectively.
[0013] Further, the key-value pair is indexed by a hash table.
[0014] Further, the data storage method for NVM and SSD provided by the present application further comprises: creating an I / O thread pool composed of four I / O threads, and creating a request queue for each I / O thread.
[0015] And the execution of the request accessing the NVM device comprises:
[0016] The user thread submits the request of accessing the NVM device to the request queue of the corresponding I / O thread, the corresponding I / O thread obtains the request from the request queue in sequence and processes it, and after the processing of the request is completed, the corresponding user thread is informed.
[0017] Further, the NVM-buffer includes four segments corresponding to the four I / O threads respectively, and the data storage method for the NVM and the SSD further includes:
[0018] When a certain segment is full or a certain I / O thread is in a light load state, the data in the corresponding segment is migrated to the SSD device.
[0019] Further, the data storage method for the NVM and the SSD provided by the application further includes: maintaining a runtime metadata for each segment in the memory.
[0020] The runtime metadata includes: the target address of the data cached by the segment in the SSD device and the cache address of the data in the NVM-buffer, and a bit map; the bit map is used to record the idle state of each data block in the segment.
[0021] Further, the data storage method for the NVM and the SSD provided by the application, for the large write request Req L , the processing includes:
[0022] In the user thread, the large write request Req L is divided into sub-requests according to the logical block size, and the offset of each sub-request is taken modulo 4, and the result is taken as the number of the corresponding I / O thread; each sub-request is submitted to the request queue of the corresponding I / O thread, and the large write request Req L is submitted to the SSD device.
[0023] The I / O thread polls the corresponding request queue to obtain the sub-requests; for the sub-requests of the large write request Req L , if the data in the sub-requests has been cached in the NVM-buffer, the record information of the target address and the cache address of the data in the SSD device is deleted, and the space occupied by the data in the NVM-buffer is released.
[0024] When the user thread receives the notification that all the sub-requests are completed in the I / O thread, and the request submitted to the SSD device is also returned, the processing of the large write request Req L is completed.
[0025] Further, the application provides a data storage method for NVM and SSD, for a read request Req mapped to the SSD device, the processing includes:
[0026] In the user thread, the read request Req is divided into sub-requests according to the logical block size, and the offset of each sub-request is taken modulo 4, and the result is taken as the number of the corresponding I / O thread; each sub-request is submitted to the request queue of the corresponding I / O thread, and the corresponding data is read from the SSD device to the NVM buf buffer;
[0027] The I / O thread polls the corresponding request queue to obtain the sub-requests; for the sub-requests of the read request Req, if the data has been cached in the NVM-buffer, the corresponding data is read from the NVM-buffer to the NVM buf buffer;
[0028] When all the data reading is completed, the user thread combines the data of the SSD buf and the NVM buf and returns.
[0029] According to another aspect of the application, a storage controller is provided, including a computer readable storage medium and a processor, the computer readable storage medium is used to store a computer program; the processor is used to read the computer program stored in the computer readable storage medium, and execute the above-mentioned data storage method for NVM and SSD provided by the application.
[0030] According to still another aspect of the application, a hybrid storage system based on NVM and SSD is provided, including: NVM, SSD and the above-mentioned storage controller provided by the application.
[0031] Overall, through the above technical solutions conceived by the application, the following beneficial effects can be achieved:
[0032] (1) In the storage system application, data can be divided into two types of metadata and file data, the metadata is generally small, and the size of the file data changes with the load; the application provides a unified linear logical address space through static address mapping, and divides it into an NVM-zone region mapped to an NVM device and an SSD-zone region mapped to an SSD device, the former is used to map metadata, and the latter is used to map file data; for the file data mapped to the SSD device, the small write request in the non-small write intensive load scenario is further cached to the NVM-buffer located in the NVM through dynamic request scheduling, so that the data of the small data request can be stored to the NVM device as much as possible, and the data of the large data request is stored to the SSD device, so that the I / O request can be directed to the appropriate medium, on the basis of utilizing the performance advantage of NVM in processing small I / O, the performance advantage of SSD in processing large I / O is fully utilized, and the overall performance of the hybrid storage system is effectively improved; in addition, since the SSD has the advantages of high capacity and high cost performance, and has a good performance advantage in large I / O, the application can better balance the performance preference of NVM and SSD, improve the storage performance, and effectively reduce the system cost.
[0033] (2) The application utilizes the NVM-buffer located in the NVM to cache the file data of the small write request, in the preferred scheme thereof, the target address of the data in the SSD and the cache address of the data in the NVM-buffer are recorded in the form of key-value pairs, which can facilitate quick determination of whether the data is cached in the NVM-buffer, thereby improving the efficiency of data query; further preferably, the key-value pairs are indexed by a hash table, which can further speed up the data query speed.
[0034] (3) The NVM has the problem of limited write parallelism, and when the number of threads accessing the NVM exceeds 4, the throughput of the NVM will decrease significantly; in the preferred scheme of the application, the user threads and I / O threads are decoupled, and an I / O thread pool is additionally created, the request for accessing the NVM is submitted to the corresponding I / O thread through the inter-thread request queue via the user thread, and the I / O thread finally completes the access of the data on the NVM device. Since the number of I / O threads in the I / O thread pool is 4, through this access mode, the maximum number of concurrent threads accessing the NVM can be limited to a fixed value of 4, so as to ensure that the performance of the NVM is always in a high state.
[0035] (4) The application correspondingly proposes a mechanism for migrating the data cached in the NVM-buffer to the SSD, specifically, when a certain segment is full or the system is in a light load state, the blocks cached in the corresponding segment are written to the SSD, thereby effectively avoiding the influence of data migration on normal I / O performance. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 The data storage method for NVM and SSD provided by the embodiment of the application is shown in the schematic diagram.
[0037] Figure 2 The I / O request processing flowchart provided by the embodiment of the application is shown in the schematic diagram.
[0038] Figure 3 The data migration schematic diagram provided by the embodiment of the application is shown in the schematic diagram. DETAILED DESCRIPTION
[0039] In order to make the objectives, technical solutions and advantages of the application clearer, the application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application and do not limit the application. In addition, the technical features involved in each embodiment of the application described below can be combined with each other as long as there is no conflict.
[0040] In the application, the terms "first", "second", etc. (if any) in the application and the drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0041] Before the technical solutions of the application are described in detail, the related technical terms will be briefly introduced:
[0042] Non-volatile memory (NVM): a new type of storage medium realized by using 3DXPoint technology, which has the characteristics of no data loss after power failure, byte addressing and near-memory read-write performance.
[0043] Solid state disk (SSD): also known as solid state drive, is a hard disk made of solid state electronic storage chip array.
[0044] Block device: a type of I / O device, which stores information in fixed-size blocks, each block has its own address, and a certain length of data can be read at any location on the device.
[0045] File system: the method and data structure used by the operating system to explicitly store files on a storage device or partition; that is, the method of organizing files on a storage device.
[0046] Small request: a request with a data size not exceeding a preset threshold is called a small request.
[0047] Large request: a request with a data size exceeding a preset threshold is called a large request.
[0048] The threshold for distinguishing a large request from a small request can be determined according to the actual storage performance of a storage device, and in general, a large request and a small request are distinguished with 4KiB as the boundary. Without loss of generality, in the following embodiments, 4KiB is taken as the threshold for distinguishing a large request from a small request, that is, in the following embodiments, a request with a data size not exceeding 4KiB is called a small request, and a request with a data size exceeding 4KiB is called a large request.
[0049] To solve the technical problem that the existing hybrid storage system for NVM and SSD cannot simultaneously exert the performance advantages of NVM and SSD due to the problem that the lower SSD is ignored in the advantage of large throughput and cost performance because of excessive use of the upper NVM, the present application provides a data storage method, a controller and a system for NVM and SSD, the overall idea of which is to improve the hybrid storage architecture composed of NVM and SSD, direct I / O requests to the appropriate medium, and maximize the performance of the two storage media.
[0050] The following is an embodiment.
[0051] Embodiment 1:
[0052] A data storage method for NVM and SSD, comprising: static address mapping and dynamic request scheduling.
[0053] As shown in Figure 1 , the static address mapping in the present embodiment comprises: providing a unified linear logical address space externally, the linear logical address space is divided into a region NVM-zone mapped to an NVM device and a region SSD-zone mapped to an SSD device; metadata and file data are respectively mapped to the region NVM-zone and the region SSD-zone.
[0054] The embodiment provides a unified linear logical address space to the outside, so that the NVM and the SSD are presented as one logical block device to the outside, and the division of the zone NVM and the zone SSD in the linear logical address space can be set according to a configuration file provided by a user or set when an application is initialized. Optionally, in the embodiment, the linear logical address space provided by the hybrid storage system to the outside is 500 GiB, the file system used is an Ext4 file system, the logical address space of 0-8 GiB stores metadata, and the logical address space of 8 GiB-500 GiB stores file data. Therefore, the region of 0-8 GiB is mapped to the NVM-zone, and the region of 8 GiB-500 GiB is mapped to the SSD-zone. When a request arrives during system running, whether the current request is located in the NVM-zone or the SSD-zone in the static address mapping can be determined according to the offset of the request. Specifically, when the offset is less than 8 GiB, the requested data is considered to be metadata, and therefore the data is submitted to the NVM-zone for processing; when the offset is greater than 8 GiB, the requested data is considered to be file data, and therefore the data is submitted to the SSD-zone for processing.
[0055] In a storage system application represented by a file system and a database, data can be divided into two types, namely metadata and file data. The metadata is generally small, and the size of the file data changes with the change of a load. For this, the embodiment further provides dynamic request scheduling to further process the request for the file data. As shown in FIG. 2, the dynamic request scheduling in the embodiment includes the following steps. Figure 1
[0056] If the system is not currently in a small write-intensive load scenario, and the request is a small write request, the data is cached in the NVM-buffer, and the target address and the cache address of the data in the SSD device are recorded; otherwise, the data is directly written into the SSD device.
[0057] The embodiment divides a part of space in the NVM device to cache small request data mapped to the SSD, can fully utilize the performance advantage of the NVM in processing small I / O, and considers that data cached in the NVM-buffer needs to be migrated to the SSD finally, and data migration can bring write amplification, affecting I / O performance, in order to avoid affecting the processing performance of normal I / O due to frequent data migration, the embodiment only caches file data of small write requests when the system is not in a small write-intensive load scenario, that is, when the number of small write requests per second exceeds a threshold (for example, 100), and directly writes file data into the SSD device when the system is in a small write-intensive load scenario.
[0058] The embodiment can direct I / O requests to appropriate storage media by combining static address mapping and dynamic request scheduling, fully utilize the performance advantage of the SSD in processing large I / O on the basis of utilizing the performance advantage of the NVM in processing small I / O, and effectively improve the overall performance of the hybrid storage system; in addition, since the SSD has the advantages of high capacity and high cost performance, and has a good performance advantage in large I / O, the application can better balance the performance preferences of the NVM and the SSD, improve the storage performance, and effectively reduce the system cost.
[0059] When processing read requests, the embodiment needs to query the runtime metadata to determine whether the data is cached in the NVM-buffer or located in the SSD device, and the query process is in the critical path of the read operation, in order to speed up the query, in the embodiment, the target address of the data cached in the NVM-buffer in the SSD device and the cache address of the data in the NVM-buffer are recorded in the form of a key-value pair, and the target address and the cache address are the key and the value of the key-value pair respectively, and the key-value pair is further indexed by a hash table to further speed up the query speed.
[0060] Since the NVM has the problem of limited parallelism, the throughput of the NVM will decrease significantly when the number of threads accessing the NVM exceeds 4. In actual use, the number of user threads will change with the change of load, and the number of user threads cannot be directly limited, in order to ensure that the performance of the NVM is always in a high state, the embodiment proposes an I / O thread pool mechanism, specifically including: creating an I / O thread pool composed of 4 I / O threads, and creating a request queue for each I / O thread;
[0061] And the execution of the request accessing the NVM device includes:
[0062] The user thread submits a request for accessing the NVM device to a request queue of a corresponding I / O thread, the corresponding I / O thread acquires the request from the request queue in sequence and processes the request, and after the request processing is completed, the corresponding user thread is notified;
[0063] As shown in Figure 2 , the NVM-buffer includes four segments, namely seg0-seg3, corresponding to the four I / O threads, and the size of each segment is 1 MiB in this embodiment. The space in the NVM for storing metadata includes four bands, namely band0-band3, corresponding to the four I / O threads. When the user thread submits a request, the index number of the I / O thread can be obtained by taking the offset of the request modulo 4, so as to determine the corresponding I / O thread.
[0064] In order to facilitate the management of the NVM-buffer space, as shown in Figure 2 , in this embodiment, a runtime metadata is maintained for each segment in the memory.
[0065] The runtime metadata includes a key-value pair and a hash table for recording the target address of the data cached by the segment in the SSD device and the cache address of the data in the NVM-buffer, and a bit bitmap. The bit bitmap is used to record the state of whether each data block in the segment is idle. Specifically, if the bit is 0, it indicates that the corresponding data block is idle, and if the bit is 1, it indicates that the corresponding data block is not an idle block.
[0066] Through the above I / O thread pool mechanism, the decoupling of the user thread and the I / O thread is realized, and the binding of the I / O thread and the resources is realized, wherein the bound resources include the request queue for communication between the I / O thread and the user thread, the segment accessed by the I / O thread and the related metadata thereof. Each I / O thread can only access the resources bound thereto, so as to avoid multi-thread conflicts. The I / O thread uses a polling method to query whether the request queue is empty, and judges whether there is an I / O request to be processed at present. If there is, the corresponding read / write operation is performed according to the type of the I / O request, otherwise, the I / O thread is in a loop waiting state. Since the number of I / O threads in the I / O thread pool is 4, through this access method, the maximum number of concurrent accesses to the NVM can be limited to a fixed value of 4, so as to ensure that the performance of the NVM is always in a high state.
[0067] Considering the limited size of a segment, the data within it eventually needs to be migrated to an SSD. To improve the efficiency of data migration and avoid adverse effects on the performance of normal I / O processing, this embodiment proposes a migration thread pool mechanism. Specifically, when a segment is full, or when an I / O thread is in a light-load state (including an unloaded state), that is, when there is no I / O or only a small amount of I / O (not exceeding a certain threshold) within a preset time period (e.g., 1 second), the data in the corresponding segment is migrated to the SSD device.
[0068] During the migration process, each migration thread in the migration thread pool selects a key-value pair linked list based on a hash element index from the hash table. Therefore, multiple migration threads perform migrations concurrently. Each migration thread iterates through the selected key-value pair linked list, reading the contents of the key-value pairs and retrieving the target address (Addr) recorded within. ssd and cache address Addr nvm and from the NVM-buffer at address Addr nvm Data is read from the block into the Mig memory. buf Then write it back to the SSD at address Addr ssd Within a block, after migrating a data block, the migration thread deletes the corresponding key-value pair from the hash table. Once all data in a segment has been migrated, the bitmap of the corresponding segment is cleared, and the current segment is set to a clean state.
[0069] by Figure 3 For example, when a migration thread in the migration thread pool performs data migration, it accesses the key-value pair linked list indexed by element rcu_list0 in the hash table. This linked list contains two key-value pairs, namely (73,21) and (12,11). First, migration thread 0 reads the data block at cache address 21 from the NVM-buffer based on the key-value pair (73,21), and then writes the read data to the SSD based on the target address 73. After that, the key-value pair (73,21) is removed from the key-value pair linked list. Then, the same process is followed to perform data migration based on the key-value pair (12,11). To further optimize write request performance, during the migration process, if there are other read / write requests accessing different target addresses in the SSD, the SSD is accessed directly; otherwise, the request waits until the corresponding data migration is completed.
[0070] In practical applications, requests for metadata can be made by accessing the space in the NVM device used to store metadata using the I / O thread pool mechanism.
[0071] When the system is not in the small case intensive load scenario, for the request of file data, it can be divided into upper case request, lower case request and read request; for the lower case request Req s , it is directly submitted to the request queue of the corresponding I / O thread by the user thread, and cached into the corresponding segment of the NVM-buffer by the I / O thread.
[0072] For the upper case request Req L mapped to the SSD device, the processing includes:
[0073] In the user thread, the upper case request Req L is divided into sub-requests according to the logical block size (4KiB in this embodiment), and the offset of the sub-requests is taken modulo 4, and the result is taken as the number of the corresponding I / O thread; each sub-request is submitted to the request queue of the corresponding I / O thread, and the upper case request Req L is submitted to the SSD device;
[0074] The I / O thread polls the corresponding request queue to obtain the sub-requests; for the sub-requests of the upper case request Req L , if the data in it has been cached in the NVM-buffer, the data cached in the NVM-buffer will be invalidated with the processing of the upper case request Req L , in order to avoid data inconsistency, this embodiment deletes the record information of the target address and the cache address of the data in the SSD device, and releases the space occupied by the data in the NVM-buffer, specifically, the state bit of the target block of the sub-request is set to invalid, and the metadata of the current I / O thread in the memory is cleared, including setting the bit in the bit map corresponding to the current block to 0, deleting the key-value pair with the content of the key being the current block address from the hash table, and finally notifying the user thread;
[0075] When the user thread receives the notification that all sub-requests are completed in the I / O thread, and the request submitted to the SSD device also returns, the processing of the upper case request Req L is completed.
[0076] For the read request Req buf mapped to the SSD device, the processing includes:
[0077] In the user thread, the read request Req buf is divided into sub-requests according to the logical block size, and the offset of the sub-requests is taken modulo 4, and the result is taken as the number of the corresponding I / O thread; each sub-request is submitted to the request queue of the corresponding I / O thread, and the corresponding data is read from the SSD device to the SSD buf ;
[0078] The I / O thread polls the corresponding request queue to obtain a sub-request; for a sub-request of a read request Req, if the data in the sub-request has been cached in the NVM-buffer, the corresponding data is read from the NVM-buffer to the NVM buf .
[0079] When all data reading is completed, the user thread merges the data in the SSD buf and the NVM buf and returns; based on the processing manner of the above uppercase request, in the embodiment, the data cached in the NVM-buffer is the latest version of data, therefore, when the data in the SSD buf and the NVM buf is merged, for the data existing in the SSD buf and the NVM buf at the same time, the data in the NVM buf is used to overwrite the corresponding data in the SSD buf .
[0080] When the system is in a lowercase intensive load scenario, for a write request mapped to the SSD device, the processing manner of the above uppercase request is uniformly used; for a read request mapped to the SSD device, the processing manner of the above read request is used.
[0081] Embodiment 2:
[0082] A storage controller, comprising a computer readable storage medium and a processor, the computer readable storage medium is used to store a computer program; the processor is used to read the computer program stored in the computer readable storage medium, and execute the data storage method for NVM and SSD provided in the above embodiment 1.
[0083] Embodiment 3:
[0084] A hybrid storage system based on NVM and SSD, comprising: an NVM, an SSD and the storage controller provided in the above embodiment 2.
[0085] The hybrid storage system provided in the embodiment is an ultra-fast hybrid storage architecture (Ultra-fast Hybrid Storage Consolidating NVM and SSD in Parallel, UHS), which can be referred to as shown in Figure 1 .
[0086] Those skilled in the art can easily understand that the above description is only a preferred embodiment of the present application, and is not used to limit the present application, and any modification, equivalent replacement and improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A data storage method for NVM and SSD, characterized in that, include: Static address mapping and dynamic request scheduling; The static address mapping includes: providing a unified linear logical address space to the outside world, the linear logical address space being divided into a region NVM-zone mapped to NVM devices and a region SSD-zone mapped to SSD devices; metadata and file data are respectively mapped to the region NVM-zone and the region SSD-zone; The dynamic request scheduling includes: allocating a space from the NVM device as an NVM-buffer, and performing the following operations on file data mapped to the SSD-zone: If the system is not currently under a low-case intensive load scenario and the request is a low-case request, then the data is cached in NVM-buffer, and the target address and cache address of the data in the SSD device are recorded; otherwise, the data is directly written to the SSD device. In this case, the data requested to be written in an uppercase request is greater than a preset threshold, while the data requested to be written in a lowercase request does not exceed the threshold. The data storage method for NVM and SSD further includes: creating an I / O thread pool consisting of 4 I / O threads, and creating a request queue for each I / O thread; Furthermore, the execution of a request to access an NVM device includes: The user thread submits the request to access the NVM device to the request queue of the corresponding I / O thread. The corresponding I / O thread retrieves the request from the request queue in order and processes it. After the request is processed, the corresponding user thread is notified. For uppercase requests (Req) mapped to SSD devices L Its processing includes: In the user thread, the uppercase request Req is processed according to the logical block size. L The request is divided into sub-requests, and the offset of each sub-request is modulo 4. The remainder of the modulo is used as the corresponding I / O thread number. Each sub-request is submitted to the request queue of the corresponding I / O thread, and the uppercase request Req is also submitted. L Submit to the SSD device; The I / O thread polls the corresponding request queue to retrieve sub-requests; for the uppercase request Req... L If the data in a sub-request has been cached in NVM-buffer, then delete the record information of the target address and cache address of the data in the SSD device, and release the space occupied by the data in NVM-buffer. When the user thread receives notification that all sub-requests have been completed in the I / O thread, and its request submitted to the SSD device has also returned, the uppercase request Req... L The processing is complete.
2. The data storage method for NVM and SSD as described in claim 1, characterized in that, Data cached in NVM-buffer has its target address in the SSD device and its cache address in NVM-buffer recorded as key-value pairs, with the target address and cache address being the key and value of the key-value pair, respectively.
3. The data storage method for NVM and SSD as described in claim 2, characterized in that, Key-value pairs are indexed using a hash table.
4. The data storage method for NVM and SSD as described in claim 1, characterized in that, The NVM-buffer comprises four segments, each corresponding to one of the four I / O threads. Furthermore, the data storage method for NVM and SSD also includes: When a segment is full, or when an I / O thread is under light load, the data in the corresponding segment is migrated to the SSD device.
5. The data storage method for NVM and SSD as described in claim 4, characterized in that, Also includes: Maintain a runtime metadata copy for each segment in memory; The runtime metadata includes: the target address of the data cached in the segment on the SSD device and its cache address in the NVM-buffer, as well as a bitmap; the bitmap is used to record whether each data block in the segment is idle.
6. The data storage method for NVM and SSD as described in claim 1, characterized in that, For read requests (Req) mapped to an SSD device, the processing includes: In the user thread, the read request `Req` is divided into sub-requests according to the logical block size, and the offset of each sub-request is modulo 4. The modulo result is used as the corresponding I / O thread number. Each sub-request is submitted to the request queue of the corresponding I / O thread, and the corresponding data is read from the SSD device and written to the SSD. buf middle; The I / O thread polls the corresponding request queue to obtain sub-requests; for a sub-request of the read request Req, if the data therein is already cached in the NVM-buffer, then the corresponding data is read from the NVM-buffer into the NVM. buf middle; Once all data has been read, the user thread merges the SSD data. buf and NVM buf The data is then returned.
7. A storage controller, characterized in that, The method includes a computer-readable storage medium and a processor, wherein the computer-readable storage medium is used to store a computer program; and the processor is used to read the computer program stored in the computer-readable storage medium and execute the data storage method for NVM and SSD as described in any one of claims 1 to 6.
8. A hybrid storage system based on NVM and SSD, characterized in that, include: NVM, SSD, and the storage controller as described in claim 7.