Data writing method and storage device
By establishing the address mapping relationship of memory and/or hard disk in the network card, the network card directly generates metadata index information and writes data, solving the problem of low data writing efficiency of storage controllers and realizing a more efficient data writing process.
Patent Information
- Application Number
- CN202311119437.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2043-08-31
AI Technical Summary
In the existing storage network architecture, the data writing efficiency of the storage controller is low, mainly because data and write requests need to be processed multiple times through the network and CPU, occupying a large amount of CPU resources and data bandwidth.
Establish a mapping relationship between the memory and/or hard disk address and the network card in the network card. The network card directly generates the metadata index information of the data to be written, and directly writes the data to the memory and/or hard disk based on the metadata index information to be written to avoid processing through the CPU of the storage controller.
It improves the data writing efficiency of the storage controller in the storage network architecture, and saves some of the CPU resources and data bandwidth occupied during the data writing process.
Smart Images

Figure CN119536619A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and more specifically, to a method for writing data and a storage device. Background Art
[0002] A storage area network (SAN) is a block-based storage network architecture that uses a network to connect host servers to storage controllers. A logical disk unit (LUN) is a series of blocks in a SAN that are configured through a shared storage pool and presented to the host server as a logical disk. The host server partitions and formats these blocks through the storage controller, usually using a file system, so that data can be stored on the LUN just like on local hard disk storage. The design of SAN eliminates single points of failure, so it has extremely high availability and fault recovery capabilities.
[0003] In a storage network architecture represented by SAN, data read and write instructions are issued by the host server, and the storage controller performs read and write operations according to the read and write instructions. Therefore, in the existing architecture, taking the write operation as an example, the data and write request need to be sent from the network card of the host server to the network card of the storage controller through the network, and then sent by the network card of the storage controller to the central processing unit (CPU) of the storage controller for processing, and the data is written to the memory and / or hard disk through the storage software working on the CPU. The above process occupies a large amount of CPU resources and data bandwidth, which becomes a bottleneck for the data writing performance of the storage controller, resulting in low efficiency of the storage controller writing data. Therefore, how to improve the data writing efficiency of the storage controller in the storage network architecture has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The embodiment of the present application provides a method for writing data and a storage controller. By establishing a mapping relationship between the address of the memory and / or hard disk and the network card in the network card, metadata index information of the data to be written can be directly generated in the network card, and the data can be directly written to the corresponding address in the memory and / or hard disk according to the metadata index information, so that the data to be written does not need to be processed by the CPU of the storage controller, thereby improving the data writing efficiency of the storage controller in the storage network architecture.
[0005] In a first aspect, a method for writing data is provided, the method being applied to a storage device, the storage device comprising a network card, a CPU and a memory, the method comprising: the network card obtaining a write instruction through a network, the write instruction comprising first data to be written; the network card generating metadata index information of the first data and sending it to the CPU, the metadata index information being used to describe an address at which the first data is written to the memory; the CPU writing the metadata index information into the memory; the network card writing the first data into the memory according to the metadata index information.
[0006] The write instruction comes from outside the storage controller, for example, from a client host.
[0007] Optionally, the storage device may be a storage controller in a storage area network (SAN); the storage device may also be a storage server in a distributed storage; the storage device may also be a separate storage server.
[0008] Optionally, the memory includes internal memory and external memory, the internal memory includes but is not limited to: random access memory (RAM), read-only memory (ROM), and the external memory includes but is not limited to a hard disk drive (HDD) and a solid state drive (SSD). The external memory is located locally or remotely from the storage device. The local memory is set inside the storage device, or connected to the storage device through a bus; the remote memory is connected to the storage device through a network, or provides storage space for the storage device in a cloud manner.
[0009] Optionally, the metadata index information includes but is not limited to at least one of the following: a logical block address (LBA), a logical disk unit identity (LUNID).
[0010] According to the technical solution provided by the present application, metadata index information of the data to be written is directly generated in the network card, and the network card directly writes the data to the corresponding address in the memory and / or hard disk according to the metadata index information. After the data to be written is from the outside of the storage device to the network card, it can be stored without being processed by the CPU of the storage controller. Compared with the traditional solution in which the metadata index information of the data to be written is generated by the storage software on the CPU, and the data to be written and the metadata index information are written to the memory through the CPU, it can save part of the CPU resources and data bandwidth occupied by the data to be written in the data writing process, thereby improving the data writing efficiency of the storage device in the storage network architecture.
[0011] In combination with the first aspect, in certain implementations of the first aspect, generating metadata index information of the first data includes: generating metadata index information of the first data according to an address mapping table stored in a network card, the address mapping table being used to indicate addresses in a memory that can be used to write data.
[0012] According to the above technical solution, by storing the addresses of the memory and / or hard disk that can be used to write data in the form of an address mapping table in the network card, the mapping relationship between the address of the memory and / or hard disk and the network card can be stored in the network card for a long time, thereby improving the efficiency of the network card in generating metadata index information.
[0013] In combination with the first aspect, in certain implementations of the first aspect, the address mapping table includes a mapping relationship between a value of an identifier maintained by a network card and an address of a memory, and metadata index information of the first data is generated based on the address mapping table stored in the network card, including: assigning a first identifier to the first data; determining a first address at which the first data is written to the memory based on the value of the first identifier and the address mapping table, wherein the address mapping table includes a mapping relationship between the value of the first identifier and the first address; and generating metadata index information based on attributes of the first address and the first data.
[0014] According to the above technical solution, by storing the mapping relationship between the identifier assigned by the network card to the data to be written and the address of the memory and / or hard disk as an address mapping table in the network card, the network card can quickly determine the address to write the data by looking up the table after assigning the identifier to the data to be written, thereby improving the efficiency of the network card in determining the address to write the data to the memory.
[0015] In combination with the first aspect, before generating metadata index information of the first data according to the address mapping table stored in the network card, the method also includes: the network card obtains the second data; the network card assigns a second identifier to the second data; the CPU writes the second data to the second address of the memory; the network card establishes an address mapping table according to the value of the second identifier and the second address; after the second address is in an idle state, the method also includes: the CPU sends an indication message to the network card, the indication message is used to indicate that the second address is available.
[0016] According to the above technical solution, the data is first written into the memory and / or hard disk using the software system in the CPU, and the address mapping table is determined according to the writing result, so that the mapping relationship between the identifier assigned by the network card to the data to be written and the address of the memory and / or hard disk in the address mapping table is consistent with the writing method through the CPU software, so that the results obtained by directly writing data through the network card and writing data through the CPU are consistent, thereby improving the reliability of the system.
[0017] In combination with the first aspect, in certain implementations of the first aspect, the CPU includes a first cache module and a second cache module, and writing metadata index information into a memory includes: writing the metadata index information into the first cache module; writing the metadata information from the first cache module into the memory; the method also includes: the CPU establishing a mirror of the metadata index information in the second cache module based on the metadata index information in the first cache module.
[0018] According to the above technical solution, since the cache can determine the corresponding data to be written from the network card based on the written metadata index information, when backing up the cache through mirroring, it is only necessary to transfer the metadata index information from the current cache to the cache of the mirror node, so that the mirror node can directly obtain the data to be written from the network card based on the metadata index information, avoiding the CPU resources and data bandwidth occupied by large amounts of data transmission between caches, thereby improving the efficiency of maintaining multiple copies running within the system.
[0019] In combination with the first aspect, in some implementations of the first aspect, writing the first data into the memory according to the metadata index information includes: writing the first data into the memory through remote direct data access RDMA according to the metadata index information.
[0020] According to the above technical solution, the data to be written is directly transferred from the network card to the memory and / or hard disk through RDMA technology without affecting the operating system of the storage controller, and can not occupy the processing power of the CPU, thereby improving the efficiency of data transmission from the network card to the memory and / or hard disk.
[0021] In combination with the first aspect, in certain implementations of the first aspect, writing metadata index information into a memory includes: writing metadata index information into the memory according to the non-volatile memory standard NVMe.
[0022] According to the above technical solution, accessing flash memory and SSD through the NVMe protocol can improve the performance of the CPU accessing memory and / or hard disk, thereby improving the efficiency of the CPU writing metadata index information to the memory and / or hard disk.
[0023] In combination with the first aspect, in certain implementations of the first aspect, before generating metadata index information of the first data according to the address mapping table stored in the network card, the method also includes: establishing a write-ahead log WAL object corresponding to the write instruction according to the write instruction, and the WAL corresponds to the identifier.
[0024] According to the above technical solution, by establishing and maintaining the WAL object corresponding to the write operation in the network card, all modifications are first written to the log and then applied to the system status, thereby ensuring the atomicity and orderliness of the operations of writing data and / or writing metadata index information.
[0025] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: the network card obtains a read instruction, the read instruction is used to instruct reading the first data; the network card obtains metadata index information of the first data according to the read instruction; the network card reads the first data from the memory according to the metadata index information.
[0026] According to the above technical solution, the network card can determine the address of the data to be read stored in the memory and / or hard disk based on the metadata index information of the data to be read written into the memory and / or hard disk, thereby directly reading the data to be read through the network card, thereby improving the data reading efficiency of the storage controller.
[0027] In a second aspect, a storage device is provided, which includes a network card, a central processing unit CPU and a memory, the network card is used to obtain a write instruction through a network, the write instruction includes first data to be written; the network card is also used to generate metadata index information of the first data and send it to the CPU, the metadata index information is used to describe the address of the first data written into the memory; the CPU is used to write the metadata index information into the memory; the network card is also used to write the first data into the memory according to the metadata index information.
[0028] Optionally, the storage device may be a storage controller in a storage area network (SAN); the storage device may also be a storage server in a distributed storage; the storage device may also be a separate storage server.
[0029] Optionally, the memory includes internal memory and external memory, the internal memory includes but is not limited to: random access memory (RAM), read-only memory (ROM), and the external memory includes but is not limited to a hard disk drive (HDD) and a solid state drive (SSD). The external memory is located locally or remotely from the storage device. The local memory is set inside the storage device, or connected to the storage device through a bus; the remote memory is connected to the storage device through a network, or provides storage space for the storage device in a cloud manner.
[0030] Optionally, the metadata index information includes but is not limited to at least one of the following: a logical block address (LBA), a logical disk unit identity (LUNID).
[0031] In combination with the second aspect, in some implementations of the second aspect, the network card is used to: generate metadata index information of the first data according to an address mapping table stored in the network card, where the address mapping table is used to indicate addresses in the memory that can be used to write data.
[0032] In combination with the second aspect, in certain implementations of the second aspect, the address mapping table includes a mapping relationship between a value of an identifier maintained by the network card and an address of a memory, and the network card is used to: assign a first identifier to the first data; determine a first address at which the first data is written to the memory based on the value of the first identifier and the address mapping table, wherein the address mapping table includes a mapping relationship between the value of the first identifier and the first address; and generate metadata index information based on the address at which the first data is written to the memory and attributes of the first data.
[0033] In combination with the second aspect, in certain implementations of the second aspect, before generating metadata index information of the first data according to the address mapping table stored in the network card, the network card is also used to: obtain the second data; assign a second identifier to the second data; the CPU is also used to write the second data to the second address of the memory; the network card is also used to establish an address mapping table according to the value of the second identifier and the second address; after the second address is in an idle state, the CPU is also used to: send an indication message to the network card, the indication message being used to indicate that the second address is available.
[0034] In combination with the second aspect, in certain implementations of the second aspect, the CPU includes a first cache module and a second cache module, and the CPU is used to: write the metadata index information into the first cache module; write the metadata index information from the first cache module into the memory; the CPU is also used to: establish a mirror of the metadata index information in the second cache module based on the metadata index information in the first cache module.
[0035] In combination with the second aspect, in some implementations of the second aspect, the network card is used to: write the first data into the memory through remote direct data access RDMA according to the metadata index information.
[0036] In combination with the second aspect, in certain implementations of the second aspect, the CPU is used to: write metadata index information into the memory according to the non-volatile memory standard NVMe.
[0037] In combination with the second aspect, in certain implementations of the second aspect, before generating metadata index information of the first data according to the address mapping table stored in the network card, the network card is also used to: establish a write-ahead log WAL object corresponding to the write instruction according to the write instruction, and the WAL object corresponds to the identifier.
[0038] In combination with the second aspect, in certain implementations of the second aspect, the network card is also used to: obtain a read instruction, the read instruction is used to instruct reading the first data; obtain metadata index information of the first data according to the read instruction; and read the first data from the memory according to the metadata index information.
[0039] In a third aspect, a computing device is provided, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call and execute the instructions from the memory, so that the computing device executes the method in the first aspect or any possible implementation of the first aspect.
[0040] Optionally, the processor may be a general-purpose processor, which may be implemented by hardware or software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor may be a general-purpose processor, which is implemented by reading software codes stored in a memory, which may be integrated in the processor or may be located outside the processor and exist independently.
[0041] In a fourth aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0042] Optionally, as an implementation, the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the method in the above-mentioned first aspect or any possible implementation of the first aspect.
[0043] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the above-mentioned first aspect or any possible implementation method of the first aspect.
[0044] In a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0045] In a sixth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0046] By way of example, these computer-readable storage media include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and hard drive.
[0047] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 The present invention is a schematic structural diagram of a storage network used in an embodiment of the present application.
[0049] Figure 2 It is a schematic flowchart of a method for writing data provided in an embodiment of the present application.
[0050] Figure 3 It is a schematic flow chart of a conventional solution in which data to be written is written into a memory through a CPU of a storage device.
[0051] Figure 4 This is a schematic flowchart of an embodiment of the present application for directly writing data to be written into a memory through a network card of a storage device.
[0052] Figure 5 It is a schematic flow chart of writing data to be written into a memory through a network card of a storage device provided in an embodiment of the present application.
[0053] Figure 6 It is a schematic flow chart of writing data to be written into a hard disk through a network card of a storage device provided in an embodiment of the present application.
[0054] Figure 7 It is a schematic structural block diagram of a device for writing data provided in an embodiment of the present application.
[0055] Figure 8 It is a schematic structural block diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0057] The present application will present various aspects, embodiments or features around a system including multiple devices, components, modules, etc. It should be understood and appreciated that each system may include additional devices, components, modules, etc., and / or may not include all devices, components, modules, etc. discussed in conjunction with the figures. In addition, combinations of these schemes may also be used.
[0058] In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.
[0059] In the embodiments of the present application, “corresponding” and “relevant” may sometimes be used interchangeably. It should be noted that when the distinction between them is not emphasized, the meanings they intend to express are consistent.
[0060] The network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0061] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0062] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0063] To facilitate understanding, relevant terms and concepts that may be involved in the embodiments of the present application are first introduced below.
[0064] 1. Storage area network (SAN): SAN is a block-based storage that uses a high-speed architecture to connect servers to their logical disk units (LUNs). LUNs are a series of blocks configured through a shared storage pool and presented to servers in the form of logical disks. The server partitions and formats these blocks, usually using a file system, so that data can be stored on the LUN as if it were on local hard disk storage. The design of SAN eliminates single points of failure, so it has extremely high availability and fault recovery capabilities. SAN is the most commonly used storage network architecture in enterprises, with low latency, high bandwidth, and high reliability. Critical applications of enterprises, such as databases, virtual machines, and other critical applications, often use this type of storage to run. The development trend of SAN is an all-flash storage SAN, which uses flash memory for memory and solid state drives (SSDs) instead of hard disk drives (HDDs) for hard disks, thereby providing better performance, stable and consistent low latency, lower power consumption, and lower total cost.
[0065] 2. Nonvolatile Memory Express (NVMe): NVMe is a new storage access and transmission protocol for flash memory and next-generation SSDs that provides the highest throughput and fastest response speed for all types of enterprise workloads. Since NVMe is designed specifically for SSD performance, it has a great advantage in accessing SSDs over traditional protocols such as the serial attached small computer system interface (SAS) and serial advanced technology attachment (SATA), and is gradually becoming mainstream.
[0066] 3. Network-based NVMe (NVMe over fabric, NoF): NoF technology is an application of NVMe protocol in SAN. NVMe is a protocol running on storage devices, but SAN involves not only individual storage devices, but also a storage network composed of multiple storage devices, as well as data reading and writing between servers and storage networks. Therefore, NoF technology uses the network based on NVMe to form data transmission between servers and storage networks. For the way to implement NVMe using different transport layer protocols, NoF has developed different technical routes, such as NVMe (NVeM over FC) using fiber channel (FC) protocol, NVMe (NVeM over TCP) using transmission control protocol (TCP), and NVMe (NVeM over RDMA) using remote direct memory access (RDMA). Among them, the currently popular NVMe (NVeM over RoCE) using RDMA over converged Ethernet (RoCE) is a type of NViM over RDMA.
[0067] 4. Remote direct memory access (RDMA): RDMA is a technology developed to solve the delay of server-side data processing in network transmission. RDMA enables user space applications to directly read or write remote storage through the network without going through the operating system, so there is no kernel intervention and memory copy, thereby saving a lot of CPU resources, improving system throughput, and reducing system network communication delay.
[0068] The working process of RDMA is as follows: (1) When an application executes an RDMA read or write request, no data copying is performed. Without the need for any kernel memory involvement, the RDMA request is sent from the application running in user space to the local network interface card (NIC); (2) The local NIC reads the information of the local memory and transmits it to the remote NIC through the network. The transmitted information includes the target virtual address, memory key and the data itself; (3) After the remote NIC confirms the memory key, it directly writes the data to the location in the remote memory indicated by the virtual address. Therefore, RDMA technology provides a way for a network card to directly read and write memory.
[0069] 5. Write-ahead logging (WAL): WAL is a series of technologies that provide atomicity and persistence for data in database systems. In a system using WAL, all modifications are first written to the log and then applied to the system state.
[0070] The storage network architecture represented by SAN connects the host server to the storage controller through the network. The data read and write instructions are issued by the host server, and the storage controller performs read and write operations according to the read and write instructions. Therefore, the read and write instructions are first sent to the network card of the storage controller through the network card of the host server. Under the existing storage network architecture (such as SAN), the read and write instructions that reach the network card of the storage controller need to be executed by the storage software working on the CPU of the storage controller. Taking the write operation as an example, the data to be written and the write request need to be sent from the network card of the host server to the network card of the storage controller through the network, and then sent by the network card of the storage controller to the CPU of the storage controller for processing, and the data is written to the memory and / or hard disk by the storage software working on the CPU. The above process occupies a large amount of CPU resources and data bandwidth, which becomes a bottleneck for the data writing performance of the storage controller, resulting in low efficiency of the storage controller writing data. Therefore, how to improve the data writing efficiency of the storage controller in the storage network architecture has become a technical problem that needs to be solved urgently.
[0071] In view of this, an embodiment of the present application provides a method and device for writing data. By establishing a mapping relationship between the address of the memory and / or hard disk and the network card in the network card, the metadata index information of the data to be written can be directly determined in the network card, and the data can be directly written to the corresponding address in the memory and / or hard disk according to the metadata index information, so that the data to be written does not need to be processed by the CPU of the storage controller, thereby improving the data writing efficiency of the storage controller in the storage network architecture.
[0072] Figure 1 FIG. 1 shows a schematic structural block diagram of a storage network used in an embodiment of the present application. Figure 1 As shown, the SAN includes at least one host server 110 and multiple storage controllers 120. The network card 111 of the host server 110 and the network card 121 of the storage controller 120 are connected through a network. Optionally, the network card 111 and the network card 121 exchange information based on NoF, or based on other protocols, which is not specifically limited in this application. The host server 110 is responsible for generating data read and write instructions and sending the data read and write instructions through the network card 111. The storage controller 120 receives the data read and write instructions through the network card 121 and completes the data read and write operations.
[0073] Specifically, the network card 121 of the storage controller 120 is responsible for parsing the NVMe protocol message, and is used to parse out the specific data write operation from the received write instruction; the network card 121 is also responsible for data routing, and is used to receive the data to be written included in the write instruction.
[0074] The storage controller 120 also includes a CPU 122. Storage software runs in the CPU 122, which is used to write the metadata index information of the data to be written into the memory of the storage controller 120, and can also be used to write the data to be written into the memory. The storage software includes but is not limited to: NoF driver, block module (block), cache module (cache), index module (index), etc. The NoF driver is responsible for the interaction between the network card 121 and the block in the CPU, including applying for pages, obtaining read and write instructions, preparing data, etc. The block is responsible for the processing of the semantics of the logical disk unit (logical disk unit, LUN), including sending read and write instructions to the cache according to the logical block address (logical block address, LBA). The cache is responsible for writing data into the internal memory, and initiating a request to write data into the external memory, and sending the request to the index. The index is responsible for the management of external memory resources, and writes data to the external memory according to the request sent by the cache. It should be understood that the data described in the above description of the storage software function refers to the data written into the memory by the CPU 122, so it can refer to different content in different scenarios. For example, in the case of writing metadata index information, data may refer to the metadata index information, and in the case of writing data to be written, data may refer to the data to be written.
[0075] The storage controller 120 also includes a memory. Optionally, the memory includes an internal memory and an external memory. The internal memory includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), such as Figure 1The double data rate synchronous dynamic random access memory (DDR) 123 shown in FIG. The external memory includes but is not limited to a hard disk drive (HDD) and a solid state drive (SSD), which are connected to the storage controller 120 via an interface card, such as Figure 1 It should be understood that in other possible implementations, the internal memory may also be referred to as a memory, and the external memory may also be referred to as a hard disk, so the terms such as memory and / or hard disk appearing below or in other technical solutions may be terms with the same meaning as the internal memory and / or external memory.
[0076] Figure 2 A schematic flow chart of a method for writing data provided by an embodiment of the present application is shown. Optionally, the method can be executed by a storage device in a storage network architecture, including but not limited to a storage controller in a SAN, a storage server in a distributed storage, a separate storage server, etc. For example, the method can be executed by Figure 1 The storage controller 120 shown in FIG. Figure 2 As shown, the method includes the following steps.
[0077] S210: The network card obtains a write instruction through the network.
[0078] For example, in step S210, the network card 121 of the storage controller 120 may obtain a write instruction. Specifically, the write instruction includes a write data request and first data, the first data is data to be written into the memory, and the write data request instructs the storage controller 120 to write the first data into the memory of the storage controller 120. The write instruction may be generated by the host server 110 in the SAN and sent to the network card 121 of the storage controller 120 through the network card 111 of the host server 110.
[0079] S220: The network card generates metadata index information of the first data and sends it to the CPU.
[0080] For example, in step S220, the network card 121 can determine the physical address of the memory and / or hard disk where the first data to be written is written based on the mapping relationship between the network card 121 and the physical address of the memory and / or hard disk, so that the physical address where the first data is written to the memory can be determined in the network card. In addition, the network card 121 can also generate metadata index information of the first data, and the metadata index information is used to describe the attributes of the first data, including but not limited to the physical address where the first data is written to the memory, such as the logical block address (logical block address, LBA), the logical disk unit identity (logical disk unit identity, LUNID), etc., so as to facilitate the retrieval of the first data from the memory according to the metadata index information after the first data is written.
[0081] Specifically, the network card 121 can divide the storage space of the memory managed by the storage controller 120 into N smallest storage units according to the size of the storage space, and each of the N storage units can be mapped to a different physical address in the memory, where N is a positive integer greater than or equal to 1. The network card 121 can record the usage of the N storage units, and when a new write instruction is obtained, the network card 121 can allocate M storage units from the currently unused storage units in the N storage units for storing the data to be written according to the size of the data to be written, where M is a positive integer less than or equal to N and greater than or equal to 1. Therefore, the network card 121 can determine the address of the memory where the data to be written is written according to the physical address mapped by the M storage units.
[0082] Optionally, for each acquired write instruction, the network card 121 can also establish a WAL object corresponding to the write instruction according to the write instruction, so as to distinguish each data write operation performed by the network card 121. By establishing and maintaining the WAL object corresponding to the write operation in the network card, due to the WAL pre-write feature, all modifications are first written to the log and then applied to the system state, thereby ensuring the atomicity and orderliness of the operations of writing data and / or writing metadata index information.
[0083] In some possible implementations, the network card 121 stores an address mapping table, which is used to indicate the address in the memory that can be used to write data. Specifically, the address mapping table may include a mapping relationship between the value of the identifier and the physical address of the memory. In this case, after obtaining the write instruction, the network card 121 first assigns an identifier to the first data to be written, thereby looking up the table to determine the address of the first data written to the memory according to the mapping relationship between the value of the identifier in the address mapping table and the physical address of the memory, and generates metadata index information according to the address of the first data written to the memory and the attributes of the first data. Optionally, the identifier can be in the form of an offset value (offset). Specifically, the offset identifies the number of used storage units in the N storage units corresponding to the storage space of the memory. If the number of storage units required for the data to be written is M, M is added to the current offset value as a new offset value. It should be understood that when the data stored in the storage unit is released, the network card 121 can assign the offset value corresponding to the storage unit to other data to be written.
[0084] For example, assuming that the storage space of the memory corresponds to 10 storage units, the value of offset in the address mapping table can be 0 to 9, mapping the physical addresses of the 1st to 10th storage units respectively. Assuming that the current offset value is 2, it means that the physical addresses corresponding to the first 2 storage units in the memory have been occupied. If the first data needs to occupy the storage space of 3 storage units, the value of offset becomes 2+3=5. At the same time, when the network card 121 queries the offset value in the address mapping table and the value is 2 to 4, the corresponding physical address is used as the address of the first data written into the memory, indicating that the first data uses the physical addresses corresponding to the 3rd to 5th storage units.
[0085] Through the above scheme, the mapping relationship between the identifier assigned by the network card to the data to be written and the address of the memory and / or hard disk is stored in the network card as an address mapping table, so that after the network card assigns an identifier to the data to be written, it can quickly determine the address where the data is written by looking up the table, thereby improving the efficiency of the network card in determining the address of the memory where the data to be written is written.
[0086] Optionally, before the address mapping table is established, or when the identifier assigned to the data to be written cannot find the corresponding physical address in the address mapping table, that is, the mapping relationship between the address of all or part of the memory and the network card 121 has not been established, the storage controller 120 can first write the data into the memory through the CPU 122, so as to establish the mapping relationship between the network card 121 and the physical address of the memory. Specifically, the network card 121 can obtain the second data and assign an identifier to the second data; after the CPU 122 writes the second data into the memory, the network card 121 establishes or updates the address mapping table according to the value of the identifier and the physical address of the second data written into the memory.
[0087] Optionally, the CPU 122 can also determine the storage status of the data in the memory. After the second address is in an idle state, the CPU 122 can send an indication message to the network card 121, and the indication message is used to indicate that the second address is available. The second address is in an idle state means that there is currently no data stored at the physical address in the memory, so it can be used to write new data at the address. After receiving the indication message sent by the CPU 122, the network card 121 can reallocate the identifier corresponding to the address indicated by the indication message to other data to be written.
[0088] Through the above scheme, the software system in the CPU is first used to write data into the memory and / or hard disk, and the address mapping table is determined according to the writing result, so that the mapping relationship between the identifier assigned by the network card to the data to be written in the address mapping table and the address of the memory and / or hard disk is consistent with the writing method through the CPU software, so that the results obtained by directly writing data through the network card and writing data through the CPU are consistent, thereby improving the reliability of the system.
[0089] It should be understood that the above scheme only provides a method that can make the method of writing data through the CPU and the method of writing data bypassing the CPU compatible, but it does not limit the mapping relationship between the address of the memory and the network card to be established only according to the result of the CPU software writing data. For example, when there is no need to consider writing the data to be written through the CPU software, the mapping relationship can also be established by other means, such as being pre-set manually, and this application does not make specific limitations on this.
[0090] S230: The CPU writes the metadata index information into the memory.
[0091] For example, in step S230, CPU 122 may write the metadata index information generated by the network card in S220 into the memory. Optionally, CPU 122 may write the metadata index information into the memory according to the NVMe protocol. Specifically, the NoF driver running on CPU 122 obtains the metadata index information from the network card 121 and sends it to the block, which organizes the metadata index information and sends it to the cache, which writes it into the memory and initiates a request to write it to the hard disk. The index writes the metadata index information into the hard disk according to the request to cut into the hard disk.
[0092] S240: The network card writes the first data into the memory according to the metadata index information.
[0093] For example, in step S240, the network card 121 can directly write the first data to be written into the memory according to the metadata index information generated by the network card in S220. Optionally, the network card 121 can write the first data into the memory using RDMA. Figures 3 to 6 The process of writing the first data and the metadata index information into the memory is specifically described and will not be repeated here.
[0094] Figure 3 FIG. 1 shows a schematic flow chart of a conventional method of writing data to be written into a memory through a CPU of a storage device. Figure 3 As shown, the network card on the storage management device side receives the protocol message sent by the host server, and parses the protocol message to obtain the write command. The NoF driver running on the CPU obtains the write command from the network card, and prepares the data to be written according to the write data request in the write command. The NoF driver sends the write data request and the data to be written to the block running on the CPU, and the block generates the index information required to write the data to be written into the memory. The block sends the generated index information together with the data to be written to the cache running on the CPU, so that the cache writes the data to be written into the memory of the storage device according to the index information.
[0095] Optionally, the cache can also back up the data after writing the data to be written into the memory. Figure 3 As shown, the cache can organize the data to be written into the form of logs and write them into the linear space, and then create a copy of the data to be written in the cache of other nodes, that is, a mirror of the data to be written. The other node used to establish the mirror can be called a mirror node. When the currently working node fails, the business sent by the host server can be taken over by the mirror node, thereby ensuring that the business is not interrupted and providing disaster recovery capabilities for the system.
[0096] The above steps are a process of writing the data to be written into an internal storage device such as a memory, and then the storage device can also write the data to be written into an external storage device such as a hard disk. Figure 3 As shown in the figure, the cache assembles the data to be written in the memory in a specific form through the background process, and sends the write data request and the data to be written to the index running on the CPU after being triggered by the buffer water level and other mechanisms. The index generates the metadata information required to write the data to be written to the hard disk according to the write data request, and writes the data to be written to the hard disk of the storage device according to the metadata information.
[0097] It should be understood that in addition to providing mirroring disaster recovery capabilities for the current working node, the mirror node itself can also be used as a normal working node to handle other services. Figure 3 Taking the scenario shown as an example, the data 1 to be written is written into the memory 1 and the hard disk 1 through the node 1, and a mirror of the data 1 to be written is established in the node 2. However, the node 2 itself can also be used to receive other data 2 to be written, and write the data 2 to be written into the memory 2 and the hard disk 2. The specific writing process can refer to the workflow of the node 1 above, which will not be repeated here.
[0098] Figure 4 The schematic flowchart of the embodiment of the present application shows that the data to be written is directly written into the memory through the network card of the storage device. Figure 3 The difference between the methods shown is that Figure 4 After receiving the protocol message sent by the host server and parsing the protocol message to obtain the write command, the network card of the storage device also generates metadata index information for writing the data to be written into the memory and hard disk. The data to be written and the metadata index information are written into the memory and hard disk respectively through different paths. Among them, the metadata index information is still written into the memory through the CPU, while the data to be written is directly written into the memory through the network card. The process of writing metadata index information into the memory and hard disk through the CPU is similar to Figure 3 The process of writing data to memory and hard disk is the same, only the data content and data volume are different. For details, please refer to Figure 3 The corresponding description in or the description of step S230 above will not be repeated here. Figure 5 and Figure 6 The process of writing the data to be written into the memory and the hard disk is described in detail.
[0099] Figure 5 The schematic flow chart of writing the data to be written into the memory through the network card of the storage device provided by the embodiment of the present application is shown. Figure 5As shown, the network card of the storage device is responsible for allocating offset values (offset) 0 to N as identification values for the data to be written, so as to generate metadata index information (meta) corresponding to the data to be written according to the mapping relationship. The network card also establishes and maintains the WAL object according to the write command to ensure the atomicity and orderliness of the write operation. The metadata index information passes through the block and cache in the CPU and is written to the memory in the form of a metadata index information log (meta log). The data to be written in the network card is directly written to the memory in the form of a data log through a one-sided RDMA in the form of an append write according to the meta log. Among them, data log 1 to N correspond to offset 1 to N allocated to the data to be written. The data to be written is written directly to the memory through the network card, which saves CPU resources and data bandwidth compared to writing through the CPU.
[0100] It should be understood that unilateral RDMA refers to the application of some technologies in RDMA technology in this scenario by directly writing data to the memory through the network card. As mentioned above, the complete RDMA technology is an application in the application space of a computing device, which sends instructions to the network card of another computing device through the network card of the computing device, and directly accesses the memory of the other computing device through the network card of the other computing device. The unilateral RDMA in this application only needs to realize that the network card of the storage device directly accesses the memory of the storage device. More specifically, the network card of the storage device directly writes data to the memory and hard disk of the memory of the storage device. Therefore, this step only involves some technologies in the complete RDMA process, so it is called unilateral RDMA. Unilateral RDMA uses RDMA technology to realize that the network card directly writes data to the memory and hard disk, which is only a means to implement step S240 in the method of writing data provided in the embodiment of the present application, but it is not limited to this. Other technologies that can realize that the network card directly writes data to the memory can be used to implement step S240, and this application does not make specific details about this.
[0101] Optionally, after the cache writes the metadata index information into the memory in the form of a meta log, it can also establish a mirror of the metadata index information in the mirror node. Specifically, the CPU may include a first cache module and a second cache module. After the CPU writes the metadata index information into the first cache module and writes the metadata information from the first cache module into the internal memory, the CPU can also establish a mirror of the metadata index information in the second cache module based on the metadata index information in the first cache module. Since the cache can determine the corresponding data to be written from the network card based on the written metadata index information, when backing up the cache by mirroring, it is only necessary to transfer the metadata index information from the current cache to the cache of the mirror node. Compared with the traditional solution of establishing a mirror of the complete data to be written, the above solution avoids the CPU resources and data bandwidth occupied by a large amount of data transmission between caches while maintaining the operation of multiple copies within the system, thereby further saving CPU resources and data bandwidth while ensuring the disaster recovery capability of the system.
[0102] Figure 6 The schematic flow chart of writing the data to be written into the hard disk through the network card of the storage device provided by the embodiment of the present application is shown. Figure 6 As shown in the figure, the meta log in the memory is written to the hard disk of the storage device through the index module in the CPU by flashing. The data to be written in the network card is directly written to the physical address corresponding to the hard disk through one-sided RDMA according to the address indicated by the meta log that is flashed to the hard disk. Similarly, the data to be written is directly written to the hard disk through the network card, which saves CPU resources and data bandwidth compared to writing through the CPU.
[0103] In summary, through the technical solution of the embodiment of the present application, a mapping relationship between the address of the memory and / or hard disk and the network card is established in the network card of the storage device, and the metadata index information of the data to be written can be directly generated in the network card, and the data can be directly written to the corresponding address in the memory and / or hard disk according to the metadata index information, so that the data to be written does not need to be processed by the CPU of the storage device. Compared with the traditional solution in which the metadata index information of the data to be written is generated by the storage software on the CPU, and the data to be written and the metadata index information are written to the memory through the CPU, it can save part of the CPU resources and data bandwidth occupied by the data to be written during the data writing process, thereby improving the data writing efficiency of the storage device in the storage network architecture.
[0104] Since the metadata index information generated by the network card in the embodiment of the present application can indicate the address where the data is written in the memory, in some possible implementations, the network card can also directly read the corresponding data from the memory according to the obtained read instruction and the metadata index information stored in the memory. Specifically, after writing the first data into the memory, the above method can also include: the network card obtains a read instruction, the read instruction is used to instruct to read the first data; the network card obtains the metadata index information of the first data according to the read instruction; the network card reads the first data from the memory according to the metadata index information. Through the above scheme, the network card can determine the address of the data to be read stored in the memory and / or hard disk according to the metadata index information of the data to be read written into the memory and / or hard disk, so as to directly read the data to be read through the network card, thereby improving the data reading efficiency of the storage device.
[0105] In addition, in some possible implementations, the network card and memory that execute the above method may also be located in different devices, that is, the network card of the host server generates metadata index information and writes the data directly to the memory of the storage device. For example, the address mapping table can be stored in the network card of the host server. When the host server generates a write instruction and reaches the network card of the host server, the network card of the host server can generate metadata information of the data to be written according to the address mapping table. The metadata information can still be sent through the path in the traditional way, that is, from the network card of the host server to the network card of the storage device, and written to the memory through the CPU of the storage device. However, based on, for example, RDMA technology, the data to be written can be written directly from the network card of the host server to the memory of the storage device according to the metadata index information, thereby reducing the data exchange between network cards and further improving the efficiency of writing data.
[0106] Combination of the above Figures 2 to 6 The method for writing data provided by the present application is described below. Figures 7 and 8 , an embodiment of the device for writing data provided in this application is described.
[0107] The embodiment of the present application provides a storage device, including a network card, a CPU and a memory. The network card is used to obtain a write instruction through a network, and the write instruction includes first data to be written; the network card is also used to generate metadata index information of the first data and send it to the CPU, and the metadata index information is used to describe the attributes of the first data and the address where the first data is written to the memory; the CPU is used to write the metadata index information to the memory; the network card is also used to write the first data to the memory according to the metadata index information.
[0108] Figure 7A schematic structural block diagram of a device 700 for writing data provided in an embodiment of the present application is shown. The device 700 is set in a storage device in a storage network architecture, including but not limited to a storage controller in a SAN, a storage server in a distributed storage, a separate storage server, etc. The storage device includes a network card, a CPU, and a memory.
[0109] Optionally, the memory includes internal memory and external memory, the internal memory includes but is not limited to: random access memory (RAM) and read-only memory (ROM), and the external memory includes but is not limited to a hard disk drive (HDD) and a solid state drive (SSD).
[0110] like Figure 7 As shown, the device 700 includes: an acquisition module 710 arranged on the network card, a generation module 720 arranged on the network card, a first writing module 730 arranged on the CPU, and a second writing module 740 arranged on the network card.
[0111] Specifically, the acquisition module 710 is used to acquire a write instruction, where the write instruction includes the first data to be written.
[0112] Optionally, the acquisition module 710 is further configured to create a write-ahead log WAL object corresponding to the write instruction according to the write instruction, where the WAL object corresponds to the identifier.
[0113] Specifically, the generating module 720 is used to generate metadata index information of the first data, where the metadata index information is used to describe the attributes of the first data and the address where the first data is written into the memory.
[0114] Optionally, the metadata index information includes but is not limited to at least one of the following: a logical block address (LBA), a logical disk unit identity (LUNID).
[0115] Optionally, the generating module 720 is specifically configured to generate metadata index information of the first data according to an address mapping table stored in the network card, where the address mapping table is used to indicate addresses in the memory that can be used to write data.
[0116] Optionally, the address mapping table includes a mapping relationship between the value of an identifier maintained by the network card and an address of a memory, and the generation module 720 is specifically used to assign a first identifier to the first data; determine a first address at which the first data is written to the memory based on the value of the first identifier and the address mapping table, wherein the address mapping table includes a mapping relationship between the value of the first identifier and the first address; and generate metadata index information based on the address at which the first data is written to the memory and the attributes of the first data.
[0117] Specifically, the first writing module 730 is used to write metadata index information into the memory.
[0118] Optionally, the first writing module 730 is specifically used to write metadata index information into the memory according to the non-volatile memory standard NVMe.
[0119] Specifically, the second writing module 740 is used to write the first data into the memory according to the metadata index information.
[0120] Optionally, the second writing module 740 is specifically configured to write the first data into the memory through remote direct data access RDMA according to the metadata index information.
[0121] Optionally, before generating metadata index information of the first data according to the address mapping table stored in the network card, the acquisition module 710 is also used to acquire the second data; the generation module 720 is also used to assign a second identifier to the second data; the first write module 730 is also used to write the second data to the second address of the memory; the generation module 720 is also used to establish an address mapping table according to the value of the second identifier and the second address; after the second address is in an idle state, the first write module 730 is also used to: send an indication message to the network card, the indication message is used to indicate that the second address is available.
[0122] Optionally, the CPU includes a first cache module and a second cache module, and the first write module 730 is specifically used to write metadata index information into the first cache module; write metadata information from the first cache module into the memory; the first write module 730 is also used to establish a mirror of the metadata index information in the second cache module based on the metadata index information in the first cache module.
[0123] Optionally, the network card may also be used to obtain a read instruction, where the read instruction is used to instruct to read the first data; obtain metadata index information of the first data according to the read instruction; and read the first data from the memory according to the metadata index information.
[0124] Among them, the above modules can be implemented by software or by hardware. Exemplarily, the implementation of the generation module 720 is introduced below by taking the generation module 720 as an example. Similarly, the implementation of the acquisition module 710, the first writing module 730 and the second writing module 740 can refer to the implementation of the generation module 720.
[0125] As an example of a software functional unit, the generation module 720 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the generation module 720 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.
[0126] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0127] As an example of a hardware functional unit, the generation module 720 may include at least one computing device, such as a server, etc. Alternatively, the generation module 720 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0128] The multiple computing devices included in the generation module 720 can be distributed in the same region or in different regions. The multiple computing devices included in the generation module 720 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the generation module 720 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0129] It should be noted that, in other embodiments, the acquisition module 710, the generation module 720, the first writing module 730 and the second writing module 740 can be used to execute any step in the above-mentioned method of writing data respectively, and the steps that the acquisition module 710, the generation module 720, the first writing module 730 and the second writing module 740 are responsible for implementing can be specified as needed. The full functions of the device 700 are realized by respectively implementing different steps in the above-mentioned method of writing data by the acquisition module 710, the generation module 720, the first writing module 730 and the second writing module 740.
[0130] The present application also provides a computing device 100. Figure 8 As shown, the computing device 100 includes: a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other through the bus 102. The computing device 100 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 100.
[0131] The bus 102 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 102 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 102 may include a path for transmitting information between various components of the computing device 100 (eg, the memory 106, the processor 104, and the communication interface 108).
[0132] The processor 104 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0133] The memory 106 may include a volatile memory, such as a random access memory (RAM). The memory 106 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0134] The memory 106 stores executable program codes, and the processor 104 executes the executable program codes to respectively implement the functions of the aforementioned acquisition module, generation module, first writing module, and second writing module, thereby implementing the aforementioned method of writing data. That is, the memory 106 stores instructions for executing the aforementioned method of writing data.
[0135] The communication interface 108 uses a command distribution module such as, but not limited to, a network interface card, a transceiver, etc. to implement communication between the computing device 100 and other devices or a communication network.
[0136] An embodiment of the present application also provides a chip, which includes a processor and a data interface. The processor reads instructions stored in a memory through the data interface to execute the above-mentioned method of writing data.
[0137] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the above-mentioned method of writing data.
[0138] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by the computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state hard disk), etc. The computer-readable storage medium includes instructions, and the instructions instruct the computing device to perform the above-mentioned management. The various technical features can be combined arbitrarily. In order to make the description concise, all possible combinations of the various technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for writing data, characterized in that: The method is applied to a storage device, the storage device includes a network card, a central processing unit (CPU) and a memory, and the method includes: The network card obtains a write instruction through a network, wherein the write instruction includes first data to be written; The network card generates metadata index information of the first data and sends it to the CPU, where the metadata index information is used to describe an address where the first data is written into the memory; The CPU writes the metadata index information into the memory; The network card writes the first data into the memory according to the metadata index information.
2. The method according to claim 1, characterized in that The generating metadata index information of the first data includes: Metadata index information of the first data is generated according to an address mapping table stored in the network card, wherein the address mapping table is used to indicate addresses in the memory that can be used to write data.
3. The method according to claim 2, characterized in that The address mapping table includes a mapping relationship between a value of an identifier maintained by the network card and an address of the memory, and generating metadata index information of the first data according to the address mapping table stored in the network card includes: assigning a first identifier to the first data; Determine, according to the value of the first identifier and the address mapping table, a first address at which the first data is written into the memory, wherein the address mapping table includes a mapping relationship between the value of the first identifier and the first address; The metadata index information is generated according to the first address and the attribute of the first data.
4. The method according to claim 3, characterized in that Before generating metadata index information of the first data according to the address mapping table stored in the network card, the method further includes: The network card acquires second data; The network card assigns a second identifier to the second data; The CPU writes the second data into a second address of the memory; The network card establishes the address mapping table according to the value of the second identifier and the second address; After the second address is in an idle state, the method further includes: The CPU sends indication information to the network card, where the indication information is used to indicate that the second address is available.
5. The method according to any one of claims 1 to 4, characterized in that: The step of writing the first data into the memory according to the metadata index information comprises: The first data is written into the memory through remote direct data access (RDMA) according to the metadata index information.
6. The method according to any one of claims 1 to 5, characterized in that The step of writing the metadata index information into the memory comprises: According to the non-volatile memory standard NVMe, the metadata index information is written into the memory.
7. The method according to any one of claims 1 to 6, characterized in that Before generating metadata index information of the first data according to the address mapping table stored in the network card, the method further includes: According to the write instruction, a write-ahead log WAL object corresponding to the write instruction is established, and the WAL object corresponds to the identifier.
8. The method according to any one of claims 1 to 7, characterized in that The metadata index information includes at least one of the following: a logical block address LBA, and a logical hard disk unit identification code LUNID.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: The network card obtains a read instruction, where the read instruction is used to instruct to read the first data; The network card obtains metadata index information of the first data according to the read instruction; The network card reads the first data from the memory according to the metadata index information.
10. A storage device, characterized in that: The storage device includes a network card, a central processing unit CPU and a memory. The network card is used to obtain a write instruction through a network, wherein the write instruction includes first data to be written; The network card is further used to generate metadata index information of the first data and send it to the CPU, wherein the metadata index information is used to describe an address where the first data is written into the memory; The CPU is used to write the metadata index information into the memory; The network card is further configured to write the first data into the memory according to the metadata index information.
11. The storage device according to claim 10, characterized in that: The network card is used for: Metadata index information of the first data is generated according to an address mapping table stored in the network card, wherein the address mapping table is used to indicate addresses in the memory that can be used to write data.
12. The storage device according to claim 11, characterized in that: The address mapping table includes a mapping relationship between a value of an identifier maintained by the network card and an address of the memory, and the network card is used to: assigning a first identifier to the first data; Determine, according to the value of the first identifier and the address mapping table, a first address at which the first data is written into the memory, wherein the address mapping table includes a mapping relationship between the value of the first identifier and the first address; The metadata index information is generated according to the address at which the first data is written into the memory and the attribute of the first data.
13. The storage device according to claim 12, characterized in that: Before generating metadata index information of the first data according to the address mapping table stored in the network card, the network card is further used to: acquiring second data; assigning a second identifier to the second data; The CPU is further configured to write the second data into a second address of the memory; The network card is further used to establish the address mapping table according to the value of the second identifier and the second address; After the second address is in an idle state, the CPU is further configured to: Send indication information to the network card, where the indication information is used to indicate that the second address is available.
14. The storage device according to any one of claims 10 to 13, characterized in that: The network card is used for: The first data is written into the memory through remote direct data access (RDMA) according to the metadata index information.
15. The storage device according to any one of claims 10 to 14, characterized in that: The CPU is used to: According to the non-volatile memory standard NVMe, the metadata index information is written into the memory.
16. The storage device according to any one of claims 10 to 15, characterized in that: Before generating metadata index information of the first data according to the address mapping table stored in the network card, the network card is further used to: According to the write instruction, a write-ahead log WAL object corresponding to the write instruction is established, and the WAL object corresponds to the identifier.
17. The storage device according to any one of claims 10 to 16, characterized in that: The metadata index information includes at least one of the following: a logical block address LBA, and a logical hard disk unit identification code LUNID.
18. The storage device according to any one of claims 10 to 17, characterized in that: The network card is also used for: Obtaining a read instruction, where the read instruction is used to instruct to read the first data; According to the read instruction, obtaining metadata index information of the first data; The first data is read from the memory according to the metadata index information.
19. A computing device, characterized in that The computer comprises a processor and a memory, wherein the processor is configured to execute instructions stored in the memory so that the computing device executes the method according to any one of claims 1 to 9.
20. A computer-readable storage medium, characterized in that: The method comprises computer program instructions which, when executed by a computing device, cause the computing device to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method for storing data, memory and computer system
CN106201350A
Controller and operation method thereof
CN110781095A
Control part of storage device
CN112765055A
Data access system, method, equipment and network card
CN115270033A
Data writing method and device, storage medium, storage equipment and electronic equipment
CN115309329A
Cited By
Data indexing method, system and related device
CN121166675A