Abstract:
A method and an apparatus for improving disk array performance relate to the technical field of computer systems. The method thereof comprises the following steps: setting a buffer between a disk array RAID and a disk block device; when write 10 is delivered to the disk array, temporarily saving data required by the disk array to the buffer; through organizing the data that is required by the disk array and temporarily saved by the buffer, providing corresponding query and update interfaces; and using the interfaces to perform query and update required by the write IO.

Description:
TECHNICAL FIELD 
       [0001]    The present disclosure relates to the field of computer systems, and in particular to a method and device for improving performance of a Redundant Array of Independent Disks (RAID). 
       BACKGROUND 
       [0002]    Redundant Arrays of Inexpensive Disks (RAID 5 / 6 ) for data protection are widely used in the field of Storage Area Network (SAN) and Network Attached Storage (NAS). Such redundancy-based data protection will exist for a long time thanks to its advantages in terms of disk resource occupation. RAID is used for RAID 5 / 6  hereafter. 
         [0003]    An Input/Output (I/O) stack of a conventional array is as shown in  FIG. 1 . Generally, an I/O is implemented by writeback. An I/O organized (e.g. a WRITE I/O rearranged and combined) in a cache is sent to a RAID module. In general, one of the most important functions of the RAID module is to perform RAID 5 / 6  computation on incoming data. At this point, the I/O has left the cache and cannot be cached again, leading to some performance problems as discussed below. 
         [0004]    Implementation of the RAID will impact I/O performance due to features of a RAID algorithm thereof. For example, when a WRITE I/O is issued, the RAID has to perform parity data computation over a range of a stripe, which applies only to a case of a full stripe. If the issued data are not of the size of a full stripe, it is mostly likely that data of another strip may first be read out from the RAID, then parity data computation may be performed on the read-out data and the newly-written data. This is called “reconstruct write (RCW)”. 
         [0005]    In another case, things may be slightly better, where only parity data of a previous stripe and the old-version original data part are read out, the three values are checked accordingly to generate new parity data, and then the new-version written data and the newly generated parity data are written to corresponding stripe positions. This is called “Read-Modify-Write”. 
         [0006]    Both cases may involve reading out old-version data or parity data from a disk and re-computing the parity data, both processes being operated on a main path of the I/O, which may have a major impact on operational efficiency of the entire I/O stack. Theoretically speaking, for redundant computation, parity computation is indispensable and thus impact thereof will be inevitable. Thus, to improve operational efficiency of the entire RAID, improvement has to be made as to how the old-version data are read out from a disk. 
         [0007]      FIG. 2  shows a solution by “Read-Modify-Write”, where old-version D 1  data and parity data are read, such that subsequent computation may be performed on parity data of RAID 5 / 6 . 
         [0008]    Another problem of the RAID is that a stripe may consist of multiple strips respectively located at different disks. During a disk-writing operation, the system per se may not be able to ensure atomicity of data being written to the disks. By atomicity it means that the data belonging to the multiple disks are all written successfully or are all written unsuccessfully. Failing to meet the atomic characteristics may lead to a serious problem. For example, when some strips of the stripe are written successfully while the others of the stripe are not, the stripe on the RAID fails to meet stripe consistency, i.e. when a disk corresponding to a strip of the stripe is broken, it is impossible to reconstruct the correct data from the stripe on the RAID. This is called a RAID write hole. 
       SUMMARY 
       [0009]    To this end, embodiments herein provide a method and device for improving performance of a Redundant Array of Independent Disks, capable of reducing data to be read for disk access and preventing a RAID write hole. 
         [0010]    According to an aspect of embodiments herein, a method for improving performance of a Redundant Array of Independent Disks (RAID) includes: 
         [0011]    setting a cache between a RAID and a disk block; 
         [0012]    when a WRITE Input/Output (I/O) is issued to the RAID, temporarily storing data required by the RAID in the cache; 
         [0013]    providing an interface corresponding to search and update required for the WRITE I/O by organizing the data required by the RAID temporarily stored in the cache; and 
         [0014]    performing the search and update required for the WRITE I/O through the interface. 
         [0015]    The organizing the data required by the RAID temporarily stored in the cache may include: 
         [0016]    dividing the data required by the RAID into a plurality of stripes suitable for concurrent processing. 
         [0017]    The organizing the data required by the RAID temporarily stored in the cache may further include: forming a Logical Unit Number (LUN) binary tree with all stripes belonging to one LUN. The LUN binary tree may include the one LUN as a root of the LUN binary tree, stripe search indices as a first-layer search tree, and the all stripes belonging to the one LUN as a second-layer search tree. Stripes in the second-layer search tree may be leaves. The root and the leaves may form the interface for the search and update. 
         [0018]    The forming a Logical Unit Number (LUN) binary tree with all stripes belonging to one LUN may include: 
         [0019]    allocating an identifier (ID) to each of the all stripes belonging to the one LUN; 
         [0020]    setting the ID of a stripe as a stripe search index; and 
         [0021]    forming a leaf by linking each of the all stripes belonging to the one LUN to a branch of the LUN binary tree corresponding to the stripe search index of the each of the all stripes belonging to the one LUN. 
         [0022]    A leaf may include: 
         [0023]    a number of headers, each being a pointer; and 
         [0024]    a number of data pages being pointed to respectively by the number of headers. 
         [0025]    The method may further include: performing dual-control mirrored protection on the data required by the RAID using two such caches. 
         [0026]    The data required by the RAID may include data to be written to a disk and data to be read out from a disk. 
         [0027]    A queue of the data to be written to a disk may be formed by allocating an ID to each stripe to be written to disks in an ascending sequence. 
         [0028]    According to another aspect of embodiments herein, a device for improving performance of a Redundant Array of Independent Disks (RAID) includes: 
         [0029]    a cache-setting module configured for: setting a cache between a RAID and a disk block; 
         [0030]    a data-storing module configured for: when a WRITE Input/Output (I/O) is issued to the RAID, temporarily storing data required by the RAID in the cache; 
         [0031]    an interfacing module configured for: providing an interface corresponding to search and update required for the WRITE I/O by organizing the data required by the RAID temporarily stored in the cache; and 
         [0032]    a search-update module configured for: performing the search and update required for the WRITE I/O through the interface. 
         [0033]    The interfacing module may be configured for organizing the data required by the RAID temporarily stored in the cache by: forming a Logical Unit Number (LUN) binary tree with all stripes belonging to one LUN. The LUN binary tree may include the one LUN as a root of the LUN binary tree, stripe search indices as a first-layer search tree, and the all stripes belonging to the one LUN as a second-layer search tree. Stripes in the second-layer search tree may be leaves. The root and the leaves may form the interface for the search and update. 
         [0034]    In process execution, the cache-setting module, the data-storing module, the interfacing module, and the search-update module may be implemented with a Central Processing Unit (CPU), a Digital Signal Processor (DSP), or a Field-Programmable Gate Array (FPGA). 
         [0035]    Compared to prior art, the present disclosure may have beneficial effect as follows. 
         [0036]    According to embodiments herein, a RAID-dedicated cache is provided between a RAID and a block, forming effective data organization in the RAID and a series of mechanisms to be used in concert with each other, such that date to be used by the RAID may be temporarily stored in a smart way, thereby improving performance of the RAID. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0037]      FIG. 1  is a diagram of an I/O stack of a conventional array according to related art. 
           [0038]      FIG. 2  is a diagram of a Read-Modify-Write mode according to related art. 
           [0039]      FIG. 3  is a flowchart of a method for improving performance of a RAID according to an embodiment herein. 
           [0040]      FIG. 4  is a diagram of a device for improving performance of a RAID according to an embodiment herein. 
           [0041]      FIG. 5  is a diagram of a device for improving performance according to an embodiment herein. 
           [0042]      FIG. 6  is a diagram of data organization according to an embodiment herein. 
           [0043]      FIG. 7  is a diagram of organization of a second-layer search table according to an embodiment herein. 
           [0044]      FIG. 8  is a diagram of organization of pages under a stripe according to an embodiment herein. 
           [0045]      FIG. 9  is a diagram of mirrored data protection according to an embodiment herein. 
           [0046]      FIG. 10  is a flowchart of storing and using old data and computed parity data according to an embodiment herein. 
       
    
    
     DETAILED DESCRIPTION 
       [0047]    Embodiments herein are elaborated below with reference to drawings. It should be understood that embodiments below are illustrative and explanatory, and are not intended to limit the present disclosure. 
         [0048]      FIG. 3  is a flowchart of a method for improving performance of a RAID according to an embodiment herein. As shown in  FIG. 3 , the method includes steps as follows. 
         [0049]    In step S 301 , a cache is set between a RAID and a disk block. 
         [0050]    In step  302 , when a WRITE Input/Output (I/O) is issued to the RAID, data required by the RAID are temporarily stored in the cache. 
         [0051]    In step  303 , an interface corresponding to search and update required for the WRITE I/O is provided by organizing the data required by the RAID temporarily stored in the cache. 
         [0052]    In step  304 , the search and update required for the WRITE I/O is performed through the interface. 
         [0053]    The data required by the RAID temporarily stored in the cache may be organized by dividing the data required by the RAID into a plurality of stripes suitable for concurrent processing. 
         [0054]    The data required by the RAID temporarily stored in the cache may further be organized by forming a Logical Unit Number (LUN) binary tree with all stripes belonging to one LUN. The LUN binary tree may include the one LUN as a root of the LUN binary tree, stripe search indices as a first-layer search tree, and the all stripes belonging to the one LUN as a second-layer search tree. Stripes in the second-layer search tree may be leaves. The root and the leaves may form the interface for the search and update. 
         [0055]    The LUN binary tree may be formed with all stripes belonging to one LUN by: allocating an identifier (ID) to each of the all stripes belonging to the one LUN; setting the ID of a stripe as a stripe search index; and forming a leaf by linking each of the all stripes belonging to the one LUN to a branch of the LUN binary tree corresponding to the stripe search index of the each of the all stripes belonging to the one LUN. 
         [0056]    A leaf may include: a number of headers, each being a pointer; and a number of data pages being pointed to respectively by the number of headers. 
         [0057]    Dual-control mirrored protection may be performed on the data required by the RAID using two such caches. The data required by the RAID may include data to be written to a disk and data to be read out from a disk. 
         [0058]    A queue of the data to be written to a disk may be formed by allocating an ID to each stripe to be written to disks in an ascending sequence. 
         [0059]      FIG. 4  is a diagram of a device for improving performance of a RAID according to an embodiment herein. As shown in  FIG. 4 , the device includes: a cache-setting module  401  configured for: setting a cache between a RAID and a disk block; a data-storing module  402  configured for: when a WRITE Input/Output (I/O) is issued to the RAID, temporarily storing data required by the RAID in the cache; an interfacing module  403  configured for: providing an interface corresponding to search and update required for the WRITE I/O by organizing the data required by the RAID temporarily stored in the cache; and a search-update module  404  configured for: performing the search and update required for the WRITE I/O through the interface. 
         [0060]    A Logical Unit Number (LUN) binary tree may be formed with all stripes belonging to one LUN. The LUN binary tree may include the one LUN as a root of the LUN binary tree, stripe search indices as a first-layer search tree, and the all stripes belonging to the one LUN as a second-layer search tree. Stripes in the second-layer search tree may be leaves. The root and the leaves may form the interface for the search and update. 
         [0061]      FIG. 5  is a diagram of a device for improving performance according to an embodiment herein. As shown in  FIG. 5 , a RAID-cache (cache dedicated to a RAID), as a temporary storage for data of the RAID, may be provided between the RAID and a disk block. The data of the RAID may include old-version data and parity data. That is, D 1  data and P data in  FIG. 2  have to be protected before WRITE to an entire stripe completes. Mirrored storage may be performed by the RAID-cache on D 1  data and P data. The RAID-cache per se may be required to be capable of mirrored storage. The RAID-cache may be write-hole proof when provided with logic for ensuring stripe consistency. 
         [0062]    The RAID-cache may serve to temporarily store all data of a stripe in memory before the all data of the stripe are correctly written to a disk. The data temporarily stored in the memory will be discarded after the data of the stripe are all written. In case during writing data of an entire stripe to the RAID, an error occurs in a disk, the errored part may be overwritten with old-version data stored in the memory, thereby achieving stripe-consistency protection. 
         [0063]      FIG. 6  is a diagram of data organization according to an embodiment herein. As shown in  FIG. 6 , disk stripeing on a conventional RAID is identical to that on a future virtual array. The only difference is that the disks are to be replaced by virtual blocks, and the virtual blocks are to be divided into stripes. 
         [0064]    A stripe per se may be settable, i.e., may vary. The stripe may consist of multiple strips. A strip may consist of multiple pages. When a RCW or a Read-Modify-Write of the RAID requires data readout, data of a stripe corresponding to the write data may have to be read out, too. It is therefore reasonable to use a stripe as minimal granularity of organization. 
         [0065]    According to the present disclosure, organization is implemented based on stripes. Continuity of addresses of the stripes means continuity of on-disk addresses. Hence a RAID-cache may include local logic for a disk access request. For example, for a sequential I/O, sending data of multiple stripes at one time may allow better use of a back-end bandwidth. In addition, the RAID-cache may also adopt a smarter disk-flushing algorithm. For example, more data of full stripes may selectively be flushed together to the disks. The RAID-cache may allow more data to be accumulated, such that it is easier to have data of a full stripe in memory. 
         [0066]    When flush-to-disk completes, if there is enough cache space in the the RAID-cache, the written new data may remain in the cache, and later be removed in a Most Recently Used (MRU) mode. For data of an entire stripe that have been completely written, old parity data and old data thereof, as well as mirrored data, may be deleted. 
         [0067]      FIG. 7  is a diagram of organization of a second-layer search table according to an embodiment herein. As shown in  FIG. 7 , IDs may be allocated to stripes belonging to a Logical Unit Number (LUN), generally in a ascending sequence. Then, the ID of a stripe may be set as a stripe search index for finding the stripe. The entire LUN may serve as a root. A stripe may be linked to a fixed branch of the LUN tree according to the stripe search index of the stripe. A LUN binary tree may be adopted for better search efficiency. 
         [0068]    First-layer search of a conventional array differs from that of a virtual array. As a conventional array consists of disks, a search for a stripe may be defined as a certain number of searches. For example, for a 10 TB LUN and a 32 KB strip, with a 5+1 RAID, first-layer search may correspond to 8192 stripe sets, and thus there are a total number of 8192 nodes on the first layer. Each first-layer node may further include a number of 8192 stripes. Therefore, a stripe may be found quickly through two-layer search. The number of the sets may be determined by weighing both a memory space occupied by the nodes therefor and search efficiency thereof. 
         [0069]    A virtual mode works in unit of block. A block size of a virtual array may vary depending on granularity adopted by an array manufacturer. For example, for a RAID consisting of blocks each of 512 MB, said search table may be organized differently, with 4096 first-layer nodes, each including 16384 second-layer nodes, i.e., leaves. 
         [0070]    Binary tree search can be performed quickly. As the whole search is actually performed on the path of the I/O, it is extremely important for the search to be performed quickly, which will directly affect performance of the entire RAID system. An exclusive linear-table mode may lead to of excessive memory space occupation by table nodes. A binary-tree mode may be a trade-off between the search efficiency and the memory overhead. In general, the composition may be changed flexibly, depending mainly on a requirement on memory occupation and search delay. 
         [0071]      FIG. 8  is a diagram of organization of pages under a stripe according to an embodiment herein. As shown in  FIG. 8 , D 1 /D 2 /D 3 /P, as a header data structure, may include a data member as a pointer array, which may include a data-containing page. Effective organization of such data may provide an interface corresponding to search and update required for the WRITE I/O. A corresponding support may be provided to the RAID module through such an interface. 
         [0072]    A stripe may include a number of strips. A strip may include data identical to those on a disk, except that such data are currently stored in the memory. Based on design of metadata of a strip, a header of a data structure of the strip may have to include information for locating the data on a disk corresponding to the data stored in the memory (such as a disk ID, a disk address, and a data length). 
         [0073]      FIG. 9  is a diagram of mirrored data protection according to an embodiment herein. As shown in  FIG. 9 , written data may firstly be written to memory space occupied by the RAID. After data writing completes, dual-control mirroring has to be adopted. In this way, the data may arrive at the RAID-cache and have already been protected in effect. At this point, as to a module on the RAID-cache, the entire process of WRITE I/O has been completed. Since the block memory per se may be stored in a zero-copy mode (i.e. the data will not be copied again when entering the RAID-cache), the memory experiences a process of being allocated by an upper layer and finally being stored in the RAID-cache. One concern regarding such a process may be that the RAID-cache may not take up the whole memory, otherwise the upper layer will not be able to allocate enough memory pages for WRITE allocation. 
         [0074]    A small box in a RAID-cache in  FIG. 9  may be a node in the organization as described above. In this way, data to be written to the RAID and data read out from a disk are stored in the RAID-cache, implementing localized caching of new written data and old data. When a controller powers down by accident, the stored data may be written to a disk relying on battery electricity, such that the data are stored. After the controller powers on again, the data (both new data and old data) may be recovered. This, plus implementation of logic for stripe consistency of part of the RAID, may allow consistent storage of content of an entire stripe. 
         [0075]      FIG. 10  is a flowchart of storing and using old data and computed parity data according to an embodiment herein. As shown in  FIG. 10 , the flow may include steps as follows. 
         [0076]    In step  1 , a WRITE I/O may arrive at a RAID module. 
         [0077]    In step  2 , it may be determined whether to perform RCW or Read-Modify-Write by computing an address and a data length. 
         [0078]    In step  3 , a computed result may be returned. 
         [0079]    In step  4 , hit in the RAID-cache may be tried. 
         [0080]    In step  5 , if data hit in the RAID-cache fails, an I/O may be generated to perform disk write/read. 
         [0081]    In step  6 , data may be read for disk access. 
         [0082]    In step  7 , read data may be returned to the RAID directly for further processing. 
         [0083]    In step  8 , logic check for stripe consistency may be performed. 
         [0084]    In step  9 , old data may be written. 
         [0085]    In step  10 , the old data may be written to local and mirror caches. 
         [0086]    In step  11 , a new node (including the old data) may be formed at the mirror cache on the opposite end. 
         [0087]    In step  12 , writing of the old data may complete. 
         [0088]    In step  13 , new data may be written. 
         [0089]    In step  14 , the new data may be written into local and mirror pages. 
         [0090]    In step  15 , writing of the new data may complete. 
         [0091]    In step  16 , writing of the old data and the new data may complete. 
         [0092]    In step  17 , regular trigger may be performed in the RAID-cache. 
         [0093]    In step  18 , the new data may be written. 
         [0094]    In step  19 , writing of the new data may complete. 
         [0095]    With such a process, the written data may in effect be written to the RAID-cache, and the entire process per se may include logic for stripe consistency, thereby improving reading efficiency in a normal state while preventing a write hole. 
         [0096]    To sum up, the present disclosure does not aim at temporary storage of data. Instead, a basic requirement herein is to allow an efficient, simple operation, such as accessing, modification, etc., on the data stored temporarily by organizing the data effectively. For example, upon arrival of a RAID WRITE, it may be selected by a RAID algorithm to be a RAID Read-Modify-Write, which requires old-version data and old-version parity data thereof to be read out. The whole reading process will be much faster given such data are already in the memory. Secondly, a SAN may manage a large number of disks. Concurrent operation of the disks requires RAID concurrency. To allow quick and efficient operation of a disk, I/Os to be written to/read from the disk have to be queued by address. Both RAID concurrency and quick and efficient disk operation may be well supported by temporary storage of data. 
         [0097]    To sum up, the present disclosure may have beneficial effect as follows. 
         [0098]    According to embodiments herein, a RAID-dedicated cache is provided between a RAID and a block, forming effective data organization in the RAID and a series of mechanisms to be used in concert with each other, such that date to be used by the RAID may be temporarily stored in a smart way, thereby improving performance of the RAID. 
         [0099]    What described are merely embodiments herein, and are not intended to limit the scope of protection of the present disclosure. 
       INDUSTRIAL APPLICABILITY 
       [0100]    According to embodiments herein, a RAID-dedicated cache is provided between a RAID and a block, forming effective data organization in the RAID and a series of mechanisms to be used in concert with each other, such that date to be used by the RAID may be temporarily stored in a smart way, thereby improving performance of the RAID.