Data sharing method, apparatus and device
By using the storage controller in the computing system to establish the storage space mapping relationship between hosts, the problem of low data sharing efficiency in the CXL 2.0 protocol is solved, and more efficient data sharing and lower power consumption are achieved.
Patent Information
- Application Number
- PCT/CN2024/077829
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-26
- Filing Date
- 2024-02-20
- Publication Date
- 2024-09-26
AI Technical Summary
The data sharing efficiency between different hosts in the CXL 2.0 protocol is low, requiring data migration, resulting in greater power consumption and low efficiency.
The storage controller establishes storage space mapping relationships between hosts to reduce data migration, directly reads data from the storage device of the target host, and updates shared information when necessary to achieve data sharing.
It improves the efficiency of data sharing between hosts, reduces the power consumption caused by data migration, ensures timely acquisition of data, and is suitable for a variety of computing device deployment scenarios.
Smart Images

Figure CN2024077829_26092024_PF_FP
Abstract
Description
Data sharing method, device and equipment
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on March 22, 2023, with application number 202310293968.7 and application name “A computing system”, the entire contents of which are incorporated by reference into this application; this application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on May 26, 2023, with application number 202310611054.0 and application name “A data sharing method, device and equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of communication technology, and in particular to a data sharing method, apparatus, and device. Background Art
[0004] Compute Express Link (CXL) is an evolution of the Peripheral Component Interconnect Express (PCIe) standard. The CXL protocol will gradually transition from CXL 1.0 to CXL 2.0.
[0005] In the CXL 2.0 protocol, storage devices in a CXL-based computing system can be divided into multiple logical devices, which can be bound to different hosts in the computing system. Hosts can access their logical devices through CXL to read and write data.
[0006] However, in the CXL 2.0 protocol, data sharing between different hosts involves data migration. For example, when Host 1 needs to share data from Host 2's logical device, the data in Host 2's logical device must be migrated to Host 1's logical device. This involves copying the data from Host 2's logical device and then writing it to Host 1's logical device. This migration of data itself occurs. Host 1 then accesses its own logical device to read the data from Host 1's logical device. This data migration results in low data sharing efficiency between different hosts in the CXL 2.0 protocol.
[0007] Summary of the Invention
[0008] The present application provides a data sharing method, apparatus and device for improving the data sharing efficiency between hosts.
[0009] In a first aspect, an embodiment of the present application provides a data sharing method, which is applied to a computing system, wherein the computing system includes a first host, a second host, a storage controller, a storage device of the first host, and a storage device of the second host. The first host can access the storage device of the first host through the storage controller, and the second host can access the storage device of the second host through the storage controller. In an embodiment of the present application, the storage space in the storage device of the first host can be mapped to the storage space of the storage device of the second host. In this way, the first host can access the storage space of the storage device of the second host to which the storage space in the storage device of the first host is mapped. The access process is explained below:
[0010] The first host may send a read request to the storage controller, where the read request is used to request to read first data (the first data may be data 1 or data 2 in the embodiment of the present application) from a first address on the storage device of the first host.
[0011] After receiving the read request, the storage controller may determine the mapping of the first address to the second address on the storage device of the second host according to the sharing information of the first host, where the sharing information of the first host indicates the mapping relationship between the first address and the second address.
[0012] After determining the second address according to the shared information of the first host, the storage controller reads the first data from the second address and feeds the first data back to the first host.
[0013] The above description uses the first host as an example. Similarly, the storage space in the storage device of the second host can also be mapped to the storage space in the storage device of the first host. In this way, the second host can access the storage space in the storage device of the first host to which the storage space in the second host's storage device is mapped. The access process is similar to the method used by the first host to access the storage space in the storage device of the second host. For details, please refer to the previous description and will not be repeated here.
[0014] Through the above method, since the mapping relationship between the first address and the second address is indicated in the shared information of the first host, the storage controller only needs to read the first data directly from the second address after determining the second address and feed it back to the first host. There is no need to move the first data itself to the storage device of the first host, which reduces data movement, ensures that the first host can obtain the first data in a timely manner, and improves the data sharing efficiency between the first host and the second host.
[0015] In a possible implementation, before initiating a read request, the first host may migrate the first data from the second address to the first address through the storage controller. The process is as follows:
[0016] The first host sends a data migration instruction to the storage controller, where the data migration instruction is used to request to migrate the first data from the second address to the first address.
[0017] After receiving the data migration instruction, the storage controller updates the sharing information of the first host. The updated sharing information of the first host indicates a mapping relationship between the first address and the second address.
[0018] Through the above method, when the host instructs the storage controller to migrate the first data from the second address to the first address, the storage controller does not need to migrate the first data itself, but only needs to add the mapping relationship between the first address and the second address in the shared information of the first host, thereby avoiding the large power consumption caused by the migration of the data itself, and the data migration efficiency is higher. It also ensures that when the first host subsequently reads the first data, the storage controller can read the first data from the second host.
[0019] In a possible implementation, the first host may also write data to the storage device of the first host. Here, the second data is taken as an example, and the second data corresponds to the data 3 mentioned in the embodiment of the present application.
[0020] The first host sends a write request to the storage controller, where the write request is used to request writing second data at a first address.
[0021] After receiving the write request, the storage controller deletes the mapping relationship between the first address and the second address in the shared information of the first host, and accesses the storage device of the first host to write the second data at the first address.
[0022] Through the above method, the storage controller promptly deletes the mapping relationship between the first address and the second address after receiving the write request, thereby avoiding failure to read the second data when subsequently reading data from the first address.
[0023] In one possible implementation, the sharing information of the second host may record whether the storage space in the storage device of the second host is allowed to be shared. When the storage controller updates the sharing information of the first host, the storage controller may query the sharing information of the second host to determine whether the second address is allowed to be shared. If the sharing information of the second host indicates that the second address is allowed to be shared, the storage controller then updates the sharing information of the first host.
[0024] Through the above method, the storage controller determines whether the second address allows sharing before updating the sharing information of the first host, so as to ensure the security of the data at the second address in the storage device of the second host and avoid data leakage of the storage device of the second host.
[0025] In one possible implementation, a storage controller receives a data migration instruction from a first host, requesting the migration of first data from a second address to a first address. The storage controller may query the second host's sharing information to determine whether the second address allows sharing. If the second host's sharing information indicates that the second address prohibits sharing, the storage controller notifies the first host of the data migration failure. Because the second address does not allow sharing, the storage controller prevents leakage of data at the second address by notifying the first host of the data migration failure.
[0026] In one possible implementation, the computing system may be deployed in multiple computing devices, and the first host, the second host, the storage controller, the storage device of the first host, and the storage device of the second host may be distributed across the multiple computing devices. For example, the first host and the storage device of the first host may be located in different computing devices, and the first host and the second host may be located in different computing devices. The computing system may also be deployed in a single computing device, that is, the first host, the second host, the storage controller, the storage device of the first host, and the storage device of the second host may be deployed in a single computing device.
[0027] Through the above methods, there are multiple deployment methods for computing systems, suitable for different scenarios.
[0028] In a possible implementation, the storage device of the first host and the storage device of the second host may be physical storage devices, or may be logical devices formed by virtualizing physical storage devices.
[0029] Through the above method, the forms of the storage device of the first host and the storage device of the second host are relatively flexible, which effectively expands the applicable scenarios of the method.
[0030] In one possible implementation, the first address and the second address are both HPA. When the storage controller reads the first data from the second address, it can first query the host device address mapping table of the second host, convert the second address into the DPA of the second host, and read the first data from the DPA, wherein the host device address mapping table of the second host describes the mapping relationship between the HPA and DPA of the second host.
[0031] Through the above method, the storage controller can first query the shared information of the first host, and then query the host device address mapping table of the second host to ensure that the first data can be read from the second address.
[0032] In one possible implementation, the storage controller stores sharing information for each host. For example, the sharing information for a first host includes the first host's HPA, the HPA of a second host mapped to the first host's HPA, and information about the second host. The first host's HPA may represent the storage space of the first host's storage device. The second host's HPA may represent the storage space of the second host's storage device.
[0033] Through the above method, the storage controller can maintain the shared information of each host to ensure that data can be shared between the hosts.
[0034] In a possible implementation, the sharing information of the first host further includes a sharing flag, where the sharing flag is used to indicate whether the HPA of the first host allows sharing.
[0035] Through the above method, by setting an explicit sharing mark, it can be made clear whether the HPA of the first host allows sharing.
[0036] In one possible implementation, if the sharing information of the first host does not indicate a mapping relationship between the first address and the second address; that is, if no mapping relationship exists between the first address and the second address, the storage controller, upon receiving the read request, may access the storage device of the first host, read the first data from the first address, and feed the first data back to the first host.
[0037] Through the above method, after receiving a read request, if the first shared information does not indicate the address mapped by the first address, the storage controller can access the storage device of the first host according to the normal data reading process, read the first data from the first address, and feed the first data back to the first host.
[0038] In one possible implementation, the first address and the second address are both HPAs, and the shared information of the first host is represented by a DPA to represent the storage space of the storage device of the first host or the storage space of the storage device of the second host. After receiving the read request, the storage controller first queries the host device address mapping table of the first host and converts the first address into the DPA of the first host, wherein the host device address mapping table of the first host describes the mapping relationship between the HPA of the first host and the DPA;
[0039] The storage controller determines, based on the shared information of the first host, that the DPA of the first host is mapped to the DPA of the storage device of the second host, wherein a mapping relationship exists between the second address and the DPA of the second host. Thereafter, the storage controller reads the first data from the DPA of the second host.
[0040] Through the above method, the storage controller can first query the host device address mapping table of the first host, and then query the shared information of the first host to ensure that the first data can be read from the second address.
[0041] In a second aspect, embodiments of the present application further provide a computing system comprising a first host, a second host, a storage controller, a storage device of the first host, and a storage device of the second host. The computing system may be connected via a computing interconnect bus. The storage controller and the first host cooperate to implement the behavior described in the method example of the first aspect. The beneficial effects can be found in the description of the first aspect and are not further elaborated here.
[0042] The first host is configured to send a read request to the storage controller, where the read request is used to request to read first data from a first address on a storage device of the first host.
[0043] A storage controller is configured to receive a read request, determine a mapping of a first address to a second address on a storage device of a second host based on shared information of a first host, wherein the shared information of the first host indicates a mapping relationship between the first address and the second address; read first data from the second address, and feed the first data back to the first host.
[0044] In a possible implementation, the first host sends a data migration instruction to the storage controller before sending the read request, where the data migration instruction is used to request that the first data be migrated from the second address to the first address.
[0045] After receiving the data migration instruction, the storage controller updates the shared information of the first host. The updated shared information of the first host indicates a mapping relationship between the first address and the second address.
[0046] In a possible implementation, the first host sends a write request to the storage controller, where the write request is used to request writing the second data at the first address.
[0047] After receiving the write request, the storage controller deletes the mapping relationship between the first address and the second address in the shared information of the first host; accesses the storage device of the first host, and writes the second data at the first address.
[0048] In a possible implementation, before updating the sharing information of the first host, the storage controller may query the sharing information of the second host, and the sharing information of the second host indicates that the second address allows sharing.
[0049] In one possible embodiment, the storage controller receives a data migration instruction from the first host, where the data migration instruction is used to request that the first data be migrated from the second address to the first address; when the storage controller determines that the sharing information of the second host indicates that the second address is prohibited from being shared, it notifies the first host that the data migration has failed.
[0050] In a possible implementation, the computing system may be deployed on one computing device or on multiple computing devices.
[0051] In a possible implementation, the storage device of the first host and the storage device of the second host may be logical devices virtually formed from physical storage devices, or the storage device of the first host and the storage device of the second host may also be physical storage devices.
[0052] In one possible implementation, the first address and the second address are both HPA. When reading the first data from the second address, the storage controller queries the host device address mapping table of the second host, converts the second address into the DPA of the second host, and reads the first data from the DPA, wherein the host device address mapping table of the second host describes the mapping relationship between the HPA and DPA of the second host.
[0053] In a possible implementation, the storage controller stores shared information of the first host, including the HPA of the first host, the HPA of the second host mapped to the HPA of the first host, and information of the second host.
[0054] In a possible implementation, the sharing information of the first host further includes a sharing flag, where the sharing flag is used to indicate whether the HPA of the first host allows sharing.
[0055] In one possible implementation, if the shared information of the first host does not indicate a mapping relationship between the first address and the second address, after receiving a read request, the storage controller accesses the storage device of the first host, reads the first data from the first address, and feeds the first data back to the first host.
[0056] In a possible implementation, the first address and the second address are both HPAs, and the shared information of the first host uses DPA to represent the storage space of the storage device of the first host or the storage space of the storage device of the second host.
[0057] After receiving the read request, the storage controller first queries the host device address mapping table of the first host and converts the first address into the DPA of the storage device of the first host, wherein the host device address mapping table of the first host describes the mapping relationship between the HPA and DPA of the first host.
[0058] The storage controller determines, based on the shared information of the first host, that the DPA of the first host is mapped to the DPA of the second host, and that a mapping relationship exists between the second address and the DPA of the second host.
[0059] On the third aspect, an embodiment of the present application further provides a data sharing device, which has the function of implementing the behavior in the method example of the first aspect above. The beneficial effects can be found in the description of the first aspect and will not be repeated here. The functions can be implemented by hardware, or by hardware executing corresponding software implementations. The hardware or software includes one or more modules corresponding to the above functions. In one possible design, the structure of the device includes a receiving module, a processing module, and a sending module, which can perform the corresponding functions in the method example of the first aspect above. Please refer to the detailed description in the method example for details, which will not be repeated here.
[0060] In a fourth aspect, the present application further provides a computing device, comprising a processor and a power supply circuit, the power supply circuit being used to power the processor, wherein the processor can execute the method provided in the first aspect or any possible implementation of the first aspect. The processor can also invoke computer program instructions stored in a memory to execute the method provided in the first aspect or any possible implementation of the first aspect, the memory being coupled to the processor and storing the computer program instructions and data necessary for the data sharing process.
[0061] In a fifth aspect, the present application provides a computing device system comprising at least one computing device. Each computing device comprises a memory and a processor. The processor of at least one computing device is configured to access code in the memory to execute the method provided in the first aspect or any possible implementation of the first aspect.
[0062] In a sixth aspect, the present application provides a non-transitory readable storage medium. When the non-transitory readable storage medium is executed by a computing device, the computing device performs the method provided in the first aspect or any possible implementation of the first aspect. The storage medium stores a program. The storage medium includes, but is not limited to, volatile memory, such as random access memory, and non-volatile memory, such as flash memory, a hard disk drive (HDD), and a solid state drive (SSD).
[0063] In a seventh aspect, the present application provides a computing device program product, comprising computer instructions that, when executed by a computing device, cause the computing device to perform the method provided in the aforementioned first aspect or any possible implementation of the first aspect. The computer program product may be a software installation package, and when the method provided in the aforementioned first aspect or any possible implementation of the first aspect is required, the computer program product may be downloaded and executed on a computing device. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] FIG1 is a schematic diagram of the architecture of a computing system provided by the present application;
[0065] FIG2 is a schematic diagram of a data sharing method provided by this application;
[0066] Figures 3 to 7 are schematic diagrams of shared information of a host provided by this application;
[0067] FIG8 is a schematic structural diagram of a data sharing device provided by the present application;
[0068] 9 and 10 are schematic structural diagrams of a computing device provided in this application. DETAILED DESCRIPTION
[0069] Before introducing a data sharing method, system, and device provided in the embodiments of the present application, some concepts involved in the embodiments of the present application are first explained.
[0070] (1) Virtualization technology, computing instance, container, virtual machine (VM).
[0071] Virtualization is a resource management technology that abstracts and transforms a host's physical resources, such as processors, memory, and interfaces, into a physical form. Virtualization is a resource allocation method based on logic, a logical abstraction of physical resources.
[0072] Computing devices can use virtualization technology to form software modules with independent operating environments on the computing device. In the embodiments of the present application, the software modules with independent operating environments formed on the computing device are referred to as computing instances. The computing instances can be virtual machines or containers.
[0073] A virtual machine is a "complete computer" simulated using virtualization technology, with complete hardware system functions, running in a completely isolated environment. Any tasks that can be performed on a physical computer can also be performed in a virtual machine. A virtual machine has a processor (also called a virtual processor), memory, a hard disk, and other components. These components are virtualized from the host's processor, memory, and hard disk.
[0074] A container is an independent operating environment simulated through virtualization technology. A container is similar to a lightweight sandbox that shields software and hardware outside the container. Containers implement virtualization at the operating system level and directly reuse the host's operating system.
[0075] For computing devices, a computing instance is considered a special "process." This "process" performs computing tasks and occupies the computing device's processor, memory, hard disk, and other resources.
[0076] (2) Direct access to equipment and direct access to equipment.
[0077] Device passthrough refers to connecting a device directly to the host for use. To facilitate this, several hardware-level virtualization technologies have emerged. These virtualization technologies can virtualize hardware into multiple "devices," which are recognized as independent hardware devices by computing devices (such as operating systems) or computing instances (such as virtual machines and containers). Both computing devices and computing instances then treat these virtual devices as real hardware. Single-root I / O virtualization (SR-IOV) is a common hardware-level virtualization technology.
[0078] In the embodiments of the present application, a physical storage device can be virtualized into multiple logical devices using hardware-level virtualization technology. Each logical device has the functions of a storage device and can store data. The host can store its own data on different logical hard drives.
[0079] (3) Compute Express Link (CXL).
[0080] CXL is an evolution of the Peripheral Component Interconnect Express (PCIe) standard. It operates on the PCIe physical layer and shares the same electrical characteristics as PCIe. Compared to PCIe, CXL optimizes cache and memory, enabling lower latency and higher bandwidth.
[0081] The CXL standard introduces "multi-logic devices (MLDs)." MLD components implement logical resource partitioning within the CXL standard and can be considered both software and hardware modules. For storage resources such as storage devices, MLD components can partition the storage device into 16 or more logical devices, assigning each logical device an identifier (LD-ID). Each logical device can operate as an independent CXL device (a CXL device is a device connected through CXL). Hosts can identify and access the logical device.
[0082] FIG1 is a schematic diagram of the structure of a computing system provided in an embodiment of the present application. The computing system includes a host 100, a storage controller 200, and a storage device 300. The embodiments of the present application do not limit the number of hosts 100 and storage devices 300 included in the computing system. The computing system may include one host 100 or multiple hosts 100. The computing system may include one storage device 300 or multiple storage devices 300. FIG1 only illustrates three hosts 100 and three storage devices 300.
[0083] In the computing system, the host 100, the storage controller 200, and the storage device 300 can be connected based on a computing interconnect bus, wherein the computing interconnect bus can be a PCIe-based line, or a bus of CXL, unified bus (Ubus or UB), cache coherent interconnect for accelerators (CCIX) protocol, or other protocols.
[0084] Host 100 is the primary data processing unit in a computing system and is the primary component responsible for the system's operations. Host 100 can be a computing device such as a desktop computer, server, laptop, or mobile device. Host 100 can also be a bare metal server. Host 100 can also host computing instances such as containers or virtual machines deployed on a computing device. Host 100 can also be a processor or processor core.
[0085] Among them, the processor can be a central processing unit (CPU), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), an artificial intelligence (AI) chip, a system on chip (SoC) or a complex programmable logic device (CPLD), a graphics processing unit (GPU), a data processing unit (DPU), etc., and any module with processing function can be used as a processor. The processor core is the core in the processor, and the embodiment of the present application does not show the type of the processor core. The processor core can be an advanced reduced instruction set machine (ARM) or a microprocessor without interlocked pipeline stages (MIPS).
[0086] This application does not limit the specific form of the host 100. For example, when the computing system is deployed on a single computing device, the multiple hosts 100 can be deployed on the same computing device, and any host 100 can be a container or virtual machine deployed on the computing device, or a processor or processor core in the computing device. For another example, when the computing system is distributed and deployed on multiple computing devices, the multiple hosts 100 can be distributed on the multiple computing devices, and any host 100 can be a container or virtual machine deployed on a computing device, or a processor or processor core in a computing device, or a computing device.
[0087] The storage device 300 has a storage function and provides storage resources to the host 100. The storage device 300 can be used to store data required by the host 100. In an embodiment of the present application, the storage device 300 (or the logical device formed virtually by the storage device 300) can serve as the "memory" of the host 100 to temporarily store data required for the operation of the host 100. The storage device 300 (or the logical device formed virtually by the storage device 300) can also serve as the "hard disk" of the host 100, which can help the host 100 temporarily and persistently store data.
[0088] The embodiments of the present application do not limit the type of storage device 300. For example, the storage device 300 may be memory in a computing device, such as read-only memory (ROM), dynamic random access memory (DRAM), or storage class memory (SCM), static random access memory (SRAM), dual in-line memory module (DIMM), etc. The storage device 300 may also be a persistent memory in a computing device, such as a hard disk drive (HDD) or a solid state drive (SSD).
[0089] The storage controller 200 is used to manage the storage device 300. The storage controller 200 manages the storage device 300 in the following aspects:
[0090] 1) Virtualization of the storage device 300.
[0091] The storage controller 200 can virtualize the storage device 300 into multiple logical devices (LDs), each of which can be bound to a host 100. Similar to the storage device 300, the logical device has a data storage function and can store data for the bound host 100. The host 100 can access the bound logical device through the storage controller 200. In the embodiment of the present application, the logical device bound to the host 100 is referred to as the logical device of the host 100. Any logical device can be located on the same storage device 300 or on different storage devices 300.
[0092] The embodiments of the present application do not limit the manner in which the storage controller 200 virtualizes the storage device 300 into multiple logical devices. A multi-logic device (MLD) component may be deployed on the storage controller 200 to virtualize the storage device 300 into multiple logical devices. The storage controller 200 may also employ hardware-level virtualization technology to virtualize the storage device 300 into multiple logical devices and directly communicate the logical devices to the host 100.
[0093] 2) Maintenance of shared information of host 100.
[0094] In the embodiment of the present application, each host 100 is provided with sharing information. The sharing information of the host 100 records the shared storage space in the storage device 310 of the host 100, and the storage device 310 of the host 100 also records the mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100.
[0095] It is worth noting that in the embodiment of the present application, the storage device 310 of the host 100 has two possible forms. For example, the storage device 310 of the host 100 can be a physical storage device 300 in the computing system, or it can be a logical device formed by virtualizing the storage device 300 in the computing system. Regardless of whether the storage device 310 of the host 100 is a physical storage device 300 or a logical device, the storage device 310 of the host 100 means that the storage space of the storage device is used by the host 100, and the host 100 can determine whether the storage space in the storage device 310 of the host 100 can be shared. Therefore, the storage space of the storage device 310 of the host 100 includes shared storage space and non-shared storage space.
[0096] The shared storage space in the storage device 310 of the host 100 refers to storage space that can be shared with hosts 100 other than the host 100. The shared storage space in the storage device 310 of the host 100 can be mapped to storage space in the storage device 310 of hosts 100 other than the host 100, and a mapping relationship exists between the shared storage space in the storage device 310 of the host 100 and storage space in the storage device 310 of hosts 100 other than the host 100. Conversely, the non-shared storage space in the storage device 310 of the host 100 refers to storage space that cannot be shared with hosts 100 other than the host 100. The non-shared storage space in the storage device 310 of the host 100 cannot be mapped to storage space in the storage device 310 of hosts 100 other than the host 100, and no mapping relationship exists between the non-shared storage space in the storage device 310 of the host 100 and storage space in the storage device 310 of hosts 100 other than the host 100.
[0097] The shared storage space in the storage device 310 of the host 100 has two states: one is a shared state, and the other is a ready-to-be-shared state.
[0098] The shared state means that the shared storage space in the storage device 310 of the host 100 has been shared with other hosts 100, and a mapping relationship has been established between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100. The storage controller 200 can convert the host 100's read operation on the shared storage space into a read operation on the storage space in the storage devices 310 of other hosts 100 that have a mapping relationship with the shared storage space. In other words, when the host 100 initiates a read request for the shared storage space (e.g., the address of the data carried in the read request belongs to the shared storage space), the storage controller 200 receives the read request, can read data from the storage space in the storage devices 310 of other hosts 100 that have a mapping relationship with the shared storage space, and feed the read data back to the host 100.
[0099] The "to-be-shared" state means that the shared storage space in the storage device 310 of the host 100 has not yet been shared with other hosts 100, and a mapping relationship has not yet been established between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100. For a shared storage space in the "to-be-shared" state, the host 100 can initiate a data migration instruction for the shared storage resource, which is used to request that data in the storage space of the storage device 310 of other hosts 100 be migrated to the shared storage space (e.g., the data migration instruction carries the address of the data in the storage device 310 of the other host 100 and the address of the storage device 310 of the host 100, where the address of the storage device 310 of the host 100 belongs to the shared storage space to be shared). When the storage controller 200 receives the data migration instruction, the storage controller 200 does not need to perform actual data migration, but only needs to update the sharing information of the host 100 and establish a mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage device 310 of other hosts 100. In this way, the shared storage space in the waiting-to-be-shared state is converted into the shared storage space in the shared state.
[0100] The storage controller 200 may maintain the shared information of each host 100 and update the shared storage space in the storage device 310 of the host 100 recorded in the shared information of the host 100. The update of the shared information of the host 100 includes but is not limited to:
[0101] Add shared storage space in the storage device 310 of the host 100, delete the shared storage space in the storage device 310 of the host 100, configure the state of the shared storage space to be shared to the shared state (that is, establish a mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100), configure the state of the shared shared storage space to the to-be-shared state (that is, delete the mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100), and modify the mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100.
[0102] ①: Increase the shared storage space in the storage device 310 of the host 100.
[0103] For any host 100, which storage spaces in the storage device 310 of the host 100 are allowed to be shared and which storage spaces are not allowed to be shared can be determined by the host 100. When the host 100 needs to increase the shared storage space in the storage device 310 of the host 100, it can initiate a sharing instruction to the storage controller 200. The sharing instruction is used to request the increase of shared storage space. The sharing instruction carries information for indicating the shared storage space to be increased, such as the address of the shared storage space. After receiving the sharing instruction, the storage controller 200 can update the sharing information of the host 100 and add the shared storage space to the sharing information of the host 100, that is, add the information of the shared storage space to the sharing information of the host 100.
[0104] ②: Delete the shared storage space in the storage device 310 of the host 100.
[0105] For any host 100, which storage spaces in the storage device 310 of the host 100 are allowed to be shared and which storage spaces are not allowed to be shared can be determined by the host 100. When the host 100 needs to prohibit the shared storage space recorded in the sharing information from being shared, it can initiate a prohibit sharing instruction to the storage controller 200. The prohibit sharing instruction is used to request the deletion of the shared storage space. The prohibit sharing instruction carries information for indicating the shared storage space to be deleted, such as the address of the shared storage space. After receiving the prohibit sharing instruction, the storage controller 200 can update the sharing information of the host 100 and delete the shared storage space in the sharing information of the host 100, such as deleting the mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage device 310 of other hosts 100 in the sharing information of the host 100, deleting the information of the shared storage space in the storage device 310 of the host 100, or marking the status of the shared storage space as prohibited from sharing.
[0106] In an embodiment of the present application, there is also a scenario of deleting the shared storage space in the storage device 310 of the host 100. When the host 100 initiates a write request to the shared storage space in a shared state, the storage controller 200 receives the write request, and can update the sharing information of the host 100 and delete the shared storage space in the sharing information of the host 100, such as deleting the mapping relationship between the shared storage space and the storage space in the storage device 310 of other hosts 100 in the sharing information of the host 100, or marking the status of the shared storage space as prohibited from sharing, and writing data in the shared storage space according to the write request.
[0107] ③: Set the status of the shared storage space to be shared to shared status.
[0108] See the aforementioned description of the host 100 initiating a data migration instruction. During the process of the host 100 initiating the data migration instruction, the storage controller 200 may establish a mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100 in the sharing information, thereby converting the shared storage space in the waiting-to-be-shared state into the shared storage space in the shared state.
[0109] ④: Set the shared storage space to ready-to-share state.
[0110] When the host 100 initiates a write request to a shared storage space in a shared state, the storage controller 200 receives the write request. In addition to deleting the shared storage space in the sharing information of the host 100, the storage controller 200 may also configure the state of the shared shared storage space to a to-be-shared state and delete the mapping relationship between the shared shared storage space and the storage space in the storage device 310 of the other host 100.
[0111] After the shared storage space in the storage device 310 of the host 100 has been shared with other hosts 100, the host 100 may decide not to share the shared storage space with the other hosts 100. The host 100 may initiate a sharing change instruction to the storage controller 200. The sharing change instruction is used to request to terminate the sharing relationship between the shared storage space and the other hosts 100. The sharing change instruction carries information indicating the shared storage space, such as the address of the shared storage space. After receiving the sharing change instruction, the storage controller 200 may update the sharing information of the host 100, configure the state of the shared shared storage space to the ready-to-share state, and delete the mapping relationship between the shared shared storage space and the storage space in the storage device 310 of the other host 100.
[0112] ⑤: Modify the mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage device 310 of other hosts 100.
[0113] When a host 100 initiates a data migration instruction requesting the migration of data from a storage space of a storage device 310 of another host 100 to a shared storage space in a shared state (e.g., the data migration instruction carries the address of the data in the storage device 310 of the other host 100 and address 1 of the storage device 310 of the host 100, where address 1 of the storage device 310 of the host 100 belongs to the shared storage space), upon receiving the data migration instruction, the storage controller 200 does not need to perform actual data migration, but only needs to update the sharing information of the host 100, modify the mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage devices 310 of other hosts 100 in the sharing information of the host 100, establish a mapping relationship between the storage space indicated by address 1 in the shared storage space and the storage space where the data is located in the storage devices 310 of the other hosts 100, and maintain the original shared state for the storage space other than the storage space indicated by address 1 in the shared storage space.
[0114] 3) Read and write data to the storage device 310 of the host 100.
[0115] When the host 100 needs to access the storage device 310 of the host 100, it can initiate a data access request, such as a write request for requesting to write data and a read request for requesting to read data. After receiving the data access request, the storage controller 200 can access the storage device 310 according to the data access request. For example, when the data access request is a write request, the storage controller 200 can write the data carried in the write request to the location indicated by the address of the data carried in the write request. For example, when the data access request is a read request, if the address of the data carried in the read request belongs to a shared storage space and the shared storage space is in a shared state, the storage controller 200 can read the data from the storage space of the storage device 310 of another host 100 that has a mapping relationship with the shared storage space and feedback it to the host 100. If the address of the storage space carried in the read request is not the address of the shared storage space, the storage controller 200 accesses the storage device 310 of the host, reads the data from the location indicated by the address of the storage space carried in the read request, and feedbacks the read data to the host 100.
[0116] The embodiments of the present application do not limit the specific form of the storage controller 200. The storage controller 200 may be a software module, such as software that is enabled on a processor. The storage controller 200 may also be a hardware module, such as an ASIC, FPGA, AI chip, SoC, or complex programmable logic device (CPLD, programmable logic device, PLD), etc.
[0117] The "mapping relationship between the shared storage space in the storage device 310 of the host 100 and the storage space in the storage device 310 of other hosts 100" mentioned in the above content can be expressed as a mapping relationship between the address of the shared storage space in the storage device 310 of the host 100 and the address of the storage space in the storage device 310 of other hosts 100.
[0118] The addresses mentioned in the embodiments of this application (such as the address of shared storage space, the address of storage space, the address of data, etc.) refer to two types of addresses. One type is the address required for interaction between the host 100 and the storage controller 200. This type of address is called the host physical address (HPA). The address carried in data access requests (such as write requests or read requests) and various instructions (sharing instructions, data migration instructions, sharing disable instructions, sharing change instructions, etc.) initiated by the host is a host physical address. The HPA is the address used by the host 100 to represent the storage location of data. The other type is the address required for interaction between the storage controller 200 and the storage device 300 (or storage device 310). This DPA is only used by the storage device 300 or storage device 310 to represent the storage location of data. Therefore, the DPA is an address visible to the storage device 300 or storage device 310 and is not visible to the host 100.
[0119] The HPA needs to be converted to the DPA. In this embodiment of the present application, the address conversion operation can be performed by the storage controller 200. The storage controller 200 can obtain the host device address mapping table (HDM) of the host 100. The host device address mapping table of the host 100 records the mapping relationship between the HPA and the DPA of the host 100. The storage controller 200 can convert the HPA to the DPA by querying the HDM.
[0120] For example, after the storage controller 200 receives a data access request (such as a write request or a read request) initiated by the host, it obtains the HPA carried in the data access request, queries the HDM to convert the HPA into a DPA, and then accesses the storage device 310 of the host 100 based on the converted DPA.
[0121] In view of these two different types of addresses, the shared information of the host 100 is represented in the following two forms.
[0122] In form 1, the shared information of the host 100 uses HPA to represent the storage space (the storage space refers to the shared storage space or the storage space that has a mapping relationship with the shared storage space). That is, the address of the shared storage space recorded in the shared information of the host 100 is HPA, and the address of the storage space that has a mapping relationship with the shared shared storage space is also HPA.
[0123] In this manner, upon receiving a data access request (such as a write request or a read request) or various instructions (such as a sharing instruction, a data migration instruction, a sharing disable instruction, or a sharing change instruction) initiated by a host, the storage controller 200 can first query the sharing information of the host 100. If address translation is required, the HDM is queried after querying the sharing information of the host 100 (the HDM query is primarily required upon receiving a data access request initiated by the host).
[0124] For a data access request initiated by a host, the storage controller 200 can query the sharing information of the host 100 to determine whether the HPA carried in the data access request is an address of a shared storage space. If the HPA carried in the data access request is not an address of a shared storage space, the storage controller 200 converts the HPA into the DPA of the host 100's storage device 310 (which may be simply referred to as the host 100's DPA) according to the HDM, then accesses the host 100's storage device 310 and writes or reads data from the DPA. If the HPA carried in the data access request is an address of a shared storage space, for a read request, the storage controller 200 will query the HPA of another host 100 that has a mapping relationship with the HPA, convert the HPA of the other host 100 into the DPA of the other host 100, then access the storage device 310 of the other host 100, read data from the DPA, and feed the read data back to the host 100. For a write request, the storage controller 200 updates the sharing information of the host 100, deletes the HPA recorded in the sharing information, or configures the status of the HPA to be shared. After converting the HPA into the DPA of the host 100 according to the HDM, the storage device 310 of the host 100 is accessed to write data at the DPA.
[0125] For instructions initiated by the host (sharing instructions, data migration instructions, prohibit sharing instructions, sharing change instructions, etc.), the storage controller 200 can query the sharing information of the host 100 and update the sharing information according to the instructions initiated by the host. For sharing instructions, the storage controller 200 adds the HPA carried by the instruction to the sharing information of the host 100 and marks the HPA as being in a state to be shared. For data migration instructions, the storage controller 200 adds the mapping relationship between the HPA carried by the instruction and the HPA of other hosts 100 to the sharing information of the host 100. For prohibit sharing instructions, the storage controller 200 deletes the HPA carried by the instruction from the sharing information of the host 100 or marks the HPA as being in a state to be prohibited from sharing. For sharing change instructions, the storage controller 200 configures the state of the shared HPA to be shared when updating the sharing information of the host 100, and deletes the mapping relationship between the shared HPA and the HPA of other hosts 100.
[0126] In the second form, the address of the storage space (the storage space refers to the shared storage space or the storage space that has a mapping relationship with the shared storage space) is represented by the DPA in the shared information of the host 100. That is, the address of the shared storage space recorded in the shared information of the host 100 is the DPA, and the address of the storage space that has a mapping relationship with the shared shared storage space is also the DPA.
[0127] In this form, when the storage controller 200 receives a data access request (such as a write request or a read request) and various instructions (sharing instructions, data migration instructions, prohibit sharing instructions, sharing change instructions, etc.) initiated by the host, it needs to first perform address conversion, that is, query the HDM, and convert the HPA of the host 100 carried in the data access request and various instructions into the DPA of the host 100. After that, it queries the sharing information of the host 100 and performs corresponding operations.
[0128] For a data access request initiated by a host, the storage controller 200 converts the HPA of the host 100 carried in the data access request into the DPA of the host 100, and then queries the sharing information of the host 100 to determine whether the DPA carried in the data access request is the address of the shared storage space. If the DPA carried in the data access request is not the address of the shared storage space, the storage controller 200 accesses the storage device 310 of the host 100 and writes or reads data at the DPA. If the DPA carried in the data access request is the address of the shared storage space, for a read request, the storage controller 200 will query the DPA of the storage device 310 of another host 100 that has a mapping relationship with the DPA, access the storage device 310 of the other host 100, read data at the DPA, and feed the read data back to the host 100. For a write request, the storage controller 200 updates the sharing information of the host 100, deletes the DPA recorded in the sharing information, or configures the status of the DPA to be shared.
[0129] For instructions initiated by the host (sharing instructions, data migration instructions, sharing prohibition instructions, sharing change instructions, etc.), after the storage controller 200 converts the HPA of the host 100 carried in the instruction into the DPA of the host 100, it can query the sharing information of the host 100 and update the sharing information according to the instructions initiated by the host. For sharing instructions, the storage controller 200 adds the DPA carried by the instruction to the sharing information of the host 100 and marks the DPA as being in a state to be shared. For data migration instructions, the storage controller 200 adds the mapping relationship between the DPA carried by the instruction and the DPAs of other hosts 100 to the sharing information of the host 100. For sharing prohibition instructions, the storage controller 200 deletes the DPA carried by the instruction from the sharing information of the host 100 or marks the DPA as being in a state to be shared. For sharing change instructions, when updating the sharing information of the host 100, the storage controller 200 configures the state of the shared DPA to be shared and deletes the mapping relationship between the shared DPA and the DPAs of other hosts 100.
[0130] A data sharing method provided in an embodiment of the present application is described below in conjunction with FIG2 . In FIG2 , a data sharing method between two hosts is taken as an example for description. For the convenience of description, the two hosts are respectively labeled as host A and host B, and the shared information of the hosts adopts the aforementioned form 1.
[0131] The data sharing method when the host's shared information adopts the aforementioned form 2 is similar to the data sharing method when the host's shared information adopts the aforementioned form 1. The difference lies in the order in which the storage controller queries the HDM and the host's shared information, which will not be repeated here.
[0132] The data sharing method shown in Figure 2 includes three processes: a data reading process (see steps 201 to 206 for details); a data migration process (see steps 207 to 210 for details); and a data writing process (see steps 211 to 214 for details). These three processes are independent of each other and can be executed independently in practice. In the embodiment shown in Figure 2, the data reading process, data migration process, and data writing process are integrated to reflect the relationship between the three processes executed for different shared storage spaces.
[0133] Step 201: The host 100A initiates a read request for requesting to read data 1. The read request carries the HPA of the data 1. The HPA of the data 1 includes the starting host physical address of the data 1 and the size of the data 1.
[0134] Step 202 : The storage controller 200 receives the read request, queries the sharing information of the host 100A, and determines whether the HPA of the data 1 is the address of the shared storage space. If so, step 203 is executed; otherwise, step 205 is executed.
[0135] As shown in FIG3 , an embodiment of the present application provides sharing information of a host 100A, in which the addresses of multiple shared storage spaces are recorded. The address of each shared storage space can be represented by the starting host physical address of the shared storage space and the size of the shared storage space. For shared storage spaces that have been shared, the sharing information of the host 100A also records the host 100 to which the storage space with which the shared storage space has a mapping relationship belongs, as well as the address of the storage space with which the shared storage space has a mapping relationship. Similarly, the address of the storage space with which the shared storage space has a mapping relationship can be represented by the starting host physical address of the storage space and the size of the storage space. The sharing relationship also includes a sharing flag, which indicates whether the storage space is allowed to be shared. For example, for a shared storage space, the sharing flag indicates that the storage space is allowed to be shared. Exemplarily, the sharing flag can also indicate whether the shared storage space is in a waiting-to-be-shared state or a shared state. For a non-shared storage space, or a storage space for which sharing is prohibited (such as a storage space indicated by a prohibition of sharing instruction), the sharing flag indicates that the storage space indicates that sharing is prohibited.
[0136] In Figure 3, the sharing information of host 100A records three shared storage spaces. Assuming that the minimum data storage granularity in host 100A's storage device 310 is 16 bytes, the starting host physical address of the first shared storage space is 1001, and its size is 64 bytes. The starting host physical address of the second shared storage space is 1005, and its size is 64 bytes. The difference between the starting host physical address of the first shared storage space and the starting host physical address of the second shared storage space is 4, and the size of the first shared storage space is exactly equal to 4 minimum data storage granularities, meaning that the first and second shared storage spaces are adjacent. The starting host physical address of the third shared storage space is 1010, and its size is 4 bytes. The sharing information of host 100A also records the status of the three shared storage spaces. The first and third shared storage spaces are in the shared state, while the second shared storage space is in the pending state. The sharing information of host 100A also records the addresses of two storage spaces that are mapped to the first and third shared storage spaces. The storage space mapped to the first shared storage space belongs to host 100B, and the starting host physical address of the storage space mapped to the first shared storage space is 2002. The storage space mapped to the third shared storage space belongs to host 100B, and the starting host physical address of the storage space mapped to the third shared storage space is 2020. Because the size of the storage space mapped to the shared storage space is consistent with the size of the shared storage space, the size of the storage space mapped to the shared storage space is omitted in the sharing information of host 100A shown in FIG3 . Only the size of the corresponding shared storage space needs to be referenced.
[0137] If the HPA of data 1 belongs to the first shared storage space or any of the third shared storage spaces, step 203 is executed; if the HPA of data 1 does not belong to the first shared storage space or any of the third shared storage spaces, step 205 is executed.
[0138] It should be noted that the description here is based on the host 100A and the host 100B as examples. In actual applications, in the sharing information of the host 100A, the multiple storage spaces that are mapped to the multiple shared storage spaces may all belong to the host 100B, or may be distributed across multiple different hosts 100. In other words, the storage space of the storage device 310 shared by the host 100A and multiple different hosts 100, but one shared storage space of the storage device 310 of the host 100A can only be shared with one host 100, that is, one shared storage space of the storage device 310 of the host 100A can only be mapped to the storage space of the storage device 310 of one host 100.
[0139] Step 203: The storage controller 200 determines the HPA of the host 100B that has a mapping relationship with the HPA of the data 1 according to the sharing information of the host 100A.
[0140] The HPA of data 1 belongs to the shared storage space in the storage device 310 of host 100A. Therefore, the storage space in the storage device 310 of host 100B, which is mapped to the shared storage space, will include the HPA of host 100B, which is mapped to the HPA of data 1. The location of the HPA of data 1 in the shared storage space is consistent with the location of the HPA of host 100B, which is mapped to the HPA of data 1.
[0141] Taking the shared information of host 100A shown in FIG3 as an example, if the starting host physical address of the HPA for data 1 is 1001, the size of data 1 is 4 bits. The HPA for data 1 belongs to the first shared storage space, the starting host physical address of the HPA for host 100B, which is mapped to the HPA for data 1, is 2002, and the size of data 1 is 4 bits. If the starting host physical address of the HPA for data 1 is 1002, the offset from the starting physical address of the first shared storage space is 16 bytes, and the size of data 1 is 4 bits. The HPA for data 1 still belongs to the first shared storage space, then the starting host physical address of the HPA for host 100B, which is mapped to the HPA for data 1, is 2003, the offset from the starting physical address of the storage space mapped to the first shared storage space is also 16 bytes, and the size of data 1 is 4 bits.
[0142] Step 204: After obtaining the HPA of the host 100B, the storage controller 200 queries the HDM of the host 100B, converts the HPA of the host 100B into the DPA of the host 100B, accesses the storage device 310 of the host 100B, and reads data 1 from the DPA.
[0143] Step 205: The storage controller 200 queries the HDM of the host 100A, converts the HPA of the data 1 into the DPA of the host 100A, accesses the storage device 310 of the host 100A, and reads the data 1 from the DPA.
[0144] Step 206: The storage controller 200 feeds back data 1 to the host 100A.
[0145] At this point, the data reading process ends. It can be seen in this data reading process that, due to the shared information settings of host 100A, host 100A can access host 100B's storage device 310 and read data from host 100B's storage device 310. Host 100A does not perceive that the data being read comes from host 100B's storage device 310.
[0146] Step 207: Host 100A initiates a data migration instruction. The data migration instruction request is used to request to migrate data 2 in the storage device 310 of host 100B to the target HPA of host 100A. The data migration instruction carries the HPA of data 2 in host 100B and the target HPA of host 100A.
[0147] Step 208 : The storage controller 200 receives the data migration instruction, queries the sharing information of the host 100A, and determines whether the target HPA of the host 100A is the address of the shared storage space. If so, step 209 is executed; otherwise, step 210 is executed.
[0148] 3 , if the target HPA of the host 100A belongs to one of the three shared storage spaces, then step 209 is executed. If the target HPA of the host 100A does not belong to any shared storage space, then step 210 is executed.
[0149] Step 209: The storage controller 200 establishes a mapping relationship between the target HPA of the host 100A and the HPA of the host 100B for the data 2 in the shared information of the host 100A.
[0150] If the shared storage space to which the target HPA in the storage device 310 of host 100A belongs is the shared storage space to be shared, the storage controller 200 can directly add a mapping relationship between the target HPA of host 100A and the HPA of host 100B for data 2 to the sharing information of host 100A. In some scenarios, the target HPA of host 100A only represents a portion of the shared storage space to be shared. In such scenarios, the storage controller 200 adds a mapping relationship between the target HPA of host 100A and the HPA of host 100B for data 2 to the sharing information of host 100A, while the remaining storage space of the shared storage space to be shared remains in the shared state.
[0151] For example, the target HPA of host 100A belongs to the second shared storage space in the storage device 310 of host 100A. The starting host physical address of the target HPA of host 100A is 1005, and the size is 16 bytes. The starting host physical address of data 2 in the HPA of host 100B is 2006. Therefore, the storage controller 200 adds a mapping relationship between the target HPA of host 100A (i.e., starting host physical address 1005, size 16 bytes) and the HPA of data 2 in host 100B (i.e., starting host physical address 2006, size 16 bytes) to the sharing information of host 100A. The remaining storage space of the shared storage space to be shared (i.e., starting host physical address 1006, size 48 bytes) remains in the shared state.
[0152] As shown in Figure 4, this is the updated sharing information of the host 100A. The updated sharing information of the host 100A divides the original second shared storage space into two shared storage spaces, one of which has a starting host physical address of 1005 and a size of 16 bytes. It is in a shared state and has a mapping relationship with the storage space in the storage device 310 of the host 100B (that is, the starting host physical address is 2006 and the size is 16 bytes). The other shared storage space (the starting host physical address is 1006 and the size is 48 bytes) is in a state to be shared.
[0153] If the shared storage space to which the target HPA of host 100A belongs is already shared, the storage controller 200 may modify the mapping relationship between the shared storage space and the storage space in the storage device 310 of host 100B in the sharing information of host 100A. The modified mapping relationship between the shared storage space and the storage space in the storage device 310 of host 100B needs to include the mapping relationship between the target HPA of host 100A and the data 2 on the HPA of host 100B. In some scenarios, the target HPA of host 100A only represents a portion of the shared storage space. In such scenarios, the storage controller 200 modifies the mapping relationship between this portion of the shared storage space and the storage space in the storage device 310 of host 100B in the sharing information of host 100A to include the mapping relationship between the target HPA of host 100A and the data 2 on the HPA of host 100B. The remaining storage space of the shared storage space remains in its original shared state.
[0154] For example, the target HPA of host 100A belongs to the first shared storage space in the storage device 310 of host 100A. The starting host physical address of the target HPA of host 100A is 1001, and the size is 16 bytes. The starting host physical address of data 2 in the HPA of host 100B is 2006. Therefore, the storage controller 200 modifies the mapping relationship between the first shared storage space of host 100A's shared information and the storage space of host 100B, adding a mapping relationship between the target HPA of host 100A (i.e., starting host physical address 1001, size 16 bytes) and the HPA of data 2 in host 100B (i.e., starting host physical address 2006, size 16 bytes). The remaining storage space of the shared storage space (i.e., starting host physical address 1002, size 48 bytes) remains shared.
[0155] As shown in Figure 5, this is the updated sharing information of the host 100A. The updated sharing information of the host 100A divides the original first shared storage space into two shared storage spaces, one of which has a starting host physical address of 1001, a size of 16 bytes, and is in a shared state. There is a mapping relationship between it and the storage space in the storage device 310 of the host 100B (i.e., the starting host physical address is 2006, and the size is 16 bytes). The other shared storage space has a starting host physical address of 1002, a size of 48 bytes, and maintains the original mapping relationship between it and the storage space in the storage device 310 of the host 100B (i.e., the starting host physical address is 2003, and the size is 48 bytes).
[0156] Step 210: The storage controller 200 accesses the storage device 310 of the host 100B, reads data 2 from the storage device 310 of the host 100B, and writes data 2 to the location indicated by the target HPA of the host 100A.
[0157] If the target HPA in the storage device 310 of host 100A does not belong to the shared storage space, the storage controller 200 obtains the HDM of host 100B, converts the data 2 on the HPA of host 100B into the data 2 on the DPA of host 100B, and reads the data 2 from the DPA. The storage controller 200 obtains the HDM of host 100A, converts the target HPA of host 100A into the DPA, and writes the data 2 to the DPA.
[0158] In some scenarios, after receiving the data migration instruction, the storage controller 200 may skip steps 208 and 210 and directly execute step 209. That is, the storage controller 200 does not need to determine whether the target HPA in the storage device 310 of the host 100A is an address of a shared storage space. The storage controller 200 can directly establish a mapping relationship between the target HPA of the host 100A and the HPA of the host 100B for data 2 in the shared information of the host 100A. This situation can be understood as the storage space of the storage device 310 of the host 100A is all shared storage space or the host 100A can clearly determine that the target HPA belongs to a shared storage space (in this case, the branch of step 210 does not exist).
[0159] In some scenarios, after receiving the data migration instruction, the storage controller 200 may query the shared information of the host 100B to determine whether the data 2 in the HPA of the host 100B belongs to the shared storage space. If so, the storage controller 200 may execute steps 208 to 210. The storage controller 200 may also skip steps 208 and 210 and directly execute step 209. If not, the storage controller 200 may notify the host 100A that the data migration failed.
[0160] The data migration process is now complete. As can be seen from the data migration process, due to the shared information settings of host 100A, when data in host 100B's storage device 310 is migrated to host 100A's storage device 310, there is no need to copy the data from host 100B's storage device 310 and then write the copied data to host 100A's storage device 310. Data migration can be achieved by simply updating host 100A's shared information and adding the corresponding mapping information, making data migration more convenient.
[0161] After performing the data migration, host 100A can initiate a read request to read data 2. This read request carries host 100A's target HPA. Upon receiving this read request, storage controller 200 can query host 100A's shared information to determine the HPA of host 100B that is mapped to host 100A's target HPA. After determining host 100B's HPA, storage controller 200 converts host 100B's HPA into host 100B's DPA, reads data 2 from this DPA, and returns the result to host 100A. The process for host 100A to read data 2 is similar to the process for host 100A to read data 1. The individual steps will not be detailed here; please refer to the previous section for details.
[0162] Step 211 : The host 100A initiates a write request, where the write request is used to request writing of data 3 , and the read request carries the HPA of the data 3 .
[0163] Step 212: The storage controller 200 receives the write request, queries the sharing information of the host 100A, and determines whether the HPA of the data 3 is the address of the shared storage space. If so, step 213 is executed; otherwise, step 214 is executed.
[0164] Taking the shared information of the host 100A shown in FIG5 as an example, if the HPA of the data 3 belongs to any shared storage space, then step 213 and step 214 are executed. Otherwise, step 214 is executed.
[0165] Step 213: The storage controller 200 deletes the HPA of data 3 from the shared information of the host 100A.
[0166] If the host 100A's sharing information records the mapping relationship between the HPA of data 3 and the HPA of data 2 in the storage device 310 of the host 100B, that is, the HPA of data 3 is in a shared state, the storage controller 200 can delete the mapping relationship or mark the HPA of data 3 as prohibited from sharing. If the host 100A's sharing information records that the HPA of data 3 is in a pending sharing state, the storage controller 200 can delete the HPA of data 3 or mark the HPA of data 3 as prohibited from sharing. The following describes different situations:
[0167] Case 1: When the shared storage space to which the HPA of data 3 belongs is a shared shared storage space.
[0168] The storage controller 200 may modify the mapping relationship between the shared storage space and the storage space in the storage device 310 of the host 100B in the sharing information of the host 100A. The modified mapping relationship between the shared storage space and the storage space in the storage device 310 of the host 100B no longer includes the mapping relationship between the HPA of data 3 and the HPA of data 2 in the host 100B. In some scenarios, the HPA of data 3 only represents a portion of the shared shared storage space. In such scenarios, the storage controller 200 deletes the mapping relationship between this portion of the shared storage space and the storage space in the storage device 310 of the host 100B in the sharing information of the host 100A, while the remaining storage space of the shared storage space remains in its original shared state.
[0169] Taking the sharing information of host 100A shown in FIG6 as an example, assume that the HPA of data 3 belongs to a shared storage space in host 100A's storage device 310. The starting host physical address of the HPA of data 3 is 1002, and the size is 16 bytes. Then, the storage controller 200 modifies the mapping relationship between the shared storage space and the storage space of host 100B's storage device 310 in the sharing information of host 100A. This mapping relationship is deleted between the HPA of data 3 (i.e., the starting host physical address is 1002, the size is 16 bytes) and the storage space in host 100B's storage device 310 (i.e., the starting host physical address is 2003, the size is 16 bytes), or the HPA of data 3 is marked as prohibited from sharing. The remaining storage space in the shared storage space (i.e., the starting host physical address is 1003, the size is 32 bytes) remains in its original shared state. The modified sharing information of host 100A is shown in FIG6.
[0170] Case 2: The shared storage space to which the HPA of data 3 belongs is the shared storage space to be shared.
[0171] The storage controller 200 may delete the HPA of data 3 from the sharing information of the host 100A or mark the HPA of data 3 as prohibited from sharing. In some scenarios, the HPA of data 3 only represents a portion of the shared storage space to be shared. In such a scenario, the storage controller 200 deletes the HPA of data 3 from the sharing information of the host 100A, and the remaining storage space of the shared storage space to be shared remains in the shared state.
[0172] Taking the sharing information of host 100A shown in FIG4 as an example, assume that the HPA of data 3 belongs to a shared storage space to be shared in the storage device 310 of host 100A, and the starting host physical address of the HPA of data 3 is 1006, with a size of 16 bytes. Then, the storage controller 200 deletes the HPA of data 3 (i.e., the starting host physical address 1006 and the size of 16 bytes) from the sharing information of host 100A, while the remaining storage space of the shared storage space to be shared (i.e., the starting host physical address 1007 and the size of 32 bytes) remains in the shared storage space to be shared. The modified sharing information of host 100A is shown in FIG7.
[0173] Step 214: The storage controller 200 writes the data 3 to the HPA of the data 3 according to the write request.
[0174] The storage controller 200 obtains the HDM of the host 100A, converts the HPA of the data 3 into the DPA, and writes the data 2 into the DPA.
[0175] Based on the same inventive concept as the method embodiment, the present application also provides a data sharing device for executing the method performed by the storage controller in the method embodiment. As shown in Figure 8, data sharing device 800 includes a receiving module 801, a processing module 802, and a sending module 803. Specifically, in the API testing device, each module is connected via a communication path.
[0176] The receiving module 801 is configured to receive a read request from a first host, where the read request is used to request to read first data from a first address on a storage device of the first host.
[0177] The processing module 802 is configured to determine a mapping of a first address to a second address on a storage device of a second host according to sharing information of the first host, wherein the sharing information of the first host indicates a mapping relationship between the first address and the second address; and read first data from the second address.
[0178] The sending module 803 is configured to feed back the first data to the first host.
[0179] As a possible implementation, the receiving module 801 receives a data migration instruction from the first host, where the data migration instruction is used to request to migrate the first data from the second address to the first address.
[0180] The processing module 802 updates the shared information of the first host. After the update, the shared information of the first host indicates a mapping relationship between the first address and the second address.
[0181] As a possible implementation, the receiving module 801 receives a write request from a first host, where the write request is used to request writing second data at a first address.
[0182] The processing module 802 deletes the mapping relationship between the first address and the second address in the shared information of the first host; accesses the storage device of the first host, and writes the second data at the first address.
[0183] As a possible implementation, the processing module 802 queries the sharing information of the second host before updating the sharing information of the first host. The sharing information of the second host indicates that the second address allows sharing.
[0184] As a possible implementation, a receiving module 801 receives a data migration instruction from a first host, the data migration instruction being used to request migration of first data from a second address to a first address. A processing module 802 determines that sharing information of the second host indicates that sharing of the second address is prohibited. A sending module 803 notifies the first host that the data migration has failed.
[0185] As a possible implementation, the storage device of the first host and the storage device of the first host are logical devices virtually formed by physical storage devices, or may be physical storage devices.
[0186] As a possible implementation, the first address and the second address are both host physical addresses HPA. When the processing module 802 reads the first data from the second address, it queries the host device address mapping table of the second host, converts the second address into the DPA of the second host, and reads the first data from the DPA, wherein the host device address mapping table of the second host describes the mapping relationship between the HPA and DPA of the second host.
[0187] As a possible implementation, the processing module 802 stores shared information of the first host, including the HPA of the first host, the HPA of the second host mapped to the HPA of the first host, and information of the second host.
[0188] As a possible implementation manner, the sharing information of the first host further includes a sharing flag, and the sharing flag is used to indicate whether the HPA of the first host allows sharing.
[0189] As a possible implementation, if the sharing information of the first host does not indicate a mapping relationship between the first address and the second address, the processing module 802 accesses the storage device of the first host, reads the first data from the first address, and feeds the first data back to the first host.
[0190] The division of modules in the embodiments of the present application is illustrative and is merely a logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of the present application may be integrated into a single processor, or may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules.
[0191] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions for enabling a terminal device (which can be a personal computer, mobile phone, or network device, etc.) or a processor to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program code.
[0192] The present application also provides a computing device 900 as shown in Figure 9. The computing device 900 includes a bus 901, a processor 902, a communication interface 903, and a memory 904. The processor 902, the memory 904, and the communication interface 903 communicate with each other via the bus 901. Although not shown, the computing device 900 may also include a power supply circuit for supplying power to the processor 902.
[0193] Among them, the processor 902 can be a CPU, ASIC, FPGA, AI chip, SoC or CPLD, GPU, DPU, etc.
[0194] The memory 904 may include volatile memory, such as random access memory (RAM). The memory 904 may also include non-volatile memory, such as ROM, flash memory, HDD, or SSD. The memory 904 may store computer program instructions.
[0195] The processor 902 can execute the executable code burned on the processor 902 and perform the method performed by the storage controller 200 in the embodiment shown in FIG. 2 .
[0196] The processor 902 may also call the computer program instructions stored in the memory 904 to execute the method executed by the storage controller 200 in the embodiment shown in FIG2 . The memory 904 may also include other software modules required for running processes such as an operating system (such as multiple modules in the data sharing device 800 ). The operating system may be LINUX TM ,UNIX TM ,WINDOWS TM wait.
[0197] The present application also provides a computing device system, comprising at least one computing device 1000 as shown in FIG10 . The computing device 1000 comprises a bus 1001, a processor 1002, a communication interface 1003, and a memory 1004. The processor 1002, the memory 1004, and the communication interface 1003 communicate with each other via the bus 1001. The at least one computing device 1000 in the computing device system communicates with each other via a communication path.
[0198] The types of the processor 1002 and the memory 1004 are similar to those of the processor 902 and the memory 904 . For details, please refer to the above description and will not be repeated here.
[0199] The processor 1002 may execute the executable code burned on the processor 1002 to execute part or all of the method executed by the storage controller 200 in the embodiment shown in FIG. 2 .
[0200] The processor 1002 may also call the computer program instructions stored in the memory 1004 to execute part or all of the methods executed by the storage controller 200 in the embodiment shown in FIG2 . The memory 1004 may also include software modules required for other running processes such as an operating system (such as part or all of the multiple modules in the data sharing device 800 ). The operating system may be LINUX TM ,UNIX TM ,WINDOWS TM wait.
[0201] At least one computing device 1000 in the computing device system establishes communication with each other via a communication network, and each computing device 1000 runs any one or multiple modules in the data sharing apparatus 800 .
[0202] The descriptions of the processes corresponding to the above figures have different focuses. For parts that are not described in detail in a certain process, please refer to the relevant descriptions of other processes.
[0203] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes computer program instructions that, when loaded and executed on a computer, fully or partially generate the process or functions described in FIG. 2 according to the embodiment of the present invention.
[0204] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line, or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD).
[0205] Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include these modifications and variations.
Claims
1. A data sharing method, characterized in that: The method uses a computing system, the computing system includes a first host, a second host, a storage controller, a storage device of the first host, and a storage device of the second host, and the method includes: The storage controller receives a read request from the first host, wherein the read request is used to request to read the first data from a first address on a storage device of the first host; The storage controller determines, according to the sharing information of the first host, that the first address is mapped to a second address on the storage device of the second host, wherein the sharing information of the first host indicates a mapping relationship between the first address and the second address; The storage controller reads the first data from the second address and feeds the first data back to the first host.
2. The method according to claim 1, characterized in that Before the storage controller receives the read request from the first host, the method further includes: The storage controller receives a data migration instruction from the first host, where the data migration instruction is used to request to migrate the first data from the second address to the first address; The storage controller updates the sharing information of the first host, and the updated sharing information of the first host indicates a mapping relationship between the first address and the second address.
3. The method according to claim 1 or 2, characterized in that The method further comprises: The storage controller receives a write request from the first host, where the write request is used to request writing the second data at the first address; The storage controller deletes the mapping relationship between the first address and the second address in the sharing information of the first host; The storage controller accesses the storage device of the first host and writes the second data at the first address.
4. The method according to claim 2, characterized in that Before updating the shared information of the first host, the storage controller further includes: The storage controller queries the sharing information of the second host, and the sharing information of the second host indicates that the second address allows sharing.
5. The method according to claim 1, characterized in that The method further comprises: The storage controller receives a data migration instruction from the first host, where the data migration instruction is used to request to migrate the first data from the second address to the first address; When determining that the sharing information of the second host indicates that the second address is prohibited from being shared, the storage controller notifies the first host that the data migration fails.
6. The method according to any one of claims 1 to 5, characterized in that: The computing system is deployed in a computing device.
7. The method according to any one of claims 1 to 6, characterized in that: The storage device of the first host and the storage device of the second host are logical devices virtualized from physical storage devices.
8. The method according to any one of claims 1 to 6, characterized in that: The first address and the second address are both host physical addresses HPA, and the storage controller reads the first data from the second address, including: The storage controller queries the host device address mapping table of the second host, converts the second address into the DPA of the second host, and reads the first data from the DPA, wherein the host device address mapping table of the second host describes the mapping relationship between the HPA and DPA of the second host.
9. The method according to any one of claims 1 to 8, characterized in that: The storage controller stores sharing information of the first host, where the sharing information of the first host includes the HPA of the first host, the HPA of the second host that is mapped to the HPA of the first host, and information of the second host.
10. The method according to claim 9, characterized in that The sharing information of the first host further includes a sharing mark, and the sharing mark is used to indicate whether the HPA of the first host allows sharing.
11. A data sharing device, characterized in that: The device comprises: a receiving module, configured to receive a read request from the first host, wherein the read request is used to request to read the first data from a first address on a storage device of the first host; a processing module, configured to determine, based on the shared information of the first host, that the first address is mapped to a second address on the storage device of the second host, wherein the shared information of the first host indicates a mapping relationship between the first address and the second address; and Read the first data at a second address; A sending module is used to feed back the first data to the first host.
12. The device according to claim 11, characterized in that The receiving module is further used to receive a data migration instruction from the first host, wherein the data migration instruction is used to request to migrate the first data from the second address to the first address; The processing module is further used to update the sharing information of the first host, and the updated sharing information of the first host indicates a mapping relationship between the first address and the second address.
13. The device according to claim 11 or 12, characterized in that The receiving module is further used to receive a write request from the first host, wherein the write request is used to request to write the second data at the first address; The processing module is further used to delete the mapping relationship between the first address and the second address in the shared information of the first host; access the storage device of the first host, and write the second data at the first address.
14. The device according to claim 12, characterized in that Before updating the shared information of the first host, the processing module is further configured to: The sharing information of the second host is queried, and the sharing information of the second host indicates that the second address allows sharing.
15. The device according to claim 11, characterized in that The receiving module is further used to receive a data migration instruction from the first host, where the data migration instruction is used to request to migrate the first data from the second address to the first address; The processing module is further used to determine that the sharing information of the second host indicates that the second address is prohibited from being shared; The sending module is used to notify the first host that the data migration fails.
16. The device according to any one of claims 11 to 15, characterized in that: The storage device of the first host and the storage device of the first host are logical devices virtually formed by storage devices in a physical form.
17. The device according to any one of claims 11 to 16, characterized in that: The first address and the second address are both host physical addresses HPA, and the processing module reads the first data from the second address, for: Query the host device address mapping table of the second host, convert the second address into the DPA of the second host, and read the first data from the DPA, wherein the host device address mapping table of the second host describes the mapping relationship between the HPA and the DPA of the second host.
18. The device according to any one of claims 11 to 17, characterized in that The storage controller stores sharing information of the first host, where the sharing information of the first host includes the HPA of the first host, the HPA of the second host that is mapped to the HPA of the first host, and information of the second host.
19. The device according to claim 18, characterized in that The sharing information of the first host further includes a sharing mark, and the sharing mark is used to indicate whether the HPA of the first host allows sharing.
20. A computing device, characterized in that The computing device includes a processor and a power supply circuit; The power supply circuit is used to supply power to the processor; The processor executes the method according to any one of claims 1 to 10.
21. A non-transitory computer-readable storage medium, characterized in that When the non-transitory computer-readable storage medium is executed by a computing device, the computing device executes the method of any one of claims 1 to 10 above.
22. A computing device program product, characterized in that The computing device program product comprises computer instructions, which when executed by a computing device, cause the computing device to perform the method according to any one of claims 1 to 10 .
Citation Information
Patent Citations
Mapping method of virtual machine memory, device, and data transmission equipment
CN107278292A
Data processing method and device based on distributed shared memory system
CN113590364A
Rapid data copying method and device, computer equipment and storage medium
CN114780448A
Copy commands for memory systems
CN115248661A
Computing system and method for sharing device memories of different computing devices
US20220121383A1
Cited By
Multi-host system and cross-domain access method
CN119449744A
