Sequential flow detection method and device
阅读说明:本技术 顺序流检测方法与装置 (Sequential flow detection method and device ) 是由 曹定尊 路向峰 孙清涛 于 2016-03-23 设计创作,主要内容包括:提供检测顺序流的方法与装置。提供的顺序流检测方法,其中缓存多个IO地址;与所缓存的多个IO地址的每个相关联地记录命中计数;所述方法包括:响应于收到第一IO命令,如果第一IO命令命中所缓存的多个IO地址之一,以所述第一IO命令的第一地址替换所命中的多个IO地址之一,递增与所述第一地址相关联的第一命中计数;若第一命中计数满足阈值,将第一IO命令标记为属于第一顺序流;若第一IO命令是写命令,将第一IO命令的数据写入同构成第一顺序流的多个写命令的数据临近的存储位置。(Methods and apparatus for detecting sequential streams are provided. The provided sequential flow detection method, wherein a plurality of IO addresses are cached; recording a hit count in association with each of the cached plurality of IO addresses; the method comprises the following steps: in response to receiving a first IO command, if the first IO command hits one of the plurality of cached IO addresses, replacing the hit one of the plurality of IO addresses with a first address of the first IO command, incrementing a first hit count associated with the first address; if the first hit count satisfies a threshold, marking the first IO command as belonging to a first sequential flow; if the first IO command is a write command, writing data of the first IO command into a storage location adjacent to data of the plurality of write commands constituting the first sequential stream.)
1. A sequential flow detection method, comprising:
in response to receiving a first IO command, if the first IO command hits one of the plurality of cached IO addresses, replacing the hit one of the plurality of IO addresses with a first address of the first IO command, incrementing a first hit count associated with the first address;
if the first hit count satisfies a threshold, marking the first IO command as belonging to a first sequential flow;
if the first IO command is a write command, writing data of the first IO command into a storage location associated with the first sequential stream.
2. The sequential flow detection method of claim 1, the method further comprising:
marking the first IO command as belonging to a random stream if the first IO misses any of the plurality of IO addresses of the cache.
3. The sequential flow detection method of claim 1 or 2, further comprising,
if the first IO command is a read command, a read ahead command is generated to read data from a location adjacent to the first address.
4. The sequential flow detection method according to one of claims 1 to 3, the method further comprising:
if the first IO miss misses any of the cached IO addresses, replacing one of the IO addresses with the first address and initializing a hit count value associated with the replaced IO address.
5. The sequential flow detection method of claim 4, wherein
If the first IO misses any one of a plurality of IO addresses cached, replacing the IO address with the first address, wherein the hit count of the plurality of IO addresses is the lowest; or replacing the least recently used IO address in the plurality of IO addresses with the first address and initializing a hit count of the first address.
6. The sequential flow detection method as claimed in one of claims 1 to 5, wherein
The first address hits one of a plurality of addresses of the cache, including:
the first address is numerically immediately adjacent to one of the plurality of IO addresses;
the first address may be incremented by one of the plurality of IO addresses;
the first address is the same as one of the plurality of IO addresses;
the first address overlaps with one of the plurality of IO addresses; or
The first address is less than a threshold distance from one of the plurality of addresses.
7. The sequential flow detection method according to one of claims 1 to 6, the method further comprising:
in response to receiving a second IO command, if the second IO command hits the cached first IO address and the first hit count satisfies a threshold, replacing one of the hit plurality of IO addresses with a second address of the second IO command and marking the second IO command as belonging to a first sequential stream.
8. The sequential flow detection method according to one of claims 1 to 7, the method further comprising:
in response to receiving a third IO command, if a third address of the third IO command hits one of the plurality of IO addresses of the cache other than the first address or the second address, replacing the hit one of the plurality of IO addresses with the third address, incrementing a third hit count associated with the third address;
if the third hit count satisfies the threshold, the third IO command is marked as belonging to the second sequential flow.
9. A computer-readable storage medium, on which a program is stored, which program, when being executed by a processor, is adapted to carry out the method of one of the claims 1 to 8.
10. An information processing apparatus comprising a memory, a processor and a program stored on the memory and executable on the processor, characterized in that the processor implements the method according to one of claims 1 to 8 when executing the program.
Technical Field
The present application relates to memory systems, and more particularly, to detecting IO commands accessing a contiguous address space.
Background
The storage system is used for processing IO commands. The IO commands may be sent to a storage device (e.g., a magnetic disk, a solid state disk, a usb disk, an optical disk, etc.), a storage server, or a storage system (such as cloud storage). The plurality of IO commands form one or more data streams. If addresses accessed by a plurality of IO commands are consecutive, a data stream formed by the IO commands is referred to as a sequential stream.
Each IO command carries or indicates an address (logical address or physical address) of data to be accessed. The length of the data to be accessed by each IO command may be a fixed length or may vary. When a host accesses a storage device, a data accessing party, such as an application, may split a large block of data access into multiple IO commands and send the IO commands to the storage device. There may also be multiple applications in the host accessing the storage device and/or multiple operating systems (such as virtual machines), which results in IO commands from multiple accessing parties being interleaved, thereby making access to otherwise contiguous addresses discontinuous.
Referring to FIG. 1, there are multiple applications in the host, and sequential stream A is generated by application A, including multiple IO commands A1, A2, A3, … An accessing consecutive addresses. As an example, the sequential stream a may come from a copy of a large size video file. The sequential stream B is generated by application B and includes a plurality of IO commands B1, B2, B3, … Bn accessing consecutive addresses. The application in the host also generates a plurality of IO commands (indicated by S, E, D, C) that access the non-contiguous address space. The plurality of IO commands are organized in a different order than originally on the operating system, drivers, device interfaces, and/or bus and received by the storage device.
In a storage device such as a solid state disk, an address translation layer is provided to translate logical addresses of IO commands to physical addresses and to access the storage medium according to the physical addresses. Referring to FIG. 2, the storage device receives IO commands in the order A1, B1, C, B2 and sequences the IO commands
The storage device writes data accessed by IO commands (taking write commands as an example) into the storage medium in the order in which the IO commands are received. A storage medium such as a flash memory writes data in units of pages. A predetermined size of data block may also be employed in the storage device as a unit of write data (e.g., a set consisting of a plurality of pages). The cells in which data is written are typically of a large size to accommodate the data written by multiple IO commands. In the example of fig. 2, data corresponding to IO commands a1, B1, C, B2 are written to the same data block, and the data in the data block is from multiple IO commands in succession. Data corresponding to a plurality of IO commands originally issued in the sequential stream (such as IO commands a1, a2, A3, … An, B1, B2, B3, … Bn) will be distributed over different data blocks.
Disclosure of Invention
However, in some cases, data belonging to the same sequential stream have the same or similar life cycle, i.e., the data may be updated or invalidated at the same time. Referring to fig. 2, if data stream a has been invalidated or updated while data stream B, C remains valid, the portion of the data block corresponding to a1 is invalid while the other portions of the data block are valid, then when the data block needs to be reclaimed for various reasons, data other than the data corresponding to a1 needs to be moved, which introduces write amplification. Write amplification results in increased read and write operations, increases system overhead, and also consumes storage medium life.
In the present application, sequential checking is performed on data streams, and successive data streams (sequential streams) are extracted and written to successive physical spaces of a storage device.
According to a first aspect of the present application, there is provided a first sequential flow detection method according to the first aspect of the present application, wherein a plurality of IO addresses are cached; recording a hit count in association with each of the cached plurality of IO addresses; the method comprises the following steps: in response to receiving a first IO command, if a first address of the first IO command hits in one of the cached IO addresses, replacing the hit in one of the IO addresses with the first address, incrementing a first hit count associated with the first address; if the first hit count satisfies the threshold, the first IO command is marked as belonging to a first sequential flow.
According to a first sequential flow detection method of a first aspect of the present application, there is provided a second sequential flow detection method of the first aspect of the present application, wherein the plurality of IO addresses are addresses of a plurality of IO commands received most recently.
The first or second sequential flow detection method according to the first aspect of the present application, there is provided a third sequential flow detection method according to the first aspect of the present application, wherein the first address hits in one of a plurality of addresses of a cache, including: the first address is numerically immediately adjacent to one of the plurality of IO addresses; the first address may be incremented by one of the plurality of IO addresses; the first address is the same as one of the plurality of IO addresses; the first address overlaps with one of the plurality of IO addresses; or the first address is less than a threshold distance from one of the plurality of addresses.
According to one of the first to third sequential flow detection methods of the first aspect of the present application, there is provided a fourth sequential flow detection method according to the first aspect of the present application, the method further comprising: if the first IO miss misses any of the cached IO addresses, replacing one of the IO addresses with the first address and initializing a hit count value associated with the replaced IO address.
According to one of the first to fourth sequential flow detection methods of the first aspect of the present application, there is provided a fifth sequential flow detection method according to the first aspect of the present application, wherein a miss counter is provided; the method further comprises the following steps: if the first IO command misses any one of the plurality of cached IO addresses, incrementing the miss counter; decrementing a hit count associated with each of the plurality of addresses if the miss counter exceeds a threshold, and resetting the miss counter.
According to one of the first to fifth sequential flow detection methods of the first aspect of the present application, there is provided a sixth sequential flow detection method according to the first aspect of the present application, the method further comprising: marking the first IO command as belonging to a random stream if the first IO command misses any of the cached plurality of IO addresses.
According to one of the fourth sequential flow detection methods of the first aspect of the present application, there is provided the seventh sequential flow detection method of the first aspect of the present application, wherein if the first IO command misses any one of the plurality of cached IO addresses, the IO address with the lowest hit count among the plurality of IO addresses is replaced with the first address; or replacing the least recently used IO address in the plurality of IO addresses with the first address and initializing a hit count of the first address.
According to one of the first to seventh sequential flow detection methods of the first aspect of the present application, there is provided the eighth sequential flow detection method of the first aspect of the present application, wherein if the first hit count does not satisfy a threshold, the first IO command is marked as belonging to a random flow.
According to one of the first to eighth sequential flow detection methods of the first aspect of the present application, there is provided a ninth sequential flow detection method according to the first aspect of the present application, the method further comprising: in response to receiving a second IO command, if a second address of the second IO command hits in the first IO address of the cache and the first hit count satisfies a threshold, replacing one of the hit plurality of IO addresses with the second address and marking the second IO command as belonging to a first sequential stream.
According to one of the first to eighth sequential flow detection methods of the first aspect of the present application, there is provided a tenth sequential flow detection method according to the first aspect of the present application, the method further comprising: in response to receiving a second IO command, if a second address of the second IO command hits one of the plurality of cached IO addresses other than the first IO address, replacing the one of the plurality of hit IO addresses with the second address, incrementing a second hit count associated with the second address, replacing the one of the plurality of hit IO addresses with the second address, and if the second hit count satisfies a threshold, marking the second IO command as belonging to a first sequential stream.
According to one of the ninth to tenth sequential flow detection methods of the first aspect of the present application, there is provided the eleventh sequential flow detection method according to the first aspect of the present application, the method further comprising: in response to receiving a third IO command, if a third address of the third IO command hits in one of the plurality of cached IO addresses other than the first address or the second address, replacing the hit one of the plurality of IO addresses with the third address, incrementing a third hit count associated with the third address; if the third hit count satisfies the threshold, the third IO command is marked as belonging to the second sequential flow.
According to one of the first to eleventh sequential flow detection methods of the first aspect of the present application, there is provided the twelfth sequential flow detection method of the first aspect of the present application, wherein if the first address of the first IO command hits one of the plurality of IO addresses cached, the first hit count is incremented corresponding to a data length of the first IO command.
According to one of the first to twelfth sequential stream detection methods of the first aspect of the present application, there is provided the thirteenth sequential stream detection method of the first aspect of the present application, further comprising, if the first IO command is a write command, writing the first sequential stream to a storage location adjacent to the physical address.
According to one of the first to thirteenth sequential flow detection methods of the first aspect of the present application, there is provided the fourteenth sequential flow detection method of the first aspect of the present application, further comprising, if the first IO command is a read command, generating a read-ahead command to read data from a location adjacent to the first address.
According to a second aspect of the present application, there is provided a first sequential flow detection method according to the second aspect of the present application, wherein a plurality of IO addresses are cached; recording a hit count in association with each of the cached plurality of IO addresses; the method comprises the following steps: responding to a received first IO command, and if the first command hits an IO address which is marked as belonging to a first sequence flow in a plurality of cached IO addresses, replacing the hit IO address with a first address of the first address; the first IO command is marked as belonging to a sequential flow.
According to the first sequential flow detection method of the second aspect of the present application, there is provided the second sequential flow detection method of the second aspect of the present application, further comprising: if the first IO command hits a second address which is not marked as belonging to a first sequential stream in the plurality of cached IO addresses, replacing the hit second address with the first address, and incrementing a second hit count associated with the first address; if the second hit count satisfies the threshold, the first IO command is marked as belonging to the sequential flow.
According to the first or second sequential flow detection method of the second aspect of the present application, there is provided a third sequential flow detection method according to the second aspect of the present application, further comprising: if the first IO command misses any one of the plurality of IO addresses of the cache, incrementing a miss counter; decrementing a hit count associated with each of the plurality of IO addresses if the miss counter exceeds a threshold; and replacing one of the plurality of IO addresses of the cache with the first address.
According to the first or second sequential flow detection method of the second aspect of the present application, there is provided a fourth sequential flow detection method according to the second aspect of the present application, further comprising: if the first IO command misses any one of the plurality of IO addresses of the cache, incrementing a miss counter; decrementing a hit count associated with each of the plurality of addresses if the miss counter exceeds a threshold; and replacing one of the cached IO addresses which is not marked as belonging to the sequential flow with the first address.
According to a third aspect of the present application, there is provided a sequential flow detection system according to the third aspect of the present application, wherein a plurality of IO addresses are cached; recording a hit count in association with each of the cached plurality of IO addresses; the system comprises: a hit detection module, configured to, in response to receiving a first IO command, if a first address of the first IO command hits one of the plurality of cached IO addresses, replace the hit one of the plurality of IO addresses with the first address, and increment a first hit count associated with the first address; and a sequential flow tagging module to tag the first IO command as belonging to a first sequential flow if the first hit count satisfies a threshold.
According to a fourth aspect of the present application, there is provided the sequential flow detection system according to the fourth aspect of the present application, wherein a plurality of IO addresses are cached; recording a hit count in association with each of the cached plurality of IO addresses; the system comprises: a hit detection module, configured to, in response to receiving a first IO command, replace a hit IO address with a first address of the first address if the first command hits an IO address, which is marked as belonging to a first sequential flow, in a plurality of IO addresses cached in the cache; and a sequential stream marking module for marking the first IO command as belonging to a sequential stream.
According to a fifth aspect of the present application, there is provided a computer program comprising computer program code to, when loaded into a computer system and executed thereon, cause said computer system to perform a sequential flow detection method as provided in accordance with the first aspect of the present application or a sequential flow detection method as provided in accordance with the second aspect of the present application.
According to a sixth aspect of the present application, there is provided a program comprising program code which, when loaded into and executed on a storage device, causes the storage device to perform the sequential flow detection method as provided in accordance with the first aspect of the present application or the sequential flow detection method as provided in accordance with the second aspect of the present application.
According to a seventh aspect of the present application, there is provided a first sequential flow detection method according to the seventh aspect of the present application, comprising: in response to receiving a first IO command, if the first IO command hits one of the plurality of cached IO addresses, replacing the hit one of the plurality of IO addresses with a first address of the first IO command, incrementing a first hit count associated with the first address; if the first hit count satisfies a threshold, marking the first IO command as belonging to a first sequential flow; if the first IO command is a write command, writing data of the first IO command into a storage location associated with the first sequential stream.
According to the first sequential flow detection method of the seventh aspect of the present application, there is provided the second sequential flow detection method of the seventh aspect of the present application, the method further comprising: marking the first IO command as belonging to a random stream if the first IO misses any of the plurality of IO addresses of the cache.
According to the first or second sequential stream detection method of the seventh aspect of the present application, there is provided the third sequential stream detection method of the seventh aspect of the present application, further comprising, if the first IO command is a read command, generating a read-ahead command to read data from a location adjacent to the first address.
According to one of the first to third sequential flow detection methods of the seventh aspect of the present application, there is provided a fourth sequential flow detection method according to the seventh aspect of the present application, the method further comprising: if the first IO miss misses any of the cached IO addresses, replacing one of the IO addresses with the first address and initializing a hit count value associated with the replaced IO address.
According to a fourth sequential flow detection method of a seventh aspect of the present application, there is provided the fifth sequential flow detection method of the seventh aspect of the present application, 5, the sequential flow detection method of
According to one of the first to fifth sequential flow detection methods of the seventh aspect of the present application, there is provided a sixth sequential flow detection method of the seventh aspect of the present application, wherein the first address hits in one of a plurality of addresses of the cache, including: the first address is numerically immediately adjacent to one of the plurality of IO addresses; the first address may be incremented by one of the plurality of IO addresses; the first address is the same as one of the plurality of IO addresses; the first address overlaps with one of the plurality of IO addresses; or the first address is less than a threshold distance from one of the plurality of addresses.
According to one of the first to sixth sequential flow detection methods of the seventh aspect of the present application, there is provided a fifth sequential flow detection method according to the seventh aspect of the present application, the method further comprising: in response to receiving a second IO command, if the second IO command hits the cached first IO address and the first hit count satisfies a threshold, replacing one of the hit plurality of IO addresses with a second address of the second IO command and marking the second IO command as belonging to a first sequential stream.
According to one of the first to seventh sequential flow detection methods of the seventh aspect of the present application, there is provided an eighth sequential flow detection method according to the seventh aspect of the present application, the method further comprising: in response to receiving a third IO command, if a third address of the third IO command hits one of the plurality of IO addresses of the cache other than the first address or the second address, replacing the hit one of the plurality of IO addresses with the third address, incrementing a third hit count associated with the third address; if the third hit count satisfies the threshold, the third IO command is marked as belonging to the second sequential flow.
According to a first sequential stream detection method of a seventh aspect of the present application, there is provided the ninth sequential stream detection method of the seventh aspect of the present application, wherein if the first IO command is a write command, data of the first IO command is written to a storage location adjacent to data of a plurality of write commands constituting the first sequential stream.
According to an eighth aspect of the present application, there is provided a computer-readable storage medium according to the eighth aspect of the present application, having a program stored thereon, characterized in that the program, when executed by a processor, implements one of the sequential flow detection methods according to the seventh aspect of the present application.
According to a ninth aspect of the present application, there is provided an information processing apparatus according to the ninth aspect of the present application, comprising a memory, a processor, and a program stored on the memory and executable on the processor, wherein the processor implements one of the sequential flow detection methods according to the seventh aspect of the present application when executing the program.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
The application, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
FIG. 1A is a diagram illustrating an IO command flow between a host and a device in the prior art;
FIG. 1B is a diagram illustrating a prior art storage IO command stream on a storage medium;
FIG. 2 shows a block diagram of a storage device according to an embodiment of the present application;
FIG. 3 shows a schematic diagram of sequential flow detection according to an embodiment of the present application;
FIG. 4 shows a schematic diagram of a buffer structure for sequential stream detection according to an embodiment of the present application;
FIG. 5 illustrates buffer changes during sequential flow detection according to an embodiment of the present application;
FIG. 6 illustrates buffer changes during sequential flow detection according to yet another embodiment of the present application;
FIG. 7 is a flow chart of a sequential flow detection method according to an embodiment of the present application;
FIG. 8 is a flow chart of a sequential flow detection method according to yet another embodiment of the present application; and
FIG. 9 is a block diagram of a sequential flow detection system according to an embodiment of the present application.
Detailed Description
Referring to fig. 2, fig. 2 shows a block diagram of a Storage Device with a Solid-State Storage Device (SSD) as an example of the Storage Device. The
In an embodiment according to the present application, the
Fig. 3 is a schematic diagram of sequential flow detection according to an embodiment of the present application. By way of example, sequential stream detection is performed on received IO commands in a storage device such as a solid state disk. Out of a plurality of IO commands that access a storage device, a sequential stream a, a sequential stream B that access consecutive addresses, and a plurality of IO commands (indicated by C, D, E, … S) whose accessed addresses are not sequential (also referred to as random streams) are detected. The sequential stream a is written into the
To detect sequential flow, referring to fig. 4, a buffer structure for sequential flow detection according to an embodiment of the present application is shown. Addresses to be accessed by a plurality of IO commands are cached in a memory. In the example of FIG. 4, the IO command carries a Logical Block Address (LBA). In other examples, the IO command may carry other forms of addresses (e.g., virtual addresses) as long as there is order between elements of the address space of the IO command.
Referring to fig. 4, a plurality of (6) entries are included in the buffer, each entry including a Logical Block Address (LBA) and a count value, the LBA being stored in correspondence with the count value. In the example of FIG. 4, the logical block address of the buffer entry is from the last of the one or more LBA addresses accessed by the IO command. In other examples, the address of the buffer entry may record the address range of the IO command, or the first address and length of the IO command. The count value of a buffer entry indicates the number of times the address of the buffer entry is hit.
Referring to fig. 4, sequential flow labels (SS1, SS2) are also provided. There may be a plurality of sequential flow markers, each indicating a sequential flow. In FIG. 4, sequential flow flag SS1 indicates that IO commands accessing LBA3 belong to a sequential flow, while sequential flow flag SS2 indicates that IO commands accessing LBA5 belong to another sequential flow.
Fig. 5 illustrates buffer changes during sequential flow detection according to an embodiment of the present application.
Buffer B shows the contents of the buffer after receiving IO commands with logical block addresses 2 and 21. In response to receiving an IO command with
Buffer C shows the contents of the buffer after receiving IO commands with
Buffer D shows the contents of the buffer after receiving IO commands with
The IO command with
In the example of FIG. 5, the IO commands in
In another example, sequential stream detection is performed on read commands and write commands, respectively, in the input stream. Write commands that make up the sequential stream are written to adjacent storage locations, while for read commands that make up the sequential stream, pre-read commands are generated to read data from locations adjacent to the address accessed by the current read command. The data read by the pre-read command may be stored in a cache of the storage medium (e.g., a buffer register of the NAND flash memory), a cache of the storage device, or a memory of the host.
FIG. 6 illustrates buffer changes in a sequential flow detection process according to yet another embodiment of the present application. The input stream 650 is a plurality of IO commands following the
Buffer E shows the contents of the buffer after receiving two IO commands with logical block addresses 5 and 47. An IO command to access
Buffer F shows the contents of the buffer after receiving IO commands with logical block addresses 6-10 and 53-54. In response to receiving an IO command with a logical block address of 6-10, which hits in buffer entry 512 (the first address "6" of logical block address 6-10 follows the address "5" of buffer entry 512), fill
In another example, only one sequential stream is marked at a time. Thus, even if the count value of
Buffer G shows the contents of the buffer after receiving IO commands with logical block addresses 19 and 67. In response to receiving an IO command with a logical block address of 19, the IO command misses any buffer entries. One of the buffer entries is selected for accommodating IO commands with
Buffer H shows the contents of the buffer after receiving IO commands with
And in response to receiving an IO command with
In a further example, the number of buffer entry misses is also counted. For example, after receiving an IO command with a logical block address of 13, if there are 9 misses in the buffer entry accumulation, and the threshold is reached, the count values of all the entries in the buffer are decremented. As shown in buffer H in FIG. 6, the count value of
In a further example, IO commands that are not identified as belonging to a sequential flow are identified as a random flow, such that all IO commands identified as random flows may be handled in the same or different manners.
Fig. 7 is a flow chart of a sequential flow detection method according to an embodiment of the present application. According to an embodiment of the application, sequential stream detection is implemented in a storage device. The storage device receives an IO command from a host or other storage device (710). The IO command includes a logical block address indicating a storage location of data to be accessed. The IO command may be a read command, a write command, or other type of command. The data to be accessed by the IO command may have different lengths, and accordingly, the logical address of the IO command may be a range. The following describes a method of sequential stream detection by taking a write command as an example.
Referring to fig. 4, a plurality of entries, each including a logical block address and a corresponding count value, are cached in a buffer, such as a memory. In response to receiving the IO command, it is checked whether the logical block address of the IO command hits in the buffered entry (720). By way of example, referring to FIG. 5, the contents of the current buffer are shown by buffer B. An IO command with a logical block address of 3 is received. In buffer B, if an IO command with
In a further example, an IO command is received to access a logical block address of 70 (710). An IO command with
In one example, at most one sequential stream exists at any one time. Even if the count value of a plurality of entries satisfies the threshold, only one entry is marked as belonging to the sequential flow, for example, the IO command corresponding to the entry with the largest count value is marked as belonging to the sequential flow. In yet another example, there may be m sequential flows (m >1) at the same time, and IO commands corresponding to m entries whose count values satisfy the threshold are marked as belonging to a sequential flow. The label is provided for sequential flow to distinguish sequential flow, such as sequential flow SS1 from
The relationship between the various addresses may be considered a hit, e.g., the address of the IO command is numerically immediately adjacent to the address in the entry, the address of the IO command may be incremented by the address in the entry, the address of the IO command is the same as the address in the entry or the distance of the address of the IO command from the address in the entry is below a threshold. Further, an address range is indicated in the IO command, and the start address of the address range of the IO command is numerically immediately adjacent to the address in the entry, may be incremented from the address in the entry, or may include the address in the entry. In yet another example, the address range is recorded in the entry, and the address range of the IO command immediately borders the lower bound of the address range in the entry, or the address range of the IO command overlaps the address range in the entry.
In another embodiment according to the present application, the storage device includes a tag in an IO command received from a host. By way of example, the tag indicates the host, virtual machine, application that issued the IO command or otherwise indicates that the IO command belongs to
FIG. 8 is a flow chart of a sequential flow detection method according to yet another embodiment of the present application. The storage device receives an IO command from a host or other storage device (810). Referring back to fig. 6, the contents of the current buffer are shown by buffer E. IO commands with logical block addresses of 6-10 are received. In buffer E, the address recorded in
In yet another example, an IO command with a logical block address of 19 is received (810) (buffer F of FIG. 6). The IO command miss is marked as an
If the uncommanded count value exceeds the threshold (890), the count values of all entries in the buffer are decremented (895) (see buffer H of FIG. 6), for example, and the miss count value is reset. Thus, when the life cycle of the sequential flow is over and the received IO command no longer belongs to any sequential flow, the buffer will frequently miss and decrement the count value of each entry to a value that does not satisfy the condition and cause the
The above describes a sequential stream detection method according to an embodiment of the present application, taking a write command as an example. A similar approach may be used to detect the presence of a sequential stream in a received read command. In response to the read commands appearing in sequence, data at subsequent addresses may be pre-read based on the address of the current read command. The pre-read data may be buffered and responded to with low latency to subsequent read commands.
Further, the type of the received IO command (read command or write command) is distinguished, and sequential stream detection is performed for the IO commands of different types. And providing resources such as a special buffer, a sequence flow identifier, a miss counter and the like for different types of commands respectively.
FIG. 9 is a block diagram of a sequential flow detection system according to an embodiment of the present application. To implement sequential flow detection, the addresses of recently received IO commands are cached in a plurality of entries, and a hit count is also recorded in each entry in association with the address of the IO command. The sequential flow detection system according to the embodiment of the present application includes a
Embodiments of the present application also provide a program comprising program code which, when loaded into a CPU and executed therein, causes the CPU to perform one of the methods provided above in accordance with embodiments of the present application.
Embodiments of the present application also provide a program comprising program code, which, when loaded into a storage device and executed thereon, causes a processor of the storage device to perform one of the methods according to embodiments of the present application as provided above.
It will be understood that each block of the block diagrams and flowchart illustrations, and combinations of blocks in the block diagrams and flowchart illustrations, respectively, can be implemented by various means including computer program instructions. These computer program instructions may be loaded onto a general purpose computer, special purpose computer, or other programmable data control apparatus to produce a machine, such that the instructions which execute on the computer or other programmable data control apparatus create means for implementing the functions specified in the flowchart block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data control apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including computer-readable instructions for implementing the function specified in the flowchart block or blocks. The computer program instructions may also be loaded onto a computer or other programmable data control apparatus to cause a series of operational operations to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide operations for implementing the functions specified in the flowchart block or blocks.
Accordingly, blocks of the block diagrams and flowchart illustrations support combinations of means for performing the specified functions, combinations of operations for performing the specified functions and program instruction means for performing the specified functions. It will also be understood that each block of the block diagrams and flowchart illustrations, and combinations of blocks in the block diagrams and flowchart illustrations, can be implemented by special purpose hardware-based computer systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Although the present invention has been described with reference to examples, which are intended to be illustrative only and not to be limiting of the application, changes, additions and/or deletions may be made to the embodiments without departing from the scope of the application.
Many modifications and other embodiments of the application set forth herein will come to mind to one skilled in the art to which these embodiments pertain having the benefit of the teachings presented in the foregoing descriptions and the associated drawings. Therefore, it is to be understood that the application is not to be limited to the specific embodiments disclosed and that modifications and other embodiments are intended to be included within the scope of the appended claims. Although specific terms are employed herein, they are used in a generic and descriptive sense only and not for purposes of limitation.
Many modifications and other embodiments of the application set forth herein will come to mind to one skilled in the art to which these embodiments pertain having the benefit of the teachings presented in the foregoing descriptions and the associated drawings. Therefore, it is to be understood that the application is not to be limited to the specific embodiments disclosed and that modifications and other embodiments are intended to be included within the scope of the appended claims. Although specific terms are employed herein, they are used in a generic and descriptive sense only and not for purposes of limitation.
- 上一篇:一种医用注射器针头装配设备
- 下一篇:一种串行总线及通信装置