Using cache feedback information to guide data pre-reading

By implementing the sequential flow detection and pre-reading mechanism in the storage device, and using cache statistics and thresholds to judge the pre-reading operation, the problem of high access delay in the prior art is solved, and the quality of service and continuous reading efficiency of data blocks is improved.

CN110580128BActive Publication Date: 2024-11-01MEMBLAZE TECH BEIJING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201810595355.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-06-11
Publication Date
2024-11-01
Estimated Expiration
2038-06-11

AI Technical Summary

Technical Problem

When existing storage devices process multiple read commands to access the continuous address space, it is difficult for existing storage devices to effectively detect sequential streams and perform data pre-reading, resulting in high access delays and poor service quality.

Method used

By implementing the sequential flow detection and pre-reading mechanism in the storage device, the pre-reading operation is determined based on the cache statistics and pre-reading accuracy threshold when responding to the read command, and the sequential flow descriptor and recent IO command address set is maintained, and the pre-pre-reading operation is optimized. Reading strategy.

Benefits of technology

The access delay and service quality of storage devices are improved, and through effective sequential flow detection and read-out mechanisms, the read command response time is reduced, and the write amplification and frequent access of data blocks is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110580128B_ABST
    Figure CN110580128B_ABST
Patent Text Reader

Abstract

A method and storage device for guiding data pre-reading using cache feedback information are provided. The provided data pre-reading method includes: obtaining a pre-reading request; and determining whether to perform a pre-reading operation according to the pre-reading data cache statistics data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a storage system, and more particularly, to detecting a sequential stream formed by a plurality of read commands accessing a continuous address space, and performing data pre-reading according to the detection of the sequential stream. Background Art

[0002] Figure 1 The block diagram of the solid-state storage device is shown. The solid-state storage device 102 is coupled to the host to provide storage capacity for the host. The host and the solid-state storage device 102 can be coupled in a variety of ways, including but not limited to connecting the host and the solid-state storage device 102 through, for example, SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express, PCIe), NVMe (NVM Express), Ethernet, Fiber Channel, wireless communication network, etc. The host can be an information processing device that can communicate with the storage device in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103 , a control component 104 , one or more NVM chips 105 , and a DRAM (Dynamic Random Access Memory) 110 .

[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), etc. are common NVMs.

[0004] The interface 103 may be adapted to exchange data with the host via, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.

[0005] The control component 104 is used to control data transmission between the interface 103, the NVM chip 105 and the DRAM 110, and is also used for storage management, mapping of host logical addresses to flash physical addresses, erase leveling, bad block management, etc. The control component 104 can be implemented in a variety of ways, such as software, hardware, firmware, or a combination thereof. For example, the control component 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 can also include a processor or a controller, in which software is executed to manipulate the hardware of the control component 104 to process IO (Input / Output) commands. The control component 104 can also be coupled to the DRAM 110 and can access the data of the DRAM 110. The data of the FTL table and / or cached IO commands can be stored in the DRAM.

[0006] The control component 104 includes a flash memory interface controller (or medium interface controller, flash memory channel controller), which is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that complies with the interface protocol of the NVM chip 105 to operate the NVM chip 105, and receives command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI" and the like.

[0007] In a solid-state storage device, the FTL (Flash Translation Layer) is used to maintain the mapping information from the logical address to the physical address. The logical address constitutes the storage space of the solid-state storage device perceived by the upper-layer software such as the operating system. The physical address is the address used to access the physical storage unit of the solid-state storage device. In the related art, the address mapping can also be implemented using the intermediate address form. For example, the logical address is mapped to the intermediate address, and then the intermediate address is further mapped to the physical address.

[0008] The table structure that stores the mapping information from logical addresses to physical addresses is called an FTL table. The FTL table is an important metadata in a solid-state storage device. Usually, the data items of the FTL table record the address mapping relationship in units of data pages in the solid-state storage device.

[0009] Storage devices are used to process IO commands. IO commands can be sent to storage devices (e.g., disks, solid-state drives, USB flash drives, optical disks, etc.), storage servers, or storage systems (such as cloud storage). If the addresses accessed by multiple IO commands are continuous or approximately continuous, these IO commands are said to belong to the same sequential flow.

[0010] Each IO command carries or indicates the address (logical address or physical address) of the data to be accessed. The length of the data to be accessed by each IO command can be fixed or variable. When the host accesses the storage device, the data access party such as the application program may split the large block data access into multiple IO commands and send them to the storage device. There may also be multiple applications and / or multiple operating systems (such as virtual machines) accessing the storage device in the host, which causes the IO commands of multiple access parties to be interleaved, thereby making the original access to the continuous address discontinuous.

[0011] Figure 2A A schematic diagram showing IO commands from multiple applications being provided to a storage device.

[0012] There are multiple applications in the host. Application A generates multiple IO commands (for example, IO commands A1 and A2) that access consecutive addresses. These IO commands belong to sequential stream A. For example, these IO commands of application A are from copying a large-size video file. Application B generates multiple IO commands (for example, IO commands B1 and B2) that access consecutive addresses. These IO commands belong to sequential stream B. The applications in the host also generate multiple IO commands that access other address spaces (for example, Figure 2A In the operating system, driver, device interface and / or bus, multiple IO commands are organized into a different order than the original order and received by the storage device. For example, see Figure 2A , the storage device receives IO commands in the order of A1, B1, C and B2.

[0013] Figure 2B A schematic diagram showing data placement on a storage device for data from multiple applications.

[0014] The storage device receives the IO commands in the order of A1, B1, C and B2, and writes the data accessed by the IO commands (taking write commands as an example) into the storage medium in the order in which the IO commands are received. Figure 2B In the example, IO commands A1, B1, C, and B2 are assigned to consecutive physical addresses, resulting in the data corresponding to multiple IO commands (such as IO commands A1 and A2, or IO commands B1 and B2) that originally accessed consecutive logical addresses being scattered rather than continuously stored in the storage medium.

[0015] The storage device also provides a pre-reading mechanism. For example, in response to the host accessing address A1, the storage device predicts that the host will likely continue to access address A2 that is continuous or adjacent to address A1, so that the storage device reads data from address A2 before receiving the host's read command, and caches the data read from address A2 to respond to the host's subsequent read command. Summary of the invention

[0016] Improved sequential flow detection and read-ahead capabilities are needed in storage devices to provide lower access latency and better quality of service.

[0017] According to the first aspect of the present application, a first data pre-reading method according to the first aspect of the present application is provided, including: in response to an address accessed by a first read command hitting a first sequential stream descriptor among multiple sequential stream descriptors, generating a pre-reading request for a first sequential stream corresponding to the first sequential stream descriptor; and determining whether to perform a pre-reading operation according to the pre-reading request based on cache statistics of the pre-read data.

[0018] According to the first data pre-reading method of the first aspect of the present application, a second data pre-reading method according to the first aspect of the present application is provided, wherein: if the accuracy of the cache statistics of the pre-read data is greater than a first threshold, a pre-reading operation is performed according to the pre-reading request.

[0019] According to the first or second data pre-reading method of the first aspect of the present application, a third data pre-reading method according to the first aspect of the present application is provided, wherein: if the accuracy of the cache statistics of the pre-read data is not greater than a second threshold, the pre-reading operation according to the pre-reading request is refused.

[0020] According to one of the first to third data pre-reading methods of the first aspect of the present application, a fourth data pre-reading method according to the first aspect of the present application is provided, which also includes: in response to the first read command not hitting any one of the multiple sequential stream descriptors, updating the recent IO command address set according to the address accessed by the first read command.

[0021] According to the fourth data pre-reading method of the first aspect of the present application, a fifth data pre-reading method according to the first aspect of the present application is provided, wherein a first element is generated according to the address accessed by the first read command, and the first element is added to the recent IO command address set, wherein the first element records the address accessed by the first read command and the number of initialized hits.

[0022] According to the fourth or fifth data pre-reading method of the first aspect of the present application, a sixth data pre-reading method according to the first aspect of the present application is provided, wherein if the address accessed by the first read command hits the second element of the recent IO command address set, the number of hits of the second element is incremented.

[0023] According to one of the fourth to sixth data pre-reading methods of the first aspect of the present application, a seventh data pre-reading method according to the first aspect of the present application is provided, which also includes: updating the second sequential stream descriptor among multiple sequential stream descriptors using the address and the number of hits recorded by the elements of the recent IO command address set.

[0024] According to the seventh data pre-reading method of the first aspect of the present application, an eighth data pre-reading method according to the first aspect of the present application is provided, wherein: the second sequential stream descriptor is the sequential stream descriptor with the smallest number of hits among multiple sequential stream descriptors.

[0025] According to the second or third data pre-reading method of the first aspect of the present application, a ninth data pre-reading method according to the first aspect of the present application is provided, wherein the accuracy is indicated by A / B, wherein B represents the pre-read data, and A represents the amount of data in the pre-read data (B) hit by the read command.

[0026] According to one of the first to ninth data pre-reading methods of the first aspect of the present application, a tenth data pre-reading method according to the first aspect of the present application is provided, further comprising: calculating virtual statistical data based on the generated pre-reading request and read command.

[0027] According to the tenth data pre-reading method of the first aspect of the present application, an eleventh data pre-reading method according to the first aspect of the present application is provided, which also includes: in a case where it is determined to refuse to perform a pre-reading operation according to the pre-reading request based on cache statistics of the pre-read data, determining whether to perform a pre-reading operation based on virtual statistical data.

[0028] According to the tenth data pre-reading method of the first aspect of the present application, a twelfth data pre-reading method according to the first aspect of the present application is provided, further comprising: determining whether to perform a pre-reading operation according to virtual statistical data.

[0029] According to one of the tenth to twelfth data pre-reading methods of the first aspect of the present application, a thirteenth data pre-reading method according to the first aspect of the present application is provided, wherein: the virtual statistical data includes the accuracy of the virtual pre-reading, and the accuracy of the virtual pre-reading is indicated by A' / B', wherein B' represents the data theoretically pre-read according to the pre-reading request, and A' represents the amount of data hit by the read command in the theoretically pre-read data B'.

[0030] According to one of the first to thirteenth data pre-reading methods of the first aspect of the present application, a fourteenth data pre-reading method according to the first aspect of the present application is provided, which also includes: determining whether to perform a pre-reading operation based on the amount of cached pre-read data; if the amount of cached pre-read data is less than a threshold, performing a pre-reading operation.

[0031] According to one of the first to fourteenth data pre-reading methods of the first aspect of the present application, a fifteenth data pre-reading method according to the first aspect of the present application is provided, wherein: according to first cache statistical data of the pre-read data of the first sequential stream, it is determined whether to perform a pre-reading operation according to the pre-reading request.

[0032] According to the fifteenth data pre-reading method of the first aspect of the present application, a sixteenth data pre-reading method according to the first aspect of the present application is provided, wherein if the first cache statistical data of the pre-read data of the first sequential stream is greater than a threshold, it is determined to perform a pre-reading operation according to the pre-reading request.

[0033] According to the fifteenth or sixteenth data pre-reading method of the first aspect of the present application, a seventeenth data pre-reading method according to the first aspect of the present application is provided, wherein if the first cache statistical data of the pre-read data of the first sequential stream is not greater than a threshold, it is determined to refuse to perform the pre-reading operation according to the pre-reading request.

[0034] According to the second aspect of the present application, a first storage device according to the second aspect of the present application is provided, comprising a control component and a non-volatile memory, wherein the control component executes one of the first to seventeenth data pre-reading methods according to the first aspect of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0036] Figure 1 A schematic diagram of a solid-state storage device in the prior art provided by this application;

[0037] Figure 2A A schematic diagram showing IO commands from multiple applications being provided to a storage device;

[0038] Figure 2B A schematic diagram showing data placement on a storage device for data from multiple applications;

[0039] Figure 3 It is a schematic diagram of implementing sequential flow detection on write commands;

[0040] Figure 4 A block diagram of a storage device according to an embodiment of the present application is shown;

[0041] Figure 5 A sequential flow descriptor and a candidate sequential flow descriptor according to an embodiment of the present application are shown;

[0042] Figure 6 A flowchart of detecting a sequential flow according to an embodiment of the present application is shown;

[0043] Figure 7 A flowchart for implementing pre-reading according to an embodiment of the present application is shown;

[0044] Figure 8 A schematic diagram of implementing pre-reading according to an embodiment of the present application is shown;

[0045] Fig. 9 A schematic diagram showing implementation of pre-reading according to another embodiment of the present application is shown; and

[0046] Fig.10 A schematic diagram of implementing pre-reading according to yet another embodiment of the present application is shown. DETAILED DESCRIPTION

[0047] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0048] Figure 3It is a schematic diagram of implementing sequential stream detection on write commands according to an embodiment of the present application. As an example, sequential stream detection is implemented on the received write commands in the storage device. From multiple write commands accessing the storage device, sequential stream A, sequential stream B formed by write commands accessing continuous addresses and multiple write commands (indicated by C, D, E, ... S) whose accessed addresses are not sequential are detected (also called random streams). In addition, a continuous physical address on the storage medium (for example, data block 1) is allocated to sequential stream A, and a continuous physical address on the storage medium (for example, data block 2) is allocated to sequential stream B, and the random stream is written to data block 3. When the data life cycle corresponding to sequential stream A is completed and updated or invalidated (for example, when sequential stream A corresponds to a large-size video file, the video file is deleted), the data in data block 1 becomes invalid, and when data block 1 is recovered, there is no need to move the valid data in the data block (because there is no valid data in data block 1, or there is less valid data), thereby reducing write amplification. In addition, the data in the sequential stream may also be read continuously. For example, when sequential stream A corresponds to a large-size video file, the data corresponding to A1, A2, A3 and A4 in data block 1 are likely to be read continuously. Therefore, for data block 1 storing a sequential stream, when responding to a read command, the subsequent data can be pre-read before receiving a subsequent read command, thereby reducing the response time to the subsequent read command, or when responding to a read command, a larger size of data is read from data block 1 at a time to reduce the number of accesses to data block 1. In the Chinese patent application with application number 201610169011.1 and invention name of sequential stream detection method and device, and the Chinese patent application with application number 2018103554271 and invention name of sequential stream detection and data pre-reading, various embodiments for implementing sequential stream detection are provided. The entire texts thereof are incorporated into this application by reference.

[0049] Figure 4 A block diagram of a storage device according to an embodiment of the present application is shown. The storage device according to an embodiment of the present application performs sequential flow detection on a read command and performs pre-reading according to the detection result.

[0050] See also Figure 4 The control component 204 of the storage device includes a host interface 210 , a medium interface 220 for accessing the NVM chip 105 , a cache management unit 260 , a backend processing unit 270 , a sequential flow detection unit 250 and a pre-reading unit 255 .

[0051] The host interface 210 is used to exchange commands and data with the host. For example, the host and the storage device communicate via the NVMe / PCIe protocol, the host interface 210 processes the PCIe protocol data packet, extracts the NVMe protocol command, and returns the processing result of the NVMe protocol command to the host.

[0052] The cache management unit 260 is coupled to the host interface 210, and is used to receive IO commands sent by the host to the storage device, and try to use one or more cache units to serve the received IO commands to improve the certainty of the performance of the IO commands being processed by the storage device.

[0053] The cache management unit 260 also writes the data in the cache unit into the NVM chip (105) through the backend processing unit 270, and / or reads data from the NVM chip (105) to fill the cache unit.

[0054] Optionally, the cache unit 260 forwards part of the received IO commands (eg, read commands that do not hit the cache unit) to the backend processing unit 270 for processing, without using the cache unit to service these IO commands.

[0055] The backend processing unit 270 receives IO commands (the form of IO commands changes due to processing by the cache management unit 260, and is collectively referred to as IO commands for simplicity) and accesses one or more NVM chips.

[0056] Optionally, the backend processing unit 270 processes the IO command using existing technology, or processes the IO command using technology to be developed in the future.

[0057] Optionally, the cache management unit 260 maintains a cache descriptor table (or a cache descriptor pool). The cache descriptor table 260 records a plurality of cache descriptors. One or more of the cache descriptors records the address of the corresponding cache unit in the DRAM 110, the state of the cache unit, and / or the location of valid data in the cache unit. For example, in the Chinese patent application with application number 201810264435.5, the invention name is "Storage device with cache having enhanced IO performance determinism", and the application date is March 28, 2018, it is described to use the cache management unit 260 to provide a cache. Caches for storage devices are also provided in application numbers 201610819411.2, 201610819400.4, 201710219096.4 and 201710219077.1.

[0058] The control component is also coupled to external memory (eg, DRAM) 110 .

[0059] Continue to view Figure 4 , part of the space of the external memory 110 (cache unit 0, cache unit 1, ..., cache unit 7) is used as a cache. The cache unit has a specified size. For example, the specified size of the cache unit is 512 bytes, 1KB, 2KB, 4KB, etc.

[0060] The cache management unit 260 manages the allocation and use of the cache unit. Exemplarily, for a write command, under the instruction of the cache management unit 260, the data to be written is transmitted from the host to the cache unit in the external memory 110 through the host interface 210, and the data in the cache unit is also transmitted to the NVM chip 105 through the media interface 220. For example, the cache management unit 260 transmits the data in the cache unit to the NVM chip 105 through the media interface 220 via the backend processing unit 270.

[0061] For a read command, the cache management unit 260 identifies whether the cache unit hits. If the cache unit hits, data is obtained from the cache unit and sent to the host under the instruction of the cache management unit 260. If the cache unit does not hit, data is obtained from the NVM chip 105 and sent to the host.

[0062] The backend processing unit 270 includes an FTL module for converting the logical address of the IO command into a physical address. The backend processing unit 270 also manages the NVM chip and the data thereon, and provides services such as wear leveling and garbage collection.

[0063] Optionally, the storage device exposes a physical address space to the host, such as a physical address space that complies with the (Open Channel SSD, OpenChannel SSD, OCSSD) protocol. Thus, the physical address to be accessed is indicated in the IO command. Thus, the backend processing unit 270 does not need to use the FTL module to convert from the logical address to the physical address.

[0064] Continue to view Figure 4 The host interface 210 is also coupled to a sequence flow detection unit 250. The sequence flow detection unit 250 also receives an IO command sent by the host to the storage device, or optionally receives a logical address / physical address accessed by the IO command (hereinafter referred to as the address accessed by the IO command). The sequence flow detection unit identifies one or more sequence flows according to the address of the received IO command, and indicates the identified sequence flows to the pre-reading unit 255.

[0065] The pre-reading unit 255 pre-reads the identified sequential stream, pre-reads the data to be read by the subsequent read command on the sequential stream in advance, and stores the read data in the cache unit. Optionally, the data read by the pre-reading unit 255 is also managed by the cache management unit 260. The cache management unit 260 allocates a cache unit for the pre-read data, and records the pre-read logical address / physical address and the index of the cache unit storing the pre-read data in the cache descriptor table.

[0066] Optionally, the cache of the pre-read data is managed by another cache management unit different from the cache management unit 260 or the sequential flow detection unit 250 .

[0067] In response to receiving a read command from the host interface, the cache management unit 260, other cache management units or the sequential flow detection unit 250 also checks whether the data to be read by the read command hits the pre-read data in the cache unit. As an example, the cache management unit 260 generates statistical data of the data pre-read by the pre-read unit 255, and provides the statistical data to the pre-read unit 255. For example, the cache management unit 260 counts the accuracy of the pre-reading, where the accuracy is indicated by A / B, where B represents the pre-read data, and A represents the amount of data in the pre-read data (B) hit by the actual read command. Optionally, the statistical data provided by the cache management unit 260 includes the hit rate of the cache unit, the number of cache units occupied by the pre-read data, and / or the proportion of the cache units occupied by the pre-read data, etc. The pre-read unit 255 adjusts its own pre-reading strategy according to the statistical data received from the cache management unit 260.

[0068] Figure 5 The schematic diagram of implementing sequential flow detection according to an embodiment of the present application is shown. The sequential flow detection unit 250 maintains a sequential flow descriptor and a recent IO command address set. The sequential flow descriptor indicates the sequential flow identified by the sequential flow detection unit 250.

[0069] By way of example, there are one or more sequential stream descriptors. Figure 5 2 sequence flow descriptors (510 and 512) are shown in FIG. It can be understood that the sequence flow detection unit 250 can maintain other numbers of sequence flow descriptors.

[0070] The sequential stream descriptor is used to describe the identified sequential stream. As an example, the sequential stream descriptor describes the sequential stream by address (the address accessed by the read command, and / or the pre-read address of the current pre-read access to the sequential stream) and the number of hits. Furthermore, the sequential stream descriptor further describes the sequential stream by the pre-read data size. Still optionally, the sequential stream descriptor also records the size of the data read by the IO command.

[0071] The hit count recorded by the sequence stream descriptor is the number of read commands that hit the sequence stream described by the sequence stream descriptor during its life cycle. The situation where the read command hits the sequence stream includes, for example, that the address accessed by the read command is the same as, overlaps with, and / or is adjacent to the address recorded in the sequence stream descriptor (the difference between the two addresses is less than a specified threshold).

[0072] The pre-read address recorded by the sequential stream descriptor is the address (logical address or physical address) of the data read according to the current pre-read operation performed by the sequential stream descriptor. The pre-read data size recorded by the sequential stream descriptor is the size of the data read according to the current pre-read operation performed by the sequential stream descriptor.

[0073] The address set of recent IO commands contains the addresses of the recently received read commands and the number of hits thereof in each element of the set, limited by the storage space of the set. Optionally, the address set of recent IO commands is sorted, in the order in which the addresses of the IO commands are received. Thus, when the address set of recent IO commands is full, the set element indicating the earliest received IO command is deleted from the set to obtain storage space to accommodate new elements.

[0074] As an example, each element of the address set of recent IO commands records the address of the IO command (read command) and, optionally, the number of times the address is hit (also referred to as the number of times the element is hit). The address set of recent IO commands accommodates a specified number of elements. For a received IO command, if the address set of recent IO commands has free space, an element is generated based on the address accessed by the IO command and added to the address set of recent IO commands. If the address set of recent IO commands has no free space, the elements of the address set of recent IO commands are sorted, and the element that was first added to the address set of recent IO commands is deleted to obtain free space. Optionally or further, when deleting an element from the address set of recent IO commands, the number of times the element is hit is also considered. For example, when deleting an element from the address set of recent IO commands, the element with a small number of hits is deleted.

[0075] In order to add the generated element to the address set of recent IO commands, traverse each element of the address set of recent IO commands to find out whether there is an element in the address set of recent IO commands that is hit by the address accessed by the IO command. If there is an element in the address set of recent IO commands that is hit by the address accessed by the IO command, the number of times the element is hit is incremented. If there is no element in the address set of recent IO commands that is hit by the address accessed by the IO command, an element is generated according to the address accessed by the IO command and added to the address set of recent IO commands. The situation in which the read command hits an element of the address set of recent IO commands includes, for example, that the address accessed by the read command is the same as, overlaps with, and / or is adjacent to the address recorded in the element of the address set of recent IO commands (the difference between the two addresses is less than a specified threshold).

[0076] When a specified condition is met or a specified situation occurs, the elements in the address set of recent IO commands are upgraded to a sequential flow (and a sequential flow descriptor is obtained). The specified conditions include, for example, that the number of hits of the elements in the address set of recent IO commands is greater than a specified threshold, that the number of hits of the elements in the address set of recent IO commands is greater than the number of hits of the sequential flow descriptor, etc.

[0077] Figure 6 A flowchart for detecting a sequential flow according to an embodiment of the present application is shown.

[0078] Sequential flow detection unit 250 (see also Figure 4 ) obtains a read command (optionally, an address accessed by the read command) (610) from the host interface 210, and determines whether the address accessed by the read command hits the sequential stream (620). Whether the address accessed by the read command hits the sequential stream is determined by comparing the address accessed by the read command with the address recorded in the sequential stream descriptor. For example, the address accessed by the read command is A1, and the address recorded in the sequential stream descriptor 510 is A2. If A1 and A2 are the same, overlapped, and / or adjacent (the absolute value of the difference between A1 and A2 is less than a threshold), it is determined that the address accessed by the read command hits the sequential stream 510. Optionally, the address accessed by the read command is compared with the address recorded in each (510 and 512) of the sequential stream descriptors maintained by the sequential stream detection unit 250 to identify whether the address accessed by the read command hits any of the sequential streams represented by the sequential stream descriptors.

[0079] For the sequential stream descriptor (e.g., sequential stream descriptor 510) hit by the address accessed by the read command, the hit sequential stream descriptor is updated (630), for example, the address recorded in the sequential stream descriptor 510 is replaced with the address accessed by the read command (A1), and the number of hits recorded in the sequential stream descriptor is incremented.

[0080] If the address (A1) accessed by the read command does not hit any of the sequential flow descriptors maintained, determine whether the address accessed by the read command hits the address set of recent IO commands (640). Determine whether the address accessed by the read command hits the address set of recent IO commands by comparing the address accessed by the read command with the address recorded by the element of the address set of recent IO commands. If the address accessed by the read command hits the element of the address set of recent IO commands, update the hit element of the address set of recent IO commands, for example, replace the address recorded in the element with the address accessed by the read command (A1), and increment the hit count recorded by the element. If the address accessed by the read command does not hit any element of the address set of recent IO commands, generate a new element that records the address accessed by the read command and add it to the address set of recent IO commands.

[0081] Further, for the updated address set of recent IO commands, it is also identified whether the elements of the address set of recent IO commands meet the conditions for upgrading to sequential flow descriptors (650). For example, if the number of hits recorded by one of the elements of the address set of recent IO commands exceeds a threshold value (e.g., 5, 10, or 100), if the number of hits recorded by one of the elements of the address set of recent IO commands is greater than the number of hits recorded by all other elements of the address set of recent IO commands, or if the number of hits recorded by one of the elements of the address set of recent IO commands is greater than the number of hits recorded by one or more sequential flow descriptors, the element of the address set of recent IO commands is upgraded. One of the sequential flow descriptors is updated according to the element to be upgraded (650). For example, select the sequential flow descriptor with the lowest hit count recorded in all sequential flow descriptors, or select the sequential flow descriptor with the longest time from the last update, or select the sequential flow descriptor that has not been used, and replace the address and hit count of the selected sequential flow descriptor with the address and hit count recorded by the element to be upgraded, so as to upgrade the element to a sequential flow descriptor.

[0082] Optionally or further, in order to upgrade the element of the address set of recent IO commands, the selected sequential stream descriptor (e.g., sequential stream descriptor 510) is also downgraded. The element of the address set of recent IO commands being upgraded is updated with the address and hit count of the downgraded sequential stream descriptor (510). By downgrading the sequential stream descriptor to the element of the address set of recent IO commands, the element of the address set of recent IO commands is provided with an opportunity to be upgraded to a sequential stream descriptor again.

[0083] It should be noted that in the Figure 6 In the description of the embodiment, the sequential stream and the sequential stream descriptor are not carefully distinguished. This is for the purpose of simplicity and clarity of explanation, and those skilled in the art will be able to understand its meaning. The sequential stream descriptor can be, for example, data for describing the sequential stream contained in a storage space in a memory, and this storage space can be modified so that the sequential stream descriptor is updated. The sequential stream descriptor indicates the sequential stream through the data recorded therein (for example, the address and the number of hits). Therefore, the address of the read command hits the sequential stream descriptor, which is also understood to hit the sequential stream indicated by the sequential stream descriptor.

[0084] Figure 7 A flowchart for implementing pre-reading according to an embodiment of the present application is shown.

[0085] According to an embodiment of the present application, when the sequence flow detection unit 250 maintains a valid sequence flow descriptor, the pre-reading unit 255 performs a pre-reading operation. The existence of a valid sequence flow descriptor means that there is currently an identified and valid sequence flow. The sequence flow descriptor is dynamic, and accordingly, the sequence flow is also dynamic. At any time, there may be 0, 1 or more sequence flows. The pre-reading unit 255 performs pre-reading on the existing sequence flows.

[0086] As an example, in response to a read command obtained from the host interface hitting a sequential stream or in response to identifying a new sequential stream (an element of an address set of a recent IO command is upgraded to a sequential stream), the pre-read unit 255 generates a pre-read request (710). The sequential stream detection unit 250 provides a pre-read indication to the pre-read unit 255 according to whether the read command obtained from the host interface hits a sequential stream or identifies a new sequential stream. Optionally, the sequential stream detection unit 250 also obtains a pre-read start address and a pre-read data size from the hit sequential stream descriptor or the newly upgraded sequential stream descriptor, and provides them to the pre-read unit 255. The pre-read start address and the pre-read size recorded in the sequential stream descriptor are the start address and the pre-read size of the last pre-read operation performed on the sequential stream indicated by the sequential stream descriptor.

[0087] The pre-reading unit 255 obtains statistical data from the cache management unit 260, and determines whether to perform a pre-reading operation according to the generated pre-reading request based on the obtained statistical data (720). As an example, the statistical data provided by the cache management unit 260 indicates the accuracy of the pre-reading. When the obtained accuracy is greater than a specified threshold, the pre-reading unit 255 performs a pre-reading operation according to the pre-reading request (730). Optionally, when the obtained pre-reading accuracy is not greater than the specified threshold, the pre-reading unit 255 refuses to perform a pre-reading operation according to the pre-reading request (740). The pre-reading accuracy provided by the cache management unit 260 indicates whether the pre-reading operation previously performed is effective and whether the pre-read data is fully utilized. Low pre-reading accuracy indicates that performing a pre-reading operation may be a waste of resources of the storage device, while high pre-reading accuracy indicates that performing a pre-reading operation is beneficial.

[0088] Optionally, the statistical data provided by the cache management unit 260 indicates the hit rate of the cache unit, the number of cache units occupied by the pre-read data, and / or the proportion of the cache units occupied by the pre-read data, etc. The pre-read unit 255 performs a pre-read operation according to the pre-read request when the hit rate of the cache unit is higher than a specified threshold, and refuses to perform the pre-read operation according to the pre-read request when the hit rate of the cache unit is not high. Similarly, the pre-read unit 255 performs a pre-read operation according to the pre-read request when the number / proportion of cache units occupied by the pre-read data is higher than a specified threshold, and refuses to perform the pre-read operation according to the pre-read request when the number / proportion of cache units occupied by the pre-read data is not high. Further, the pre-read unit 260 comprehensively considers a variety of statistical data to determine whether to perform a pre-read operation.

[0089] Optionally or further, after the pre-reading unit 255 refuses to perform the pre-reading operation (740) according to the pre-reading request, it continues to obtain statistical data from the cache management unit 260. Because the pre-reading unit 255 refuses to perform the pre-reading operation (740), as time passes, the statistical data such as the accuracy of the pre-reading provided by the cache management unit 260 gradually increases (because subsequent read commands may hit the pre-read data). In response to the new statistical data being greater than a specified threshold (which may be the same or different threshold as the threshold used in step 720), the pre-reading unit 255 performs the pre-reading operation again according to the pre-reading request. And in response to the new statistical data being not greater than the specified threshold (which may be the same or different threshold as the threshold used in step 720), the pre-reading unit 255 still refuses to perform the pre-reading operation according to the pre-reading request.

[0090] Return to view Figure 7 The pre-reading unit 255 also maintains virtual statistics. The virtual statistics include, for example, the accuracy of the virtual pre-reading. The accuracy of the virtual pre-reading is indicated by, for example, A' / B', where B' represents the data theoretically pre-read according to the pre-reading request, and A' represents the amount of data hit by the real read command in the theoretical pre-reading data (B'). It can be understood that since the pre-reading request may be rejected (740), B' is less than the pre-reading data B.

[0091] Optionally, the virtual statistical data is provided by the cache management unit 260. In order to calculate the virtual statistical data, the pre-read unit 255 also provides the rejected pre-read requests to the cache management unit 260. The cache management unit 260 maintains the virtual pre-read data according to the rejected pre-read requests to know which virtual pre-read data is hit by the read command.

[0092] Continue to view Figure 7After the pre-reading unit 255 refuses to perform the pre-reading operation according to the pre-reading request (740), it continues to obtain virtual statistical data. It is determined whether to perform the pre-reading operation according to the generated pre-reading request according to the virtual statistical data (750). As an example, the virtual statistical data indicates the accuracy of the pre-reading. When the obtained virtual accuracy is greater than a specified threshold, the pre-reading unit 255 performs the pre-reading operation according to the pre-reading request (760). Optionally, when the obtained virtual pre-reading accuracy is not greater than the specified threshold, the pre-reading unit 255 refuses to perform the pre-reading operation according to the pre-reading request (770).

[0093] By using virtual statistical data to indicate whether to perform pre-reading, the problem of how to resume the pre-reading operation in time after the pre-reading operation is rejected in step 740 is solved.

[0094] Figure 8 A schematic diagram of implementing pre-reading according to an embodiment of the present application is shown.

[0095] The pre-read unit 255 obtains the sequential flow information provided by the sequential flow detection unit 250 and the statistical data provided by the cache management unit 260, determines whether to perform a pre-read operation and what kind of pre-read operation to perform, and generates a pre-read command to provide to the back-end processing unit 270 to read data according to the pre-read command.

[0096] The pre-reading unit 255 generates a pre-reading request (810) according to the sequential flow information provided by the sequential flow detection unit 250. For the generated pre-reading request, only when the statistical data of the pre-reading currently provided by the cache management unit 260 meets the specified condition, the pre-reading operation corresponding to the pre-reading request is performed according to the generated pre-reading request (830). For example, if the pre-reading request indicates that the data at the address A is to be pre-read, and the pre-reading accuracy data provided by the cache management unit 260 indicates that the current pre-reading accuracy is too low, the pre-reading unit 260 abandons the current pre-reading request (810) and does not perform the corresponding pre-reading operation.

[0097] Optionally, in response to receiving a pre-read request, the pre-read unit 255 obtains designated statistical data from the cache management unit 260. To obtain pre-read statistical data, the cache management unit 260 distinguishes whether the data filled in the cache unit comes from a read command or a pre-read command.

[0098] The pre-read unit 255 generates a pre-read command to perform a pre-read operation, and provides the pre-read command to the back-end processing unit 270 to read data according to the pre-read command.

[0099] Fig. 9 A schematic diagram of implementing pre-reading according to another embodiment of the present application is shown.

[0100] The pre-read unit 255 obtains the sequential flow information provided by the sequential flow detection unit 250 and the statistical data provided by the cache management unit 260, determines whether to perform a pre-read operation and what kind of pre-read operation to perform, and generates a pre-read command to provide to the back-end processing unit 270 to read data according to the pre-read command.

[0101] The pre-reading unit 255 generates a pre-reading request (910) based on the sequence stream information provided by the sequence stream detection unit 250. The sequence stream detection unit 250 can maintain multiple sequence streams at the same time. As an example, the sequence stream detection unit 250 maintains three sequence streams (sequence stream 1, sequence stream 2, and sequence stream 3). The pre-reading request directly or indirectly indicates which sequence stream is to be pre-read. For example, the pre-reading request indicates the address of the sequence stream, and the pre-reading unit 255 identifies which sequence stream is to be pre-read according to the address. The pre-reading unit 255 also maintains the pre-reading start address and the pre-reading data size for each sequence stream.

[0102] For the generated pre-reading request, the pre-reading operation corresponding to the pre-reading request is performed according to the generated pre-reading request only when the pre-reading statistics currently provided by the cache management unit 260 meet the specified conditions (930). For example, the pre-reading request indicates that the sequence stream 1 is to be pre-read, and the pre-reading unit 255 obtains the accuracy of the pre-reading that has been done for the sequence stream 1 from the cache management unit 260. When the accuracy of the pre-reading that has been done for the sequence stream 1 meets the specified conditions (for example, higher than the specified threshold) (920), the pre-reading operation for the sequence stream 1 is performed (930), and a pre-reading command is generated according to the pre-reading request and provided to the back-end processing unit (270). If the accuracy of the pre-reading that has been done for the sequence stream 1 does not meet the specified conditions (for example, lower than the specified threshold) (920), the pre-reading operation for the sequence stream 1 is refused (940).

[0103] In an optional embodiment, after the storage device is started, since there is no pre-read data, the pre-read accuracy provided by the cache management unit 260 is 0. The pre-read unit 255 also maintains virtual statistical data (950) about pre-reading. For example, in response to obtaining a pre-read request indicating that a pre-read operation is to be performed on the sequential stream 2, it is assumed that the pre-read operation on the sequential stream 2 is performed, the pre-read data of the sequential stream 2 is obtained, and the subsequent read command hits on the pre-read data of the assumed sequential stream 2 are recorded to obtain the virtual pre-read accuracy. As an example, the virtual pre-read accuracy is the amount of data of the pre-read data of the assumed sequential stream 2 hit by the read command divided by the amount of data of the pre-read data of the assumed sequential stream 2. Therefore, the virtual pre-read accuracy is not affected by operation 920. After a period of time, the virtual pre-reading accuracy may meet the specified conditions (960) (at this time, because the actual pre-reading operation is not performed, the pre-reading accuracy provided by the cache management unit 260 may not meet the specified conditions (920)), so that the pre-reading unit 255 performs a pre-reading operation (935) according to the pre-reading request, generates a pre-reading command, and provides it to the back-end processing unit 270.

[0104] As another example, after operation 920 refuses to perform a pre-read operation (940) for, for example, sequential stream 3 because the accuracy of the pre-reading does not satisfy a specified condition, if the virtual statistical data (950) about the pre-reading of sequential stream 3 maintained by the pre-reading unit 255 satisfies the specified condition (960), a pre-read operation is also performed on sequential stream 3 according to the pre-reading request (935), a pre-reading command is generated, and provided to the back-end processing unit 270.

[0105] And optionally, avoid generating the same read-ahead command in operation 930 and operation 935 .

[0106] Fig.10 A schematic diagram of implementing pre-reading according to yet another embodiment of the present application is shown.

[0107] The pre-read unit 255 obtains the sequential flow information provided by the sequential flow detection unit 250 and the statistical data provided by the cache management unit 260, determines whether to perform a pre-read operation and what kind of pre-read operation to perform, and generates a pre-read command to provide to the back-end processing unit 270 to read data according to the pre-read command.

[0108] The pre-reading unit 255 generates a pre-reading request (1010) according to the sequence flow information provided by the sequence flow detection unit 250. As an example, the sequence flow detection unit 250 maintains three sequence flows (sequence flow 1, sequence flow 2 and sequence flow 3).

[0109] For the generated pre-reading request, the pre-reading operation corresponding to the pre-reading request is performed according to the generated pre-reading request only when the pre-reading statistics currently provided by the cache management unit 260 meet the specified conditions. For example, the pre-reading request indicates that the sequence stream 1 is to be pre-read, and the pre-reading unit 255 obtains the accuracy of the pre-reading that has been done for the sequence stream 1 from the cache management unit 260. When the accuracy of the pre-reading that has been done for the sequence stream 1 meets the specified conditions (for example, higher than the specified threshold) (1020), the pre-reading operation for the sequence stream 1 is performed (1030), and a pre-reading command is generated according to the pre-reading request and provided to the back-end processing unit (270). If the accuracy of the pre-reading that has been done for the sequence stream 1 does not meet the specified conditions (for example, lower than the specified threshold) (1020), the pre-reading operation for the sequence stream 1 is refused (1040).

[0110] according to Fig.10 In the embodiment shown, whether to perform pre-reading is also determined based on the amount of pre-read data. The pre-reading unit 255 can count the pre-reading operations performed within a specified time period to obtain the amount of pre-read data. The cache management unit 260 can also provide the currently cached pre-read data. Since the cache management unit 260 will replace the cache unit as needed, the current cache pre-reading amount provided by the cache management unit 260 may be equal to the current pre-reading data amount counted by the message pre-reading unit 266. It is hoped that the amount of cached pre-read data is maintained at a certain level to balance the occupation of resources (cache, bandwidth, etc.) and the reduction in read latency caused by pre-reading.

[0111] According to one embodiment, in operation 1020, if the accuracy of the pre-reading performed on the sequence stream 1 does not meet the specified condition, it is further determined whether the current pre-read data amount is lower than the threshold value (1025). If the current pre-read data amount is lower than the threshold value, the pre-reading operation on the sequence stream 1 is performed (1030) to increase the current pre-read data amount. If the current pre-read data amount is not lower than the threshold value, the pre-reading operation on the sequence stream 1 is rejected (1040). Optionally, a pre-reading data amount threshold value is provided for each identified sequence stream, so that it is determined for each sequence stream whether the pre-reading operation is performed, so that the current pre-reading data amount of each data stream can be maintained at a certain level.

[0112] according to Fig.10 In the embodiment, even in the initialization stage of the storage device without pre-read data, although the pre-read statistical data does not meet the condition in operation 1020, the pre-read operation can be performed in operation 1025 by judging based on the amount of pre-read data.

[0113] The embodiment of the present application also provides a program including program code. When the program is loaded into a host and executed on the host, the program enables the processor of the host to execute one of the methods according to the embodiment of the present application provided above.

[0114] It should be understood that each block of the block diagram and the flow chart and the combination of blocks of the block diagram and the flow chart can be implemented by various means including computer program instructions, respectively. These computer program instructions can be loaded onto a general-purpose computer, a special-purpose computer or other programmable data control device to produce a machine, so that the instructions executed on the computer or other programmable data control device create a device for implementing the functions specified in one or more flow chart blocks.

[0115] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data control device to function in a particular manner, so that the instructions stored in the computer readable memory can be used to manufacture an article of manufacture including computer readable instructions for implementing the functions specified in one or more flowchart blocks. The computer program instructions may also be loaded onto a computer or other programmable data control device to cause a series of operations to be performed on the computer or other programmable data control device, thereby producing a computer-implemented process, and the instructions executed on the computer or other programmable data control device provide operations for implementing the functions specified in one or more flowchart blocks.

[0116] Thus, the blocks of the block diagrams and flow charts support a combination of means for performing a specified function, a combination of operations for performing a specified function, and a combination of program instruction means for performing a specified function. It should also be understood that each block of the block diagrams and flow charts and the combination of blocks of the block diagrams and flow charts can be implemented by a hardware-based special-purpose computer system that performs the specified function or operation, or by a combination of special-purpose hardware and computer instructions.

[0117] Although the present invention has been described with reference to examples, this is for illustrative purposes only and is not intended to limit the present application, and changes, additions and / or deletions to the embodiments may be made without departing from the scope of the present application.

[0118] Those skilled in the art to which these embodiments relate and who benefit from the teachings presented in the above description and associated drawings will recognize many modifications and other embodiments of the present application described herein. Therefore, it should be understood that the present application is not limited to the specific embodiments disclosed, and 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 only in a general and descriptive sense and are not used for the purpose of limitation.

Claims

1. A data pre-reading method, comprising: In response to the address accessed by the first read command hitting a first sequential stream descriptor among the plurality of sequential stream descriptors, a pre-read request is generated for a first sequential stream corresponding to the first sequential stream descriptor; Get pre-read request; Determining whether to perform a pre-read operation according to the pre-read request based on cache statistics of the pre-read data; The cache statistics include a hit rate of a cache unit, a number of cache units occupied by pre-read data, and / or a ratio of cache units occupied by pre-read data; If the accuracy of the cache statistics of the pre-read data is greater than a first threshold, performing a pre-read operation according to the pre-read request; If the accuracy of the cache statistics of the pre-read data is not greater than the second threshold, refusing to perform the pre-read operation according to the pre-read request; The accuracy is indicated by A / B, where B represents the pre-read data and A represents the amount of data in the pre-read data B hit by the read command.

2. The method according to claim 1, further comprising: In response to the first read command not hitting any one of the plurality of sequential stream descriptors, the recent IO command address set is updated according to the address accessed by the first read command.

3. The method according to claim 2, wherein A first element is generated according to the address accessed by the first read command, and the first element is added to the recent IO command address set, wherein the first element records the address accessed by the first read command and the number of initialized hits.

4. The method according to claim 3, wherein If the address accessed by the first read command hits the second element of the recent IO command address set, the hit count of the second element is incremented.

5. The method according to claim 3, wherein: Also includes: The second sequential stream descriptor among the plurality of sequential stream descriptors is updated using the address and the hit count recorded by the element of the recent IO command address set.

6. The method according to claim 3, wherein: The second sequential stream descriptor is a sequential stream descriptor having the smallest number of hits among the multiple sequential stream descriptors.

7. The method according to claim 1, wherein: Also includes: Calculate virtual statistics based on the generated pre-read requests and read commands; The virtual statistics include the accuracy of virtual pre-reading, which is indicated by A' / B', where B' represents the theoretically pre-read data according to the pre-read request, and A' represents the amount of data hit by the read command in the theoretically pre-read data B'.

8. The method according to claim 1, further comprising: In the case that it is determined to refuse to perform the pre-read operation according to the pre-read request according to the cache statistics of the pre-read data, it is determined whether to perform the pre-read operation according to the virtual statistics.

9. The method according to claim 1, wherein: Also includes: Determine whether to perform a read-ahead operation based on virtual statistics.

10. The method according to claim 1, wherein: Also includes: Determine whether to perform a pre-read operation according to the amount of pre-read data in the cache; If the amount of cached pre-read data is less than the threshold, the pre-read operation is performed.

11. The method according to claim 1, wherein: It is determined whether to perform a pre-read operation according to the pre-read request according to first cache statistics of the pre-read data of the first sequential flow. 12 . The method according to claim 1 , wherein if first cache statistics of the pre-read data of the first sequential stream are greater than a threshold, it is determined to perform a pre-read operation according to the pre-read request.

13. The method according to claim 1, wherein if the first cache statistics of the pre-read data of the first sequential flow is not greater than a threshold, it is determined to refuse to perform the pre-read operation according to the pre-read request.

14. A storage device comprising a control component and a non-volatile memory, wherein the control component executes one of the methods according to claims 1-13.