WO2017041673A1 - 刷新磁盘输入输出请求的处理方法及设备 - Google Patents

刷新磁盘输入输出请求的处理方法及设备 Download PDF

Info

Publication number
WO2017041673A1
WO2017041673A1 PCT/CN2016/098008 CN2016098008W WO2017041673A1 WO 2017041673 A1 WO2017041673 A1 WO 2017041673A1 CN 2016098008 W CN2016098008 W CN 2016098008W WO 2017041673 A1 WO2017041673 A1 WO 2017041673A1
Authority
WO
WIPO (PCT)
Prior art keywords
output request
input
disk
refresh
disk input
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2016/098008
Other languages
English (en)
French (fr)
Inventor
陶辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of WO2017041673A1 publication Critical patent/WO2017041673A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • the present application relates to the field of computers, and in particular, to a processing method and device for refreshing a disk input and output request.
  • the refresh disk input/output request is divided into two types: data with and without data.
  • data with and without data When processing the disk input/output request, the disk input/output request with data is refreshed.
  • the disk input/output request data to be written needs to be processed before the data can be processed.
  • the virtual machine returns to refresh the disk input and output request processing, and if the input and output requests for the refresh disk without data are returned, the virtual machine can be directly returned to the virtual machine.
  • a necessary condition for a refresh disk I/O request to start processing is that all previous disk write I/O requests are processed and returned to the virtual machine; all previous flush disk I/O requests are processed and returned to the virtual machine.
  • the host's disk input and output request processing module supports caching, it will cause tens of thousands of disk write input and output requests and refresh disk input and output requests in the disk input and output request processing module to be incomplete (flying). status).
  • the above problem 1 requires that the number of disk input and output requests in flight should not be too large.
  • the above problem 2 requires that the number of disk input and output requests should not be too large.
  • the above existing processing method makes the core disk input and output request process have unnecessary loss of performance when a large number of refresh disk input and output requests start to appear, especially with the emergence of the cache technology, the cache write back mode (writeback) mode. Cache a large number of disk write input and output requests will result in a rapid decline in performance.
  • An object of the present application is to provide a processing method and device for refreshing a disk input/output request, which can solve the problem of reducing the efficiency of processing a disk input and output request when a large number of disk write input and output requests and refresh disk input and output requests are concurrent. .
  • a processing method for refreshing a disk input and output request includes:
  • Each disk input and output request is incrementally assigned a unique identification number when each disk input and output request comes in, wherein the disk input and output request includes any one of a disk write input and output request and a refresh disk input and output request. ;
  • the disk input/output request is refreshed, it is determined whether the incoming refresh disk input/output request satisfies a preset condition, and determining, according to the determination result, whether to process the incoming refresh disk input/output request.
  • determining whether the incoming refresh disk input/output request satisfies a preset condition, and determining, according to the determination result, whether to process the incoming refresh disk input/output request comprises:
  • the accumulated number of real-time disk write input and output requests is recorded as the original accumulated number, and the cumulative number of real-time disk write input and output requests is updated to 1; if no data is carried, the real-time disk writes input and output. After the accumulated number of requests is recorded as the original accumulated number, the cumulative number of real-time disk write input and output requests is updated to 0, wherein the cumulative number of real-time disk write input and output requests is recorded from the previous refresh disk. The cumulative number of disk write input and output requests that the input and output requests arrive at the current time;
  • Whether to process the incoming refresh disk input/output request is determined according to the original accumulated number.
  • determining whether to process the incoming refresh disk input/output request according to the original accumulated number includes:
  • the key code key value association container Determining whether the original accumulated number is 0, and at this time, the key code key value association container is empty, wherein the key code key value association container is used to store the identification number of the disk input and output request and the corresponding node information.
  • Each node information includes a refresh disk input/output request and a cumulative gap number of the refresh disk input/output request, and an initial value of the accumulated gap number is the original accumulated number;
  • the identification number of the incoming refresh disk input/output request and the corresponding node information are inserted into the key code key value association. In the container.
  • the key code key association container is a red black tree container.
  • the method further includes:
  • the identification number of the incoming disk write input and output request is compared with the identification number of the previous refresh disk input/output request.
  • the cumulative number of the real-time disk write input and output requests is increased by one
  • the refresh disk input and output that is just greater than the identification number of the disk write input and output request is found from the key code key association container. Request and add 1 to the cumulative gap of the found refresh disk input and output request.
  • the method further includes:
  • the identification number of the input and output request of the disk is compared with the identification number of the input and output request of the previous refresh disk, and the input and output request of the disk is processed according to the comparison result.
  • the disk input and output request includes a disk write input and output request or a refresh disk input and output request with data.
  • the identification number of the disk input/output request and the previous refresh disk input and output The identification number of the request is compared, and the disk input and output request is processed according to the comparison result, including:
  • the cumulative number of real-time disk write input and output requests is decremented by one.
  • the method further includes:
  • the identification number of the disk input/output request is less than or equal to the identification number of the previous refresh disk input/output request, search for a refresh disk input/output request in the key code key association container that is just larger than the identification number of the disk input/output request. And after the number of accumulated gaps of the found refresh disk input/output request is decreased by 1, it is determined whether the current accumulated gap number of the found refresh disk input/output request is 0.
  • a processing device for refreshing a disk input and output request includes:
  • Assigning an identification number means for incrementally assigning a unique identification number to each disk input and output request when each disk input/output request arrives, wherein the disk input and output request includes a disk write input and output request and a refresh disk input Output any of the requests;
  • a type determining device configured to determine a type of the incoming disk input and output request
  • the condition determining means is configured to determine whether the incoming refresh disk input/output request satisfies a preset condition if the disk input/output request is refreshed, and determine whether to process the incoming refresh disk input/output request according to the determination result.
  • condition determining device is configured to determine whether the incoming refresh disk input/output request carries data
  • the cumulative number of real-time disk write input and output requests is recorded as the original cumulative number.
  • the cumulative number of disk write input and output requests is updated to 1; if no data is carried, the cumulative number of real-time disk write input and output requests is recorded as the original accumulated number, and the cumulative number of real-time disk write input and output requests is updated. Is 0, wherein the cumulative number of the real-time disk write input and output requests records the cumulative number of disk write input and output requests from the last refresh disk input and output request to the current time;
  • Whether to process the incoming refresh disk input/output request is determined according to the original accumulated number.
  • condition determining means is configured to determine whether the original accumulated number is 0, and at this time, the key code key value associated with the container is empty, wherein the key code key value associated container is And storing the identification number of the refresh disk input/output request and the corresponding node information, each node information includes a refresh disk input/output request and a cumulative gap number of the refresh disk input/output request, and the initial value of the accumulated gap number is the The original cumulative number;
  • the identification number of the incoming refresh disk input/output request and the corresponding node information are inserted into the key code key value association. In the container.
  • the key code key association container is a red black tree container.
  • the device further includes:
  • a disk write input/output request processing device configured to compare an identification number of the incoming disk write input and output request with an identification number of a previous refresh disk input/output request if writing an input/output request for the disk
  • the cumulative number of the real-time disk write input and output requests is increased by one
  • the refresh disk input and output that is just greater than the identification number of the disk write input and output request is found from the key code key association container. Request and add 1 to the cumulative gap of the found refresh disk input and output request.
  • the device further includes:
  • the identification number comparison device is configured to compare the identification number of the input and output request of the disk with the identification number of the input and output request of the previous refresh disk after the data requested by one disk input and output is successfully forwarded to the actual storage medium, according to the comparison result
  • the disk input/output request is processed, wherein the disk input/output request includes a disk write input/output request or a refresh disk input/output request with data.
  • the identifier number comparing means is configured to: if the identification number of the disk input/output request is greater than the identification number of the previous refresh disk input/output request, the cumulative number of real-time disk write input and output requests Decrease by 1.
  • the identifier number comparing means is further configured to: if the identification number of the disk input/output request is less than or equal to the identification number of the previous refresh disk input/output request, in the key code key value association container Finding a refresh disk input/output request that is just larger than the identification number of the disk input/output request, and decrementing the accumulated gap number of the found refresh disk input/output request by 1, and determining the current accumulated gap of the found refresh disk input/output request Whether the number is 0,
  • the present application can determine whether the incoming refresh disk input/output request satisfies the preset condition, and can quickly process the refresh disk input and output request according to the judgment result, and efficiently use the CPU to satisfy a large number of scenarios in the cache existence scenario.
  • the disk write input and output request is concurrent with the refresh disk input and output request, the disk input and output request and the disk write input and output request can still be efficiently processed, and the disk input/output request processing module can realize high efficiency and low power consumption processing to refresh the disk input and output. request.
  • the present application can determine whether to process the incoming refresh disk input/output request more accurately according to the determination result by determining whether the incoming refresh disk input/output request carries data.
  • the present application can determine whether the current refresh disk input/output request can be executed immediately by judging whether the original accumulated number is 0, and the key code key association container is empty at this time.
  • the present application can accurately calculate that the incoming disk input/output request type is a disk write input and output by comparing the identification number of the incoming disk write input and output request with the identification number of the previous refresh disk input and output request. Request, the impact of future disk on disk input and output requests.
  • the present application compares the identification number of the disk input/output request with the identification number of the previous refresh disk input/output request, and can accurately determine whether the landing disk input/output request triggers the completion of other refresh disk input and output requests. Satisfy a large number of disk write input and output requests and refresh disks in the cache existence scenario When the input/output request is concurrent, the disk input/output request and the disk write input and output request can still be efficiently processed, thereby realizing the high-efficiency and low-power processing of the disk input/output request processing module to refresh the disk input and output request.
  • the present application can perform O (logN) by searching for a refresh disk input/output request in the key code key association container that is just larger than the identification number of the disk input/output request.
  • O logN
  • Algorithm complexity processing where N refers to the number of refresh disk input and output requests, rather than the number of all disk input and output requests, can improve processing speed.
  • FIG. 1 shows a flow chart of a method of processing a refresh disk input and output request in accordance with an aspect of the present application
  • FIG. 2 is a flow chart showing a processing method for refreshing a disk input/output request according to a preferred embodiment of the present application
  • FIG. 3 is a flow chart showing a processing method for refreshing a disk input/output request according to another preferred embodiment of the present application
  • FIG. 4 is a flow chart showing a processing method for refreshing a disk input/output request according to still another preferred embodiment of the present application
  • FIG. 5 is a flow chart showing a processing method for refreshing a disk input/output request according to still another preferred embodiment of the present application.
  • FIG. 6 is a schematic flowchart showing a specific application embodiment of the present application.
  • FIG. 7 is a schematic flowchart showing another specific application embodiment of the present application.
  • FIG. 8 is a structural diagram of a processing device for refreshing a disk input/output request according to another aspect of the present application.
  • FIG. 9 is a structural diagram of a processing device for refreshing a disk input/output request according to a preferred embodiment of the present application.
  • FIG. 10 is a block diagram showing a processing apparatus for refreshing a disk input/output request according to another preferred embodiment of the present application.
  • the terminal, the device of the service network, and the trusted party each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage,
  • computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
  • a processing method for refreshing a disk input and output request including:
  • Step S1 when each disk input/output request (disk input/output request) comes, an input identification request is incrementally assigned a unique identification number for each disk input and output request, wherein the disk input and output request includes a disk write input and output request (disk write) Any of the input and output requests) and the refresh disk input and output requests; here, usually the disk input and output requests include a disk write input and output request, a disk read input and output request (read IO), and a refresh disk input and output request, due to the present application.
  • the disk read/write request is independent of the refresh disk input/output request processing, so the disk read input and output request can be ignored here, and the refresh disk input and output request is used to finally store the write data in the cache into the actual storage medium;
  • Step S2 determining the type of the incoming disk input and output request
  • Step S3 if the incoming disk input/output request type is a refresh disk input/output request, determining whether the incoming refresh disk input/output request satisfies a preset condition, and determining, according to the determination result, whether to process the incoming refresh disk input. Output request.
  • the disk input and output request can be quickly processed according to the judgment result, and the CPU is efficiently used to satisfy a large number of disk write input and output requests in the cache existence scenario.
  • the disk input/output request and the disk write input and output request can be processed efficiently, and the disk input/output request processing module can realize the high efficiency and low power consumption processing to refresh the disk input and output request.
  • a method for processing a disk input/output request is refreshed.
  • step S3 if the incoming disk input/output request type is a refresh disk input/output request, the incoming refresh is determined. Whether the disk input/output request satisfies a preset condition, and determining, according to the determination result, whether to process the incoming refresh disk input/output request, including:
  • Step S31 determining whether the incoming refresh disk input/output request carries data
  • step S32 if the data is carried, the accumulated number of real-time disk write input and output requests (PendingsFromLastFlush) is recorded as the original accumulated number, and the cumulative number of real-time disk write input and output requests is updated to 1, and then the process proceeds to step S34.
  • the cumulative number of the real-time disk write input and output requests records the cumulative number of disk write input and output requests from the last refresh disk input/output request to the current time; here, due to the disk input and output request
  • the processing module (such as TDC) has a unique identification number for each disk input and output request. This identification number can be incremented by 1, so the last update disk input and output request identification number (LastFlushIOId) is a variable, the previous one.
  • the identification number of the refresh disk input and output request can be initialized to 0, that is, if the disk input and output request has not been refreshed, the identification number of the previous refresh disk input and output request is always 0;
  • Step S33 if no data is carried, the accumulated number of real-time disk write input and output requests is recorded as the original accumulated number, and the accumulated number of real-time disk write input and output requests is updated to 0, and then the process goes to step S34; Re-assigning the cumulative number of real-time disk write input and output requests to 1 indicates that the current refresh disk input and output request must also be successfully sent.
  • Step S34 determining whether to process the incoming refresh disk input/output request according to the original accumulated number, so that the disk input/output request can be processed more accurately and quickly according to the original accumulated number, and the CPU is used efficiently.
  • step S34 determining whether to process the incoming refresh disk input/output request according to the original accumulated number includes:
  • Step S341 determining whether the original accumulated number is 0, and at this time, whether the key code key value association container is empty, that is, there is no outstanding refresh disk input and output request, wherein the key code key value association container is used for And storing the identification number of the refresh disk input/output request and the corresponding node information, where each node information includes the refresh disk input/output request and the accumulated gap number (gap) of the refresh disk input/output request, and the initial value of the accumulated gap number is The original accumulated number, specifically, each brush node (FlushNode) may be stored in the key code key association container, and each brush node is used to describe an identification number and corresponding node information for refreshing the disk input and output request, each The node information may include two members: the accumulated gap number and the disk input/output request pointer. The accumulated gap number is the number of outstanding disk writes between the refresh disk input and output request and the refresh disk input and output request in front of it. Input and output requests, and the disk input and output request
  • Step S342 if the original accumulated number is 0, and the key code key value association container is empty at this time, the two conditions are used to determine whether the current refresh disk input/output request can be executed immediately, that is, 2 All conditions are In case of real time, the refresh disk input and output request is processed immediately. For example, if the data is not carried, the execution directly returns to the execution. If the data is carried, the data is immediately sent. When the two conditions are judged, the disk input and output request can be refreshed. Fast processing with O(1) algorithm complexity;
  • Step S343 if the original accumulated number is not 0, or the key code key association container is not empty at this time, that is, if one of the two conditions is not satisfied, the incoming refresh disk input and output request is sent.
  • the identification number and the corresponding node information are inserted into the key code key value association container.
  • the pointer for refreshing the disk input/output request may be set to refresh the identification number of the disk input and output request as a key code, and the brush node is inserted into the key code key value association container, and the process is completed.
  • the pointer for refreshing the disk input/output request may be executed immediately.
  • the key code key associated container is a red black tree container.
  • the red-black tree can be used as a key-value association container for storing disk input and output requests.
  • Its key code can be the identification number of the disk input and output request, and the key value is a brush. node.
  • the key code association container may be replaced with any container that supports traversal by element key code size and whose time complexity is within O(logn) and can be queried just above a given key code element.
  • step S2 the incoming disk input/output request type is determined, and then includes:
  • Step S4 if the incoming disk input/output request type is a disk write input/output request, compare the identification number of the incoming disk write input and output request with the identification number of the previous refresh disk input and output request,
  • Step S5 if the identification number of the disk write input and output request is greater than the identification number of the previous refresh disk input/output request, the logical number of the real-time disk write input and output request is increased by one, and the logic of the disk input/output request is refreshed. Processing completed;
  • Step S6 if the identification number of the disk write input and output request is smaller than the identification number of the previous refresh disk input and output request, the refresh of the identification number just larger than the disk write input and output request is found from the key code key association container. Disk input and output request, and increase the cumulative gap of the refresh disk input and output request by one.
  • the identification number of the disk write input/output request is equal to the identification number of the previous refresh disk input/output request.
  • there will be no execution of the disk write input and output request identification number is smaller than the execution of the last refresh disk input and output request identification number step, only the multi-disk input and output request write input and output request and refresh disk input and output request It is only possible to go to this step when executing concurrently.
  • a brush node larger than the identification number of the disk write input and output request can be found from the red black tree, and after the cumulative gap value is incremented by 1, the logic for refreshing the disk input and output request is processed.
  • the identification number of the incoming disk write input and output request with the identification number of the previous refresh disk input/output request, it can be accurately calculated that the incoming disk input and output request type is a disk write input and output request. The impact of future disk input and output requests.
  • disk input and output request processing including disk read input and output requests, disk write input and output requests, and data with data. Refresh disk input and output requests.
  • the disk write input/output request and the refresh disk input/output request with data are completed, it is necessary to determine whether to trigger the process of refreshing the disk input/output request.
  • the method for refreshing the disk input and output request After determining whether to process the incoming refresh disk input and output request according to the determination result, the method further includes:
  • Step S7 After the data requested by one disk is successfully forwarded to the actual storage medium (landing), the identification number of the input and output request of the disk is compared with the identification number of the input and output request of the previous refresh disk, and processed according to the comparison result.
  • the disk input/output request wherein the disk input/output request includes a disk write input/output request or a refresh disk input/output request with data.
  • the identification number of the disk input/output request includes a disk write input/output request or a refresh disk input/output request with data.
  • the disk input/output request and the disk write input and output request can be efficiently processed, thereby realizing the high efficiency of the disk input/output request processing module.
  • Low-power processing refreshes disk input and output requests.
  • step S7 the identification number of the disk input/output request is compared with the identification number of the previous refresh disk input/output request, and the disk input is processed according to the comparison result.
  • Output requests including:
  • Step S71 if the identification number of the disk input/output request is greater than the identification number of the previous refresh disk input/output request, the accumulated number of real-time disk write input and output requests is reduced by 1, thereby triggering the input and output request trigger process for subsequent refresh disks. Be prepared.
  • the identification number of the disk input/output request is greater than the identification number of the previous refresh disk input/output request, indicating that the disk input/output request is a disk write input/output request.
  • a method for processing a disk input/output request is refreshed.
  • the identification number of the disk input/output request is compared with the identification number of the previous refresh disk input/output request, according to The comparison result processes the disk input and output request, and also includes:
  • Step S72 if the identification number of the disk input/output request is less than or equal to the identification number of the previous refresh disk input/output request, look for the refresh disk input and output in the key code key association container that is just larger than the identification number of the disk input and output request. After requesting and reducing the number of accumulated gaps of the found refresh disk input/output request by 1, determine whether the current accumulated gap number of the found refresh disk input/output request is 0, if it is 0, go to step S73, if not If the value is 0, go to step S77.
  • the disk input and output request is a disk write input and output request, if the disk input
  • the identification number of the output request is equal to the identification number of the previous refresh disk input/output request, indicating that the disk input/output request is a refresh disk input/output request with data, the disk write input/output request or the refresh disk input/output request is completed,
  • the key in the key-value association container looks for an identifier that is just greater than the disk input and output request
  • the refresh disk input and output request can be processed by O(logN) algorithm complexity, where N refers to the number of refresh disk input and output requests, not the number of all disk input and output requests, so the processing speed is fast;
  • Step S73 determining whether the identification number of the found refresh disk input/output request is the smallest identification number in the key code key association container, and if yes, go to step S74, and if no, go to step S76.
  • Step S74 the refresh disk input/output request is the first disk input/output request in all the uncompleted refresh disk input and output requests, and after processing the found refresh disk input and output request, deleting the key code from the associated container
  • step S75 the following steps are repeated until the accumulated gap number of the refresh disk input/output request immediately after the identification number of the newly deleted refresh disk input/output request is greater than 0, and the process ends:
  • the trigger condition is also satisfied. If it is 0, after processing the found refresh disk input and output request, the identification number of the found refresh disk input and output request and the corresponding node information are deleted from the key code key association container;
  • Step S76 if the identification number of the found refresh disk input/output request is not the smallest identification number in the key code key association container, it indicates that the disk input/output request causes the cumulative gap of the disk input/output request after it is refreshed. The value is reduced to 0, but since there is still an uncompleted refresh disk input and output request before the refresh disk input and output request, the refresh disk input and output request cannot be executed;
  • Step S77 if the disk input and output request after refreshing the identification number of the disk input/output request is found If the accumulated gap number is not 0, the execution of other refresh disk input/output requests is not triggered, and the flow ends.
  • the overall flow of the application consists of two parts: the processing flow of the flush related logic after the disk input and output request reaches the TDC, and if it is a write disk input and output request, it is necessary to calculate the influence on the future refresh disk input and output request, if it is to refresh the disk input
  • the output request needs to be calculated when it can be processed; the processing flow after the disk input/output request data is landed, that is, when the disk write input and output request and the refresh disk input/output request with data are completed, whether other refresh disk input/output requests are triggered The completion.
  • the disk input/output request arrival processing flow is as shown in FIG. 6, and includes the following steps:
  • Step 21 when each disk input and output request comes, the incremental allocation identification number includes a disk read input and output request, a disk write input and output request, and a refresh disk input and output request;
  • Step 22 if the disk input/output request is a disk write input and output request, skip to step 23 to execute; if it is to refresh the disk input and output request, skip to step 26; if it is a disk read input and output request, because Refresh disk input and output request processing is irrelevant, ignored;
  • Step 23 Compare the identification number assigned in step 21 with the identification number of the previous refresh disk input/output request. If the identification number is greater than the identification number of the previous refresh disk input/output request, skip to step 24 to execute; If it is smaller than the identification number of the previous refresh disk input/output request, skip to step 25 and there is no equal scenario;
  • Step 24 adding 1 to the cumulative number of real-time disk write input and output requests, and refreshing the disk input and output request related logic processing;
  • step 25 there is no execution of this step under normal circumstances. It is only possible to go to this step when the first step and the eleventh step of the multi-disk input/output request are executed concurrently. Find the brush node larger than the request ID from the red-black tree (corresponding to the upper_bound method of the map of c++stl), and increase the cumulative gap value by 1. Refresh the disk input and output request related logic processing;
  • Step 26 judging whether the refresh disk input and output request carries data, if carrying data, skip to step 28 to execute; if no data is carried, proceed to step 27;
  • Step 27 clearing the count variable of the real-time disk write input and output request by 0;
  • step 28 the count variable of the real-time disk write input and output request is set to 1, and this 1 indicates that the current refresh disk input and output request must also be successfully sent.
  • Step 29 before the execution of the 27th and 28th steps, the accumulated count of the original real-time disk write input and output request is judged to be 0, and there is no outstanding refresh disk input and output request (determination of storing the red disk input and output request request red) Whether the black tree container is empty or not), this step is used to determine whether the current refresh disk input and output request is Can be executed immediately, if the above two conditions are true, continue to perform step 30; otherwise, jump to step 31 to execute;
  • Step 30 Immediately process the refresh disk input and output request, for example, if the data is not carried, the execution directly returns to the execution; if the data is carried, the data is immediately sent.
  • Step 31 Construct a brush node structure body, and the accumulated gap value is recorded as the cumulative number of original real-time disk write input and output requests (the cumulative number of original real-time disk write input and output requests before the execution of steps 27 and 28), and is set at the same time.
  • the refresh disk input and output request pointer in order to refresh the disk input and output request identification number as a key code, the brush node is inserted into the red-black tree container, and the process is completed.
  • the disk input and output request processing is completed, including reading the disk input and output request, writing the disk input and output request, and The data is flushed to the disk input and output request.
  • the disk input and output request processing is completed, including reading the disk input and output request, writing the disk input and output request, and The data is flushed to the disk input and output request.
  • Step 41 When a write disk input/output request or a refresh disk input/output request with data falls, first compare the identification number of the disk input and output request with the identification number of the previous refresh disk input and output request, if the identification number is less than or equal to If the identification number of the disk input/output request is refreshed, skip to step 3 for execution; if the identification number is greater than the identification number of the previous refresh disk input/output request, proceed to step 42.
  • step 42 the cumulative number of real-time disk write input and output requests is decremented by one, and the refresh disk input/output request triggering process is completed.
  • Step 43 searching for a brush node in the red-black tree container that is just larger than the identification number of the disk input/output request (corresponding to the upper_bound method of the map of c++stl).
  • Step 44 Subtract the count value of the accumulated gap number of the brush node node found in step 43 by 1, and then judge whether the accumulated gap value is 0. If it is 0, continue to perform step 45; if it is greater than 0, no other trigger is triggered. Refresh the execution of the disk input and output request, and the process ends;
  • Step 45 Check whether the current brush node is the node with the smallest ID in the red-black tree (the first node that can be traversed in the order, corresponding to the begin method of the map in the c++ stl library), if not, the disk is described.
  • the input and output request causes the accumulated gap value of the refresh disk input and output request after it to drop to 0, but because there is still an uncompleted refresh disk input and output request before the refresh disk input and output request, the refresh disk input and output request cannot be executed. Conversely, this refresh disk input and output request is the first disk input and output request in all outstanding refresh disk input and output requests, and the processing of step 46 is continued.
  • step 46 the refresh disk input/output request is normally processed. For example, if the data is not carried, the virtual machine directly returns to the virtual machine. If the data is carried, the data is sent to the storage medium.
  • Step 47 since the processing has been completed, the brush node is deleted from the red-black tree
  • Step 48 and then need to check the refresh disk input and output request immediately following the red-black tree (corresponding to the ++ overload method of the map in the c++ stl library), whether the accumulated gap value is also 0, and the trigger is also satisfied. Condition, if the accumulated gap number is 0, proceed to step 46; otherwise, the flow ends.
  • the device 100 includes:
  • disk input and output request includes a disk write input and output request and a refresh disk input Output request (refresh disk input and output request);
  • disk input and output requests include disk write input and output requests, disk read input and output requests, and refresh disk input and output requests, due to the disk read input and output in this application
  • the request is independent of the refresh disk input/output request processing, so the disk read input and output request can be ignored here, and the refresh disk input and output request is used to finally store the write data in the cache into the actual storage medium;
  • the type judging device 2 is configured to determine the type of the incoming disk input/output request
  • the condition judging device 3 is configured to determine whether the incoming refresh disk input/output request satisfies a preset condition if the incoming disk input/output request type is a refresh disk input/output request, and determine whether to process the arrival according to the determination result.
  • Refresh disk input and output requests by judging whether the incoming refresh disk input/output request satisfies the preset condition, the disk input and output request can be quickly processed according to the judgment result, and the CPU is efficiently used to satisfy a large number of disk write input and output requests in the cache existence scenario.
  • the disk input/output request and the disk write input and output request can be processed efficiently, and the disk input/output request processing module can realize the high efficiency and low power consumption processing to refresh the disk input and output request.
  • condition determining device 3 is configured to determine whether the incoming refresh disk input/output request carries data.
  • the cumulative number of real-time disk write input and output requests is recorded as the original accumulated number, and the cumulative number of real-time disk write input and output requests (the cumulative number of real-time disk write input and output requests) is updated to 1,
  • the cumulative number of the real-time disk write input and output requests records the cumulative number of disk write input and output requests from the last refresh disk input/output request (LastFlushIOId) to the current time; here, due to disk input
  • the output request processing module (such as TDC) has a unique label for every disk input and output request received.
  • Identification number this identification number can be incremented by 1, so the identification number of the last refresh disk input and output request is a variable, the identification number of the last refresh disk input and output request can be initialized to 0, that is, if the disk input and output request has not been refreshed , the identification number of the last refresh disk input and output request is always 0; if there is no data, the accumulated number of real-time disk write input and output requests is recorded as the original accumulated number, and the real-time disk writes the input and output requests.
  • the number is updated to 0, wherein the cumulative number of the real-time disk write input and output requests records the cumulative number of disk write input and output requests from the previous refresh disk input and output request to the current time, where The cumulative number of real-time disk write input and output requests is reassigned to 1 to indicate that the current refresh disk input and output request must also be successfully sent.
  • the condition determining device 3 is configured to determine whether the original accumulated number is 0, and whether the key code key value associated container is empty at this time. That is, there is no outstanding refresh disk input and output request, wherein the key code value association container is used to store the identification number of the disk input and output request and the corresponding node information, and each node information includes a refresh disk input and output request and The accumulated gap number (gap) of the disk input/output request, the initial value of the accumulated gap number is the original accumulated number, specifically, each brush node (FlushNode) may be stored in the key code key association container, Each brush node is used to describe an identification number and corresponding node information for refreshing the disk input and output request.
  • Each node information may include two members: a cumulative gap number and a disk input/output request pointer, and the accumulated gap number is the refresh disk input. Between the output request and the refresh disk input and output request in front of it, how many unfinished disk writes and outputs are available? Request, and the disk input and output request pointer points to the corresponding refresh disk input and output request;
  • the two conditions are used to determine whether the current refresh disk input/output request can be executed immediately, that is, the two conditions are In case of real time, the refresh disk input and output request is processed immediately. For example, if the data is not carried, the execution directly returns to the execution. If the data is carried, the data is immediately sent. When the two conditions are judged, the disk input and output request can be refreshed. Fast processing with O(1) algorithm complexity;
  • the identification number of the incoming refresh disk input and output request is And corresponding node information is inserted into the key code key value association container.
  • the original value of the accumulated gap number of the brush node is recorded as the original accumulated number, that is, the real-time disk write input before the update.
  • the cumulative number of output requests (PendingsFromLastFlush). Specifically, you can set this refresh.
  • the pointer of the disk input and output request is used to refresh the identification number of the disk input and output request as a key code, and the brush node is inserted into the key code key value correlation container, and the process is completed.
  • the key code key association container is empty, it can be efficiently determined whether the current refresh disk input/output request can be executed immediately.
  • the key code key associated container is a red black tree container.
  • the red-black tree can be used as a key-value association container for storing disk input and output requests.
  • Its key code can be the identification number of the disk input and output request, and the key value is a brush. node.
  • the key code value association container may be replaced with any container that supports traversal by element key code size and whose time complexity is within O(logn) and can be queried just above a given key code.
  • the device 100 further includes:
  • the disk write input/output request processing device 4 is configured to compare the identification number of the incoming disk write input and output request with the identification number of the previous refresh disk input/output request if the input/output request is written for the disk,
  • the cumulative number of the real-time disk write input and output requests is increased by 1, and the correlation of the disk input/output request is refreshed, that is, the logic is processed. ;
  • the refresh disk input and output that is just greater than the identification number of the disk write input and output request is found from the key code key association container. Request and add 1 to the cumulative gap (gap) of the found refresh disk input and output request.
  • the identification number of the disk write input/output request is equal to the identification number of the previous refresh disk input/output request.
  • there will be no execution of the disk write input and output request identification number is smaller than the execution of the previous refresh disk input and output request identification number step, only the multi-disk input and output request write input and output request and refresh disk input and output request concurrent execution It is only possible to go to this step.
  • a brush node larger than the identification number of the disk write input and output request can be found from the red black tree, and after the cumulative gap value is incremented by 1, the logic for refreshing the disk input and output request is processed.
  • the identification number of the incoming disk write input and output request with the identification number of the previous refresh disk input/output request, it can be accurately calculated that the incoming disk input and output request type is a disk write input and output request. The impact of future disk input and output requests.
  • the device 100 When a disk input and output request data is released (by the TDC module successfully forwarded to the actual storage medium), it can be called disk input and output request processing, including disk read input and output requests, disk write input and output requests, and data with data. Refresh disk input and output requests. Among them, when the disk writes input and output requests, the refresh magnetic with data When the disk input/output request is completed, it is necessary to determine whether to trigger the process of refreshing the disk input/output request.
  • the device 100 further includes:
  • the identification number comparing means 5 is configured to compare the identification number of the input and output request of the disk with the identification number of the input and output request of the previous refresh disk after the data of the input and output request of one disk is successfully transferred to the actual storage medium, according to the comparison The result is processing the disk input and output request, wherein the disk input and output request includes a disk write input/output request or a refresh disk input/output request with data.
  • the disk input and output request includes a disk write input/output request or a refresh disk input/output request with data.
  • the disk input/output request and the disk write input and output request can be efficiently processed, thereby realizing the high efficiency of the disk input/output request processing module.
  • Low-power processing refreshes disk input and output requests.
  • the identification number comparing means 5 is configured to: if the identification number of the disk input/output request is greater than the identification number of the previous refresh disk input and output request, The cumulative number of real-time disk write input and output requests is decremented by one, thus preparing for the subsequent refresh disk input and output request triggering process.
  • the identification number of the disk input/output request is greater than the identification number of the previous refresh disk input/output request, indicating that the disk input/output request is a disk write input/output request.
  • the identification number comparison device 5 is further configured to: if the identification number of the disk input/output request is less than or equal to the identification number of the previous refresh disk input and output request, Then, in the key code key association container, look for a refresh disk input and output request that is just larger than the identification number of the disk input and output request, and reduce the accumulated gap number of the found refresh disk input and output request by one, and determine that the found Whether the current accumulated gap number of the refresh disk input/output request is 0.
  • the identification number of the disk input/output request is smaller than the identification number of the previous refresh disk input/output request, the disk input/output request is written to the disk.
  • Input and output request if the identification number of the disk input and output request is equal to the identification number of the previous refresh disk input and output request, it indicates that the disk input and output request is a refresh disk input and output request with data, the disk writes an input and output request or refreshes the disk.
  • the input and output request is completed, in the key code association container
  • Finding a refresh disk input and output request that is just larger than the identification number of the disk input and output request can be processed by O(logN) algorithm complexity, where N refers to the number of refresh disk input and output requests, not all disk input and output requests. The number, so the processing speed is very fast;
  • the refresh disk input and output request is the first disk input and output request in all outstanding refresh disk input and output requests, and after processing the found refresh disk input and output request, the search is deleted from the key code key value correlation container. Refreshing the identification number of the disk input and output request and the corresponding node information, where the refresh disk input and output request can be processed normally, for example, if the data is not carried, the virtual machine returns directly to the virtual machine; if the data is carried, the data is Delivered to the storage medium landing, since it has been processed, the brush node is deleted from the key code key association container;
  • the present application can determine whether the incoming refresh disk input/output request satisfies the preset condition, and can quickly process the refresh disk input and output request according to the judgment result, and efficiently use the CPU to satisfy a large number of disks in the cache existence scenario.
  • the disk input/output request and the disk write input and output request can still be efficiently processed, and the disk input/output request processing module can realize the high efficiency and low power consumption processing to refresh the disk input and output request.
  • the present application can determine whether to process the incoming refresh disk input/output request more accurately according to the determination result by determining whether the incoming refresh disk input/output request carries data.
  • the present application can determine whether the current refresh disk input/output request can be executed immediately by judging whether the original accumulated number is 0, and the key code key association container is empty at this time.
  • the present application can accurately calculate that the incoming disk input/output request type is a disk write input and output by comparing the identification number of the incoming disk write input and output request with the identification number of the previous refresh disk input and output request. Request, the impact of future disk on disk input and output requests.
  • the present application compares the identification number of the disk input/output request with the identification number of the previous refresh disk input/output request, and can accurately determine whether the landing disk input/output request triggers the completion of other refresh disk input and output requests.
  • the disk input/output request and the disk write input and output request can be efficiently processed, thereby realizing the high efficiency of the disk input/output request processing module.
  • the processing of power consumption refreshes disk input and output requests.
  • the refresh disk input and output of the identification number directly larger than the disk input/output request is searched in the key code key association container. It can be processed by O(logN) algorithm complexity, where N refers to the number of refresh disk input and output requests, not the number of all disk input and output requests, which can improve the processing speed.
  • the present invention can be implemented in software and/or a combination of software and hardware, for example, using an application specific integrated circuit (ASIC), a general purpose computer, or any other similar hardware device.
  • the software program of the present invention may be executed by a processor to implement the steps or functions described above.
  • the software program (including related data structures) of the present invention can be stored in a computer readable recording medium such as a RAM memory, a magnetic or optical drive or a floppy disk and the like.
  • some of the steps or functions of the present invention may be implemented in hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.
  • a portion of the invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide a method and/or solution in accordance with the present invention.
  • the program instructions for invoking the method of the present invention may be stored in a fixed or removable recording medium and/or transmitted by a data stream in a broadcast or other signal bearing medium, and/or stored in a The working memory of the computer device in which the program instructions are run.
  • an embodiment in accordance with the present invention includes a device including a memory for storing computer program instructions and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, triggering
  • the apparatus operates based on the aforementioned methods and/or technical solutions in accordance with various embodiments of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

一种刷新磁盘输入输出请求的处理方法及设备,通过判断所述到来的刷新磁盘输入输出请求是否满足预设条件,及将落地的磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,可以根据判断结果快速处理刷新磁盘输入输出请求,高效使用CPU,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,实现磁盘输入输出请求处理模块高效率低功耗地处理刷新磁盘输入输出请求。

Description

刷新磁盘输入输出请求的处理方法及设备
本申请要求2015年09月10日递交的申请号为201510572319.6、发明名称为“刷新磁盘输入输出请求的处理方法及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机领域,尤其涉及一种刷新磁盘输入输出请求的处理方法及设备。
背景技术
在虚拟化技术的(Xen)虚拟机环境的宿主机(domain0)中,当客户机虚拟机(domainU)发来的磁盘输入输出请求(IO)经过domain0的磁盘输入输出请求处理模块(如TDC)继续处理时,需要能够正确处理刷新磁盘输入输出请求(Flush IO),处理方法为:当一个刷新磁盘输入输出请求来临时,之前未完成的磁盘写输入输出请求(write IO)必须全部完成后,才能够处理这个刷新磁盘输入输出请求。
刷新磁盘输入输出请求分为带数据与不带数据2种,处理刷新磁盘输入输出请求时,对带数据的刷新磁盘输入输出请求,需要将待写入的磁盘输入输出请求数据处理完,才能向虚拟机返回刷新磁盘输入输出请求处理完毕,对不带数据的刷新磁盘输入输出请求,则直接向虚拟机返回成功即可。
在一个刷新磁盘输入输出请求来临且未处理完成时,之后到来的磁盘写输入输出请求仍然能够继续处理。在一个刷新磁盘输入输出请求未处理完成时,允许更多的刷新磁盘输入输出请求继续到达模块。一个刷新磁盘输入输出请求开始处理的必要条件是:之前的所有磁盘写输入输出请求全部处理完成且返回虚拟机;之前的所有刷新磁盘输入输出请求全部处理完成且返回虚拟机。
若宿主机的磁盘输入输出请求处理模块支持缓存(cache),将会导致磁盘输入输出请求处理模块中会有数以万计的磁盘写输入输出请求和刷新磁盘输入输出请求都处于未完成状态(飞行状态)。
现有的刷新磁盘输入输出请求处理方式有如下2个明显的问题:
问题一:当刷新磁盘输入输出请求到达时,需要遍历包含全部的飞行中磁盘输入输出请求的链表(OngoingIOList),使用链表中的磁盘写输入输出请求个数以求得上一个 刷新磁盘输入输出请求与当前的刷新磁盘输入输出请求之间的磁盘写输入输出请求个数即累计间隙数值;
问题二:当磁盘写输入输出请求完成时,需要遍历包含全部刷新磁盘输入输出请求的链表(FlushIOList),以降低刷新磁盘输入输出请求的等待时间,试图触发刷新磁盘输入输出请求的处理。
上述问题一要求飞行中的磁盘输入输出请求个数不能过大,上述问题二要求刷新磁盘输入输出请求个数不能过大。一旦上述包含全部的飞行中磁盘输入输出请求的链表和包含全部刷新磁盘输入输出请求的链表数目开始从几十上升到数百、数千、数万时,由于遍历链表这种O(N)的算法复杂度,将会导致最基础的磁盘输入输出请求处理流程损耗大量的CPU在计算累计间隙数值上,而且处理时间还会增加。
所以,上述现有的处理方式使得核心的磁盘输入输出请求流程在大量刷新磁盘输入输出请求开始出现时,性能出现不必要的损耗,尤其随着缓存技术的出现,缓存回写模式(writeback)模式下缓存大量磁盘写输入输出请求更会导致性能的快速下降。
发明内容
本申请的一个目的是提供一种刷新磁盘输入输出请求的处理方法及设备,能够解决在大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,处理刷新磁盘输入输出请求的效率下降的问题。
一种刷新磁盘输入输出请求的处理方法,其中,该方法包括:
在每一个磁盘输入输出请求到来时,为每个磁盘输入输出请求递增地分配唯一的标识号,其中,所述磁盘输入输出请求包括磁盘写输入输出请求和刷新磁盘输入输出请求中的任一种;
判断所述到来的磁盘输入输出请求的种类,
若为刷新磁盘输入输出请求,则判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求。
进一步的,上述方法中,判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求包括:
判断所述到来的刷新磁盘输入输出请求是否携带数据,
若携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为1;若没有携带数据,将实时磁盘写输入输出 请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为0,其中,所述实时磁盘写输入输出请求的累计个数每次记录从上一个刷新磁盘输入输出请求至当前时刻所到达的磁盘写输入输出请求的累计个数;
根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求。
进一步的,上述方法中,根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求,包括:
判断所述原始累计个数是否为0,且此时键码键值关联容器是否为空,其中,所述键码键值关联容器用于存放刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息包括一个刷新磁盘输入输出请求和该刷新磁盘输入输出请求的累计间隙数,所述累计间隙数的初始值为所述原始累计个数;
若所述原始累计个数为0,且此时键码键值关联容器为空,立即处理该刷新磁盘输入输出请求;
若所述原始累计个数不为0,或此时键码键值关联容器不为空,则将该到来的刷新磁盘输入输出请求的标识号和对应的节点信息插入所述键码键值关联容器中。
进一步的,上述方法中,所述键码键值关联容器为红黑树容器。
进一步的,上述方法中,判断所述到来的磁盘输入输出请求的种类之后,还包括:
若为磁盘写输入输出请求,将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,
若该磁盘写输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将所述实时磁盘写输入输出请求的累计个数加1;
若该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则从所述键码键值关联容器中找到恰大于该磁盘写输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数加1。
进一步的,上述方法中,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求之后,还包括:
当一个磁盘输入输出请求的数据成功转发到实际存储介质中后,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,其中,磁盘输入输出请求包括磁盘写输入输出请求或带数据的刷新磁盘输入输出请求。
进一步的,上述方法中,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输 出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,包括:
若该磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将实时磁盘写输入输出请求的累计个数减1。
进一步的,上述方法中,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,还包括:
若该磁盘输入输出请求的标识号小于等于上一个刷新磁盘输入输出请求的标识号,则在所述键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数减1后,判断该找到的刷新磁盘输入输出请求的当前的累计间隙数是否为0,
如果为0,判断该找到的刷新磁盘输入输出请求的标识号是否是所述键码键值关联容器中最小的标识号,
若是,处理该找到的刷新磁盘输入输出请求后,从键码键值关联容器中删除该找到的刷新磁盘输入输出请求的标识号和对应的节点信息;
重复如下步骤,直至查找到的刷新磁盘输入输出请求的累计间隙数大于0:
查找所述键码键值关联容器中标识号紧随于最近删除的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求,判断该查找到的刷新磁盘输入输出请求的累计间隙数是否也为0,若为0,则处理该查找到的刷新磁盘输入输出请求后,从所述键码键值关联容器中删除该查找到的刷新磁盘输入输出请求的标识号和对应的节点信息。
根据本申请的一个方面,提供了一种刷新磁盘输入输出请求的处理设备,其中,该设备包括:
分配标识号装置,用于在每一个磁盘输入输出请求到来时,为每个磁盘输入输出请求递增地分配唯一的标识号,其中,所述磁盘输入输出请求包括磁盘写输入输出请求和刷新磁盘输入输出请求中的任一种;
种类判断装置,用于判断所述到来的磁盘输入输出请求的种类,
条件判断装置,用于若为刷新磁盘输入输出请求,则判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求。
进一步的,上述设备中,所述条件判断装置,用于判断所述到来的刷新磁盘输入输出请求是否携带数据,
若携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实 时磁盘写输入输出请求的累计个数更新为1;若没有携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为0,其中,所述实时磁盘写输入输出请求的累计个数每次记录从上一个刷新磁盘输入输出请求至当前时刻所到达的磁盘写输入输出请求的累计个数;
根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求。
进一步的,上述设备中,所述条件判断装置,用于判断所述原始累计个数是否为0,且此时键码键值关联容器是否为空,其中,所述键码键值关联容器用于存放刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息包括一个刷新磁盘输入输出请求和该刷新磁盘输入输出请求的累计间隙数,所述累计间隙数的初始值为所述原始累计个数;
若所述原始累计个数为0,且此时键码键值关联容器为空,立即处理该刷新磁盘输入输出请求;
若所述原始累计个数不为0,或此时键码键值关联容器不为空,则将该到来的刷新磁盘输入输出请求的标识号和对应的节点信息插入所述键码键值关联容器中。
进一步的,上述设备中,所述键码键值关联容器为红黑树容器。
进一步的,上述设备中,所述设备还包括:
磁盘写输入输出请求处理装置,用于若为磁盘写输入输出请求,将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,
若该磁盘写输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将所述实时磁盘写输入输出请求的累计个数加1;
若该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则从所述键码键值关联容器中找到恰大于该磁盘写输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数加1。
进一步的,上述设备中,所述设备还包括:
标识号比较装置,用于当一个磁盘输入输出请求的数据成功转发到实际存储介质中后,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,其中,磁盘输入输出请求包括磁盘写输入输出请求或带数据的刷新磁盘输入输出请求。
进一步的,上述设备中,所述标识号比较装置,用于若该磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将实时磁盘写输入输出请求的累计个 数减1。
进一步的,上述设备中,所述标识号比较装置,还用于若该磁盘输入输出请求的标识号小于等于上一个刷新磁盘输入输出请求的标识号,则在所述键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数减1后,判断该找到的刷新磁盘输入输出请求的当前的累计间隙数是否为0,
如果为0,判断该找到的刷新磁盘输入输出请求的标识号是否是所述键码键值关联容器中最小的标识号,
若是,处理该找到的刷新磁盘输入输出请求后,从键码键值关联容器中删除该找到的刷新磁盘输入输出请求的标识号和对应的节点信息;
重复查找所述键码键值关联容器中标识号紧随于最近删除的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求,判断该查找到的刷新磁盘输入输出请求的累计间隙数是否也为0,若为0,则处理该查找到的刷新磁盘输入输出请求后,从所述键码键值关联容器中删除该查找到的刷新磁盘输入输出请求的标识号和对应的节点信息,直至查找到的刷新磁盘输入输出请求的累计间隙数大于0。
与现有技术相比,本申请通过判断所述到来的刷新磁盘输入输出请求是否满足预设条件,可以根据判断结果能够快速处理刷新磁盘输入输出请求,高效使用CPU,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
进一步的,本申请通过判断所述到来的刷新磁盘输入输出请求是否携带数据,能够根据判断结果更精确确定是否处理所述到来的刷新磁盘输入输出请求。
进一步的,本申请通过判断是否满足所述原始累计个数为0,且此时键码键值关联容器为空,可以高效地判断地当前这个刷新磁盘输入输出请求是否可以立即执行。
进一步的,本申请通过将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,可以精确计算出所述到来的磁盘输入输出请求种类是磁盘写输入输出请求,对未来刷新磁盘输入输出请求的影响。
进一步的,本申请通过将磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,能够精确判断出落地的磁盘输入输出请求是否会触发其他刷新磁盘输入输出请求的完成,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘 输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,从而实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
进一步,本申请当磁盘写输入输出请求或者刷新磁盘输入输出请求完成时,通过在键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,可以O(logN)的算法复杂度处理,其中N是指刷新磁盘输入输出请求的数目,而不是指所有磁盘输入输出请求的数目,可以提高处理速度。
附图说明
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1示出根据本申请一个方面的一种刷新磁盘输入输出请求的处理方法的流程图;
图2示出本申请一个优选实施例的刷新磁盘输入输出请求的处理方法流程图;
图3示出本申请另一个优选实施例的刷新磁盘输入输出请求的处理方法流程图;
图4示出本申请再一个优选实施例的刷新磁盘输入输出请求的处理方法流程图;
图5示出本申请又一个优选实施例的刷新磁盘输入输出请求的处理方法流程图;
图6示出本申请一具体的应用实施例的原理流程图;
图7示出本申请另一具体的应用实施例的原理流程图;
图8示出根据本申请另一个方面的一种刷新磁盘输入输出请求的处理设备的结构图;
图9示出本申请一个优选实施例的刷新磁盘输入输出请求的处理设备的结构图;
图10示出本申请另一个优选实施例的刷新磁盘输入输出请求的处理设备的结构图。
附图中相同或相似的附图标记代表相同或相似的部件。
具体实施方式
下面结合附图对本发明作进一步详细描述。
在本申请一个典型的配置中,终端、服务网络的设备和可信方均包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
根据本申请的一个方面,如图1所示,提供一种刷新磁盘输入输出请求的处理方法,包括:
步骤S1,在每一个磁盘输入输出请求(磁盘输入输出请求)到来时,为每个磁盘输入输出请求递增地分配唯一的标识号,其中所述磁盘输入输出请求包括磁盘写输入输出请求(磁盘写输入输出请求)和刷新磁盘输入输出请求中的任一种;在此,通常磁盘输入输出请求包括磁盘写输入输出请求、磁盘读输入输出请求(read IO)和刷新磁盘输入输出请求,由于本申请中磁盘读输入输出请求与刷新磁盘输入输出请求处理无关,所以这里可以忽略磁盘读输入输出请求,所述刷新磁盘输入输出请求用于将缓存中的写数据最终存储到实际存储介质中;
步骤S2,判断所述到来的磁盘输入输出请求的种类,
步骤S3,若所述到来的磁盘输入输出请求种类是刷新磁盘输入输出请求,则判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求。在此,通过判断所述到来的刷新磁盘输入输出请求是否满足预设条件,可以根据判断结果能够快速处理刷新磁盘输入输出请求,高效使用CPU,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
本申请刷新磁盘输入输出请求的处理方法一优选的实施例中,如图2所示,步骤S3,若所述到来的磁盘输入输出请求种类是刷新磁盘输入输出请求,则判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求,包括:
步骤S31,判断所述到来的刷新磁盘输入输出请求是否携带数据;
步骤S32,若携带数据,将实时磁盘写输入输出请求的累计个数(PendingsFromLastFlush)记录为原始累计个数后,并将实时磁盘写输入输出请求的累计个数更新为1后,转到步骤S34,其中,所述实时磁盘写输入输出请求的累计个数每次记录从上一个刷新磁盘输入输出请求至当前时刻所到达的磁盘写输入输出请求的累计个数;在此,由于磁盘输入输出请求处理模块(如TDC)每收到1个磁盘输入输出请求都有独一无二的标识号,这个标识号是可由1开始递增,所以上一个刷新磁盘输入输出请求的标识号(LastFlushIOId)是个变量,上一个刷新磁盘输入输出请求的标识号可初始化为0,即如果一直没有刷新磁盘输入输出请求,则上一个刷新磁盘输入输出请求的标识号一直是0;
步骤S33,若没有携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为0后,转到步骤S34;在此,将实时磁盘写输入输出请求的累计个数重新赋值为1表示当前的刷新磁盘输入输出请求也必须把数据下发成功;
步骤S34,根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求,从而根据所述原始累计个数能够更精确、快速处理刷新磁盘输入输出请求,高效使用CPU。
本申请刷新磁盘输入输出请求的处理方法一优选的实施例中,如图3所示,步骤S34,根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求,包括:
步骤S341,判断所述原始累计个数是否为0,且此时键码键值关联容器是否为空,即没有未完成的刷新磁盘输入输出请求,其中,所述键码键值关联容器用于存放刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息包括该刷新磁盘输入输出请求和该刷新磁盘输入输出请求的累计间隙数(gap),所述累计间隙数的初始值为所述原始累计个数,具体来说,可在键码键值关联容器存放各个刷节点(FlushNode),每个刷节点用于描述一个刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息可包括2个成员:累计间隙数和磁盘输入输出请求指针,累计间隙数就是这个刷新磁盘输入输出请求与它前面的刷新磁盘输入输出请求之间,还有多少个未完成的磁盘写输入输出请求,而磁盘输入输出请求指针则指向所属的刷新磁盘输入输出请求;
步骤S342,若所述原始累计个数为0,且此时键码键值关联容器为空,在此,这2个条件用于判断当前这个刷新磁盘输入输出请求是否可以立即执行,即这2个条件均为 真时,则立即处理该刷新磁盘输入输出请求,比如,如果未携带数据,直接返回执行成功,如果携带数据则立即下发,通过该2个条件的判断,可实现刷新磁盘输入输出请求到达时,以O(1)的算法复杂度快速处理;
步骤S343,若所述原始累计个数不为0,或此时键码键值关联容器不为空,即2个条件中只要有其中一个条件不满足,则将该到来的刷新磁盘输入输出请求的标识号和对应的节点信息插入所述键码键值关联容器中。在此,需要在所述键码键值关联容器中构造一个新的刷节点结构体,该刷节点的累计间隙数的原始值记为所述原始累计个数,即步骤S32、步骤S33中更新前的实时磁盘写输入输出请求的累计个数。具体可以设置好该刷新磁盘输入输出请求的指针,以刷新磁盘输入输出请求的标识号作为键码,将刷节点插入所述键码键值关联容器中后,流程处理完毕。本实施例中通过判断是否满足所述原始累计个数为0,且此时键码键值关联容器为空,可以高效地判断当前这个刷新磁盘输入输出请求是否可以立即执行。
本申请刷新磁盘输入输出请求的处理方法一优选的实施例中,所述键码键值关联容器为红黑树容器。在此,红黑树可作为一个存放刷新磁盘输入输出请求的键码-键值(key-value)关联容器,它的键码可以是刷新磁盘输入输出请求的标识号,而键值则是刷节点。另外,所述键码键值关联容器还可替换为任何支持按元素键码大小遍历的、时间复杂度在O(logn)以内的、可查询刚好大于给定键码元素的容器。
本申请刷新磁盘输入输出请求的处理方法一优选的实施例中,如图4所示,步骤S2,判断所述到来的磁盘输入输出请求种类,之后还包括:
步骤S4,若所述到来的磁盘输入输出请求种类是磁盘写输入输出请求,则将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,
步骤S5,若该磁盘写输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将实时磁盘写输入输出请求的累计个数加1后,刷新磁盘输入输出请求的相关即逻辑处理完毕;
步骤S6,若该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则从所述键码键值关联容器中找到恰大于该磁盘写输入输出请求的标识号的刷新磁盘输入输出请求,并将该刷新磁盘输入输出请求的累计间隙数加1。在此,不存在该磁盘写输入输出请求的标识号等于上一个刷新磁盘输入输出请求的标识号的场景。正常情况下,不会有该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号步骤的执行,只有多磁盘输入输出请求的写输入输出请求和刷新磁盘输入输出请求 并发执行时,才有可能走到本步骤。例如,可从红黑树中找到大于磁盘写输入输出请求的标识号的刷节点,将其累计间隙数值加1后,刷新磁盘输入输出请求相关逻辑即处理完毕。在此,通过将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,可以精确计算出所述到来的磁盘输入输出请求种类是磁盘写输入输出请求,对未来刷新磁盘输入输出请求的影响。
当一个磁盘输入输出请求的数据落地后(由TDC模块成功转发到实际存储介质中),可称为磁盘输入输出请求处理完成,这里包括磁盘读输入输出请求、磁盘写输入输出请求、带数据的刷新磁盘输入输出请求。其中,当磁盘写输入输出请求、带数据的刷新磁盘输入输出请求完成时,需要判断是否触发到刷新磁盘输入输出请求的处理,本申请刷新磁盘输入输出请求的处理方法一优选的实施例中,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求之后,还包括:
步骤S7,当一个磁盘输入输出请求的数据成功转发到实际存储介质中(落地)后,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,其中,磁盘输入输出请求包括磁盘写输入输出请求或带数据的刷新磁盘输入输出请求。在此,本实施例通过将磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,能够精确判断出落地的磁盘输入输出请求是否会触发其他刷新磁盘输入输出请求的完成,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,从而实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
本申请刷新磁盘输入输出请求的处理方法一优选的实施例中,步骤S7,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,包括:
步骤S71,若磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将实时磁盘写输入输出请求的累计个数减1后,从而为后续的刷新磁盘输入输出请求触发流程作好准备。在此,磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则说明这个磁盘输入输出请求是磁盘写输入输出请求。
本申请刷新磁盘输入输出请求的处理方法一优选的实施例中,如图5所示,步骤S7,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,还包括:
步骤S72,若该磁盘输入输出请求的标识号小于等于上一个刷新磁盘输入输出请求的标识号,则在键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数减1后,判断该找到的刷新磁盘输入输出请求的当前的累计间隙数是否为0,如果为0,转到步骤S73,如果不为0,转到步骤S77,在此,若该磁盘输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则说明该磁盘输入输出请求为磁盘写输入输出请求,若该磁盘输入输出请求的标识号等于上一个刷新磁盘输入输出请求的标识号,则说明该磁盘输入输出请求为带数据的刷新磁盘输入输出请求,磁盘写输入输出请求或者刷新磁盘输入输出请求完成时,通过在键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,可以O(logN)的算法复杂度处理,其中N是指刷新磁盘输入输出请求的数目,而不是指所有磁盘输入输出请求的数目,所以处理速度很快;
步骤S73,判断该找到的刷新磁盘输入输出请求的标识号是否是所述键码键值关联容器中最小的标识号,若是,转到步骤S74,若不是,转到步骤S76,
步骤S74,这个刷新磁盘输入输出请求就是所有未完成的刷新磁盘输入输出请求中的第1个磁盘输入输出请求,处理该找到的刷新磁盘输入输出请求后,从键码键值关联容器中删除该找到的刷新磁盘输入输出请求的标识号和对应的节点信息,在此,可以正常处理该刷新磁盘输入输出请求,例如,如果不携带数据,则直接向虚拟机返回成功;如果携带数据,则将数据下发到存储介质落地,既然已经处理完毕,就从键码键值关联容器中删除这个刷节点;
步骤S75,重复如下步骤,直至紧随于最近删除的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求的累计间隙数大于0,流程结束:
查找所述键码键值关联容器中标识号紧随于最近删除的刷新磁盘输入输出请求,判断查找到的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求的累计间隙数是否也为0,也满足了触发条件,若为0,则处理该找到的刷新磁盘输入输出请求后,从键码键值关联容器中删除该找到的刷新磁盘输入输出请求的标识号和对应的节点信息;
步骤S76,如果该找到的刷新磁盘输入输出请求的标识号不是所述键码键值关联容器中最小的标识号,则说明这个磁盘输入输出请求虽然导致它之后的刷新磁盘输入输出请求的累计间隙数值降为0,但是由于这个刷新磁盘输入输出请求前还有未完成的刷新磁盘输入输出请求,所以刷新磁盘输入输出请求并不能执行;
步骤S77,若找到的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求 的累计间隙数不为0,则没有触发其他刷新磁盘输入输出请求的执行,流程结束。
详细的,本申请总体流程包含两部分:磁盘输入输出请求到达TDC后flush相关逻辑的处理流程,如果是写磁盘输入输出请求需要计算出对未来刷新磁盘输入输出请求的影响,如果是刷新磁盘输入输出请求则需要计算什么时候才可以处理它;磁盘输入输出请求数据落地后的处理流程,即磁盘写输入输出请求和带数据的刷新磁盘输入输出请求完成时,是否会触发其他刷新磁盘输入输出请求的完成。
本发明一具体应用实施例中,磁盘输入输出请求到达处理流程如图6所示,包括如下步骤:
步骤21,每一个磁盘输入输出请求到来时,递增的分配标识号,包括磁盘读输入输出请求、磁盘写输入输出请求、刷新磁盘输入输出请求;
步骤22,如果这个磁盘输入输出请求是磁盘写输入输出请求,则跳到第23步执行;如果是刷新磁盘输入输出请求,则跳到第26步执行;如果是磁盘读输入输出请求,因为与刷新磁盘输入输出请求处理无关,忽略;
步骤23,将第21步分配到的标识号与上一个刷新磁盘输入输出请求的标识号比较,如果该标识号大于上一个刷新磁盘输入输出请求的标识号,则跳到第24步执行;如果小于上一个刷新磁盘输入输出请求的标识号,则跳到第25步执行,不存在等于的场景;
步骤24,将实时磁盘写输入输出请求的累计个数计数加1,刷新磁盘输入输出请求相关逻辑处理完毕;
步骤25,正常情况下不会有这个步骤的执行,只有多磁盘输入输出请求的第1步与第11步并发执行时,才有可能走到本步骤。从红黑树中找到大于请求ID的刷节点(可对应于c++stl的map的upper_bound方法),将其累计间隙数值加1。刷新磁盘输入输出请求相关逻辑处理完毕;
步骤26,判断这个刷新磁盘输入输出请求是否携带数据,如果携带数据,则跳到第28步执行;如果没有携带数据,则继续执行第27步;
步骤27,将实时磁盘写输入输出请求的累计个数这个计数变量清0;
步骤28,将实时磁盘写输入输出请求的累计个数这个计数变量设置为1,这个1表示当前的刷新磁盘输入输出请求也必须把数据下发成功;
步骤29,在第27、28步执行前,原先的实时磁盘写输入输出请求的累计个数计数判断是否为0,且没有未完成的刷新磁盘输入输出请求(判断存放刷新磁盘输入输出请求的红黑树容器是否为空即可),这一步是用于判断当前这个刷新磁盘输入输出请求是 否可以立即执行,如果上述2个条件为真,则继续执行第30步;否则,跳到31步执行;
步骤30,立即处理这个刷新磁盘输入输出请求,比如,如果未携带数据,直接返回执行成功;如果携带数据则立即下发。
步骤31,构造刷节点结构体,累计间隙数值记为原实时磁盘写输入输出请求的累计个数(第27、28步执行前的原实时磁盘写输入输出请求的累计个数),同时设置好该刷新磁盘输入输出请求的指针,以刷新磁盘输入输出请求的标识号作为键码,将刷节点插入红黑树容器中,流程处理完毕。
另外,当一个磁盘输入输出请求的数据落地后(由TDC模块成功转发到实际存储介质中),可称为磁盘输入输出请求处理完成,这里包括读磁盘输入输出请求、写磁盘输入输出请求、带数据的刷新磁盘输入输出请求。其中,当写磁盘输入输出请求、带数据的刷新磁盘输入输出请求完成时,需要判断是否触发到刷新磁盘输入输出请求的处理,如图7所示,当一个磁盘输入输出请求的数据落地后,后续的判断是否触发到刷新磁盘输入输出请求的处理步骤包括:
步骤41,当一个写磁盘输入输出请求或者带数据的刷新磁盘输入输出请求落地后,首先将磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,如果标识号小于等于上一个刷新磁盘输入输出请求的标识号,则跳到第3步执行;如果标识号大于上一个刷新磁盘输入输出请求的标识号,则继续执行第42步。
步骤42,将实时磁盘写输入输出请求的累计个数计数减1,刷新磁盘输入输出请求触发流程处理完毕。
步骤43,在红黑树容器中查找恰大于该磁盘输入输出请求的标识号的刷节点结点(可对应于c++stl的map的upper_bound方法)。
步骤44,将第43步找到的刷节点结点的累计间隙数计数值减去1,再判断累计间隙数值是否为0,如果为0,继续执行第45步;如果大于0,则没有触发其他刷新磁盘输入输出请求的执行,流程结束;
步骤45,检查当前的刷节点是否为红黑树中ID最小的结点(可中序遍历的第1个结点,对应于c++的stl库中map的begin方法),如果不是则说明这个磁盘输入输出请求虽然导致它之后的刷新磁盘输入输出请求的累计间隙数值降为0,但是由于这个刷新磁盘输入输出请求前还有未完成的刷新磁盘输入输出请求,所以刷新磁盘输入输出请求并不能执行;反之,这个刷新磁盘输入输出请求就是所有未完成的刷新磁盘输入输出请求中的第1个磁盘输入输出请求,继续执行第46步处理。
步骤46,正常处理该刷新磁盘输入输出请求,例如,如果不携带数据,则直接向虚拟机返回成功;如果携带数据,则将数据下发到存储介质落地。
步骤47,既然已经处理完毕,就从红黑树中删除这个刷节点;
步骤48,接着需要查看红黑树中紧随其后的刷新磁盘输入输出请求(可对应于c++的stl库中map的++重载方法)中是否累计间隙数值也为0,也满足了触发条件,如果累计间隙数为0,则继续执行第46步;否则,流程结束。
根据本申请的另一面,还提供一种刷新磁盘输入输出请求的处理设备,如图8所示,该设备100包括:
分配标识号装置1,用于在每一个磁盘输入输出请求到来时,为每个磁盘输入输出请求递增地分配唯一的标识号,其中所述磁盘输入输出请求包括磁盘写输入输出请求和刷新磁盘输入输出请求(刷新磁盘输入输出请求)中的任一种;在此,通常磁盘输入输出请求包括磁盘写输入输出请求、磁盘读输入输出请求和刷新磁盘输入输出请求,由于本申请中磁盘读输入输出请求与刷新磁盘输入输出请求处理无关,所以这里可以忽略磁盘读输入输出请求,所述刷新磁盘输入输出请求用于将缓存中的写数据最终存储到实际存储介质中;
种类判断装置2,用于判断所述到来的磁盘输入输出请求的种类,
条件判断装置3,用于若所述到来的磁盘输入输出请求种类是刷新磁盘输入输出请求,则判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求。在此,通过判断所述到来的刷新磁盘输入输出请求是否满足预设条件,可以根据判断结果能够快速处理刷新磁盘输入输出请求,高效使用CPU,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
本申请刷新磁盘输入输出请求的处理设备一优选的实施例中,所述条件判断装置3,用于判断所述到来的刷新磁盘输入输出请求是否携带数据,
若携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数(实时磁盘写输入输出请求的累计个数)更新为1,其中,所述实时磁盘写输入输出请求的累计个数每次记录从上一个刷新磁盘输入输出请求(LastFlushIOId)至当前时刻所到达的磁盘写输入输出请求的累计个数;在此,由于磁盘输入输出请求处理模块(如TDC)每收到1个磁盘输入输出请求都有独一无二的标 识号,这个标识号是可由1开始递增,所以上一个刷新磁盘输入输出请求的标识号是个变量,上一个刷新磁盘输入输出请求的标识号可初始化为0,即如果一直没有刷新磁盘输入输出请求,则上一个刷新磁盘输入输出请求的标识号一直是0;若没有携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为0,其中,所述实时磁盘写输入输出请求的累计个数每次记录从上一个刷新磁盘输入输出请求至当前时刻所到达的磁盘写输入输出请求的累计个数,在此,将实时磁盘写输入输出请求的累计个数重新赋值为1表示当前的刷新磁盘输入输出请求也必须把数据下发成功;
根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求,从而根据所述原始累计个数能够更精确、快速处理刷新磁盘输入输出请求,高效使用CPU。
本申请刷新磁盘输入输出请求的处理设备一优选的实施例中,所述条件判断装置3,用于判断所述原始累计个数是否为0,且此时键码键值关联容器是否为空,即没有未完成的刷新磁盘输入输出请求,其中,所述键码键值关联容器用于存放刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息包括一个刷新磁盘输入输出请求和该刷新磁盘输入输出请求的累计间隙数(gap),所述累计间隙数的初始值为所述原始累计个数,具体来说,可在键码键值关联容器存放各个刷节点(FlushNode),每个刷节点用于描述一个刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息可包括2个成员:累计间隙数和磁盘输入输出请求指针,累计间隙数就是这个刷新磁盘输入输出请求与它前面的刷新磁盘输入输出请求之间,还有多少个未完成的磁盘写输入输出请求,而磁盘输入输出请求指针则指向所属的刷新磁盘输入输出请求;
若所述原始累计个数为0,且此时键码键值关联容器为空在此,这2个条件用于判断当前这个刷新磁盘输入输出请求是否可以立即执行,即这2个条件均为真时,则立即处理该刷新磁盘输入输出请求,比如,如果未携带数据,直接返回执行成功,如果携带数据则立即下发,通过该2个条件的判断,可实现刷新磁盘输入输出请求到达时,以O(1)的算法复杂度快速处理;
若所述原始累计个数不为0,或此时键码键值关联容器不为空,即2个条件中只要有其中一个条件不满足,则将该到来的刷新磁盘输入输出请求的标识号和对应的节点信息插入所述键码键值关联容器中。在此,需要在所述键码键值关联容器中构造一个新的刷节点结构体,该刷节点的累计间隙数的原始值记为所述原始累计个数,即更新前的实时磁盘写输入输出请求的累计个数(PendingsFromLastFlush)。具体可以设置好该刷新 磁盘输入输出请求的指针,以刷新磁盘输入输出请求的标识号作为键码,将刷节点插入所述键码键值关联容器中后,流程处理完毕。本实施例中通过判断是否满足所述原始累计个数为0,且此时键码键值关联容器为空,可以高效地判断当前这个刷新磁盘输入输出请求是否可以立即执行。
本申请刷新磁盘输入输出请求的处理设备一优选的实施例中,所述键码键值关联容器为红黑树容器。在此,红黑树可作为一个存放刷新磁盘输入输出请求的键码-键值(key-value)关联容器,它的键码可以是刷新磁盘输入输出请求的标识号,而键值则是刷节点。另外,所述键码键值关联容器还可替换为任何支持按元素键码大小遍历的、时间复杂度在O(logn)以内的、可查询刚好大于给定键码的容器。
本申请刷新磁盘输入输出请求的处理设备一优选的实施例中,如图9所示,所述设备100还包括:
磁盘写输入输出请求处理装置4,用于若为磁盘写输入输出请求,将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,
若该磁盘写输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将所述实时磁盘写输入输出请求的累计个数加1,刷新磁盘输入输出请求的相关即逻辑处理完毕;
若该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则从所述键码键值关联容器中找到恰大于该磁盘写输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数(gap)加1。在此,不存在该磁盘写输入输出请求的标识号等于上一个刷新磁盘输入输出请求的标识号的场景。正常情况下,不会有该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号步骤的执行,只有多磁盘输入输出请求的写输入输出请求和刷新磁盘输入输出请求并发执行时,才有可能走到本步骤。例如,可从红黑树中找到大于磁盘写输入输出请求的标识号的刷节点,将其累计间隙数值加1后,刷新磁盘输入输出请求相关逻辑即处理完毕。在此,通过将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,可以精确计算出所述到来的磁盘输入输出请求种类是磁盘写输入输出请求,对未来刷新磁盘输入输出请求的影响。
当一个磁盘输入输出请求的数据落地后(由TDC模块成功转发到实际存储介质中),可称为磁盘输入输出请求处理完成,这里包括磁盘读输入输出请求、磁盘写输入输出请求、带数据的刷新磁盘输入输出请求。其中,当磁盘写输入输出请求、带数据的刷新磁 盘输入输出请求完成时,需要判断是否触发到刷新磁盘输入输出请求的处理,本申请刷新磁盘输入输出请求的处理设备一优选的实施例中,如图10所示,所述设备100还包括:
标识号比较装置5,用于当一个磁盘输入输出请求的数据成功转发到实际存储介质中后,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,其中,磁盘输入输出请求包括磁盘写输入输出请求或带数据的刷新磁盘输入输出请求。在此,本实施例通过将磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,能够精确判断出落地的磁盘输入输出请求是否会触发其他刷新磁盘输入输出请求的完成,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,从而实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
本申请刷新磁盘输入输出请求的处理设备一优选的实施例中,所述标识号比较装置5,用于若该磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将实时磁盘写输入输出请求的累计个数减1,从而为后续的刷新磁盘输入输出请求触发流程作好准备。在此,磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则说明这个磁盘输入输出请求是磁盘写输入输出请求。
本申请刷新磁盘输入输出请求的处理设备一优选的实施例中,所述标识号比较装置5,还用于若该磁盘输入输出请求的标识号小于等于上一个刷新磁盘输入输出请求的标识号,则在所述键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数减1后,判断该找到的刷新磁盘输入输出请求的当前的累计间隙数是否为0,在此,若该磁盘输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则说明该磁盘输入输出请求为磁盘写输入输出请求,若该磁盘输入输出请求的标识号等于上一个刷新磁盘输入输出请求的标识号,则说明该磁盘输入输出请求为带数据的刷新磁盘输入输出请求,磁盘写输入输出请求或者刷新磁盘输入输出请求完成时,通过在键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,可以O(logN)的算法复杂度处理,其中N是指刷新磁盘输入输出请求的数目,而不是指所有磁盘输入输出请求的数目,所以处理速度很快;
如果为0,判断该找到的刷新磁盘输入输出请求的标识号是否是所述键码键值关联容器中最小的标识号,
若是,这个刷新磁盘输入输出请求就是所有未完成的刷新磁盘输入输出请求中的第1个磁盘输入输出请求,处理该找到的刷新磁盘输入输出请求后,从键码键值关联容器中删除该找到的刷新磁盘输入输出请求的标识号和对应的节点信息,在此,可以正常处理该刷新磁盘输入输出请求,例如,如果不携带数据,则直接向虚拟机返回成功;如果携带数据,则将数据下发到存储介质落地,既然已经处理完毕,就从键码键值关联容器中删除这个刷节点;
重复查找所述键码键值关联容器中标识号紧随于最近删除的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求,判断该查找到的刷新磁盘输入输出请求的累计间隙数是否也为0,若为0,则处理该查找到的刷新磁盘输入输出请求后,从所述键码键值关联容器中删除该查找到的刷新磁盘输入输出请求的标识号和对应的节点信息,直至查找到的刷新磁盘输入输出请求的累计间隙数大于0。
综上所述,本申请通过判断所述到来的刷新磁盘输入输出请求是否满足预设条件,可以根据判断结果能够快速处理刷新磁盘输入输出请求,高效使用CPU,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
进一步的,本申请通过判断所述到来的刷新磁盘输入输出请求是否携带数据,能够根据判断结果更精确确定是否处理所述到来的刷新磁盘输入输出请求。
进一步的,本申请通过判断是否满足所述原始累计个数为0,且此时键码键值关联容器为空,可以高效地判断地当前这个刷新磁盘输入输出请求是否可以立即执行。
进一步的,本申请通过将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,可以精确计算出所述到来的磁盘输入输出请求种类是磁盘写输入输出请求,对未来刷新磁盘输入输出请求的影响。
进一步的,本申请通过将磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,能够精确判断出落地的磁盘输入输出请求是否会触发其他刷新磁盘输入输出请求的完成,满足在缓存存在场景下大量的磁盘写输入输出请求与刷新磁盘输入输出请求并发时,仍然能够高效的处理刷新磁盘输入输出请求与磁盘写输入输出请求,从而实现磁盘输入输出请求处理模块高效率低功耗的处理刷新磁盘输入输出请求。
进一步,本申请当磁盘写输入输出请求或者刷新磁盘输入输出请求完成时,通过在键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请 求,可以O(logN)的算法复杂度处理,其中N是指刷新磁盘输入输出请求的数目,而不是指所有磁盘输入输出请求的数目,可以提高处理速度。
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。
需要注意的是,本发明可在软件和/或软件与硬件的组合体中被实施,例如,可采用专用集成电路(ASIC)、通用目的计算机或任何其他类似硬件设备来实现。在一个实施例中,本发明的软件程序可以通过处理器执行以实现上文所述步骤或功能。同样地,本发明的软件程序(包括相关的数据结构)可以被存储到计算机可读记录介质中,例如,RAM存储器,磁或光驱动器或软磁盘及类似设备。另外,本发明的一些步骤或功能可采用硬件来实现,例如,作为与处理器配合从而执行各个步骤或功能的电路。
另外,本发明的一部分可被应用为计算机程序产品,例如计算机程序指令,当其被计算机执行时,通过该计算机的操作,可以调用或提供根据本发明的方法和/或技术方案。而调用本发明的方法的程序指令,可能被存储在固定的或可移动的记录介质中,和/或通过广播或其他信号承载媒体中的数据流而被传输,和/或被存储在根据所述程序指令运行的计算机设备的工作存储器中。在此,根据本发明的一个实施例包括一个装置,该装置包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发该装置运行基于前述根据本发明的多个实施例的方法和/或技术方案。
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。装置权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。

Claims (16)

  1. 一种刷新磁盘输入输出请求的处理方法,其中,该方法包括:
    在每一个磁盘输入输出请求到来时,为每个磁盘输入输出请求递增地分配唯一的标识号,其中,所述磁盘输入输出请求包括磁盘写输入输出请求和刷新磁盘输入输出请求中的任一种;
    判断所述到来的磁盘输入输出请求的种类,
    若为刷新磁盘输入输出请求,则判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求。
  2. 如权利要求1所述的方法,其中,判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求包括:
    判断所述到来的刷新磁盘输入输出请求是否携带数据,
    若携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为1;若没有携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为0,其中,所述实时磁盘写输入输出请求的累计个数每次记录从上一个刷新磁盘输入输出请求至当前时刻所到达的磁盘写输入输出请求的累计个数;
    根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求。
  3. 如权利要求2所述的方法,其中,根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求,包括:
    判断所述原始累计个数是否为0,且此时键码键值关联容器是否为空,其中,所述键码键值关联容器用于存放刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息包括一个刷新磁盘输入输出请求和该刷新磁盘输入输出请求的累计间隙数,所述累计间隙数的初始值为所述原始累计个数;
    若所述原始累计个数为0,且此时键码键值关联容器为空,立即处理该刷新磁盘输入输出请求;
    若所述原始累计个数不为0,或此时键码键值关联容器不为空,则将该到来的刷新磁盘输入输出请求的标识号和对应的节点信息插入所述键码键值关联容器中。
  4. 如权利要求3所述的方法,其中,所述键码键值关联容器为红黑树容器。
  5. 如权利要求3所述的方法,其中,判断所述到来的磁盘输入输出请求的种类之后,还包括:
    若为磁盘写输入输出请求,将所述到来的磁盘写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,
    若该磁盘写输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将所述实时磁盘写输入输出请求的累计个数加1;
    若该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则从所述键码键值关联容器中找到恰大于该磁盘写输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数加1。
  6. 如权利要求3至5所述的方法,其中,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求之后,还包括:
    当一个磁盘输入输出请求的数据成功转发到实际存储介质中后,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,其中,磁盘输入输出请求包括磁盘写输入输出请求或带数据的刷新磁盘输入输出请求。
  7. 如权利要求6所述的方法,其中,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,包括:
    若该磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将实时磁盘写输入输出请求的累计个数减1。
  8. 如权利要求7所述的方法,其中,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,还包括:
    若该磁盘输入输出请求的标识号小于等于上一个刷新磁盘输入输出请求的标识号,则在所述键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数减1后,判断该找到的刷新磁盘输入输出请求的当前的累计间隙数是否为0,
    如果为0,判断该找到的刷新磁盘输入输出请求的标识号是否是所述键码键值关联容器中最小的标识号,
    若是,处理该找到的刷新磁盘输入输出请求后,从键码键值关联容器中删除该找到的刷新磁盘输入输出请求的标识号和对应的节点信息;
    重复如下步骤,直至查找到的刷新磁盘输入输出请求的累计间隙数大于0:
    查找所述键码键值关联容器中标识号紧随于最近删除的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求,判断该查找到的刷新磁盘输入输出请求的累计间 隙数是否也为0,若为0,则处理该查找到的刷新磁盘输入输出请求后,从所述键码键值关联容器中删除该查找到的刷新磁盘输入输出请求的标识号和对应的节点信息。
  9. 一种刷新磁盘输入输出请求的处理设备,其中,该设备包括:
    分配标识号装置,用于在每一个磁盘输入输出请求到来时,为每个磁盘输入输出请求递增地分配唯一的标识号,其中,所述磁盘输入输出请求包括磁盘写输入输出请求和刷新磁盘输入输出请求中的任一种;
    种类判断装置,用于判断所述到来的磁盘输入输出请求的种类,
    条件判断装置,用于若为刷新磁盘输入输出请求,则判断所述到来的刷新磁盘输入输出请求是否满足预设条件,根据判断结果确定是否处理所述到来的刷新磁盘输入输出请求。
  10. 如权利要求9所述的设备,其中,所述条件判断装置,用于判断所述到来的刷新磁盘输入输出请求是否携带数据,
    若携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为1;若没有携带数据,将实时磁盘写输入输出请求的累计个数记录为原始累计个数后,将实时磁盘写输入输出请求的累计个数更新为0,其中,所述实时磁盘写输入输出请求的累计个数每次记录从上一个刷新磁盘输入输出请求至当前时刻所到达的磁盘写输入输出请求的累计个数;
    根据所述原始累计个数确定是否处理所述到来的刷新磁盘输入输出请求。
  11. 如权利要求10所述的设备,其中,所述条件判断装置,用于判断所述原始累计个数是否为0,且此时键码键值关联容器是否为空,其中,所述键码键值关联容器用于存放刷新磁盘输入输出请求的标识号和对应的节点信息,每个节点信息包括一个刷新磁盘输入输出请求和该刷新磁盘输入输出请求的累计间隙数,所述累计间隙数的初始值为所述原始累计个数;
    若所述原始累计个数为0,且此时键码键值关联容器为空,立即处理该刷新磁盘输入输出请求;
    若所述原始累计个数不为0,或此时键码键值关联容器不为空,则将该到来的刷新磁盘输入输出请求的标识号和对应的节点信息插入所述键码键值关联容器中。
  12. 如权利要求11所述的设备,其中,所述键码键值关联容器为红黑树容器。
  13. 如权利要求11所述的设备,其中,所述设备还包括:
    磁盘写输入输出请求处理装置,用于若为磁盘写输入输出请求,将所述到来的磁盘 写输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号比较,
    若该磁盘写输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将所述实时磁盘写输入输出请求的累计个数加1;
    若该磁盘写输入输出请求的标识号小于上一个刷新磁盘输入输出请求的标识号,则从所述键码键值关联容器中找到恰大于该磁盘写输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数加1。
  14. 如权利要求11至13所述的设备,其中,所述设备还包括:
    标识号比较装置,用于当一个磁盘输入输出请求的数据成功转发到实际存储介质中后,将该磁盘输入输出请求的标识号与上一个刷新磁盘输入输出请求的标识号进行比较,根据比较结果处理该磁盘输入输出请求,其中,磁盘输入输出请求包括磁盘写输入输出请求或带数据的刷新磁盘输入输出请求。
  15. 如权利要求14所述的设备,其中,所述标识号比较装置,用于若该磁盘输入输出请求的标识号大于上一个刷新磁盘输入输出请求的标识号,则将实时磁盘写输入输出请求的累计个数减1。
  16. 如权利要求15所述的设备,其中,所述标识号比较装置,还用于若该磁盘输入输出请求的标识号小于等于上一个刷新磁盘输入输出请求的标识号,则在所述键码键值关联容器中查找恰大于该磁盘输入输出请求的标识号的刷新磁盘输入输出请求,并将该找到的刷新磁盘输入输出请求的累计间隙数减1后,判断该找到的刷新磁盘输入输出请求的当前的累计间隙数是否为0,
    如果为0,判断该找到的刷新磁盘输入输出请求的标识号是否是所述键码键值关联容器中最小的标识号,
    若是,处理该找到的刷新磁盘输入输出请求后,从键码键值关联容器中删除该找到的刷新磁盘输入输出请求的标识号和对应的节点信息;
    重复查找所述键码键值关联容器中标识号紧随于最近删除的刷新磁盘输入输出请求的标识号之后的刷新磁盘输入输出请求,判断该查找到的刷新磁盘输入输出请求的累计间隙数是否也为0,若为0,则处理该查找到的刷新磁盘输入输出请求后,从所述键码键值关联容器中删除该查找到的刷新磁盘输入输出请求的标识号和对应的节点信息,直至查找到的刷新磁盘输入输出请求的累计间隙数大于0。
PCT/CN2016/098008 2015-09-10 2016-09-05 刷新磁盘输入输出请求的处理方法及设备 Ceased WO2017041673A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510572319.6A CN106527959B (zh) 2015-09-10 2015-09-10 刷新磁盘输入输出请求的处理方法及设备
CN201510572319.6 2015-09-10

Publications (1)

Publication Number Publication Date
WO2017041673A1 true WO2017041673A1 (zh) 2017-03-16

Family

ID=58240600

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/098008 Ceased WO2017041673A1 (zh) 2015-09-10 2016-09-05 刷新磁盘输入输出请求的处理方法及设备

Country Status (2)

Country Link
CN (1) CN106527959B (zh)
WO (1) WO2017041673A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12504988B2 (en) * 2023-04-25 2025-12-23 Vmware, Inc. Method to handle heterogeneous input/output (I/O) load for containers running in a virtualized environment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782694B (zh) * 2020-06-28 2023-10-20 百度在线网络技术(北京)有限公司 一种信息写入方法、装置以及电子设备

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060069716A1 (en) * 2004-09-30 2006-03-30 International Business Machines Corporation Decision mechanisms for adapting raid operation placement
US20090119538A1 (en) * 2007-11-06 2009-05-07 Vmware, Inc. Storage Handling for Fault Tolerance in Virtual Machines
CN102541982A (zh) * 2011-10-25 2012-07-04 曙光信息产业(北京)有限公司 一种组织和访问元数据文件日志的方法
CN103049219A (zh) * 2012-12-12 2013-04-17 华中科技大学 适用于虚拟化平台的虚拟磁盘写缓存系统及其操作方法
CN103336669A (zh) * 2013-05-21 2013-10-02 华中科技大学 一种基于固态盘内部并行性的i/o调度方法及调度器
CN103823636A (zh) * 2012-11-19 2014-05-28 苏州捷泰科信息技术有限公司 Io调度方法及装置
CN104375883A (zh) * 2014-12-03 2015-02-25 浪潮电子信息产业股份有限公司 一种cfs调度器
CN104407820A (zh) * 2014-12-12 2015-03-11 华为技术有限公司 基于固态硬盘存储系统的数据处理方法、装置以及系统

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7082495B2 (en) * 2002-06-27 2006-07-25 Microsoft Corporation Method and apparatus to reduce power consumption and improve read/write performance of hard disk drives using non-volatile memory
JP4892812B2 (ja) * 2004-04-28 2012-03-07 株式会社日立製作所 キャッシュ制御およびデータ処理システム並びにその処理プログラム
JP4723921B2 (ja) * 2005-06-13 2011-07-13 株式会社日立製作所 記憶制御装置及びその制御方法
US7721049B2 (en) * 2006-03-27 2010-05-18 Kabuhsiki Kaisha Toshiba Disk drive write method
US8560760B2 (en) * 2007-01-31 2013-10-15 Microsoft Corporation Extending flash drive lifespan
CN101689142A (zh) * 2007-06-20 2010-03-31 富士通株式会社 信息处理装置、高速缓冲存储器控制装置以及存储器访问顺序保证方法
JP5163220B2 (ja) * 2008-03-26 2013-03-13 富士通株式会社 キャッシュ制御装置、情報処理装置
KR101474344B1 (ko) * 2008-07-11 2014-12-18 시게이트 테크놀로지 엘엘씨 캐시 플러시 제어 방법 및 이를 이용한 데이터 저장 시스템
US20100205367A1 (en) * 2009-02-09 2010-08-12 Ehrlich Richard M Method And System For Maintaining Cache Data Integrity With Flush-Cache Commands
US8380962B2 (en) * 2010-08-16 2013-02-19 Symantec Corporation Systems and methods for efficient sequential logging on caching-enabled storage devices
KR101873526B1 (ko) * 2011-06-09 2018-07-02 삼성전자주식회사 에러 정정회로를 구비한 온 칩 데이터 스크러빙 장치 및 방법
CN103150267B (zh) * 2013-02-21 2017-02-08 郑州云海信息技术有限公司 一种多控制器间的缓存同步方法

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060069716A1 (en) * 2004-09-30 2006-03-30 International Business Machines Corporation Decision mechanisms for adapting raid operation placement
US20090119538A1 (en) * 2007-11-06 2009-05-07 Vmware, Inc. Storage Handling for Fault Tolerance in Virtual Machines
CN102541982A (zh) * 2011-10-25 2012-07-04 曙光信息产业(北京)有限公司 一种组织和访问元数据文件日志的方法
CN103823636A (zh) * 2012-11-19 2014-05-28 苏州捷泰科信息技术有限公司 Io调度方法及装置
CN103049219A (zh) * 2012-12-12 2013-04-17 华中科技大学 适用于虚拟化平台的虚拟磁盘写缓存系统及其操作方法
CN103336669A (zh) * 2013-05-21 2013-10-02 华中科技大学 一种基于固态盘内部并行性的i/o调度方法及调度器
CN104375883A (zh) * 2014-12-03 2015-02-25 浪潮电子信息产业股份有限公司 一种cfs调度器
CN104407820A (zh) * 2014-12-12 2015-03-11 华为技术有限公司 基于固态硬盘存储系统的数据处理方法、装置以及系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LI, DINGDING: "Write Performance Optimization of Virtual Machine on The Local Storage", ELECTRONIC TECHNOLOGY & INFORMATION SCIENCE , CHINA DOCTOR DISSERTATION FULL-TEXT DATABASE (ELECTRONIC JOURNAL, 15 February 2014 (2014-02-15) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12504988B2 (en) * 2023-04-25 2025-12-23 Vmware, Inc. Method to handle heterogeneous input/output (I/O) load for containers running in a virtualized environment

Also Published As

Publication number Publication date
CN106527959A (zh) 2017-03-22
CN106527959B (zh) 2019-07-26

Similar Documents

Publication Publication Date Title
US10970173B2 (en) Logging process in a data storage system
CN103544077B (zh) 数据处理方法及装置、共享存储设备
CN107590207B (zh) 数据同步方法及装置、电子设备
US10860480B2 (en) Method and device for cache management
US9990510B2 (en) Database logging using storage class memory
US20180300330A1 (en) Proactive spilling of probe records in hybrid hash join
WO2014153940A1 (zh) 处理数据库重做数据的方法和装置
WO2019037617A1 (zh) 数据事务处理方法、装置以及电子设备
JP7729904B2 (ja) シャード化データベース内のデータの論理削除
CN114328018A (zh) 快照的创建方法、计算设备及存储介质
US20250086067A1 (en) Method and apparatus for fast generating a full snapshot, electronic device and storage medium
CN113127382A (zh) 用于追加写的数据读取方法、装置、设备和介质
CN115686881A (zh) 数据处理方法、装置和计算机设备
CN115599804A (zh) 数据库慢查询日志处理方法、装置、设备及存储介质
CN110874354A (zh) 数据库迁移方法及装置、电子设备、存储介质
JP2018536230A (ja) キャッシュへのアクセス
CN115115433B (zh) 订单数据处理方法、装置、计算机设备和存储介质
CN107622057A (zh) 一种查找任务的方法和装置
WO2017041673A1 (zh) 刷新磁盘输入输出请求的处理方法及设备
WO2015087509A1 (ja) 状態保存復元装置、状態保存復元方法、および、記憶媒体
CN107291777A (zh) 一种热点数据识别和处理的方法和装置
WO2026052116A1 (zh) 应用于分区分裂过程中的数据查询方法及装置、电子设备
CN107102898B (zh) 一种基于numa架构的内存管理、构建数据结构的方法及装置
CN110515861A (zh) 处理刷写命令的存储设备及其方法
US12093528B2 (en) System and method for managing data access in distributed systems

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16843611

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16843611

Country of ref document: EP

Kind code of ref document: A1