# US 2018/0321879 A1 · Method and Apparatus for Processing Read/Write Request in Physical Machine

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2018/0321879 A1
- Document ID: US20180321879A1
- Status: Published application
- Kind: A1
- Application number: 16/025,584
- Filed: 2018-07-02
- Published: 2018-11-08
- Earliest claimed: 2015-12-31
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Lina Lu
- Web page: https://patentgrep.com/patent/US20180321879A1

## CPC

- G06F 3/0659: {Command handling arrangements, e.g. command buffers, queues, command scheduling}
- G06F 3/06: Digital input from, or digital output to, record carriers {, e.g. RAID, emulated record carriers or networked record carriers}
- G06F 3/0604: {Improving or facilitating administration, e.g. storage management}
- G06F 3/061: {Improving I/O performance}
- G06F 3/0664: {at device level, e.g. emulation of a storage device or system}
- G06F 3/0679: {Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 13/105: {where the program performs an input/output emulation function}
- G06F 13/1668: {Details of memory controller}
- G06F 13/4282: {on a serial bus, e.g. I2C bus, SPI bus (on daisy chain buses G06F13/4247)}
- G06F 2009/45579: {I/O management, e.g. providing access to device drivers or storage}
- G06F 2213/0028: Serial attached SCSI [SAS]
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and an apparatus for processing a read/write request in a physical machine, where the method includes polling, by a host by accessing memory of at least one of virtual storage devices, at least one instruction transmit queue of the at least one virtual storage device in order to obtain a first read/write request from the at least one instruction transmit queue, performing a first forwarding operation on the first read/write request, and obtaining, by the host, another first read/write request from the at least one instruction transmit queue by polling such that the host performs the first forwarding operation on the other first read/write request. According to the method and the apparatus in embodiments of the present disclosure, a speed of processing a read/write request in a virtualization storage scenario can be increased.

## Claims

### Claim 1

A method for processing a read/write request in a physical machine, the physical machine comprising a physical storage device, a host machine (host), and a virtual machine, the physical machine configured to provide, based on a virtual storage device virtualized by the physical storage device, a storage service to the virtual machine, and the method comprising:
polling, by the host by accessing virtual memory space corresponding to at least one of virtual storage devices, at least one instruction transmit queue of the at least one virtual storage device in order to obtain a plurality of first read/write requests from the at least one instruction transmit queue, the virtual memory space being simulated by the host in a memory mapped input/output (I/O) (MMIO) manner, the first read/write requests are from an application running on the virtual machine, and each first read/write request comprising information about a target virtual storage device; and
performing, by the host, a first forwarding operation on each of the first read/write requests, the first forwarding operation comprising:
generating, by the host according to the information about the target virtual storage device comprised in the first read/write request and a mapping relationship between the information about the target virtual storage device and information about a target physical storage device, a second read/write request corresponding to the first read/write request, the second read/write request comprising the information about the target physical storage device; and
adding, by the host, the second read/write request to an instruction transmit queue of the target physical storage device according to the information about the target physical storage device to enable the target physical storage device to obtain the second read/write request from the instruction transmit queue of the target physical storage device and to perform a read/write operation according to the second read/write request.

### Claim 2 (depends on 1)

The method of claim 1, wherein generating the second read/write request corresponding to the first read/write request comprises:
generating, by the host, the second read/write request corresponding to the first read/write request, according to the information about the target virtual storage device comprised in the first read/write request and the mapping relationship between the information about the target virtual storage device and the information about the target physical storage device, the second read/write request comprising the information about the target physical storage device, and a format of the second read/write request matching the target physical storage device.

### Claim 3 (depends on 2)

The method of claim 2, further comprising:
obtaining, by the host, a third read/write request from the at least one instruction transmit queue by polling, the third read/write request comprising a length of read/written data and information about a read/written virtual storage device, the read/written virtual storage device comprising a read/written target virtual block device, and the length of the read/written data being greater than a readable/writable address range of the read/written target virtual block device;
generating, by the host, a response to the third read/write request; and
adding, by the host, the response to the third read/write request to an instruction response queue of the read/written virtual storage device, the response to the third read/write request indicating that a read/write operation corresponding to the third read/write request fails.

### Claim 4 (depends on 1)

The method of claim 1, further comprising:
polling, by the host, at least one instruction response queue of at least one of physical storage devices to obtain a plurality of second read/write responses from the at least one instruction response queue, an interrupt of the at least one instruction response queue comprising a disabled state, the second read/write responses indicating that the target physical storage device has performed a read/write operation, and the second read/write responses comprising the information about the target physical storage device; and
performing, by the host, a second forwarding operation on each of the second read/write responses, the second forwarding operation comprising:
generating, by the host according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device, a first read/write response corresponding to a second read/write response, the first read/write response comprising the information about the target virtual storage device; and
adding, by the host, the first read/write response to an instruction response queue of the target virtual storage device according to the information about the target virtual storage device to enable the application to obtain the first read/write response.

### Claim 5 (depends on 4)

The method of claim 4, wherein generating the first read/write response corresponding to the second read/write response comprises:
determining, by the host, the information about the target virtual storage device according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device; and
generating, by the host, the first read/write response corresponding to the second read/write response, the first read/write response comprising the information about the target virtual storage device, and a format of the first read/write response matching the target virtual storage device.

### Claim 6

A physical machine, applied for processing a read/write request, comprising:
a physical storage device configured to virtualize a virtual storage device; and
a host machine (host) coupled to the physical storage device and:
poll, by accessing virtual memory space corresponding to at least one of virtual storage devices, at least one instruction transmit queue of the at least one virtual storage device to obtain a plurality of first read/write requests from the at least one instruction transmit queue, the virtual memory space being simulated by the host in a memory mapped input/output (I/O) (MMIO) manner, the first read/write requests are from an application running on a virtual machine, and each first read/write request comprising information about a target virtual storage device; and
perform a first forwarding operation on each of the first read/write requests, when performing the first forwarding operation, the host being further configured to:
generate, according to the information about the target virtual storage device comprised in the first read/write request and a mapping relationship between the information about the target virtual storage device and information about a target physical storage device, a second read/write request corresponding to the first read/write request, the second read/write request comprising the information about the target physical storage device; and
add the second read/write request to an instruction transmit queue of the target physical storage device according to the information about the target physical storage device to enable the target physical storage device to obtain the second read/write request from the instruction transmit queue of the target physical storage device and to perform a read/write operation according to the second read/write request.

### Claim 7 (depends on 6)

The physical machine of claim 6, wherein when generating the second read/write request corresponding to the first read/write request, the host is further configured to:
determine the information about the target physical storage device according to the information about the target virtual storage device comprised in the first read/write request and the mapping relationship between the information about the target virtual storage device and the information about the target physical storage device; and
generate the second read/write request corresponding to the first read/write request, the second read/write request comprising the information about the target physical storage device, and a format of the second read/write request matching the target physical storage device.

### Claim 8 (depends on 7)

The physical machine of claim 7, wherein the host is further configured to:
obtain a third read/write request from the at least one instruction transmit queue by polling, the third read/write request comprising a length of read/written data and information about a read/written virtual storage device, the read/written virtual storage device comprising a read/written target virtual block device, and the length of the read/written data being greater than a readable/writable address range of the read/written target virtual block device;
generate a response to the third read/write request; and
add the response to the third read/write request to an instruction response queue of the read/written virtual storage device, the response to the third read/write request indicating that a read/write operation corresponding to the third read/write request fails.

### Claim 9 (depends on 6)

The physical machine of claim 6, wherein the host is further configured to:
poll at least one instruction response queue of at least one of physical storage devices to obtain a plurality of second read/write responses from the at least one instruction response queue, an interrupt of the at least one instruction response queue comprising a disabled state, the second read/write responses indicating that the target physical storage device has performed a read/write operation, and the second read/write responses comprising the information about the target physical storage device; and
perform a second forwarding operation on each of the second read/write responses, when performing the second forwarding operation, the host being further configured to:
generate, according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device, a first read/write response corresponding to a second read/write response, the first read/write response comprising the information about the target virtual storage device; and
add the first read/write response to an instruction response queue of the target virtual storage device according to the information about the target virtual storage device to enable the application to obtain the first read/write response.

### Claim 10 (depends on 9)

The physical machine of claim 9, wherein when generating the first read/write response corresponding to the second read/write response, the host is further configured to:
determine the information about the target virtual storage device according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device; and
generate the first read/write response corresponding to the second read/write response, the first read/write response comprising the information about the target virtual storage device, and a format of the first read/write response matching the target virtual storage device.

### Claim 11

A method for processing a read/write response in a physical machine, the physical machine comprising a physical storage device, a host machine (host), and a virtual machine and configured to provide, based on a virtual storage device virtualized by the physical storage device, a storage service to the virtual machine, and the method comprising:
polling, by the host, at least one instruction response queue of at least one of physical storage devices to obtain a plurality of first read/write responses from the at least one instruction response queue, an interrupt of the at least one instruction response queue comprising a disabled state or a processor of the physical machine being configured for ignoring an interrupt request of the at least one instruction response queue, the first read/write responses indicating that a target physical storage device has performed a read/write operation, and the first read/write responses comprising information about the target physical storage device; and
performing, by the host, a forwarding operation on each of the first read/write responses, the forwarding operation comprising:
generating, by the host according to the information about the target physical storage device and a mapping relationship between the information about the target physical storage device and information about a target virtual storage device, a second read/write response corresponding to the first read/write response, the second read/write response comprising the information about the target virtual storage device; and
adding, by the host, the second read/write response to an instruction response queue of the target virtual storage device according to the information about the target virtual storage device to enable an application to obtain the second read/write response.

### Claim 12 (depends on 11)

The method of claim 11, wherein in terms of generating the second read/write response corresponding to the first read/write response, the method further comprises:
determining, by the host, the information about the target virtual storage device according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device; and
generating, by the host, the second read/write response corresponding to the first read/write response, the second read/write response comprising the information about the target virtual storage device, and a format of the second read/write response matching the target virtual storage device.

### Claim 13 (depends on 2)

The method of claim 2, further comprising:
obtaining, by the host, a third read/write request from the at least one instruction transmit queue by polling, the third read/write request comprising a length of read/written data and information about a read/written virtual storage device, the read/written virtual storage device comprising a read/written target virtual block device, and the length of the read/written data being equal to a readable/writable address range of the read/written target virtual block device;
generating, by the host, a response to the third read/write request; and
adding, by the host, the response to the third read/write request to an instruction response queue of the read/written virtual storage device, the response to the third read/write request indicating that a read/write operation corresponding to the third read/write request fails.

### Claim 14 (depends on 1)

The method of claim 1, further comprising:
polling, by the host, at least one instruction response queue of at least one of physical storage devices to obtain a plurality of second read/write responses from the at least one instruction response queue, an interrupt of the at least one instruction response queue comprising a processor of the physical machine being configured for ignoring an interrupt request of the at least one instruction response queue, the second read/write responses indicating that the target physical storage device has performed a read/write operation, and the second read/write responses comprising the information about the target physical storage device; and
performing, by the host, a second forwarding operation on each of the second read/write responses, the second forwarding operation comprising:
generating, by the host according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device, a first read/write response corresponding to a second read/write response, the first read/write response comprising the information about the target virtual storage device; and
adding, by the host, the first read/write response to an instruction response queue of the target virtual storage device according to the information about the target virtual storage device to enable the application to obtain the first read/write response.

### Claim 15 (depends on 4)

The method of claim 4, wherein generating the first read/write response corresponding to the second read/write response comprises:
determining, by the host, the information about the target virtual storage device according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device; and
generating, by the host, the first read/write response corresponding to the second read/write response, the first read/write response comprising the information about the target virtual storage device, and a format of the first read/write response matching the target virtual storage device.

### Claim 16 (depends on 7)

The physical machine of claim 7, wherein the host is further configured to:
obtain a third read/write request from the at least one instruction transmit queue by polling, the third read/write request comprising a length of read/written data and information about a read/written virtual storage device, the read/written virtual storage device comprising a read/written target virtual block device, and the length of the read/written data being equal to a readable/writable address range of the read/written target virtual block device;
generate a response to the third read/write request; and
add the response to the third read/write request to an instruction response queue of the read/written virtual storage device, the response to the third read/write request indicating that a read/write operation corresponding to the third read/write request fails.

### Claim 17 (depends on 6)

The physical machine of claim 6, wherein the host is further configured to:
poll at least one instruction response queue of at least one of physical storage devices to obtain a plurality of second read/write responses from the at least one instruction response queue, an interrupt of the at least one instruction response queue comprising a processor of the physical machine being configured for ignoring an interrupt request of the at least one instruction response queue, the second read/write responses indicating that the target physical storage device has performed a read/write operation, and the second read/write responses comprising the information about the target physical storage device; and
perform a second forwarding operation on each of the second read/write responses, when performing the second forwarding operation, the host being further configured to:
generate, according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device, a first read/write response corresponding to a second read/write response, the first read/write response comprising the information about the target virtual storage device; and
add the first read/write response to an instruction response queue of the target virtual storage device according to the information about the target virtual storage device to enable the application to obtain the first read/write response.

### Claim 18 (depends on 9)

The physical machine of claim 9, wherein when generating the first read/write response corresponding to the second read/write response, the host is further configured to:
determine the information about the target virtual storage device according to the information about the target physical storage device and the mapping relationship between the information about the target physical storage device and the information about the target virtual storage device; and
generate the first read/write response corresponding to the second read/write response, the first read/write response comprising the information about the target virtual storage device, and a format of the first read/write response matching the target virtual storage device.
