Data writing method and storage device

By establishing the address mapping relationship of memory and/or hard disk in the network card, directly generating metadata index information and writing data, the problem of low data writing efficiency in the existing storage network architecture is solved, and more efficient utilization of CPU resources and data bandwidth is achieved.

WO2025044078A1PCT designated stage expired Publication Date: 2025-03-06HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/077799
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-31
Filing Date
2024-02-20
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

In the existing storage network architecture, data writing operations occupy a large amount of CPU resources and data bandwidth, resulting in low data writing efficiency of the storage controller.

Method used

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 data processing through the CPU of the storage controller.

Benefits of technology

It saves part of the CPU resources and data bandwidth occupied by the data to be written during the data writing process, and improves the data writing efficiency of storage devices in the storage network architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024077799_06032025_PF_FP_ABST
    Figure CN2024077799_06032025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the field of computers, and provides a data writing method and a storage device. The storage device comprises a network card, a CPU and a memory. The method comprises: a network card acquiring a write instruction by means of a network, wherein the write instruction comprises first data to be written (S210); the network card generating metadata index information of the first data and sending same to a CPU, wherein the metadata index information is used for describing an address where the first data is written into a memory (S220); the CPU writing the metadata index information into the memory (S230); and the network card writing the first data into the memory on the basis of the metadata index information (S240). In the present application, by establishing in a network card a mapping relationship between an address of a memory and a network card, metadata index information of data to be written can be directly generated in the network card, and the data is directly written into a corresponding address in the memory on the basis of the metadata index information, such that said data does not need to be processed by a CPU of a storage device, thereby improving the data writing efficiency of a storage device in a storage network architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Method for writing data and storage device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on August 31, 2023, with application number 202311119437.2 and application name “Method and Storage Device for Writing Data”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computers, and more specifically, to a method for writing data and a storage device. Background Art

[0003] A storage area network (SAN) is a block-based storage network architecture that connects host servers to storage controllers over a network. A logical disk unit (LUN) is a series of blocks configured from a shared storage pool within the SAN, presented to host servers as logical disks. The host server, through the storage controller, partitions and formats these blocks, typically using a file system, so that data can be stored on the LUNs as if they were local disk storage. The SAN design eliminates single points of failure, resulting in extremely high availability and resilience.

[0004] 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 a write operation as an example, data and write requests need to be sent from the host server's network card through the network to the storage controller's network card, and then sent by the storage controller's network card to the storage controller's central processing unit (CPU) for processing. The data is then written to the memory and / or hard disk by the storage software running on the CPU. The above process occupies a large amount of CPU resources and data bandwidth, becoming a bottleneck for the storage controller's data write performance, resulting in low efficiency in the storage controller's data writing. Therefore, how to improve the data write efficiency of the storage controller in the storage network architecture has become a technical problem that urgently needs to be solved.

[0005] Summary of the Invention

[0006] An 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.

[0007] In a first aspect, a method for writing data is provided, which is applied to a storage device, the storage device including a network card, a CPU and a memory, the method comprising: the network card obtaining a write instruction through a network, the write instruction including 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; and the network card writing the first data into the memory according to the metadata index information.

[0008] The write command comes from outside the storage controller, for example, from a client host.

[0009] 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; or the storage device may also be a separate storage server.

[0010] 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). 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 provided inside the storage device or connected to the storage device via a bus; the remote memory is connected to the storage device via a network or provides storage space for the storage device in a cloud manner.

[0011] Optionally, the metadata index information includes but is not limited to at least one of the following: a logical block address (LBA) and a logical disk unit identity (LUNID).

[0012] According to the technical solution provided by the present application, metadata index information of the data to be written is directly generated by 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. This allows the data to be written to be stored without being processed by the CPU of the storage controller after it is transferred from the outside of the storage device to the network card. 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 both the data to be written and the metadata index information are written to the memory through the CPU, this solution can save some 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.

[0013] 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 based on 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.

[0014] 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 addresses 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.

[0015] In combination with the first aspect, in certain implementations of the first aspect, the address mapping table includes a mapping relationship between the value of an identifier maintained by the network card and the address of the 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 the first address and attributes of the first data.

[0016] 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 be written 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 memory address to be written of the data to be written.

[0017] In combination with the first aspect, before generating metadata index information of the first data based on 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 based on 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 being used to indicate that the second address is available.

[0018] According to the above technical solution, by first using the software system in the CPU to write data into the memory and / or hard disk, 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.

[0019] 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 the 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.

[0020] 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-scale data transmission between caches, thereby improving the efficiency of maintaining multiple copies running within the system.

[0021] 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.

[0022] 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 does 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.

[0023] 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.

[0024] 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.

[0025] In combination with the first aspect, in certain implementations of the first aspect, before generating metadata index information of the first data based on 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 based on the write instruction, and the WAL corresponds to the identifier.

[0026] 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.

[0027] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: the network card obtains a read instruction, the read instruction is used to instruct reading of the first data; the network card obtains metadata index information of the first data according to the read instruction; and the network card reads the first data from the memory according to the metadata index information.

[0028] 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.

[0029] 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, where 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, where the metadata index information is used to describe the address at which the first data is written to the memory; the CPU is used to write the metadata index information into the memory; and the network card is also used to write the first data into the memory according to the metadata index information.

[0030] 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; or the storage device may also be a separate storage server.

[0031] 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). 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 provided inside the storage device or connected to the storage device via a bus; the remote memory is connected to the storage device via a network or provides storage space for the storage device in a cloud manner.

[0032] Optionally, the metadata index information includes but is not limited to at least one of the following: a logical block address (LBA) and a logical disk unit identity (LUNID).

[0033] 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.

[0034] In combination with the second aspect, in certain implementations of the second aspect, the address mapping table includes a mapping relationship between the value of an identifier maintained by the network card and the address of the memory, and the network card is used to: assign a first identifier to the first data; determine the 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.

[0035] In combination with the second aspect, in certain implementations of the second aspect, before generating metadata index information of the first data based on 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 based on 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, where the indication message is used to indicate that the second address is available.

[0036] 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 metadata index information into the first cache module; write metadata index information from the first cache module into the memory; and 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.

[0037] 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.

[0038] 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.

[0039] In combination with the second aspect, in certain implementations of the second aspect, before generating metadata index information of the first data based on the address mapping table stored in the network card, the network card is also used to: establish a pre-written log WAL object corresponding to the write instruction based on the write instruction, and the WAL object corresponds to the identifier.

[0040] In combination with the second aspect, in some implementations of the second aspect, the network card is further 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.

[0041] 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.

[0042] Optionally, the processor may be a general-purpose processor, which may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated into the processor or located independently of the processor.

[0043] In a fourth aspect, a chip is provided, which obtains an instruction and executes the instruction to implement the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0044] 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.

[0045] 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.

[0046] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed by a computing device, enables the computing device to execute the method in the above-mentioned first aspect or any possible implementation of the first aspect.

[0047] 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 of the first aspect.

[0048] 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 a hard drive.

[0049] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] FIG1 is a schematic structural diagram of a storage network used in an embodiment of the present application.

[0051] FIG2 is a schematic flowchart of a method for writing data provided in an embodiment of the present application.

[0052] FIG3 is a schematic flow chart of a conventional solution in which data to be written is written into a memory via a CPU of a storage device.

[0053] FIG4 is a schematic flowchart of a method for directly writing data to be written into a memory through a network card of a storage device according to an embodiment of the present application.

[0054] FIG5 is a schematic flowchart of writing data to be written into a memory through a network card of a storage device according to an embodiment of the present application.

[0055] FIG6 is a schematic flowchart of writing data to be written into a hard disk through a network card of a storage device according to an embodiment of the present application.

[0056] FIG7 is a schematic structural block diagram of a device for writing data provided in an embodiment of the present application.

[0057] FIG8 is a schematic structural block diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0059] This application will present various aspects, embodiments, or features around systems 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 of the devices, components, modules, etc. discussed in conjunction with the figures. Furthermore, combinations of these aspects may also be used.

[0060] Additionally, in the embodiments of this application, words such as "exemplary" and "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner.

[0061] 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.

[0062] 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 skilled in the art will 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 equally applicable to similar technical problems.

[0063] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0064] In this application, "at least one" means one or more, and "more" 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 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.

[0065] To facilitate understanding, the following first introduces relevant terms and concepts that may be involved in the embodiments of this application.

[0066] 1. Storage Area Network (SAN): A SAN is a block-based storage architecture that connects servers to their logical disk units (LUNs) using a high-speed architecture. A LUN is a series of blocks configured from a shared storage pool and presented to the server as a logical disk. The server partitions and formats these blocks, typically using a file system, so that data can be stored on the LUN just like on local hard disk storage. The SAN design eliminates single points of failure, resulting in extremely high availability and resilience. SAN is the most commonly used storage network architecture in enterprises, offering low latency, high bandwidth, and high reliability. Critical enterprise applications such as databases and virtual machines often rely on this type of storage. The trend toward all-flash SANs is towards all-flash storage, using flash memory for memory and solid-state drives (SSDs) instead of hard disk drives (HDDs). This provides superior performance, consistently low latency, lower power consumption, and a lower total cost.

[0067] 2. Nonvolatile Memory Express (NVMe): NVMe is a new storage access and transfer protocol for flash memory and next-generation SSDs, delivering the highest throughput and fastest response times for all types of enterprise workloads. Designed specifically for SSD performance, NVMe offers significant performance advantages over legacy protocols like Serial Attached Small Computer System Interface (SAS) and Serial Advanced Technology Attachment (SATA), making it a popular choice for SSD access.

[0068] 3. Network-based NVMe (NVMe over fabric, NoF): NoF technology is an application of the NVMe protocol in a SAN. NVMe is a protocol that runs on storage devices, but a 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 the storage network. Therefore, NoF technology uses the network based on NVMe to form data transmission between servers and the storage network. NoF has developed different technical routes to implement NVMe using different transport layer protocols, such as NVMe (NVeM over FC) using the Fibre Channel (FC) protocol, NVMe (NVeM over TCP) using the 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.

[0069] 4. Remote Direct Memory Access (RDMA): RDMA is a technology developed to address server-side data processing delays during network transmission. RDMA enables user-space applications to directly read or write remote storage over the network, bypassing the operating system. Therefore, no kernel intervention or memory copying occurs, saving significant CPU resources, improving system throughput, and reducing network communication latency.

[0070] RDMA works as follows: (1) When an application executes an RDMA read or write request, no data copying is performed. Without 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 in the local memory and transmits it to the remote NIC over 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 network cards to directly read and write to memory.

[0071] 5. Write-ahead logging (WAL): WAL is a set of technologies used in database systems to provide atomicity and persistence for data. In a system using WAL, all modifications are first written to the log and then applied to the system state.

[0072] 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 the 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 arriving at 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. 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, becoming a bottleneck for the data writing performance of the storage controller, resulting in low efficiency of the storage controller in 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.

[0073] 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.

[0074] Figure 1 shows a schematic structural block diagram of a storage network used in an embodiment of the present application. As shown in Figure 1, 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 via a network. Optionally, information exchange between the network card 111 and the network card 121 is based on NoF, or can be 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 data read and write instructions through the network card 111. The storage controller 120 receives data read and write instructions through the network card 121 and completes the data read and write operations.

[0075] 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.

[0076] The storage controller 120 also includes a CPU 122. Storage software runs in the CPU 122, which is used to write 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 processing 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 to the internal memory and initiating a request to write data to the external memory, and sending the request to the index. The index is responsible for managing external memory resources and writing data to the external memory according to the request sent by the cache. It should be understood that the data described above in the storage software function refers to the data written to 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.

[0077] 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, random access memory (RAM) and read-only memory (ROM), such as the double data rate synchronous dynamic RAM (DDR) 123 shown in FIG1 . 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 the SSD 124 shown in FIG1 . It should be understood that in other possible implementations, the internal memory may also be referred to as memory, and the external memory may also be referred to as hard disk. Therefore, the terms memory and / or hard disk appearing below or in other technical solutions may have the same meaning as the internal memory and / or external memory.

[0078] FIG2 is a schematic flow chart illustrating a method for writing data provided by an embodiment of the present application. Optionally, the method may be performed 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 system, or a separate storage server. For example, the method may be performed by the storage controller 120 shown in FIG1 . As shown in FIG2 , the method includes the following steps.

[0079] S210: The network card obtains a write instruction through the network.

[0080] For example, in step S210, the network interface card 121 of the storage controller 120 may obtain a write instruction. Specifically, the write instruction includes a write data request and first data, where the first data is data to be written to the memory. The write data request instructs the storage controller 120 to write the first data to 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 interface card 121 of the storage controller 120 via the network interface card 111 of the host server 110.

[0081] S220: The network card generates metadata index information of the first data and sends it to the CPU.

[0082] 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, thereby determining the physical address where the first data is written to the memory 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 (LBA), the logical disk unit identity (LUNID), etc., so as to facilitate retrieval of the first data from the memory according to the metadata index information after the first data is written.

[0083] Specifically, the network card 121 can divide the storage space of the memory managed by the storage controller 120 into N smallest storage units based on the size of the storage space. 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. 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 to store the data to be written based on 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 in the memory where the data to be written is written based on the physical addresses mapped by the M storage units.

[0084] Optionally, for each acquired write instruction, the network card 121 can also create a WAL object corresponding to the write instruction, which is used to distinguish each data write operation performed by the network card 121. By creating 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 data write and / or metadata index information write operations.

[0085] In some possible implementations, the network card 121 stores an address mapping table, which is used to indicate addresses 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, and then determines the address of the first data written to the memory based on 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 based on 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 memory storage space. If the number of storage units required for the data to be written is M, then M is added to the current offset value as the 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.

[0086] 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 two storage units in the memory are already 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 from 2 to 4 in the address mapping table, the physical addresses corresponding to each are used as the addresses for writing the first data into the memory, indicating that the first data uses the physical addresses corresponding to the 3rd to 5th storage units.

[0087] 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 memory address where the data to be written is written.

[0088] Optionally, before the address mapping table is established, or when the identifier assigned to the data to be written cannot find a corresponding physical address in the address mapping table, that is, when the mapping relationship between the addresses of all or part of the memory and the network card 121 has not yet been established, the storage controller 120 can first write the data to the memory through the CPU 122, thereby establishing a 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 to the memory, the network card 121 establishes or updates the address mapping table based on the value of the identifier and the physical address where the second data was written to the memory.

[0089] Optionally, CPU 122 can also determine the storage status of data in the memory. After the second address is in an idle state, CPU 122 can send an indication to network card 121, indicating that the second address is available. The idle state of the second address means that no data is currently stored at that physical address in the memory, and therefore new data can be written to that address. After receiving the indication from CPU 122, network card 121 can reallocate the identifier corresponding to the address indicated by the indication to other data to be written.

[0090] 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 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.

[0091] It should be understood that the above solution merely provides a method for enabling compatibility between methods of writing data via the CPU and methods of writing data bypassing the CPU. It does not limit the mapping relationship between memory addresses and network cards to being established solely based on the results of data written by the CPU software. For example, if the data to be written is no longer written via the CPU software, the mapping relationship can also be established through other means, such as manually pre-setting, and this application does not specifically limit this.

[0092] S230: The CPU writes the metadata index information into the memory.

[0093] For example, in step S230, CPU 122 may write the metadata index information generated by the network card in S220 to the memory. Alternatively, CPU 122 may write the metadata index information to 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. The block organizes the metadata index information and sends it to the cache. The cache writes it to the memory and initiates a request to write it to the hard disk. The index writes the metadata index information to the hard disk according to the request to cut into the hard disk.

[0094] S240: The network card writes the first data into the memory according to the metadata index information.

[0095] For example, in step S240, the network card 121 can directly write the first data to be written into the memory based on the metadata index information generated by the network card in S220. Alternatively, the network card 121 can write the first data into the memory via RDMA. The process of writing the first data and metadata index information into the memory will be described in detail below with reference to Figures 3 to 6, and will not be repeated here.

[0096] FIG3 shows a schematic flow chart of a conventional method of writing data to be written into a memory through the CPU of a storage device. As shown in FIG3 , the network card on the storage management device side receives a protocol message sent by a host server, and parses the protocol message to obtain a 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.

[0097] Optionally, the cache can back up the data after writing it to memory. As shown in Figure 3, the cache can organize the data into a log and write it to a linear space. A copy of the data, or mirror, is then created in the cache of another node. This mirrored copy is called a mirror node. If the currently active node fails, the services issued by the host server can be taken over by the mirror node, ensuring uninterrupted service and providing disaster recovery for the system.

[0098] The above steps describe the process of writing data to internal storage, such as RAM. The storage device can then write the data to external storage, such as a hard drive. As shown in Figure 3, the cache, through a background process, assembles the data in memory into a specific format. After triggering mechanisms such as the buffer level, it sends a write request and the data to the index running on the CPU. Based on the write request, the index generates the metadata necessary to write the data to disk and, based on this metadata, writes the data to the storage device's hard drive.

[0099] It should be understood that, in addition to providing mirroring disaster recovery for the current working node, the mirror node can also function as a normal working node to handle other tasks. For example, in the scenario shown in Figure 3, data to be written 1 is written to memory 1 and disk 1 via node 1, and a mirror of data to be written 1 is created on node 2. However, node 2 can also receive other data to be written 2 and write it to memory 2 and disk 2. The specific write process can be referenced in the workflow for node 1 above and will not be detailed here.

[0100] Figure 4 shows a schematic flowchart of the process of directly 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. The difference from the method shown in Figure 3 is that the network card of the storage device in Figure 4 receives the protocol message sent by the host server and parses the protocol message to obtain the write command, and then generates metadata index information for writing the data to be written into the memory and the hard disk. The data to be written and the metadata index information are written into the memory and the hard disk respectively through different paths, wherein 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 the metadata index information into the memory and the hard disk through the CPU is the same as the process of writing the data to be written into the memory and the hard disk in Figure 3, except that the data content and the amount of data are different. For details, please refer to the corresponding description in Figure 3, or the description of step S230 in the previous text, which will not be repeated here. The process of writing the data to be written into the memory and the hard disk is specifically described in conjunction with Figures 5 and 6.

[0101] FIG5 shows a schematic flow chart of writing data to be written into memory through the network card of a storage device provided by an embodiment of the present application. As shown in FIG5 , 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, thereby generating metadata index information (meta) corresponding to the data to be written according to the mapping relationship. The network card also establishes and maintains a WAL object according to the write command to ensure the atomicity and orderliness of the write operation. The metadata index information is written into the memory in the form of a metadata index information log (meta log) through the block and cache in the CPU. The data to be written in the network card is directly written into the memory in the form of a data log (data log) through a unilateral RDMA in accordance with the meta log by appending writes. Among them, data log 1 to N correspond to offsets 1 to N allocated for the data to be written. The data to be written is written directly into the memory through the network card, which saves CPU resources and data bandwidth compared to writing through the CPU.

[0102] It should be understood that unilateral RDMA refers to the application of some technologies in RDMA technology in this scenario, which is to write data directly to the memory through the network card. As mentioned above, the complete RDMA technology is a process in which an application in the application space of a computing device 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 implement the network card of the storage device to directly access 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 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 implement the network card to directly write data to the memory and hard disk. It is only a means to implement step S240 in the method of writing data provided in the embodiment of this application, but the application is not limited to this. Other technologies that can enable the network card to directly write data to the memory can be used to implement step S240, and this application does not go into details.

[0103] 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 can 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 multiple copies running in the system, thereby further saving CPU resources and data bandwidth while ensuring the disaster recovery capability of the system.

[0104] Figure 6 shows a schematic flow chart of writing data to a hard disk via a storage device's network interface card (NIC), according to an embodiment of the present application. As shown in Figure 6 , the in-memory metalog is written to the storage device's hard disk via a flash write operation, passing through the CPU's index module. The data to be written in the NIC is directly written to the corresponding physical address on the hard disk via unilateral RDMA, based on the address indicated by the metalog being flashed to the hard disk. Similarly, writing data directly to the hard disk via the NIC saves CPU resources and data bandwidth compared to writing via the CPU.

[0105] 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 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 both written to the memory through the CPU, it can save some 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.

[0106] 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 based on 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 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 device.

[0107] 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 it 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 based on 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 based on the metadata index information, thereby reducing the data exchange between network cards and further improving the efficiency of writing data.

[0108] The above description is based on FIG. 2 to FIG. 6 to illustrate an embodiment of the method for writing data provided by the present application. The following description is based on FIG. 7 to FIG. 8 to illustrate an embodiment of the device for writing data provided by the present application.

[0109] An embodiment of the present application provides a storage device, including a network card, a CPU, and a memory. The network card is configured to obtain a write instruction via a network, wherein the write instruction includes first data to be written; the network card is further configured to generate metadata index information of the first data and send it to the CPU, wherein the metadata index information is used to describe the attributes of the first data and the address at which the first data is written to the memory; the CPU is configured to write the metadata index information to the memory; and the network card is further configured to write the first data to the memory based on the metadata index information.

[0110] Figure 7 shows a schematic block diagram of a data writing device 700 provided in an embodiment of the present application. Device 700 is provided 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.

[0111] 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).

[0112] As shown in FIG7 , the apparatus 700 includes: an acquisition module 710 provided in the network card, a generation module 720 provided in the network card, a first writing module 730 provided in the CPU, and a second writing module 740 provided in the network card.

[0113] Specifically, the acquisition module 710 is used to acquire a write instruction, where the write instruction includes the first data to be written.

[0114] 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.

[0115] 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.

[0116] Optionally, the metadata index information includes but is not limited to at least one of the following: a logical block address (LBA) and a logical disk unit identity (LUNID).

[0117] 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.

[0118] Optionally, the address mapping table includes a mapping relationship between the value of an identifier maintained by the network card and the address of the memory, and the generation module 720 is specifically used to assign a first identifier to the first data; determine the 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.

[0119] Specifically, the first writing module 730 is used to write metadata index information into the memory.

[0120] 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.

[0121] Specifically, the second writing module 740 is configured to write the first data into the memory according to the metadata index information.

[0122] 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.

[0123] Optionally, before generating metadata index information of the first data based on 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 based on 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.

[0124] 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.

[0125] 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.

[0126] The above modules can be implemented in software or hardware. For example, the implementation of the generation module 720 will be described below using 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.

[0127] As an example of a software functional unit, the generation module 720 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the 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 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 one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.

[0128] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.

[0129] As an example of a hardware functional unit, the generation module 720 may include at least one computing device, such as a server. Alternatively, the generation module 720 may be 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.

[0130] 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 servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.

[0131] 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 respectively execute any steps in the above-mentioned method of writing data. 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.

[0132] This application also provides a computing device 100. As shown in FIG8 , computing device 100 includes a bus 102, a processor 104, a memory 106, and a communication interface 108. Processor 104, memory 106, and communication interface 108 communicate with each other via bus 102. Computing device 100 may be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 100.

[0133] Bus 102 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG8 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 102 may include a path for transmitting information between various components of computing device 100 (e.g., memory 106, processor 104, and communication interface 108).

[0134] The processor 104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0135] The memory 106 may include volatile memory, such as random access memory (RAM). The memory 106 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0136] The memory 106 stores executable program code, and the processor 104 executes the executable program code to implement the functions of the aforementioned acquisition module, generation module, first writing module, and second writing module, thereby implementing the aforementioned method for writing data. In other words, the memory 106 stores instructions for executing the aforementioned method for writing data.

[0137] 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.

[0138] An embodiment of the present application also provides a chip, which includes a processor and a data interface. The processor reads instructions stored in the memory through the data interface to execute the above-mentioned method of writing data.

[0139] 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 on any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the aforementioned method for writing data.

[0140] 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 a 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 that instruct the computing device to perform the above-mentioned management. The various technical features can be arbitrarily combined. In order to make the description concise, not all possible combinations of the various technical features in the above embodiments are 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.

[0141] 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, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. 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

  • Metadata processing method and device

    CN110532201A

  • Data writing method, device and equipment

    CN110691062A

  • Write operation method and read operation method for memory

    CN113419675A

  • Data storage method and device and network equipment

    CN114911411A

  • Data access system, method, equipment and network card

    CN115270033A

Cited By

  • Access instruction sending method and device, storage medium, electronic equipment and computer program product

    CN121658076A