Data operation method and device, equipment, product and medium
By splitting the virtual address interval of the virtual hard disk and generating multiple physical hard disk operation requests, the problem of fragmentation and utilization of storage partitions caused by virtual hard disk divisions has been solved, and the use of more efficient storage resource use.
Patent Information
- Application Number
- CN202411379428.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-24
AI Technical Summary
In the prior art, due to the partitioning method of virtual hard disks, there are fragmented storage partitions in the physical hard disk, resulting in low storage partition utilization. In order to prevent cross-border IO access, it is necessary to restrict access to the tail of the storage partition, resulting in wasted resources.
By receiving the target virtual address interval of the virtual hard disk, find the overlapping mapping records, split the target virtual address interval for multiple sub -virtual address interval, and generate multiple second data operations based on the physical address interval associated with these sub -virtual address interval Request to operate data in physical hard disks.
It effectively solves the problem of cross-border access and avoids restricted access to the tail of the physical hard disk partition, thereby improving the utilization of the physical hard disk storage partition.
Smart Images

Figure CN119356600A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of storage technology, and in particular to a data operation method, device, equipment, product and medium. Background Art
[0002] Local disk virtualization is to divide a physical hard disk into multiple virtual hard disks and provide these virtual hard disks to different virtual devices (such as virtual machines) for use. When dividing a virtual hard disk, a continuous storage partition in the physical hard disk is usually mapped to a virtual hard disk. However, with the destruction and creation of virtual devices, fragmented storage partitions will inevitably exist in the physical hard disk. In order to improve storage utilization efficiency, multiple fragmented storage partitions in the physical hard disk can be mapped to a virtual hard disk. For such a virtual hard disk mapped from multiple fragmented storage partitions, in order to prevent cross-boundary IO access, access to a section of space at the end of the storage partition will be restricted. In this way, the storage partitions in the physical hard disk cannot be fully utilized, reducing the utilization rate of the storage partitions.
[0003] Therefore, a method for improving storage partition utilization is urgently needed. Summary of the invention
[0004] In view of this, embodiments of the present disclosure provide a data operation method, a data operation device, an electronic device, a computer program product, and a computer-readable storage medium, which can improve storage partition utilization.
[0005] On the one hand, the present disclosure provides a data operation method, the method comprising:
[0006] receiving a first data operation request, wherein the first data operation request includes a target virtual address interval of the virtual hard disk;
[0007] Searching in a mapping table for a target mapping record having a virtual address interval overlapping the target virtual address interval, wherein the mapping records in the mapping table are used to associate the virtual address interval of the virtual hard disk with the physical address interval of the physical hard disk, and the virtual address intervals in different mapping records are different;
[0008] If there are multiple target mapping records, split the target virtual address interval into multiple sub-virtual address intervals according to the virtual address intervals in each of the target mapping records;
[0009] Based on the physical address intervals associated with the sub-virtual address intervals, a plurality of second data operation requests are generated to perform data operations in the physical hard disk.
[0010] Another aspect of the present disclosure provides a data operation device, the device comprising:
[0011] A request receiving module, configured to receive a first data operation request, wherein the first data operation request includes a target virtual address interval of the virtual hard disk;
[0012] An address search module is used to search a target mapping record having a virtual address interval overlapping with the target virtual address interval in a mapping table, wherein the mapping records in the mapping table are used to associate the virtual address interval of the virtual hard disk with the physical address interval of the physical hard disk, and the virtual address intervals in different mapping records are different;
[0013] An address splitting module, for splitting the target virtual address interval into multiple sub-virtual address intervals according to the virtual address intervals in each of the target mapping records if there are multiple target mapping records;
[0014] The request generation module is used to generate multiple second data operation requests based on the physical address intervals associated with each of the sub-virtual address intervals, so as to perform data operations in the physical hard disk.
[0015] Another aspect of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0016] Another aspect of the present disclosure provides an electronic device, which includes a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method described above is implemented.
[0017] Another aspect of the present disclosure provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method as described above is implemented.
[0018] In the technical solutions of some embodiments of the present disclosure, when the target virtual address interval in the first data operation request has an overlapping virtual address interval with multiple target mapping records, the target virtual address interval is split according to the virtual address interval in the target mapping record, and multiple second operation requests are generated based on the physical address intervals associated with the multiple sub-virtual address intervals obtained by the splitting. In this way, the problem of cross-boundary access can be effectively solved, so that there is no need to restrict access to the last storage partition at the end of the physical hard disk partition, thereby effectively improving the utilization rate of the physical hard disk storage partition. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The features and advantages of the present disclosure will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present disclosure in any way. In the accompanying drawings:
[0020] Figure 1 shows a schematic diagram of initial physical hard disk partitioning;
[0021] Figure 2 For the general Figure 1 Schematic diagram of physical hard disk partitioning after some virtual machines are destroyed;
[0022] Figure 3 For Figure 2 A schematic diagram of one of the solutions for continuing to use the released storage partition;
[0023] Figure 4 right Figure 2 Schematic diagram of another solution when the storage partition in continues to be used;
[0024] Figure 5 A schematic diagram of a data processing architecture provided by an embodiment of the present disclosure is shown;
[0025] Figure 6 A schematic diagram showing a flow chart of a data operation method provided by an embodiment of the present disclosure is shown;
[0026] Figure 7 A schematic diagram of splitting a sub-virtual address interval provided by an embodiment of the present disclosure is shown;
[0027] Figure 8 A schematic diagram of a module of a data operation device provided by an embodiment of the present disclosure is shown;
[0028] Fig. 9 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0030] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0031] Combined with reference Figure 1 , which is a schematic diagram of the initial physical hard disk partition. Figure 1 In the example, the physical hard disk is divided into three continuous storage partitions, Nslice0, Nslice1 and Nslice2, and each storage partition is mapped to a virtual hard disk. The size of storage partition Nslice0 is 1T and is allocated to virtual machine VM0; the size of storage partition Nslice1 is 2T and is allocated to virtual machine VM1; the size of storage partition Nslice2 is 1T and is allocated to virtual machine VM2.
[0032] Combined with reference Figure 2 , for the Figure 1 Schematic diagram of physical hard disk partitioning after some virtual machines are destroyed. Figure 2 In the example, after virtual machines VM0 and VM2 are destroyed, storage partition Nslice1 continues to be used by virtual machine VM1, storage partitions Nslice0 and Nslice2 are released, and storage partitions Nslice0 and Nslice2 are discontinuous storage partitions.
[0033] Combined with reference Figure 3 , for Figure 2 A schematic diagram of one of the solutions for continuing to use the released storage partition. Figure 3 In the example, the virtual hard disk specifications used by the virtual machines are restricted to ensure that the storage partitions used by each virtual machine are continuous storage partitions. In this case, two virtual machines VM3 and VM4 with a virtual hard disk specification of 1T can be recreated, where virtual machine VM3 uses storage partition Nslice0, and virtual machine VM4 uses storage partition Nslice2. In this solution, only two virtual machines with a virtual hard disk specification of 1T can be created, and virtual machines with a virtual hard disk specification of 2T cannot be created.
[0034] Combined with reference Figure 4 , for Figure 2 Schematic diagram of another solution for continuing to use the storage partition in. Figure 4In the example, the storage partitions Nslice0 and Nslice2 are fragmented and integrated to obtain a storage partition of 2T in size. After mapping the 2T storage partition to a virtual hard disk, a virtual machine VM5 with a virtual hard disk specification of 2T can be recreated. However, since the storage partitions used by the virtual machine VM5 are discontinuous, when the virtual machine VM5 initiates an IO access request, a cross-border access problem is likely to occur. The so-called cross-border access means that part of the storage address in the IO access request is located in the storage partition Nslice0, and part of the storage address is located in the storage partition Nslice2. Under normal circumstances, such cross-border IO access requests are not supported (i.e., each IO access request can only access one continuous storage partition), so IO access exceptions will occur. In order to solve this problem, in some technologies, the last segment of the storage partition M at the end of the storage partition Nslice0 is restricted to access (i.e., data operations are not allowed in this storage partition), so that the problem of cross-border access is effectively avoided. However, this will also cause the storage partition Nslice0 to not be fully utilized, reducing the utilization rate of the storage partition Nslice0.
[0035] In order to solve the problem of low storage partition utilization, the present disclosure first provides a data processing architecture. Figure 5 , which is a schematic diagram of a data processing architecture provided for an embodiment of the present disclosure. Figure 5 In the data processing architecture, a plurality of virtual devices, a virtual hard disk management layer and a physical hard disk are included. The physical hard disk is provided to the plurality of virtual devices for use. Specifically, the physical hard disk can be divided into a plurality of storage partitions, and these storage partitions can be mapped to a plurality of virtual hard disks, and these virtual hard disks can be provided to the virtual devices for use. The virtual hard disk management layer can at least realize the following functions:
[0036] 1) Mapping management of physical hard disks and virtual hard disks. Mapping management is to associate the physical address interval of the physical hard disk with the virtual address interval of the virtual hard disk to achieve mapping from the virtual address interval to the physical address interval. Generally, the virtual address interval of a virtual hard disk can be continuous, but the physical address interval associated with the virtual address interval of the virtual hard disk can be discontinuous. For example, assuming that the virtual address interval of the virtual hard disk is 20-100, then the virtual address interval 20-30 can be associated with the physical address interval 05-15, the virtual address interval 31-50 can be associated with the physical address interval 101-120, and the virtual address interval 51-100 can be associated with the physical address interval 201-250. In this way, on the one hand, when the virtual hard disk is provided to the virtual device for use, the virtual device perceives a continuous storage partition; on the other hand, the storage partitions of the physical hard disk can be fragmented and integrated to improve storage utilization.
[0037] In some embodiments of the present disclosure, each virtual device may have a corresponding mapping table, which is used to store the address association relationship between the virtual hard disk and the physical hard disk used by the virtual device.
[0038] In other embodiments of the present disclosure, the address association relationship between the virtual hard disks and physical hard disks used by all virtual devices is stored in the same mapping table.
[0039] 2) Perform conversion management on the IO access requests initiated by the virtual device. Specifically, the IO access requests initiated by the virtual device may include the virtual address range to be accessed. The virtual hard disk management layer converts the virtual address range in the IO access request into a physical address range based on the mapping table of the virtual device, and reconstructs the access request for the physical address range based on the physical address range obtained by the conversion. In this way, data operations can be performed on the physical hard disk, such as writing data to the physical hard disk, reading data from the physical hard disk, deleting or modifying data in the physical hard disk, etc.
[0040] Figure 5 The data processing architecture shown may be located in an electronic device, wherein the electronic device includes but is not limited to a server, a tablet computer, a laptop computer, a desktop computer, etc. Further, a data processor (Data Processing Unit, DPU) in the electronic device may be used to implement the functions of the above-mentioned virtual hard disk management layer.
[0041] based on Figure 5 The data processing architecture shown in the present disclosure provides a data operation method that can improve the utilization rate of storage partitions. The data operation method can be applied to Figure 5 In conjunction with the virtual disk management layer Figure 6 , which is a flow chart of a data operation method provided by an embodiment of the present disclosure. Figure 6 In the data operation method, the data operation method includes the following steps:
[0042] Step S61: receiving a first data operation request, where the first data operation request includes a target virtual address range of a virtual hard disk.
[0043] Specifically, the first data operation request is an IO operation request sent by the virtual device. The first data operation request may include IO operation information. The IO operation information includes but is not limited to the IO operation type (such as reading data, writing data, deleting or modifying data, etc.), the request identifier of the first data operation request, the first starting virtual address of the data to be operated in the virtual hard disk and the first virtual address length, etc. Among them, the first starting virtual address can be used as the starting address of the target virtual address range, and the first starting virtual address can be offset by the first virtual address length to obtain the end address of the target virtual address range. For example, assuming that the first starting virtual address is 5 and the first virtual address length is 20, then the target virtual address range is 5 to 25.
[0044] Step S62, searching the mapping table for a target mapping record having an overlapping virtual address interval with the target virtual address interval. The mapping records in the mapping table are used to associate the virtual address interval of the virtual hard disk with the physical address interval of the physical hard disk. The virtual address intervals in different mapping records are different.
[0045] Combination Figure 5 , when each virtual device has its own corresponding mapping table, the target virtual device that sends the first data operation request can be determined, and in the mapping table corresponding to the target virtual device, the target mapping record with the virtual address interval overlapping the target virtual address interval can be searched. Since each virtual device has its own corresponding mapping table, the amount of data in each mapping table can be small, which can increase the search speed. Conversely, when all virtual devices correspond to the same mapping table, the target mapping record with the virtual address interval overlapping the target virtual address interval can be searched in the same mapping table. When all virtual devices correspond to the same mapping table, the number of mapping tables to be maintained can be reduced, thereby reducing maintenance costs.
[0046] In this embodiment, each virtual device has its own corresponding mapping table as an example to illustrate the data storage form of the mapping table. Please refer to the following Table 1 and Table 2. Table 1 is the mapping table corresponding to virtual device A, and Table 2 is the mapping table corresponding to virtual device B.
[0047] Table 1 Mapping table corresponding to virtual device A
[0048] Mapping Record ID Second virtual address length Second starting virtual address Starting physical address idx length_A0 v_slba_A0 ssd_slba_A0 IxD length_A1 v_slba_A1 ssd_slba_A1 …… …… …… …… idx length_An v_slba_An ssd_slba_An
[0049] Table 2 Mapping table corresponding to virtual device B
[0050] Mapping Record ID Second virtual address length Second starting virtual address Starting physical address xD length_B0 v_slba_B0 ssd_slba_B0 IdxB length_B1 v_slba_B1 ssd_slba_B1 …… …… …… …… xD length_Bm v_slba_Bm ssd_slba_Bm
[0051] In combination with Table 1 and Table 2 above, each row in the mapping table except the first row represents a mapping record. Each mapping record is used to associate a virtual address interval with a physical address interval. In any mapping record, the second starting virtual address can be used as the starting address of the virtual address interval. By offsetting the second starting virtual address by the second virtual address length, the end address of the virtual address interval can be obtained. The starting physical address can be used as the starting address of the physical address interval. By offsetting the starting physical address by the second virtual address length, the end address of the physical address interval can be obtained. For example, for the first mapping record (i.e., the second row) in Table 1, when v_slba_A0=5, length_A0=20, and ssd_slba_A0=30, the virtual address interval is 5-25, the physical address interval is 30-50, and the virtual address interval 5-25 and the physical address interval 30-50 are associated, that is, the virtual address interval 5-25 is mapped to the physical address interval 30-50.
[0052] In the mapping table, the virtual address intervals in different mapping records can be continuous, so that the virtual device can perceive continuous storage partitions. However, the physical address intervals in different mapping records can be discontinuous, so that the storage partitions in the physical hard disk can be fragmented and integrated to improve storage utilization.
[0053] In this embodiment, for any mapping record in the mapping table, if the starting address of the virtual address interval in the mapping record is smaller than the starting address of the target virtual address interval, or the ending address of the virtual address interval in the mapping record is larger than the ending address of the target virtual address interval, then the mapping record is used as a target mapping record having an overlapping virtual address interval with the target virtual address interval. In other words, if the virtual address interval in a mapping record has an overlapping interval with the target virtual address interval in the first data operation request, then the mapping record can be used as a target mapping record having an overlapping virtual address interval with the target virtual address interval.
[0054] In the embodiments shown in the present disclosure, the target virtual address interval may have an overlapping interval with the virtual address intervals in multiple mapping records, or may have an overlapping interval with the virtual address interval in only one mapping record. Wherein, the target virtual address interval has an overlapping interval with the virtual address interval in the mapping record, and the target virtual address interval may partially overlap with the virtual address interval in the mapping record, or the target virtual address interval may completely overlap with the virtual address interval in the mapping record. For example, assuming that in Table 1:
[0055] Mapping record 1: v_slba_A0=5, length_A0=20, ssd_slba_A0=30
[0056] Mapping record 2: v_slba_A1=26, length_A1=10, ssd_slba_A1=60
[0057] Mapping record 3: v_slba_A2=37, length_A2=15, ssd_slba_A2=120
[0058] When the target virtual address interval is 5 to 36, the target virtual address interval completely overlaps with the virtual address intervals in mapping records 1 and 2;
[0059] When the target virtual address interval is 15 to 30, the target virtual address interval partially overlaps with the virtual address intervals in mapping records 1 and 2;
[0060] When the target virtual address range is 15 to 21, the target virtual address range partially overlaps with the virtual address range in the mapping record 1.
[0061] Step S63: if there are multiple target mapping records, split the target virtual address interval into multiple sub-virtual address intervals according to the virtual address intervals in each target mapping record.
[0062] Specifically, for any virtual address interval in a target mapping record, the overlapping interval between the target virtual address interval and the virtual address interval can be split out. Figure 7 , which is a schematic diagram of splitting sub-virtual address intervals provided for an embodiment of the present disclosure. Figure 7 In the example, it is assumed that virtual address interval 5-25 is the virtual address interval in mapping record 1, virtual address interval 26-36 is the virtual address interval in mapping record 2, virtual address interval 37-52 is the virtual address interval in mapping record 3, and virtual address interval 15-30 is the target virtual address interval in the first data operation request. Since the target virtual address interval 15-30 overlaps with the virtual address interval 5-25 for interval 15-25, and the target virtual address interval 15-30 overlaps with the virtual address interval 26-36 for interval 26-30, the target virtual address interval can be split into two sub-virtual address intervals 15-25 and 26-30.
[0063] Step S64: Based on the physical address intervals associated with each sub-virtual address interval, a plurality of second data operation requests are generated to perform data operations in the physical hard disk.
[0064] For ease of understanding, combined Figure 7Let's take an example. Assuming that the physical address interval in mapping record 1 is 30-50, and the physical address interval in mapping record 2 is 60-70, then the sub-virtual address interval 15-25 obtained by splitting the target virtual address interval can be associated with the physical address interval 40-50, and the sub-virtual address interval 26-30 obtained by splitting the target virtual address interval can be associated with the physical address interval 60-64.
[0065] Based on each physical address interval, a second data operation request can be constructed to request data operation in the corresponding physical address interval. For example, based on the above physical address interval 40-50, a second data operation request A can be constructed to request data operation in the physical address interval 40-50, and based on the above physical address interval 60-64, a second data operation request B can be constructed to request data operation in the physical address interval 60-64.
[0066] To sum up, in the technical solutions of some embodiments of the present disclosure, when the target virtual address interval in the first data operation request has an overlapping virtual address interval with multiple target mapping records, the target virtual address interval is split according to the virtual address interval in the target mapping record, and multiple second operation requests are generated based on the physical address intervals associated with the multiple sub-virtual address intervals obtained by the split. In this way, the problem of cross-boundary access can be effectively solved, so that there is no need to restrict access to the last storage partition at the end of the physical hard disk partition, thereby effectively improving the utilization rate of the physical hard disk storage partition.
[0067] In some embodiments, in step S62, if only one target mapping record is found, the target virtual address interval may not need to be split, and a second data operation request may be directly generated based on the physical address interval associated with the target virtual address interval, thereby reducing the amount of data processing.
[0068] In some embodiments, after performing data operations in the physical hard disk, the physical hard disk generates an operation response message. The request response message may include the result of the data operation, such as the data read by the virtual device from the physical hard disk, information indicating whether the data operation is successfully executed, etc. If only one second data operation request is generated based on the first data operation request, the request response message of the second data operation request is forwarded to the virtual device that initiated the first data operation request. The following describes how to generate a request response message for a first data operation request when multiple second data operation requests are generated based on the first data operation request. Specifically, the process may include the following steps:
[0069] 1) Receive the operation response message returned by the physical hard disk.
[0070] 2) Among the received operation response messages, identify the operation response messages of the multiple second data operation requests.
[0071] Specifically, multiple second data operation requests may have the same first request identifier. The first request identifier may be a request identifier for identifying the first data operation request (i.e., the request identifier carried in the first data operation request), and each second data operation request may have a corresponding operation response message, and the operation response message returned by the physical hard disk may include the second request identifier. The second request identifier may be the first request identifier of the second data operation request corresponding to the operation response message. For example, assuming that the request identifier of the first data operation request is Q1, and second data operation requests A and B are generated based on the first data operation request, then the first request identifiers of the second data operation requests A and B are both Q1, and the second request identifier in the request response message corresponding to the second data operation request A is Q1, and the second request identifier in the request response message corresponding to the second data operation request B is also Q1.
[0072] Based on the above principle, for any received operation response message, if the second request identifier in the operation response message is the same as the first request identifier of the multiple second data operation requests, the operation response message can be used as the operation response message of the multiple second data operation requests.
[0073] 3) Based on the operation response messages of the multiple second data operation requests, construct a request response message of the first data operation request.
[0074] Specifically, the operation response messages of the multiple second data operation requests may be aggregated into one message, and the aggregated message may be used as the request response message of the first data operation request.
[0075] In this way, when the first data operation request is split into multiple second data operation requests, a complete request response message can be returned to the first data operation request.
[0076] In some embodiments, the first request identifier is associated with the number of the plurality of second data operation requests. When identifying the operation response messages of the plurality of second data operation requests, if the number of identified operation response messages reaches the number of requests associated with the first request identifier, the identification of the operation response messages is stopped.
[0077] This completes the entire description of the disclosed solution.
[0078] Combined with reference Figure 8 , which is a module diagram of a data operation device provided in one embodiment of the present disclosure. Figure 8 In the data operation device, the data operation device includes:
[0079] A request receiving module, configured to receive a first data operation request, wherein the first data operation request includes a target virtual address interval of the virtual hard disk;
[0080] An address search module is used to search in a mapping table for a target mapping record having a virtual address interval overlapping with a target virtual address interval. The mapping records in the mapping table are used to associate the virtual address interval of the virtual hard disk with the physical address interval of the physical hard disk. The virtual address intervals in different mapping records are different.
[0081] An address splitting module, for splitting a target virtual address interval into multiple sub-virtual address intervals according to virtual address intervals in each target mapping record if there are multiple target mapping records;
[0082] The request generation module is used to generate multiple second data operation requests based on the physical address intervals associated with each sub-virtual address interval, so as to perform data operations in the physical hard disk.
[0083] In some embodiments, the request receiving module is further configured to:
[0084] Receive the operation response message returned by the physical hard disk;
[0085] identifying, among the received operation response messages, a plurality of operation response messages for the second data operation request;
[0086] A request response message of the first data operation request is constructed based on the operation response messages of the plurality of second data operation requests.
[0087] In some embodiments, each second data operation request has a corresponding operation response message; the request receiving module is specifically used to:
[0088] The operation response messages of the multiple second data operation requests are aggregated into one message, and the aggregated message is used as the request response message of the first data operation request.
[0089] In some embodiments, the plurality of second data operation requests have the same first request identifier, and the operation response message returned by the physical hard disk includes the second request identifier; the request receiving module is specifically used to:
[0090] For any received operation response message, if the second request identifier in the operation response message is the same as the first request identifiers of the multiple second data operation requests, the operation response message is used as the operation response message of the multiple second data operation requests.
[0091] In some embodiments, the first request identifier is associated with the number of the plurality of second data operation requests; and the request receiving module is specifically configured to:
[0092] When identifying operation response messages of multiple second data operation requests, if the number of identified operation response messages reaches the number of requests associated with the first request identifier, the identification of the operation response messages is stopped.
[0093] In some embodiments, the address lookup module is specifically used to:
[0094] For any mapping record in the mapping table, if the starting address of the virtual address interval in the mapping record is smaller than the starting address of the target virtual address interval, or the ending address of the virtual address interval in the mapping record is larger than the ending address of the target virtual address interval, then the mapping record is regarded as a target mapping record having an overlapping virtual address interval with the target virtual address interval.
[0095] In some embodiments, the physical hard disk is provided to multiple virtual devices, and each virtual device has its own corresponding mapping table; the address lookup module is specifically used for:
[0096] Determine a target virtual device to which a first data operation request is sent;
[0097] In the mapping table corresponding to the target virtual device, a target mapping record having a virtual address interval overlapping the target virtual address interval is searched.
[0098] In some embodiments, the request generation module is further configured to:
[0099] If there is only one target mapping record, a second data operation request is generated based on the physical address interval associated with the target virtual address interval.
[0100] See also Fig. 9 , is a schematic diagram of an electronic device provided by an embodiment of the present disclosure. The electronic device includes a processor and a memory, the memory is used to store a computer program, and when the computer program is executed by the processor, the above method is implemented.
[0101] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0102] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiment.
[0103] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0104] An embodiment of the present disclosure further provides a computer-readable storage medium, where the computer-readable storage medium is used to store a computer program. When the computer program is executed by a processor, the above method is implemented.
[0105] The present disclosure also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the above method is implemented.
[0106] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A data operation method, characterized in that: The method comprises: receiving a first data operation request, wherein the first data operation request includes a target virtual address interval of the virtual hard disk; Searching in a mapping table for a target mapping record having a virtual address interval overlapping the target virtual address interval, wherein the mapping records in the mapping table are used to associate the virtual address interval of the virtual hard disk with the physical address interval of the physical hard disk, and the virtual address intervals in different mapping records are different; If there are multiple target mapping records, split the target virtual address interval into multiple sub-virtual address intervals according to the virtual address intervals in each of the target mapping records; Based on the physical address intervals associated with the sub-virtual address intervals, a plurality of second data operation requests are generated to perform data operations in the physical hard disk.
2. The method according to claim 1, characterized in that The method further comprises: Receive an operation response message returned by the physical hard disk; identifying, among the received operation response messages, the operation response messages of the plurality of second data operation requests; A request response message of the first data operation request is constructed based on the operation response messages of the multiple second data operation requests.
3. The method according to claim 2, characterized in that Each of the second data operation requests has a corresponding operation response message; The constructing a request response message of the first data operation request based on the operation response messages of the multiple second data operation requests includes: The operation response messages of the multiple second data operation requests are aggregated into one message, and the aggregated message is used as the request response message of the first data operation request.
4. The method according to claim 2, characterized in that: The multiple second data operation requests have the same first request identifier, and the operation response message returned by the physical hard disk includes the second request identifier; The step of identifying the operation response messages of the plurality of second data operation requests in the received operation response messages comprises: For any of the received operation response messages, if the second request identifier in the operation response message is the same as the first request identifiers of the multiple second data operation requests, the operation response message is used as the operation response message of the multiple second data operation requests.
5. The method according to claim 4, characterized in that The first request identifier is associated with the number of the plurality of second data operation requests; the method further comprising: When identifying the operation response messages of the multiple second data operation requests, if the number of identified operation response messages reaches the number of requests associated with the first request identifier, the identification of the operation response messages is stopped.
6. The method according to claim 1, characterized in that The searching the mapping table for a target mapping record having a virtual address interval overlapping the target virtual address interval includes: For any mapping record in the mapping table, if the starting address of the virtual address interval in the mapping record is smaller than the starting address of the target virtual address interval, or the ending address of the virtual address interval in the mapping record is larger than the ending address of the target virtual address interval, then the mapping record is regarded as a target mapping record having an overlapping virtual address interval with the target virtual address interval.
7. The method according to claim 1, characterized in that The physical hard disk is provided to multiple virtual devices for use, and each virtual device has its own corresponding mapping table; The searching the mapping table for a target mapping record having a virtual address interval overlapping the target virtual address interval includes: Determine a target virtual device to which the first data operation request is sent; In the mapping table corresponding to the target virtual device, a target mapping record having a virtual address interval overlapping with the target virtual address interval is searched.
8. The method according to claim 1, characterized in that The method further comprises: If there is only one target mapping record, a second data operation request is generated based on the physical address interval associated with the target virtual address interval.
9. A data operation device, characterized in that: The device comprises: A request receiving module, configured to receive a first data operation request, wherein the first data operation request includes a target virtual address interval of the virtual hard disk; An address search module is used to search a target mapping record having a virtual address interval overlapping with the target virtual address interval in a mapping table, wherein the mapping records in the mapping table are used to associate the virtual address interval of the virtual hard disk with the physical address interval of the physical hard disk, and the virtual address intervals in different mapping records are different; An address splitting module, for splitting the target virtual address interval into multiple sub-virtual address intervals according to the virtual address intervals in each of the target mapping records if there are multiple target mapping records; The request generation module is used to generate multiple second data operation requests based on the physical address intervals associated with each of the sub-virtual address intervals, so as to perform data operations in the physical hard disk.
10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 8 by executing the computer instructions.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the method according to any one of claims 1 to 8.