WO2015018065A1 - 一种文件处理方法、装置及存储设备 - Google Patents

一种文件处理方法、装置及存储设备 Download PDF

Info

Publication number
WO2015018065A1
WO2015018065A1 PCT/CN2013/081182 CN2013081182W WO2015018065A1 WO 2015018065 A1 WO2015018065 A1 WO 2015018065A1 CN 2013081182 W CN2013081182 W CN 2013081182W WO 2015018065 A1 WO2015018065 A1 WO 2015018065A1
Authority
WO
WIPO (PCT)
Prior art keywords
column
matrix
data
raid
block
Prior art date
Application number
PCT/CN2013/081182
Other languages
English (en)
French (fr)
Inventor
孔晗
王静
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP13886152.1A priority Critical patent/EP3026546A4/en
Priority to PCT/CN2013/081182 priority patent/WO2015018065A1/zh
Priority to CN201380001800.9A priority patent/CN103733175B/zh
Priority to JP2015530281A priority patent/JP6069742B2/ja
Priority to KR1020147036585A priority patent/KR101677473B1/ko
Priority to AU2013392019A priority patent/AU2013392019B2/en
Priority to CA2881618A priority patent/CA2881618C/en
Priority to US14/568,502 priority patent/US9483194B2/en
Publication of WO2015018065A1 publication Critical patent/WO2015018065A1/zh
Priority to US14/704,514 priority patent/US9417806B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0625Power saving in storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0683Plurality of storage devices
    • G06F3/0689Disk arrays, e.g. RAID, JBOD
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a file processing method, apparatus, and storage device. Background technique
  • Redundant Array of Independent Disks also known as Redundant Array of Inexpensive Disks (RAID)
  • RAID Redundant Array of Inexpensive Disks
  • the principle of RAID is to combine a number of relatively inexpensive hard drives into a hard disk array group to achieve performance even more than an expensive, large-capacity hard disk, and with data decentralized design to improve data security.
  • RAID not only increases storage capacity, but also enhances data integration and data fault tolerance compared to a single hard drive.
  • the disk array looks like a separate hard disk or logical storage unit for the computer.
  • RAID is usually used to store archived files
  • RAID with verification function is usually used to store archived files, such as RAID3, RAID4, RAID5 or RAID6.
  • a file is usually divided into a plurality of data blocks, and a plurality of data blocks belonging to the same file are combined with the check block to form a stripe of the RA ID (stri pe). ID in multiple disks.
  • a file processing method, apparatus, and storage device provided in the embodiments of the present invention can store the same file in a memory of a RAID while ensuring the security of file storage, and can achieve an energy saving effect.
  • a file processing method including:
  • RAID Redundant Array of Independent Disks
  • the RAID is composed of T memories, F is a natural number not less than 2, and ⁇ is a natural number not less than 3;
  • a data block of each column in the first matrix and a check block group component strip calculated according to the column data block are written into a memory that constructs the RAID. .
  • the obtaining, by the at least two data blocks, the first matrix of the ⁇ line includes:
  • the each is in each column of the second matrix. Inserting a check block, obtaining the first matrix of the T row includes:
  • Inserting a check block into the first matrix of the T line includes:
  • a risk block of the y column data block is inserted at a position of A [X, y] in the y column of the second matrix to obtain a first matrix of the T row.
  • the data of each column in the first matrix is The block and the check block obtained according to the calculation of the column data block form a stripe, and the T memories that are written into the RAID are included:
  • the data block in the y column of the first matrix and the check block composed of the parity block calculated according to the data block of the y column are full of data, the data block of the y column and the school are The block is written into the T memories of the RAID, wherein the y column is one of the first matrix.
  • the first matrix has M columns
  • the The data block of each column in the first matrix and the check block calculated according to the column data block form a stripe
  • the T memories that are built into the RAID include:
  • the data block of the y column and the parity block of the updated y column are divided into T memorys for constructing the RAID.
  • the data of each column in the first matrix is The block and the check block obtained according to the calculation of the column data block form a stripe, and are written into the T memories that construct the RAID.
  • the position of the y column without the data block is The padding is 0, and the padded data block of the y column and the check block are grouped into a memory for constructing the RAID, wherein the y column is one of the columns in the first matrix.
  • the method further includes:
  • a data block of the file stored in the memory is returned to the host.
  • an embodiment of the present invention provides a file processing method, including:
  • the interval between the two adjacent data blocks is D-1, where the value of D is the number of data memories in the RAID;
  • the method further includes:
  • a data block of the file stored in the memory is returned to the host.
  • an embodiment of the present invention provides a file processing apparatus, including: a receiving module, configured to receive F files to be stored in a Redundant Array of Independent Disks (RAID), the RAID is composed of T memories, and F is a natural number not less than 2, and is not a natural number less than 3;
  • RAID Redundant Array of Independent Disks
  • a dividing module configured to divide the F files into at least two data blocks according to a stripe size of the RAID
  • a processing module configured to obtain a first matrix of T rows according to the at least two data blocks, where data blocks belonging to the same file are located in the same row of the first matrix
  • a writing module configured to form a data block of each column in the first matrix and a parity block calculated according to the column data block into a T memory that constructs the RAID.
  • the processing module is specifically configured to: arrange at least two data blocks obtained after the segmentation into a second matrix of D rows, where, belong to the same The data blocks of the file are located in the same row of the second matrix, and the D is the number of data stores in the RAID;
  • the processing module is specifically configured to:
  • the processing module when the independent verification memory is not included in the RAID, the processing module is specifically configured to:
  • a risk block of the y column data block is inserted at a position of A [ X , y] in the y column of the second matrix to obtain a first matrix of the T row.
  • the writing module is specifically configured to:
  • the data block in the y column of the first matrix and the check block composed of the parity block calculated according to the data block of the y column are full of data, the data block of the y column and the school are The block is written into the T memories of the RAID, wherein the y column is one of the first matrix.
  • the first matrix has M columns, the writing The module is specifically used to:
  • the data block of the y column and the parity block of the updated y column are divided into T memorys for constructing the RAID.
  • the writing module is specifically configured to:
  • the position of the y column without the data block is The padding is 0, and the padded data block of the y column and the parity block are divided into blocks to be written into a memory for constructing the RAID, wherein the y column is one of the columns in the first matrix.
  • the receiving module is further configured to receive an access request of the host The access request is used to read a file stored in the RAID, where the access request carries a visit The logical address of the file being asked;
  • the file processing device further includes:
  • a reading module configured to query, according to the logical address, a physical address of a data block storing the file, determine, according to the physical address, a memory that stores the file, and store the memory in a memory of the RAID The data block of the file is returned to the host.
  • an embodiment of the present invention provides a storage device, including a controller and a Redundant Array of Independent Disks (RAID).
  • RAID Redundant Array of Independent Disks
  • the RAID is used to store a file
  • the controller includes:
  • processor a memory
  • communication bus a communication interface
  • communication interface a communication interface
  • the communication interface is configured to communicate with a host and the Redundant Array of Independent Disks (RAID)
  • the memory is configured to store a computer execution instruction
  • the processor is configured to execute the computer to execute an instruction, and execute the file processing method according to the first aspect or the second aspect.
  • an embodiment of the present invention provides a computer program product, including a computer readable storage medium storing program code, where the program code includes instructions for performing the first aspect or the second aspect.
  • the storage device obtains the first matrix of the T rows according to the F files divided into a plurality of data blocks according to the plurality of data blocks. Data blocks belonging to the same file are located in the same row of the first matrix.
  • the storage device further stores the data block of each column in the first matrix and the check block composed and calculated according to the column data block in a RAID, so that data blocks belonging to the same file can be stored in the RAID in one disk.
  • the storage device can recover the damaged file according to other files and the check block, thereby ensuring the security of the file storage.
  • the storage device only needs to wake up and operate a memory that stores the file, and the energy saving effect is remarkable.
  • FIG. 1 is a schematic diagram of an application scenario of a file processing method according to an embodiment of the present invention
  • FIG. 1B is a schematic structural diagram of a storage device 110 according to an embodiment of the present invention.
  • FIG. 2A is a flowchart of a file processing method according to an embodiment of the present invention.
  • FIG. 2B is a flowchart of still another file processing method according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of a method for inserting a check block in a file processing method according to an embodiment of the present invention
  • FIG. 4-A, FIG. 4-B, and FIG. 4-C are schematic diagrams of arrangement of file data blocks to be stored according to an embodiment of the present invention.
  • FIG. 4D is a schematic diagram of a file storage structure according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of still another method for inserting a check block in a file processing method according to an embodiment of the present invention
  • FIG. 6-A, FIG. 6-B, and FIG. 6-D are schematic diagrams showing another arrangement of file data blocks to be stored according to an embodiment of the present invention.
  • 6-C is a schematic diagram of still another file storage structure according to an embodiment of the present invention.
  • FIG. 7 is a data writing method in a file processing method according to an embodiment of the present invention.
  • FIG. 8 is a flowchart of still another file processing method according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of another arrangement of file data blocks to be stored according to an embodiment of the present invention.
  • FIG. 10 is a schematic flowchart of a file reading method according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a file processing apparatus according to an embodiment of the present invention. detailed description
  • FIG. 1A is an application scenario diagram of an embodiment of the present invention.
  • the storage system includes a host 100 and a connection device. 105 and storage device 110.
  • the host 100 may include any computing device known in the art, such as an application server, a desktop computer, etc., with an operating system and other applications installed in the host 100, and there may be multiple hosts 100.
  • any computing device known in the art such as an application server, a desktop computer, etc., with an operating system and other applications installed in the host 100, and there may be multiple hosts 100.
  • the connectivity device 105 can include any interface between the storage device and the host known in the art, such as a fiber switch, or other existing switch.
  • the storage device 110 may include one or more storage devices known in the prior art, such as a storage array, a cluster of disks (JBOD), and a direct access memory (DASD).
  • An interconnected disk drive, wherein the direct access memory can include a tape storage device such as a tape library, one or more storage units.
  • FIG. 1B is a schematic structural diagram of a storage device 110 according to an embodiment of the present invention.
  • the storage device shown in FIG. 1-B is a storage array.
  • the storage device 110 may include a controller 115 and a disk array 125, where the disk array refers to Redundant Arrays of Independent Diaries (RAID), and the disk array 125 may There are a plurality of, and the disk array 125 is composed of a plurality of disks 130.
  • RAID Redundant Arrays of Independent Diaries
  • the controller 115 is a "brain" of the storage device 110, and mainly includes a processor (proces sor) 118, a cache 120, a memory 122, a communication bus (abbreviated as a bus) 126, and a communication interface (Com wake up). Nicat ion Interface) 128.
  • the processor 118, the cache 120, the memory 122, and the communication interface 128 complete communication with each other via the communication bus 126.
  • the communication interface 128 is configured to communicate with the host 100 and the disk array 125.
  • the memory 122 is configured to store the program 124.
  • the memory 124 may include a high speed RAM memory, and may also include a non-volatile memory, such as at least one magnetic disk memory. It can be understood that the memory 124 can be a random memory (Random-Acces s Memory, RAM), a magnetic disk, a hard disk, a USB flash drive, a mobile hard disk, an optical disk, a solid state hard disk (SSD), or a non-volatile memory.
  • RAM Random-Acces s Memory
  • a non-trans i tory machine readable medium such as a memory, that can store program code.
  • Program 124 can include program code, the program code including computer operating instructions.
  • Cache 120 is used to cache data received from host 100 and cached from disk
  • the array 125 reads the data to improve the performance and reliability of the array.
  • the cache 120 may be a non-trans i tory machine readable medium that can store data, such as RAM, ROM, Flash memory or Solid State Disk (SSD). Not limited.
  • the processor 118 may be a central processing unit CPU, or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.
  • An operating system and other software programs are installed in the processor 118, and different software programs can be regarded as one processing module having different functions. For example, processing input/output (1/0) requests to disk 130, performing other processing on the data in the disk, or modifying metadata stored in the storage device, and the like. Therefore, the controller 115 can realize 10 operations and RAID management functions, and can also provide various data management functions such as snapshot, mirroring, and copying.
  • the processor 118 is configured to execute the program 124, and specifically, the related steps in the following method embodiments may be performed.
  • any one of the storage devices 110 can receive a plurality of files sent by one or more hosts 100 through the connection device 105, and divide the received multiple files into a plurality of data blocks and store them in the constituent disks.
  • the plurality of disks 130 of the array 125 are.
  • Any one of the storage devices 110 may also receive a file read request sent by any one of the hosts 100, and return the data block of the file stored in the disk 130 to the host according to the file read request.
  • the disk 130 is only one example of the memory of the disk array 125.
  • an embodiment such as a disk array may be constructed between machine rejections including multiple disks. Therefore, the memory in the embodiment of the present invention may include a disk, a solid state disk (SSD), and a device such as a machine or a server composed of a plurality of disks, which is not limited herein.
  • SSD solid state disk
  • FIG. 2A is a flowchart of a file processing method according to an embodiment of the present invention, which may be performed by the controller 115 of the storage device 110 shown in FIG. 1-B, and the method may be applied to In the scenario of file archiving, as shown in Figure 2-A, the method includes:
  • the storage device 110 receives F files to be stored in the RAID, where F is a natural number not less than 2.
  • the controller 115 of the storage device 110 may receive a file storage request sent by one or more hosts 100, where the file storage request is used to request to store the file in the first RA ID of the storage device 110, An access request can contain F to be stored Documents.
  • the first RAID includes T memories, and the value of T is a natural number not less than 3.
  • a plurality of RAIDs may be included in the storage device 110.
  • the first RAID or the second RAID in the embodiment is any one of the plurality of RAIDs included in the storage device 110.
  • the first RAID and the second RAID in the embodiment of the present invention are only one distinction between different RAIDs. .
  • the multiple RAIDs included in the same storage device 110 may be organized in the same manner.
  • the first RAID and the second RAID are both organized forms of RAID 5.
  • the configuration of multiple RAIDs included in the same storage device 110 may also be different.
  • the first RAID is RAID3 and the second RAID is RAID5. This is not limited here. It can be understood that, in actual operation, the received F files may be cached in the cache 120, and the F files are processed and then written into the disk array 125.
  • step 205 the storage device 110 divides the F files into at least two data blocks according to a stripe size (s t r ip s ize) of the first RAID.
  • Strip (s t r ip ) is a contiguous block of addresses on a extent.
  • the controller typically uses a stripe to map the virtual disk's block address ( b lock addres ses ) to the member disk's block address.
  • a strip is also called a stripe element ( s t r ipe e lement ).
  • the strip size (s t r ip s ize), sometimes called b lock s ize, chunk s i ze or granular i ty, refers to the size of the stripe data block written on each disk.
  • the stripe size of RAID is generally between 2KB and 512KB (or larger), and its value is 1 to the power of n, that is, 2KB, 4KB, 8KB, 16KB, and so on.
  • the controller 115 receives five files Fl-F5 to be stored. After segmentation according to the stripe size of the first RAID, the file F1 is divided into five data blocks: Fl-1, Fl_2, Fl-3, F1-4, and Fl-5. File F2 is divided into 3 data blocks: F2_l, F2-2, and F2_3.
  • File F3 into a data block: F3-l.
  • File F4 is divided into 5 data blocks: F4-1, F4_2, F4_3, F4-4, and F4-5.
  • the file F5 is divided into 4 data blocks: F5-F5_2, F5-3 and F5_4.
  • step 210 the storage device 110 obtains a first matrix of T rows according to the at least two data blocks. Wherein, the data blocks belonging to the same file are located in the same row of the first matrix. And, in each column of the first matrix, a check block obtained by calculating according to the data block of the column is included The value of T is equal to the number of disks in the first RAID.
  • the first matrix of 4 rows may be obtained according to the data block of the split F1-F5 file, and the data blocks belonging to the same file are located. In the same row of the first matrix.
  • the data blocks F1-1, Fl-2, Fl_3, F1-4, and F1-5 of the file F1 are all located in the 0th row of the first matrix, and the data blocks F2_l, F2_2 of the file F2 are And F2-3 are both located in the first row of the second matrix.
  • the first data block of the first file may be determined as a data block at the A [0, 0] position of the first matrix, and it is determined whether the second data block belongs to a first file, if the second data block belongs to the first file, the second data block is arranged in the same row as the first data block, and if the second data block does not belong to the first file, The two data blocks are arranged in the first empty line found, or the second data block is arranged in the shortest line of the second matrix. And so on, until all the data blocks obtained by the segmentation are arranged.
  • the first matrix of the aligned T rows can be specifically as shown in Figure 4-C or Figure 6-B.
  • each column in the first matrix of the arranged T rows includes a parity block obtained by calculation according to the data block of the column, for example, in the first matrix as shown in FIG. 4-C,
  • the 0th column contains the data blocks according to the 0th column: the check block P1 obtained by Fl-1, F2-1, and F3-1, and the data block according to the 1st column is included in the 1st column: Fl-2 , check block P2 obtained by F2-2 and F3-2.
  • the specific position of the file in the first matrix is not limited, and the order of the data blocks belonging to the same file is not limited, as long as the same file is guaranteed.
  • the data blocks are located in the same row of the first matrix. In practical applications, data blocks belonging to the same file may be sequentially arranged in the same row of the first matrix.
  • step 215 the storage device 110 composes a data block of each column in the first matrix and a parity block calculated according to the column data block into a s tr ipe A RAID of T memory.
  • the data block of each column in the first matrix and the check block calculated according to the data block of the column are respectively composed into one strip of RAID and written into the first RAID.
  • the disk For example, in one case, each column of data in the first matrix shown in Figure 4-C is separately After the block and the check block formed according to the data block of the column are written into the disk, a memory structure as shown in FIG. 4-D is formed.
  • Fl-1, F2-F3-1, and P1 constitute one stripe of the first RAID
  • Fl-2, F2-2, F3-2, and P2 constitute another stripe of the first RAID, in turn analogy.
  • the s tr ipe described in the embodiment of the present invention refers to a set of data blocks written in parallel on each memory of the built RAID, wherein each data block in the stripe has the same size, and The data blocks on the same stripe are located at the same offset position in each memory.
  • a column of data blocks in the first matrix shown in FIG. 4-C or FIG. 6-B may be calculated to obtain a parity block of the column, and in the column.
  • the column data block and the check block are combined into a stripe stored in the disk on which the first RA ID is constructed.
  • each column data block in the first matrix and the parity block calculated according to the column data block are respectively combined into a stripe and stored in a stripe. Constructing the disk of the first RAID. For example, after the check block P1 is obtained according to the 0th column data F1-1, F2-1, and F3-1 in the first array shown in FIG.
  • the file processing method after the files to be stored are segmented and arranged, the data blocks belonging to different files are stored in a stripe to be stored in the first RA ID.
  • the data blocks belonging to the same file can be stored in one disk. For example, all data blocks belonging to file F1 are stored in disk D1, and all data blocks belonging to file F2 are also stored in disk D2.
  • the storage device 110 can wake up the disk in the entire RAID, only need to wake up a disk storing the file, and return the file in the disk to the host, thereby enabling Played a better energy saving effect. Moreover, in the technical solution of the embodiment of the present invention, if a certain data block is damaged, the security of the same piece of storage may be used. [0070] It should be noted that the data block described in the embodiment of the present invention refers to a data unit composed of a plurality of data.
  • the check block described in the embodiment of the present invention refers to a data unit composed of check data.
  • the matrix described in the embodiment of the present invention may be a queue including a plurality of data blocks, and may also include a plurality of queues composed of data blocks and check blocks.
  • a row in the embodiment of the present invention refers to a queue containing all data blocks belonging to the same file.
  • a column in the embodiment of the present invention refers to a queue that is perpendicular to the row.
  • the rows defined in the embodiments of the present invention are not limited to being only horizontal queues as defined in the usual matrix.
  • the horizontal queue (for example, the horizontal queue in FIG. 4-C) may be referred to as a row in the embodiment of the present invention.
  • the vertical queue in a normal matrix contains data blocks belonging to the same file
  • the vertical queue is referred to as a row in the embodiment of the present invention. There is no limit here.
  • FIG. 2B is a flowchart of still another file processing method according to an embodiment of the present invention.
  • the method may be performed by the controller 115 of the storage device 110 shown in FIG. 1-B, and the method may be applied to In the scenario of file archiving, as shown in FIG. 2-B, the method is similar to the method shown in FIG. 2-A, wherein step 207 and step 209 are detailed descriptions of step 210 in the method shown in FIG. 2-A. .
  • the method includes:
  • step 200 the storage device 110 receives the F files to be stored in the first RAID.
  • F is a natural number not less than 2.
  • the first RAID includes T memories, and the value of T is a natural number not less than 3.
  • step 205 the storage device 110 divides the F files into at least two data blocks according to the stripe size of the first RAID.
  • step 207 the storage device 110 arranges the at least one data block into a second matrix of D rows, where the data blocks belonging to the same file are located in the same row of the second matrix, D is the number of data disks in the first RAID;
  • the obtained plurality of data blocks may be arranged into a second matrix of D rows*N columns, where D is used to represent the number of rows of the second matrix, D
  • D is used to represent the number of rows of the second matrix
  • D The value is determined by the number of data disks that construct the first RAID, where N is a positive integer. It can be understood that the number of data disks of the first RAID needs to be determined according to the organization form of the first RAID. For example, RAID3 includes a data disk and a separate parity disk. RAID4 includes a data disk and a separate parity disk. And only in RAID5 Data disk, no independent check disk. The value of D only needs to be determined according to the number of data disks in the first RAID.
  • the first RAID is organized in the form of RAID 3, and the first RAID has a total of four disks, the number of data disks is three, and the number of parity disks is one, so the second matrix The number of lines is 3 lines, which can be arranged into a second matrix as shown in Fig. 4-B. If the organization of the first RAID is RAID5, and the first RAID has a total of four disks, the number of data disks is four, and the number of parity disks is zero, then the rows of the second matrix The number is 4 lines and can be arranged in a second matrix as shown in Figure 6-A.
  • N is used to represent the number of columns of the second matrix, and N is a positive integer.
  • the value of N may not be limited, and may be determined according to the number of data blocks. It can be understood that, in the case that the received multiple files to be stored are cached in the cache 120, the size of N may be determined according to the size of the cache 120, and the product of N and the stripe size is not greater than the buffer 120. capacity.
  • the process of arranging the second matrix is similar to the method of arranging the first matrix described in the above step 210 of FIG. 2-A, and details are not described herein again.
  • the data disk in the embodiment of the present invention is only an example of a data storage device that stores data blocks.
  • the independent parity disk in the embodiment of the present invention is only used for storing independent data for verifying data.
  • the data memory in the embodiment of the present invention refers to a memory for storing data blocks
  • the independent check memory refers to a memory dedicated to storing a check block, wherein the memory includes but is not limited to a disk, a machine rejecting the disk or a server And other devices.
  • the data blocks obtained by dividing the files F1 to F5 can be arranged into a second matrix of 3 rows*7 columns, and the data block F1 of the file F1.
  • l, Fl-2, Fl-3, F1-4, and F1-5 are all located in the 0th row of the second matrix
  • the data blocks F2_l, F2_2, and F2-3 of the file F2 are located in the 1st row of the second matrix.
  • the data blocks F5-1, F5-2, F5-3, and F5-4 of the file F5 are also located in the first row of the second matrix.
  • step 209 the storage device 110 inserts a check block in each column of the second matrix to obtain a first matrix of T rows.
  • the check block inserted in each column of the second matrix is obtained by calculating the column data block according to a check algorithm determined by the organization form of the first RAID, and the value of the T is The difference in the value of D is the number of independent check disks in the first RAID.
  • the first matrix of the T rows may be a first matrix of (D+P) rows*M columns, where the P is a school insurance disk in the first RAID.
  • the quantity, M is a positive integer not less than N, and the product of M and the stripe size is not greater than the capacity of a single disk in the RAID group.
  • the controller 115 of the storage device 110 may determine a verification algorithm (ie, a calculation method of the check block) according to the organization form of the first RAID, and calculate a calibration of each column of the second matrix according to the determined verification algorithm.
  • the block is checked, and the check block of each column of data blocks is inserted into the second matrix to obtain the first matrix of the (D+P) row *M column.
  • P is the number of independent check disks in the first RAID
  • the value of ⁇ should be not less than N
  • the product of ⁇ and the strip size is not greater than the capacity of a single disk in the RAID group. It can be understood that, in the case of buffering a plurality of files to be stored in the cache 120, the product of M and the stripe size is not larger than the capacity of the buffer 120.
  • the storage time limit is a preset time limit for writing a file to the disk that constructs the first RAID. For example, if you can store it once in 1 hour, the storage time limit is 1 hour.
  • the storage time limit can be determined according to the actual situation such as the amount of data to be written to the disk. It can be stored once in one day or once in 10 minutes, which is not limited here.
  • step 209 when the check block is inserted in the second matrix, different processes may be separately performed according to the organization manner of the first RAID. For details, refer to the related descriptions in FIG. 3 and FIG. 5.
  • the controller 115 can be inserted according to the method flow shown in FIG. Check block. As shown in Figure 3, the method includes:
  • step 305 the storage device 110 determines a location in which the parity block is inserted in the second matrix according to the location of the independent parity disk in the first RAID.
  • the first RAID is RAID3, there is one independent parity disk in the first RAID.
  • any one of D1, D2, D3, and D4 can be used as an independent school disk.
  • D4 is used as an independent parity disk in the first RAID as shown in FIG. 4-D.
  • the second matrix is inserted into the school.
  • Check the location of the block For example, based on the position of the independent check disk D4 as shown in FIG. 4-D, it may be determined that a check block is added after the last line in the second matrix shown in FIG. 4-B. According to this manner, the second matrix shown in FIG. 4-B has 3 rows, and the 4th row is added to the second matrix to insert the parity block.
  • step 310 the storage device 110 performs a check calculation on the data blocks of each column in the second matrix according to the check algorithm of the first RAID to obtain a check block of each column of data blocks.
  • each column data in the second matrix as shown in FIG. 4-B may be verified according to a parity check algorithm, respectively.
  • Calculate to obtain a check block for each column of data For example, the check calculation is performed according to the data F1-1, F2-1, and F3-1 of the 0th column in FIG. 4-B, and the check block PL is obtained for the data of the first column F1-2, F2-2, and F4-1.
  • the check calculation obtains the check block P2.
  • the parity algorithm is only an example and does not limit the verification algorithm. The order of steps 305 and 310 is not limited.
  • step 315 the storage device 110 inserts a parity block calculated according to the column data block in each column of the second matrix according to the determined position of the parity block, and obtains the first matrix of the ⁇ row.
  • the first matrix of 4 rows*7 columns as shown in FIG. 4-C can be obtained, wherein ⁇ is according to the first The parity block calculated by the data F1-F2-1 and F3-1 of the 0th column in the two matrix, and ⁇ 2 is the parity block calculated according to the data of the first column F1_2, F2-2 and F4-1 in the second matrix, And so on.
  • the number of check blocks inserted in each column of the second matrix can be determined according to the number of independent check disks. Therefore, after the check block is inserted, the number of rows of the second matrix changes, and the number of columns of the second matrix does not change.
  • the first RAID is a RAID organization with independent insurance disks
  • the value of M in the first matrix is equal to the value of N in the second matrix.
  • the controller 115 can insert the check block according to the method flow shown in FIG. As shown in FIG. 5, the method includes: [0094] In step 505, the storage device 110 determines to insert the position A [x, y] of the check block in each column of the second matrix.
  • the insertion of the check block in each column of the second matrix may be determined according to the organization form of the first RAID and the distribution manner of the check block in the first RAID.
  • the parity block in RAID 5 can be distributed on the disk in the left symmetry (latte parity or Lef t Synchronous ), left asymmetry ( backward dynamic or Lef t Asynchronous ), right symmetrical (forward parity Or Right Synchronous ) or asymmetric to the right ( f orward dynamic or Right Asynchronous ).
  • “left” or “right” refers to how the information is distributed
  • “symmetric” or “asymmetric” refers to how the data is distributed.
  • the check block starts from the last disk, and each strip moves the check block one disk closer to the first disk (repeating the loop distribution if necessary).
  • the check block starts from the first disk, and each strip moves the check block to a position close to the last disk in the direction of the last disk (repeating the cyclic distribution if necessary).
  • RAID6 adds a set of school insurance blocks to RAID5.
  • how the specific check block is distributed in the disk may be determined according to the organization manner of the first RAID and the set check block distribution manner. For example, if the first RAID is a RAID 5 organization mode, and the set of the risk blocks is symmetrically distributed to the left, it can be known that the check block starts from the last disk in the disk, and each strip will The parity block is distributed to the position where one disk is moved in the direction of the first disk.
  • the position A [X, y] of inserting the check block in the second matrix may be determined according to the set distribution manner of the check block in the first RAID.
  • X is an integer not less than 0 and not greater than (D-1)
  • y is an integer not less than 0 and not greater than (N-1)
  • the value of X, y varies with the position of the risk block in the second matrix
  • the value of x is incremented from 0 to (D-1)
  • the value of y is incremented by 0. To (N-1).
  • the check is inserted in the 0th column in the second matrix as shown in FIG. 6-A.
  • the position of the block is A [3, 0]
  • the position where the check block is inserted in the first column is A [2, 1]
  • the position where the check block is inserted in the second column is A[l, 2]
  • the next cycle starts from the 4th column, that is, the position where the check block is inserted in the 4th column is A [3, 4]
  • the position where the check block is inserted in the 5th column is A [2, 5], and so on.
  • Figure 6-B The position shown by P1-P7 is shown.
  • step 510 the storage device 110 sequentially shifts the data of the y column to the (N-1) column in the X row of the second matrix to the position of the column (N+1) in the X row to the column N.
  • 6- ⁇ is A [3, 0], the third row A[3, 0 in the second matrix needs to be used. ] All data blocks to the A[3, 4] position are moved one bit backward, and sequentially moved to the position of A[3, 1] to A[3, 5]. According to this method, the data block F4-1 of the original A[3, 0] position can be moved to A[3, 1], and the data block F4-2 of the original A[3, 1] position can be moved to A[3, 2], and so on. Wherein, the value of x, y varies according to the position of the check block in the second matrix.
  • the original line A[x, All data blocks from y] to A[x, Nl] are shifted one bit backward.
  • the embodiment of the present invention does not limit the number of check blocks of each column of data blocks.
  • step 515 the storage device 110 performs a check calculation on the data block in the y column according to the check algorithm of the first RAID, and obtains a check block of the y column data block.
  • the data block of the y column may be checked and calculated according to the check algorithm of the first RAID.
  • a check block of the y column data block is obtained. This check block is the check block that needs to be inserted into the A [x, y] position. For example, as shown in FIG. 6-B, when it is determined that the position of the parity block in the 0th column is A [3, 0], and the data block F4-1 in the position of the original A [3, 0] in the second matrix is moved A. After the [3, 1] position, the parity block P1 of the 0th column can be obtained according to the data block of the new 0th column: Fl-1, F2-1 and F3-1.
  • step 520 the storage device 110 inserts a parity block of the y column data block at a position of A [x, y] in the y column of the second matrix to obtain the first of the T rows. matrix.
  • the check block may be inserted at the position A [x, y] of the determined check block, so that the first matrix of the T line can be obtained. For example, a first matrix of (D+P) rows *M columns can be obtained. Since the parity block needs to be inserted in each column in the second matrix in the RAID organization mode without the independent parity disk, and the original data block in the position where the parity block is inserted needs to be moved backward in the row order, , The value of M in the obtained first matrix will be greater than the value of N in the second matrix.
  • the first RAID is organized in RAID5 and the risk block is symmetrically distributed to the left, it will be obtained when a check block is inserted in each column of the 4*5 second matrix shown in FIG. 6-A.
  • step 215 the storage device 110 respectively divides the data block of each column in the first matrix and the check block calculated according to the column data block into strips, and writes the disk that constructs the first RAID. in.
  • step 215 when each column of the data in the first matrix is written into the disk of the first RAID, the following situations may occur, and the processing may be separately performed.
  • the data block and the check block of the y column may be directly directly used.
  • y is one of the M columns of the first matrix.
  • the position of the y column without the data block may be filled. It is 0, and the data block and the check block of the filled y column are combined into one stripe and written into the disk of the first RAID.
  • y is listed as a column in the first matrix. For example, when the data is not filled in the fourth column of the first matrix as shown in FIG. 6-B, that is, the position of A [l, 4] is not written, the position of A [l, 4] can be filled. 0, then the data block and the check block in the 4th column are composed into a stripe and written into the disk, that is, the data block Fl-4, 0, F5-3 and the check block P5 are composed into a stripe and written into the disk. .
  • the method includes:
  • step 700 storage device 110 determines the number of data blocks that are missing in the y column.
  • step 705 the storage device 110 sequentially selects the number of data blocks from the M-1th column to the y+1th column of the first matrix to fill the position in the y column where there is no data block. .
  • the storage device 110 may sequentially order from the first A corresponding number of data blocks are selected from the M-1th column to the y+1th column in the matrix to be filled in the position of the y column where there is no data block. In other words, when it is determined that there is no location of data in the yth column of the first matrix, the storage device 110 may select a corresponding number of data block padding in the direction from the last column to the 0th column from the last column of the first matrix. The location where the data is missing in the y column.
  • the storage device 110 may select the data block F5-4 from the sixth column in the first matrix shown in FIG. 4-C to fill the position of the missing data block in the fifth column, that is, the first matrix A [ l, 6]
  • the position data F5-4 is filled to the position of A [0, 5].
  • the storage device 110 may arbitrarily select one of the data in the sixth column in the first matrix (ie, the data F5-4 and F4-5) as shown in FIG. 6-B to be filled into the fourth column A [1, 4]. position.
  • step 710 the storage device 110 updates the parity block of the y column according to the data block in the filled y column.
  • the storage device 110 needs to calculate and update the y column according to the determined check algorithm and all the data blocks in the filled y column in the first matrix.
  • Check block wherein, the value of y varies with the position of the missing data block in the first matrix. For example, as shown in FIG. 6-B, if the data F4-5 of the M-1 column shown in FIG. 6-B is filled into the yth column, the filled y column data can be as shown in FIG. 6-D. As shown in the data block in the yth column, it is necessary to recalculate and update the parity block P5 based on the data in the filled yth column: Fl-4, F4-5, and F5-3.
  • the storage device 110 can also select one data padding from the M-1 column.
  • the position where there is no data in the y+1th column, and the check block P6 is recalculated and updated based on the updated data 1-1 of the y+1 column, F1-5, F5-4, and F4-4.
  • step 715 the storage device 110 groups the data blocks and the check blocks of the y column into the T disks that construct the first RAID.
  • the storage device 110 may update the data block and check of the updated y column.
  • Block composition The strips are written into the ⁇ disks.
  • the method shown in FIG. 7 can save the same file while ensuring that the same file is stored in as few disks as possible. disk space.
  • the first matrix may be used.
  • the data in which the first RAID is not written is written in the second RAID. It can be understood that, when the data that is not written in the first RAID is written into the second RAID, if the second RAID is organized in the same manner as the first RAID, and the second RAID is the same as the number of member disks in the first RAID, For example, the first RAID and the second RAID are both RAID5, and the second RAID is the same as the number of disks in the first RAID.
  • the data in which the first matrix is not written in the first RAID may be written into the disk that constructs the second RAID according to the method of step 215. If the second RAID is organized differently than the first RAID, or the second RAID is different from the number of member disks in the first RAID, for example, the first RAID is RAID3 and the second RAID is RAID5. Then, it is necessary to re-write the remaining data blocks into the second RAID according to the above file processing method.
  • FIG. 8 is a flowchart of still another file processing method according to an embodiment of the present invention. This method can only be applied to the organization of RAID with independent school license plates. The method can also be performed by the storage device 110 shown in Figure 1-A. As shown in Figure 8, the method includes:
  • step 800 the storage device 110 receives the F files to be stored in the first RA I D .
  • step 805 the storage device 110 divides the F files into at least two data blocks according to the stripe size of the first RAID.
  • steps 800 and 805 For a description of steps 800 and 805, reference may be made to the related description of steps 200 and 205 in FIG. 2-A.
  • step 810 the storage device 110 arranges at least two data blocks obtained after the segmentation into an array.
  • the interval between two adjacent data blocks belonging to the same file (D-1) Location where the value of D is the number of data disks in the first RAID.
  • the first RAID is a RAID organization with a separate check disk, such as RAID3 or RAID4.
  • the interval between the two adjacent data blocks belonging to the same file requires (D-1) positions.
  • the value of D is the number of data disks in the first RAID.
  • the first RAID is the organization of RAID3.
  • the first RAID has 4 disks, Dl, D2 and D3 are data disks, and D4 is an independent parity disk.
  • the data blocks obtained by the segmentation can be arranged into an array as shown in FIG. Among them, there is one position between the data blocks F1-1 and F1-2 of the file F1, and one position between the data blocks F2-1 and F2-2 of the file F2, and so on.
  • step 815 the storage device 110 sequentially groups the D data blocks in the array and the P parity blocks calculated according to the D data blocks into a stripe, and writes the first RAID.
  • the value of P is the number of independent check disks in the first RAID.
  • the file can be written in parallel to the RAID, the file writing efficiency is ensured, and the same file can be stored in one disk. And the data blocks of different files form a stripe. When a file is damaged, the damaged file can be repaired according to other files, which ensures the security of file storage.
  • the file is stored in the disk on which the RAID is built by the file processing method shown in FIG. 2-A, FIG. 2-B or FIG. 8 described above. Because stored files are accessed less frequently in an archived scenario, the disk is typically hibernated or powered down for energy savings. When the file needs to be read, it can be read as described in Figure 10. FIG. 10 will be described below with reference to FIGS. 1-A and 1-B. The method includes:
  • step 225 the storage device 110 receives an access request of the host 100, and the access request is used to read a file stored in the RAID. Wherein the access request carries a read to be read The logical address of the file. It can be understood that the access request can also carry the file name of the file to be accessed.
  • the storage device 110 queries the physical address of the data block storing the file according to the logical address.
  • a mapping table of the correspondence between the physical address and the logical address of the data storage is constructed.
  • the storage device 110 can look up the mapping table according to the logical address carried in the access request to query the physical address of the data on the disk. It can be understood that in the RAID, a mapping table is established for the cache 120 and the data on the disk 130. When the physical address is queried, the mapping table of the cache 120 is usually queried first, and then the mapping table of the disk 130 is queried. If the data is in the cache, the data in the cache is returned directly to the host.
  • step 235 the storage device 110 determines a disk in which the file is stored based on the physical address.
  • a file can be stored in one disk, so in this step, the storage device 110 A disk that stores a file can be determined based on the physical address.
  • step 240 the storage device 110 returns the data block of the file stored in the disk to the host 100. Specifically, the storage device 110 can wake up a disk 130 where the file is located according to the physical address, and read data in the disk 130 according to the obtained physical address, and return the data to the host 100.
  • the disk and the cache 120 storing the metadata are always kept in a power-on state, so as to be able to respond to the host's access request in time.
  • the metadata is data describing the data stored in the RAID and its environment.
  • the metadata may include a mapping relationship between a logical address and a physical address.
  • the frequent power-on or power-off of the disk affects the energy-saving effect of the storage system and affects the disk life.
  • the disk can be classified.
  • a small number of high-performance disks are always powered on, and a large number of high-capacity disks enter a power-saving state.
  • the high-performance disk here refers to a disk with a low access latency or a high number of I/O operations per second (Input/Output Operat ions Per Second, IOPS), for example, a solid state disk.
  • a high-capacity disk is a disk with a relatively large capacity. After storage, files with higher access frequency can be migrated to a small number of reserved disks that are always powered on according to file access conditions. In order to effectively reduce the number of times the disk is powered on or awake, the response speed is improved.
  • an early warning mechanism and a protection mechanism may be provided in the storage system of the embodiment of the present invention.
  • the system counts the number of times that the disks in the RA ID are powered on and off. When the number of power-on and power-off times of a disk exceeds the preset threshold, the system prompts or alerts the system and can take some protection measures. .
  • the threshold set can be, for example, 10 times/day or 100 times/month.
  • the protection measure can be set to no longer power on or power off the disk within a set time, and so on.
  • the file processing apparatus 1100 includes:
  • the receiving module 1102 is configured to receive F files to be stored in the RAID, where the RAID is composed of T memories, F is a natural number not less than 2, and T is a natural number not less than 3;
  • a dividing module 1104 configured to divide the F files into at least two data blocks according to a stripe size of the RAID
  • the processing module 1106 is configured to obtain, according to the at least two data blocks, a first matrix of T rows, where data blocks belonging to the same file are located in the same row of the first matrix;
  • the writing module 1108 is configured to form a data block of each column in the first matrix and a parity block calculated according to the column data block into a T memory that constructs the RAID.
  • processing module 1106 is configured to:
  • the processing mode is specifically used to:
  • the processing module is specifically configured to:
  • a risk block of the y column data block is inserted at a position of A [X, y] in the y column of the second matrix to obtain a first matrix of the T row.
  • the writing module 1108 is specifically configured to:
  • the data block in the y column of the first matrix and the check block composed of the parity block calculated according to the data block of the y column are full of data, the data block of the y column and the school are The block is written into the T memories of the RAID, wherein the y column is one of the first matrix.
  • the writing module 1108 is specifically configured to:
  • the writing module 1108 is specifically configured to:
  • the position of the y column without the data block is Filling with 0, and writing the padded data block of the y column and the check block into a memory for constructing the first RAID, wherein the y column is among the first matrix a row.
  • the receiving module 1102 may be further configured to: receive an access request of the host, where the access request is used to read a file stored in the RAID, where the access The request carries the logical address of the file to be accessed;
  • the file processing device further includes:
  • the reading module 1110 is configured to query, according to the logical address, a physical address of a data block storing the file, determine a memory storing the file according to the physical address, and store the file stored in the memory The data block is returned to the host.
  • the file processing apparatus provided by the embodiment of the present invention may be disposed in the controller described in the foregoing embodiment, and is used to execute the file processing method described in the foregoing embodiments.
  • the file processing apparatus may be disposed in the controller described in the foregoing embodiment, and is used to execute the file processing method described in the foregoing embodiments.
  • each unit function refer to the method implementation. The description in the example will not be repeated here.
  • the file processing apparatus described in the embodiment of the present invention is capable of storing data belonging to the same file on one disk. Moreover, the file processing apparatus described in the embodiment of the present invention can write data blocks of different files into one strip and write them to the disk. When a data block is damaged, the file processing device can recover the damaged data block by using the check block in the same stripe and the data block of other files, thereby improving the security of the file storage. Further, when the file processing apparatus described in the embodiment of the present invention reads a file, only one disk storing the file needs to be woken up or powered on, and the data of the file is read from the disk and returned to the host without All disks in the RAID wake up or power up, thus achieving better energy savings.
  • An embodiment of the present invention further provides a computer program product for data processing, comprising: a computer readable storage medium storing program code, the program code comprising instructions for executing the method described in any one of the foregoing method embodiments Process.
  • a computer readable storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a random memory (Random-Acces s Memory, RAM), a solid state hard disk (SSD), or a non- Volatile memory (non-volat i le memory) And other non-t rans i tory machine readable media that can store program code.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules is only a logical function division.
  • there may be another division manner for example, multiple modules or components may be combined or Can be integrated into another device, or some features can be ignored, or not executed.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some communication interface, device or module, and may be in the form of an electrical, mechanical or other form.
  • modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple networks. On the unit. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

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)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Storage Device Security (AREA)

Abstract

本发明实施例提供了一种文件处理方法、装置和存储设备。在该方法中,存储设备通过将接收的F个文件划分为多个数据块,并根据所述多个数据块获得T行的第一矩阵。属于同一个文件的数据块位于所述第一矩阵的同一行中。存储设备再将所述第一矩阵中每一列的数据块和根据该列数据块计算获得的校验块组成分条,写入独立磁盘冗余阵列(Redundant Array of Independent Disks,RAID)中。通过该文件处理方法,存储设备能够确保文件存储的安全性的基础上将同一个文件写入RAID的一个存储器中,并能在读取文件时,达到了较好的节能效果。

Description

一种文件处理方法、 装置及存 殳备 技术领域
[0001] 本发明涉及通信技术领域, 尤其涉及一种文件处理方法、 装置及存 储设备。 背景技术
[0002] 独立磁盘冗余阵列(Redundant Array of Independent Di sks , RAID ), 又称廉价磁盘冗余阵列 (Redundant Array of Inexpens ive Di sks , RAID ), 简 称硬盘阵列。 RAID 的原理是通过将多个相对便宜的硬盘组合起来, 成为一个硬 盘阵列组, 使性能达到甚至超过一个价格昂贵、 容量巨大的硬盘, 并且配合数据 分散排列的设计, 提升数据的安全性。 根据选择的版本不同, RAID 与单颗硬盘 相比, 不仅能够增大存储容量, 还能够增强数据集成度以及数据的容错能力。 另 外, 磁盘阵列对于电脑来说, 看起来就像一个单独的硬盘或逻辑存储单元。
[0003] 在归档的场景下, 由于需要归档的文件很多。 现有技术中通常釆用 RAID来存储归档的文件,且为了提升数据的安全性,通常釆用带校验功能的 RAID 来存储归档的文件, 例如: RAID3、 RAID4、 RAID5或 RAID6等形式。 现有技术中 为了提升数据访问速度,通常将一个文件分割成若干数据块,将属于同一个文件 的多个数据块与校验块一起组成 RA I D的一个分条(s t r i pe)写入构建 RA I D的多个 磁盘中。 由于归档的文件被访问的频率较低, 因此, 为了达到节能的目的, 将文 件归档后,通常会将存储系统中的磁盘处于休眠或下电状态,在需要访问某个归 档的文件时, 才对存储该文件的数据块的多个磁盘进行唤醒或上电操作, 以读取 文件。 发明内容
[0004] 本发明实施例中提供的一种文件处理方法、 装置及存储设备, 能够 在确保文件存储的安全性的同时将同一个文件存储于 RAID的一个存储器中, 并 能够达到节能效果。 [0005] 第一方面, 本发明实施例提供一种文件处理方法, 包括:
接收待存储于独立磁盘冗余阵列(Redundant Array of Independent Di sks , RAID )中的 F个文件, 所述 RAID由 T个存储器组成, F为不小于 2的自然数, Τ为不小 于 3的自然数;
将所述 F个文件按照 RA I D的条带大小划分成至少两个数据块;
根据所述至少两个数据块获得 Τ行的第一矩阵, 其中, 属于同一个文件的数 据块位于所述第一矩阵的同一行中;
将所述第一矩阵中每一列的数据块和根据该列数据块计算获得的校验块组 成分条, 写入构建所述 RAID的 Τ个存储器中。 。
[0006] 在第一方面的第一种可能的实现方式中, 所述根据所述至少两个数 据块获得 τ行的第一矩阵包括:
将切分后获得的至少两个数据块排列为 D行的第二矩阵, 其中, 属于同一个 文件的数据块位于所述第二矩阵的同一行中, 所述 D为所述 RAID中的数据存储器 的数量;
分别在所述第二矩阵的每一列中插入校验块, 获得所述 T行的第一矩阵, 其 中,所述插入的校验块是根据所述第一矩阵中校验块所在列的数据块计算获得的。
[0007] 结合第一方面的第一种可能的实现方式, 在第二种可能的实现方式 中, 当所述 RAID中包括独立校验存储器时, 所述分别在所述第二矩阵的每一列 中插入校验块, 获得所述 T行的第一矩阵包括:
根据所述 R A I D中独立校验存储器的位置确定在所述第二矩阵中插入校验块 的位置;
根据所述 RA I D的校验算法分别对所述第二矩阵中每一列的数据块进行校验 计算, 获得每一列数据块的校验块;
根据确定的校验块的位置在第二矩阵的每一列中插入根据该列数据块计算 的校验块, 获得所述 T行的第一矩阵。
[0008] 结合第一方面的第一种可能的实现方式, 在第三种可能的实现方式 中, 所述 RAID中不包括独立校验存储器时, 所述分别在所述第二矩阵的每一列 中插入校验块, 获得 T行的第一矩阵包括:
确定在所述第二矩阵的各列中插入校验块的位置 A [ X , y] ,其中, 所述第二矩 阵具有 N列, x和 y均为整数, X的取值由 0递增到 D-l , y的取值由 0递增到 N-1 ; 将所述第二矩阵的 X行中 y列至 (N-1 ) 列的数据块顺序移动到 X行中(y+1)列 至 N列的位置;
根据所述 RAID的校验算法对所述 y列中的数据块进行校验计算, 获得所述 y 列数据块的校验块;
在所述第二矩阵的 y列中的 A [X, y]的位置插入所述 y列数据块的校险块,获得 所述 T行的第一矩阵。
[0009] 结合第一方面或者第一方面的第一种至第三种任意一种可能的实现 方式,在第四种可能的实现方式中, 所述将所述第一矩阵中每一列的数据块和根 据该列数据块计算获得的校验块组成分条, 写入构建所述 RAID的 T个存储器中 包括:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中写满数据时, 将所述 y列的数据块和所述校验块写入构建所述 RAID的 T个存储器中, 其中, 所述 y列为所述第一矩阵中的其中一列。
[0010] 结合第一方面或者第一方面的第一种至第三种任意一种可能的实现 方式, 在第五种可能的实现方式中, 所述第一矩阵具有 M列, 所述将所述第一矩 阵中每一列的数据块和根据该列数据块计算获得的校验块组成分条,写入构建所 述 RAID的 T个存储器中包括:
当所述第一矩阵的 y列中的数据块和根据所述 y列数据块计算获得的校验块 组成的分条中未写满数据时, 则确定所述 y列中缺少的数据块的数量, 其中, 所 述 y列为所述第一矩阵中的其中一列;
从所述第一矩阵的第 M-1列至第 y+1列中选择所述数量的数据块填充到所述 y 列中没有数据块的位置;
根据填充后的 y列中的数据块更新所述 y列的校验块;
将所述 y列的数据块和所述更新后的 y列的校验块组成分条写入构建所述 RAID的 T个存储器中。
[0011] 结合第一方面或者第一方面的第一种至第三种任意一种可能的实现 方式,在第六种可能的实现方式中, 所述将所述第一矩阵中每一列的数据块和根 据该列数据块计算获得的校验块组成分条, 写入构建所述 RAID的 T个存储器中 包括:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中未写满数据时,将所述 y列中没有数据块的位置填充为 0 , 并将填 充后的 y列的数据块和所述校验块组成分条写入构建所述 RAID的存储器中,其中, 所述 y列为所述第一矩阵中的其中一列。
[0012] 结合第一方面或者第一方面的第一种至第六种任意一种可能的实现 方式, 在第七种可能的实现方式中, 还包括:
接收主机的访问请求, 所述访问请求用于读取存储于所述 RAID中的文件, 所 述访问请求中携带有要访问的文件的逻辑地址;
根据所述逻辑地址查询存放所述文件的数据块的物理地址;
根据所述物理地址确定存储所述文件的一个存储器;
将存储于所述存储器中的所述文件的数据块返回给所述主机。
[0013] 第二方面, 本发明实施例提供一种文件处理方法, 包括:
接收待存储于独立磁盘冗余阵列(Redundant Array of Independent Di sks , RAID ) 中的 F个文件;
将所述 F个文件按照所述 RA I D的条带大小划分成至少两个数据块; 将切分后获得的至少两个数据块排列成一个数组,在所述数组中,属于同一 文件的相邻两个数据块之间间隔 D-1个位置, 其中, 所述 D的值为所述 RAID中的 数据存储器的数量;
顺序将所述数组中的 D个数据块以及根据所述 D个数据块计算获得的 P个校验 块组成分条, 写入构建所述 RAID的存储器中, 其中, 所述 P的值为所述 RAID中独 立校验存储器的数量。
[0014] 在第二方面的第一种可能的实现方式中, 还包括:
接收主机的访问请求, 所述访问请求用于读取存储于所述 RAID中的文件, 所 述访问请求中携带有要访问的文件的逻辑地址;
根据所述逻辑地址查询存放所述文件的数据块的物理地址;
根据所述物理地址确定存储所述文件的一个存储器;
将存储于所述存储器中的所述文件的数据块返回给所述主机。
[0015] 第三方面, 本发明实施例提供一种文件处理装置, 包括: 接收模块, 用于接收待存储于独立磁盘冗余阵列 (Redundant Array of Independent Di sks , RAID ) 中的 F个文件, 所述 RAID由 T个存储器组成, F为不小 于 2的自然数, Τ为不小于 3的自然数;
划分模块, 用于将所述 F个文件按照所述 RAID的条带大小划分成至少两个数 据块;
处理模块, 用于根据所述至少两个数据块获得 T行的第一矩阵, 其中, 属于 同一个文件的数据块位于所述第一矩阵的同一行中;
写入模块, 用于将所述第一矩阵中的每一列的数据块和根据该列数据块计 算获得的校验块组成分条, 写入构建所述 RAID的 T个存储器中。
[0016] 在第三方面的第一种可能的实现方式中, 所述处理模块具体用于: 将切分后获得的至少两个数据块排列为 D行的第二矩阵, 其中, 属于同一个 文件的数据块位于所述第二矩阵的同一行中, 所述 D为所述 RAID中的数据存储器 的数量;
分别在所述第二矩阵的每一列中插入校验块, 获得所述 T行的第一矩阵, 其 中,所述插入的校验块是根据所述第一矩阵中校验块所在列的数据块计算获得的。
[0017] 结合第三方面的第一种可能的实现方式, 在第二种可能的实现方式 中, 当所述 RAID中包括独立校验存储器时, 所述处理模块具体用于:
根据所述 R A I D中独立校验存储器的位置确定在所述第二矩阵中插入校验块 的位置;
根据所述 RA I D的校验算法分别对所述第二矩阵中每一列的数据块进行校验 计算, 获得每一列数据块的校验块;
根据确定的校验块的位置在第二矩阵的每一列中插入根据该列数据块计算 的校验块, 获得所述 T行的第一矩阵。
[0018] 结合第三方面的第一种可能的实现方式, 在第三种可能的实现方式 中, 当所述 RAID中不包括独立校验存储器时, 所述处理模块具体用于:
确定在所述第二矩阵的各列中插入校验块的位置 A [X, y] ,其中, 所述第二矩 阵具有 N列, X和 y均为整数, X的取值由 0递增到 D-l , y的取值由 0递增到 N-1 ; 将所述第二矩阵的 X行中 y列至 (N-1 ) 列的数据块顺序移动到 X行中(y+1)列 至 N列的位置; 根据所述 RAID的校验算法对所述 y列中的数据块进行校验计算, 获得所述 y 列数据块的校验块;
在所述第二矩阵的 y列中的 A [ X , y]的位置插入所述 y列数据块的校险块,获得 所述 T行的第一矩阵。
[0019] 结合第三方面或者第三方面的第一种至第三种任意一种可能的实现 方式, 在第四种可能的实现方式中, 所述写入模块具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中写满数据时, 将所述 y列的数据块和所述校验块写入构建所述 RAID的 T个存储器中, 其中, 所述 y列为所述第一矩阵中的其中一列。
[0020] 结合第三方面或者第三方面的第一种至第三种任意一种可能的实现 方式, 在第五种可能的实现方式中, 所述第一矩阵具有 M列, 所述写入模块具体 用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列数据块计算获得的校验块 组成的分条中未写满数据时, 则确定所述 y列中缺少的数据块的数量, 其中, 所 述 y列为所述第一矩阵中的其中一列;
从所述第一矩阵的第 M-1列至第 y+1列中选择所述数量的数据块填充到所述 y 列中没有数据块的位置;
根据填充后的 y列中的数据块更新所述 y列的校验块;
将所述 y列的数据块和所述更新后的 y列的校验块组成分条写入构建所述 RAID的 T个存储器中。
[0021] 结合第三方面或者第三方面的第一种至第三种任意一种可能的实现 方式, 在第六种可能的实现方式中, 所述写入模块具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中未写满数据时,将所述 y列中没有数据块的位置填充为 0, 并将填 充后的 y列的数据块和所述校验块组成分条写入构建所述 RAID的存储器中,其中, 所述 y列为所述第一矩阵中的其中一列。
[0022] 结合第三方面或者第三方面的第一种至第六种任意一种可能的实现 方式,在第七种可能的实现方式中,所述接收模块,还用于接收主机的访问请求, 所述访问请求用于读取存储于所述 RAID中的文件, 所述访问请求中携带有要访 问的文件的逻辑地址;
所述文件处理装置还包括:
读取模块, 用于根据所述逻辑地址查询存放所述文件的数据块的物理地址, 根据所述物理地址确定存储所述文件的一个存储器,并将存储于所述 RAID的一个 存储器中的所述文件的数据块返回给所述主机。
[0023] 第四方面, 本发明实施例提供了一种存储设备, 包括控制器和独立 磁盘冗余阵列 (Redundant Array of Independent Di sks , RAID ),
所述 RAID,用于存储文件;
所述控制器包括:
处理器、 存储器、 通信总线和通信接口, 所述处理器、 所述存储器和所述通 信接口通过所述通信总线连接并完成相互间的通信;
所述通信接口, 用于与主机及所述独立磁盘冗余阵列( Redundant Array of Independent Di sks , RAID )通信
所述存储器, 用于存储计算机执行指令;
所述处理器, 用于运行所述计算机执行指令,执行如第一方面或第二方面所 述的文件处理方法。
[0024] 第五方面, 本发明实施例提供了一种计算机程序产品, 包括存储了 程序代码的计算机可读存储介质,所述程序代码包括的指令用于执行如第一方面 或第二方面所述的文件处理方法。
[0025] 在本发明实施例中提供的文件处理方法中,存储设备通过将接收的 F 个文件划分为多个数据块, 并根据所述多个数据块获得 T行的第一矩阵。属于同 一个文件的数据块位于所述第一矩阵的同一行中。存储设备再将所述第一矩阵中 每一列的数据块和根据该列数据块计算获得的校验块组成分条存储在 RAID中, 从而可以使得属于同一个文件的数据块能够存储于所述 RAID的一个磁盘中。 并 且, 当一个文件损坏时,存储设备可以根据其他文件以及校验块对损坏的文件进 行恢复, 保证了文件存储的安全性。 进一步的, 在归档的场景下, 当需要访问 RAID中的文件时, 存储设备只需要对存储该文件的一个存储器进行唤醒及操作, 节能效果显著。 附图说明
[0026] 为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将 对实施例描述中所需要使用的附图作简单地介绍,显而易见地, 下面描述中的附 图仅仅是本发明的一些实施例。
[0027] 图 1-A为本发明实施例的一种文件处理方法的应用场景图;
[0028] 图 1-B为本发明实施例提供的一种存储设备 110的结构示意图;
[0029] 图 2-A为本发明实施例提供的一种文件处理方法的流程图;
[0030] 图 2-B为本发明实施例提供的又一种文件处理方法的流程图;
[0031] 图 3 为本发明实施例提供的一种文件处理方法中的校验块插入方法 的流程图;
[0032] 图 4-A、图 4-B以及图 4-C为本发明实施例提供的一种待存储文件数 据块的排列示意图;
[0033] 图 4-D为本发明实施例提供的一种文件存储结构示意图;
[0034] 图 5 为本发明实施例提供的文件处理方法中的又一种校验块插入方 法的流程图;
[0035] 图 6-A、图 6-B及图 6-D为本发明实施例提供的又一种待存储文件数 据块的排列示意图;
[0036] 图 6-C为本发明实施例提供的又一种文件存储结构示意图;
[0037] 图 7 为本发明实施例提供的一种文件处理方法中的将数据写入构建
RAID的磁盘中的方法流程图;
[0038] 图 8为本发明实施例提供的再一种文件处理方法的流程图;
[0039] 图 9为本发明实施例提供的再一种待存储文件数据块的排列示意图;
[0040] 图 10为本发明实施例提供的一种文件读取方法流程示意图;
[0041] 图 11为本发明实施例提供的一种文件处理装置的结构示意图。 具体实施方式
[0042] 为了使本技术领域的人员更好地理解本发明方案, 下面将结合本发 明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然, 所描述的实施例仅仅是本发明一部分的实施例, 而不是全部的实施例。 [0043] 如图 1-A所示, 图 1-A为本发明实施例的一种应用场景图,在图 1-A 所述的一种应用场景中,该存储系统包括主机 100、连接设备 105和存储设备 110。
[0044] 主机 100可以包括当前技术已知的任何计算设备, 如应用服务器、 台式计算机等等, 在主机 100 中安装有操作系统以及其他应用程序, 主机 100 可以有多个。
[0045] 连接设备 105 可以包括当前技术已知的存储设备和主机之间的任何 接口, 如光纤交换机, 或者其他现有的交换机。
[0046] 存储设备 110可以包括当前技术已知的存储设备, 如存储阵列、 磁 盘簇( Jus t a Bunch Of Di sks, JBOD )、 直接存取存储器( Direct Acces s Storage Device, DASD )的一个或多个互连的磁盘驱动器, 其中, 直接存取存储器可以包 括诸如磁带库、 一个或多个存储单元的磁带存储设备。
[0047] 图 1-B为本发明实施例提供的一种存储设备 110的结构示意图, 图 1-B所示的存储设备为一种存储阵列。 如图 1-B所示, 存储设备 110可以包括控 制器 115 以及磁盘阵列 125 , 其中, 这里的磁盘阵列指的是独立磁盘冗余阵列 ( Redundant Arrays of Independent Di sks , RAID ),磁盘阵列 125可以有多个, 磁盘阵列 125由多个磁盘 130构成。
[0048] 控制器 115 是存储设备 110 的 "大脑" , 主要包括处理器 (proces sor) 118、 緩存 ( cache ) 120、 存储器(memory) 122、 通信总线 (简称总 线) 126以及通信接口(Com醒 nicat ion Interface) 128。 处理器 118、緩存 120、 存储器 122以及通信接口 128通过通信总线 126完成相互间的通信。
[0049] 通信接口 128 , 用于与主机 100及磁盘阵列 125通信。
[0050] 存储器 122 , 用于存放程序 124 , 存储器 124可能包含高速 RAM存储 器, 也可能还包括非易失性存储器 (non-vola t i le memory ) , 例如至少一个磁 盘存储器。可以理解的是,存储器 124可以为随机存储器 (Random-Acces s Memory, RAM) ,磁碟、硬盘、 U盘、 移动硬盘、 光盘、 固态硬盘(Sol id State Di sk, SSD ) 或者非易失性存储器等各种可以存储程序代码的非短暂性的 (non-trans i tory ) 机器可读介质。
[0051] 程序 124可以包括程序代码, 所述程序代码包括计算机操作指令。
[0052] 緩存 120 ( Cache )用于緩存从主机 100接收的数据以及緩存从磁盘 阵列 125读取的数据, 以提高阵列的性能和可靠性。緩存 120可以是 RAM、 ROM, 闪存(Flash memory )或固态硬盘 ( Sol id State Di sk, SSD )等各种可以存储 数据的非短暂性的 (non-trans i tory )机器可读介质, 在此不做限定。
[0053] 处理器 118可能是一个中央处理器 CPU, 或者是特定集成电路 ASIC ( Appl icat ion Specif ic Integrated Circui t ), 或者是被配置成实施本发明实 施例的一个或多个集成电路。 在处理器 118中安装有操作系统和其他软件程序, 不同的软件程序可以视作一个处理模块, 具有不同的功能。 例如, 处理对磁盘 130的输入 /输出(Input/output , 1/0)请求, 对磁盘中的数据进行其他处理, 或 者修改存储设备中保存的元数据等等。从而使控制器 115可以实现 10操作、 RAID 管理功能, 还能够提供如快照、 镜像、 复制等各种的数据管理功能。 在本发明实 施例中, 处理器 118用于执行程序 124 , 具体可以执行下述方法实施例中的相关 步骤。
[0054] 结合图 1-A,任意一个存储设备 110均可以通过连接设备 105接收一 个或多个主机 100发送的多个文件,并将接收的多个文件分成多个数据块并存储 在构成磁盘阵列 125的多个磁盘 130中。任意一个存储设备 110也可以接收任意 一个主机 100发送的文件读取请求,根据文件读取请求将磁盘 130中存储的所述 文件的数据块返回给主机。
[0055] 需要说明的是, 磁盘 130仅仅是构建磁盘阵列 125的存储器的一种 示例,实际应用中,还可以在包含多个磁盘的机拒之间构建磁盘阵列等实施方式。 因此,本发明实施例中的存储器可以包括磁盘、固态硬盘(Sol id State Dr ives , SSD ), 由多个磁盘构成的机拒或服务器等装置, 在此不做限定。
[0056] 图 2-A为本发明实施例所示的一种文件处理方法的流程图, 该方法 可以由图 1-B所示的存储设备 110的控制器 115来执行,该方法可以应用于文件 归档的场景中, 如图 2-A所示, 该方法包括:
[0057] 在步骤 200中, 存储设备 110接收待存储在 RAID中的 F个文件, 其 中, F为不小于 2的自然数。 在本发明实施例中, 存储设备 110的控制器 115可 以接收一个或多个主机 100发送的文件存储请求,该文件存储请求用于请求将文 件存储于存储设备 110的第一 RA I D中, 第一访问请求中可以包含有待存储的 F 个文件。 所述第一 RAID中包含有 T个存储器, 且所述 T的值为不小于 3的自然 数。
[0058] 结合图 1-B所示, 在存储设备 110中可以包括多个 RAID。 本实施例 中所述的第一 RAID或第二 RAID是存储设备 110中包含的多个 RAID中的任意一 个,本发明实施例中的第一 RAID和第二 RAID仅仅只是对不同 RAID的一个区分。 同一个存储设备 110中包含的多个 RAID的组织形式可以相同, 例如, 第一 RAID 和第二 RAID都是 RAID5的组织形式。 当然, 同一个存储设备 110中包含的多个 RAID的组织形式也可以不同, 例如, 第一 RAID为 RAID3 , 第二 RAID为 RAID5。 在此并不限定。 可以理解的是, 实际操作中, 可以先将接收的 F个文件緩存在緩 存 120中, 对该 F个文件进行处理后再写入磁盘阵列 125中。
[0059] 在步骤 205中, 存储设备 110将所述 F个文件按照第一 RAID的条带 大小(s t r ip s ize)切分成至少两个数据块。 条带 (s t r ip )是一个盘区上的连续 地址块。 在磁盘阵列中, 控制器通常釆用条带将虚拟磁盘的块地址 ( b lock addres ses )映射到成员盘的块地址。条带也被称为分条元素( s t r ipe e lement )。 条带大小 (s t r ip s ize) , 有时也被叫做 b lock s ize, chunk s i ze 或者 granular i ty, 指的是写在每块磁盘上的条带数据块的大小。 通常, RAID的条带 大小一般在 2KB 到 512KB 之间(或者更大), 其数值是 1 的 n 次方, 即 2KB, 4KB, 8KB, 16KB 等。
[0060] 当将接收的文件按照第一 RAID的条带大小进行切分时, 如果有个文 件小于第一 RAID的条带大小的值, 可以将该文件作为一个数据块。 如果某个文 件切分后剩下的数据块小于条带大小的值,则将该文件剩下的数据作为一个数据 块。 例如, 如图 4-A所示, 控制器 115接收到 5个待存储的文件 Fl-F5。 按照 第一 RAID的条带大小进行切分后, 将文件 F1切分为 5个数据块: Fl-1、 Fl_2、 Fl-3、 F1-4和 Fl-5。 将文件 F2切分为 3个数据块: F2_l、 F2-2和 F2_3。 将文 件 F3切分为一个数据块: F3-l。将文件 F4切分为 5个数据块: F4-1、F4_2、F4_3、 F4-4和 F4-5。 将文件 F5切分为 4个数据块: F5- F5_2、 F5-3和 F5_4。
[0061] 在步骤 210中, 存储设备 110根据所述至少两个数据块获得 T行的 第一矩阵。其中,属于同一个文件的数据块位于所述第一矩阵的同一行中。并且, 在所述第一矩阵的每一列中包含有根据该列的数据块进行计算获得的校验块,所 述 T的值等于构建所述第一 RAID中的磁盘的数量。
[0062] 例如, 如果所述第一 RAID中共有 4块磁盘, 则可以根据上述切分后 的 F1-F5的文件的数据块获得 4行的第一矩阵,且属于同一个文件的数据块位于 所述第一矩阵的同一行中。如图 4-C所示,文件 F1的数据块 Fl-1、 Fl-2、 Fl_3、 F1-4和 F1-5均位于第一矩阵的第 0行中,文件 F2的数据块 F2_l、 F2_2、和 F2-3 均位于第二矩阵的第 1行中。
[0063] 具体在获得第一矩阵的过程中, 可以将第一个文件的第一个数据块 确定为第一矩阵的 A [0, 0]位置的数据块, 并判断第二数据块是否属于第一文件, 如果第二数据块属于第一个文件,则将第二个数据块与所述第一个数据块排列在 同一行,如果第二数据块不属于第一个文件, 则将第二数据块排列在第一个找到 的空行, 或将第二数据块排列在第二矩阵最短的行中。 依次类推, 直到将切分获 得的所有数据块排列完毕。 当然可以理解的是,还可以釆用其他的方法将切分获 得的数据块排列为第一矩阵,只要保证属于同一个文件的数据块位于矩阵的同一 行中即可, 在此不做限定。 排列后的 T行的第一矩阵具体可以如图 4-C或图 6-B 所示。
[0064] 在排列的 T行的第一矩阵中的每一列中包含有根据该列的数据块进 行计算获得的校验块, 例如, 在如图 4-C所示的第一矩阵中, 在第 0列中包含有 根据第 0列的数据块: Fl-1、 F2-1和 F3-1获得的校验块 P1 , 在第 1列中包含有 根据第 1列的数据块: Fl-2、 F2-2和 F3-2获得的校验块 P2。
[0065] 在本发明实施例中, 并不对文件在所述第一矩阵中的具体位置做限 定,也不对属于同一个文件的数据块之间的排列顺序做任何限定, 只要保证同一 个文件的数据块位于所述第一矩阵的同一行中即可。 实际应用中,可以将属于同 一个文件的数据块顺序排列在所述第一矩阵的同一行中。
[0066] 在步骤 215 中, 存储设备 110将所述第一矩阵中每一列的数据块和 根据该列数据块计算获得的校验块组成分条(s tr ipe) , 写入构建所述第一 RAID 的 T个存储器中。
[0067] 在获得第一矩阵后, 可以分别将第一矩阵中的每一列的数据块和根 据该列的数据块计算获得的校验块组成 RAID 中的一个分条写入构建第一 RAID 的磁盘中。 例如, 在一种情况下, 分别将图 4-C所示的第一矩阵中的每一列数据 块和根据该列的数据块计算获得的校验块组成分条写入磁盘中后, 形成如图 4-D 所示的存储结构。 其中, Fl-1、 F2- F3-1和 P1构成所述第一 RAID的一个分 条, Fl-2、 F2-2、 F3-2和 P2构成所述第一 RAID的另一个分条, 依次类推。 在 另一种情况下,分别将图 6-B所示的第一矩阵中的每一列数据块和根据该列的数 据块计算获得的校验块组成分条写入磁盘中后,可以形成如图 6 -C所示的存储结 构。需要说明的是,本发明实施例中描述的分条(s tr ipe)是指并行写入构建 RAID 的各个存储器上的数据块的集合, 其中, 分条中的各个数据块的大小相同, 且同 一个分条上的数据块位于各个存储器中的偏移位置相同。
[0068] 可以理解的是, 在实际应用中, 可以将图 4-C或图 6-B中所示的第 一矩阵中某一列数据块计算获得该列的校验块, 并在该列中插入校验块后,将该 列数据块和校验块组成一个分条存储在构建所述第一 RA I D的磁盘中。 也可以等 到该第一矩阵中每一列的校验块均计算完成后,再分别将第一矩阵中的每一列数 据块和根据该列数据块计算获得的校验块组成一个分条, 存储在构建所述第一 RAID的磁盘中。例如,可以先根据图 4-C所示的第一阵列中的第 0列数据 Fl-1、 F2-1和 F3-1计算获得校验块 P1后, 即将图 4-C中的第 0列数据 Fl- F2_l、 F3-1和 P1组成一个分条存储在构建第一 RAID的磁盘 D1-D4中。 也可以分别计 算获得所有校验块 P1-P7后,再分别将第一矩阵中的各列数据块和校验块组成分 条存储在磁盘 D1-D4中。 在此不做限定。
[0069] 由上述描述可知, 本发明实施例所述的文件处理方法, 通过将待存 储的文件进行切分、排列之后,再将属于不同文件的数据块组成分条存储在构建 第一 RA I D的磁盘中, 不仅保证了文件的写入效率, 并且可以使得属于同一个文 件的数据块能够存储一个磁盘中。 例如, 属于文件 F1的所有数据块均被存储于 磁盘 D1中, 属于文件 F2的所有数据块也均被存储于磁盘 D2中。 釆用本发明实 施例的方法将多个文件存储在 RAID中后。 当需要访问存储阵列中的某一个文件 时, 存储设备 110可以不用将整个 RAID中的磁盘均唤醒, 只需要唤醒存储有该 文件的一个磁盘, 并将该磁盘中的文件返回给主机,从而能够起到了较好节能效 果。 并且, 在本发明实施例的技术方案中, 如果某个数据块被损坏, 可以通过同 件存储的安全性。 [0070] 需要说明的是, 本发明实施例中描述的数据块是指由多个数据组成 的数据单元。本发明实施例中描述的校验块是指由校验数据组成的数据单元。本 发明实施例中描述的矩阵可以为包含多个由数据块组成的队列,还可以为包含多 个由数据块和校验块组成的队列。本发明实施例中的行是指包含有属于同一个文 件的所有数据块的一个队列。本发明实施例中的列是指与所述行处于垂直方向的 队列。换句话说,本发明实施例中定义的行并没有限定为只能是如通常矩阵中定 义的横向的队列。当普通矩阵中横向的队列中包含有属于同一个文件的数据块时, 可以将该横向队列(例如如图 4-C中的横向队列)称为本发明实施例中的行。 当 普通矩阵中纵向的队列中包含有属于同一个文件的数据块时,则将该纵向队列称 为本发明实施例中的行。 在此不做限定。
[0071] 图 2-B为本发明实施例提供的又一种文件处理方法的流程图, 该方 法可以由图 1-B所示的存储设备 110的控制器 115来执行,该方法可以应用于文 件归档的场景中, 如图 2-B所示, 该方法与图 2-A所示的方法类似, 其中, 步骤 207和步骤 209是对图 2-A所示方法中的步骤 210的详细描述。 如图 2-B所示, 该方法包括:
[0072] 在步骤 200中,存储设备 110接收待存储于第一 RAID中的 F个文件。 其中, F为不小于 2的自然数。 所述第一 RAID中包含有 T个存储器, 所述 T的 值为不小于 3的自然数。
[0073] 在步骤 205中, 存储设备 110将 F个文件按照第一 RAID的条带大小 切分为至少两个数据块。
[0074] 在步骤 207中, 存储设备 110将所述至少 1个数据块排列为 D行的 第二矩阵, 其中, 属于同一个文件的数据块位于所述第二矩阵的同一行中, 所述 D为所述第一 RAID中的数据盘的数量;
[0075] 在将文件进行切分得到多个数据块后, 可以将获得的多个数据块排 列为 D行 *N列的第二矩阵, 其中, D用于表示第二矩阵的行数, D的值由构建第 一 RAID的数据盘的数量来确定, N为正整数。 可以理解的是, 第一 RAID的数据 盘的数量需要根据第一 RAID的组织形式来确定。 例如, RAID3 中会包括数据盘 和 1个独立校验盘, RAID4中会包括数据盘和 1个独立校验盘。 而 RAID5中只有 数据盘, 没有独立校验盘。 D的值只需要根据第一 RAID中的数据盘的数量来确 定。 例如, 如果所述第一 RAID的组织形式为 RAID3, 且该第一 RAID总共有 4个 磁盘, 则数据盘的个数为 3个, 校验盘的个数为 1个, 因此该第二矩阵的行数为 3行, 可以排列成如图 4-B所示的第二矩阵。 如果所述第一 RAID的组织形式为 RAID5 , 且该第一 RAID总共有 4个磁盘, 则数据盘的个数为 4个, 校验盘的个数 为 0个, 则该第二矩阵的行数为 4行, 可以排列成如图 6-A所示的第二矩阵。
[0076] N用于表示第二矩阵的列数, N为正整数, N的值可以不用限定, 具 体可以根据数据块的多少来确定。可以理解的是,在将接收的多个待存储的文件 緩存在緩存 120中的情况下, N的大小可以根据緩存 120的大小来确定, N与所 述条带大小的乘积不大于緩存 120的容量。具体在排列第二矩阵的过程与上述图 2-A的步骤 210中描述的排列第一矩阵的方法类似, 在此不再赘述。
[0077] 需要说明的是, 本发明实施例中的数据盘只是存放数据块的数据存 储器的一种示例,本发明实施例中的独立校验盘也只是专门用于存储校验数据的 独立校验存储器的一种示例。本发明实施例中的数据存储器是指用于存储数据块 的存储器, 独立校验存储器是指专门用于存储校验块的存储器, 其中, 存储器包 括但不限于磁盘、 包含磁盘的机拒或服务器等装置。
[0078] 在本发明实施例中, 在具体排列数据块时, 必须保证属于同一个文 件的数据块位于所述第二矩阵的同一行中, 例如,如图 4-B所示,如果第一 RAID 为 RAID3的组织形式, 第一 RAID中有 3块数据盘, 则可以把文件 F1至 F5切分 后获得的数据块排成 3行 *7列的第二矩阵,文件 F1的数据块 Fl-l、Fl-2、Fl-3、 F1-4和 F1-5均位于第二矩阵的第 0行中,文件 F2的数据块 F2_l、 F2_2、和 F2-3 均位于第二矩阵的第 1行中, 文件 F5的数据块 F5-l、 F5-2、 F5-3和 F5-4也都 位于第二矩阵的第 1行中。
[0079] 在步骤 209 中, 存储设备 110分别在所述第二矩阵的各列中插入校 验块, 获得 T行的第一矩阵。
[0080] 其中, 所述第二矩阵的各列中插入的校验块是根据所述第一 RAID的 组织形式确定的校验算法对该列数据块进行计算获得的, 所述 T 的值与所述 D 的值的差值为所述第一 RAID中独立校验盘的数量。 例如, 所述 T行的第一矩阵 可以为(D+P)行 *M列的第一矩阵, 其中, 所述 P为所述第一 RAID中的校险盘的 数量, M为不小于 N的正整数, 且 M与所述条带大小的乘积不大于所述 RAID组 中单块磁盘的容量。
[0081] 存储设备 110的控制器 115可以根据第一 RAID的组织形式确定校验 算法(即校验块的计算方法), 并根据确定的校验算法计算第二矩阵的各列数据 块的校验块, 并在第二矩阵中分别插入各列数据块的校验块, 获得(D+P)行 *M列 的第一矩阵。其中 P为第一 RAID中的独立校验盘的数量,Μ的取值应该不小于 N, 且 Μ与所述条带大小的乘积不大于所述 RAID组中单块磁盘的容量。 可以理解的 是,在将接收的多个待存储的文件緩存在緩存 120中的情况下, 则 M与所述条带 大小的乘积也不会大于緩存 120的容量。
[0082] 可以理解的是, 实际操作中, 如果先将接收的多个文件緩存在临时 存储区 (即緩存 120 ) 中, 由于考虑到校验块还需要占用临时存储区的容量, 因 此, 可以设定在第二矩阵中插入校验块的条件。 例如, 可以设定当临时存储区的 数据量超过设定的阈值时, 在所述第二矩阵的各列中插入校验块。 当然, 还可以 设定当达到设定的存储时限时, 则在所述第二矩阵的各列中插入校验块。 其中, 存储时限是预先设定的需要将文件写入构建第一 RAID的磁盘的时限。 例如, 可 以规定 1小时存储一次, 则存储时限为 1小时。存储时限可以根据需要写入磁盘 的数据量等实际情况来确定, 可以 1天存储一次也可以 10分钟存储一次, 在此 不做限定。
[0083] 在步骤 209中, 当在第二矩阵中插入校验块时, 可以根据第一 RAID 的组织方式分别进行不同的处理。 具体可以参见如图 3和图 5的相关描述。
[0084] 在一种情形下, 当第一 RAID为带独立校险盘的 RAID组织形式时, 例如, 当第一 RAID为 RAID3或 RAID4时, 控制器 115可以按照图 3所示的方法 流程插入校验块。 如图 3所示, 该方法包括:
[0085] 在步骤 305中, 存储设备 110根据所述第一 RAID中独立校验盘的位 置确定在所述第二矩阵中插入校验块的位置。
[0086] 例如,如果第一 RAID为 RAID3, 则所述第一 RAID中有一个独立校验 盘。 如图 4-D所示, 如果所述第一 RAID中有 4块磁盘, 则可以将 Dl、 D2、 D3 和 D4中任意一块磁盘作为独立校险盘。 例如在如图 4-D所示的第一 RAID中将 D4 作为独立校验盘。 根据确定的独立校验盘的位置可以确定第二矩阵中插入校 验块的位置。 例如, 根据在如图 4-D所示的独立校验盘 D4的位置, 可以确定在 图 4-B所示的第二矩阵中最后一行的后面增加一行校验块。根据这种方式,如图 4-B所示的第二矩阵有 3行, 则在第二矩阵中增加第 4行来插入校验块。
[0087] 当然, 可以理解的是, 如果将 D2作为独立校验盘, 则在图 4-B所示 的第二矩阵中第一行数据与第二行数据之间插入一行作为校验块的位置, 使 3 行 *7列的第二矩阵变为 4行 *7列的第一矩阵。 上述对独立校验盘的位置的举例 并不用于对独立校验盘的位置的任何限定。
[0088] 在步骤 310中, 存储设备 110根据所述第一 RAID的校验算法分别对 所示第二矩阵中每一列的数据块进行校验计算, 获得每一列数据块的校验块。
[0089] 例如, 若所述第一 RAID的校验算法为奇偶校验算法, 则可以分别根 据奇偶校验算法对如图 4-B中所示的第二矩阵中的每一列数据进行校验计算,获 得每一列数据块的校验块。 例如, 根据图 4-B中第 0列数据 Fl-1、 F2-1和 F3-1 进行校验计算, 获得校验块 PL 对第 1列数据 Fl-2、 F2-2和 F4-1进行校验计 算获得校验块 P2。 需要说明的是, 在这个实施例中, 奇偶校验算法只是一种举 例, 并不对校验算法进行限制。 步骤 305和步骤 310的顺序并不做限定。
[0090] 在步骤 315 中, 存储设备 110根据确定的校验块的位置在第二矩阵 的每一列中插入根据该列数据块计算的校验块, 获得所述 τ行的第一矩阵。
[0091] 例如, 在对如图 4-B所示的第二矩阵中插入校险块后可以获得如图 4-C所示的 4行 *7列的第一矩阵,其中,ΡΙ是根据第二矩阵中第 0列数据 F1- F2-1和 F3-1计算获得的校验块, Ρ2是根据第二矩阵中第 1列数据 Fl_2、 F2-2 和 F4-1计算获得的校验块, 依次类推。
[0092] 在具有独立校验盘的情况下, 可以根据独立校验盘的数量确定在第 二矩阵的每一列中插入校验块的数量。 因此, 插入校验块之后, 会使第二矩阵的 行数发生变化, 而第二矩阵的列数不会变化。 换句话说, 如果第一 RAID为具有 独立校险盘的 RAID的组织方式, 则第一矩阵中 M的值等于第二矩阵中 N的值。
[0093] 在另一种情形下, 当第一 RAID为不带独立校险盘的 RAID组织形式 而是带分布式校验块的 RAID组织形式时, 例如, 当第一 RAID为 RAID5或 RAID6 时, 控制器 115可以按照图 5所示的方法流程插入校验块。 如图 5所示, 该方法 包括: [0094] 在步骤 505 中, 存储设备 110确定在所述第二矩阵的各列中插入校 验块的位置 A [x, y]。
[0095] 实际应用中, 可以才艮据所述第一 RAID的组织形式以及设置的所述第 一 RAID 中校验块的分布方式确定在所述第二矩阵的各列中插入校验块的位置 A[x, y]。 本领域人员可以知道, RAID5中校验块在磁盘上的分布方式可以为向左 对称 ( backward parity或 Lef t Synchronous )、 向左非对称 ( backward dynamic 或 Lef t Asynchronous )、 向右对称 (forward parity 或 Right Synchronous ) 或向右非对称 ( f orward dynamic 或 Right Asynchronous )。其中, "左"或 "右" 是指校验信息如何分布, 而 "对称" 或 "非对称" 是指数据如何分布。 在 "左" 的算法中,校验块从最后一个磁盘开始,每一个分条将校验块向靠近第一个磁盘 的方向移动一个磁盘的位置 (必要时重复循环分布)。 而 "右" 算法中, 校验块 从第一个磁盘开始,每一个分条将校验块向靠近最后一个磁盘的方向移动一个磁 盘的位置 (必要时重复循环分布)。 RAID6在 RAID5 的基础上又增加了一组校险 块。
[0096] 在不具有独立校验盘的 RAID组织方式中, 具体校验块在磁盘中如何 分布, 可以按照所述第一 RAID的组织方式和设置的校验块分布方式来确定。 例 如, 如果所述第一 RAID为 RAID5的组织方式, 且设置的校险块的分布方式为向 左对称分布, 则可以知道校验块在磁盘中是从最后一个磁盘开始,每一个分条将 校验块向靠近第一个磁盘的方向移动一个磁盘的位置进行分布。
[0097] 在本发明实施例中, 可以根据设置的所述第一 RAID中校验块的分布 方式确定在所述第二矩阵中插入校验块的位置 A [X, y]。其中, X为不小于 0且不 大于( D-1 )的整数, y为不小于 0且不大于( N-1 )的整数,即 0≤ X≤ (D— 1), 0≤ y < (N - 1), 且 X, y的取值随着校险块在所述第二矩阵的位置不同而变化, x的 取值由 0递增到( D-1 ), y的取值由 0递增到( N-1 )。 例如, 如果所述第一 RAID 为 RAID5 的组织方式, 且设置的校验块的分布方式为向左对称分布, 则在如图 6-A所示的第二矩阵中第 0列插入的校验块的位置为 A [3, 0],在第 1列插入校验 块的位置为 A [2, 1] ,在第 2列插入校验块的位置为 A[l, 2] ,在第 3列插入校验块 的位置为 A[0, 3]。 并从第 4列开始下一个循环, 即在第 4列插入校验块的位置 为 A [3, 4] ,在第 5列插入校验块的位置为 A [2, 5] ,依此类推。具体可以如图 6-B 中所示的 P1-P7所示的位置。
[0098] 在步骤 510中,存储设备 110将所述第二矩阵的 X行中 y列至( N-1 ) 列的数据顺序移动到 X行中(y+l)列至 N列的位置。
[0099] 确定了在所述第二矩阵的各列中插入校验块的位置 A [x,y]后, 需要 将第二矩阵的 X行中 y列至(N-1 ) 列的数据块顺序移动到 X行中(y+l)列至 N 列的位置, 即需要将第二矩阵中 X行中原 A[x,y]至 A[x,N-l]位置的所有数据块 均向右移动一位, 顺序移动到 A [X, y+l]至 A [χ,Ν]的位置。 例如, 当确定在如图 6-Α所示的第二矩阵中第 0列插入的校验块的位置为 A [3, 0]时,需要将第二矩阵 中第 3行 A[3, 0]至 A[3, 4]位置的所有数据块均向后移动一位,顺序移动到 A[3, 1] 至 A[3, 5]的位置。 根据这种方式可以将原 A[3, 0]位置的数据块 F4-1 移动到 A[3, 1], 将原 A[3, 1]位置的数据块 F4-2移动到 A[3,2],依此类推。 其中, x, y 的取值随着校验块在所述第二矩阵的位置不同而变化,每确定一个校验块的位置 A[x,y] , 均需要将 X行中原 A[x,y]至 A[x,N-l]位置的所有数据块均向后移动一 位。 本发明实施例并不对每一列数据块的校验块的个数进行限定。
[00100] 在步骤 515中, 存储设备 110根据所述第一 RAID的校验算法对所述 y列中的数据块进行校验计算, 获得所述 y列数据块的校验块。
[00101] 当确定校验块的位置为 A[x, y] ,且将所述第二矩阵的 X行中 y列至
( N-1 )列的数据块顺序移动到 X行中(y+l)列至 N列的位置后,可以根据所述第 一 RAID的校验算法对 y列的数据块进行校验计算, 获得 y列数据块的校验块。 该校验块即为需要插入 A [x,y]位置的校验块。 例如, 如图 6-B所示, 当确定第 0 列的校验块的位置为 A [3, 0] ,并将第二矩阵中原 A [3, 0]位置的数据块 F4-1移动 A [3, 1]位置之后, 可以根据新的第 0列的数据块: Fl-1, F2-1和 F3-1计算获得 第 0列的校验块 Pl。
[00102] 在步骤 520中, 存储设备 110在所述第二矩阵的 y列中的 A [x,y]的 位置插入所述 y列数据块的校验块, 获得所述 T行的第一矩阵。
[00103] 当计算获得校验块后, 可以在确定的校验块的位置 A [x, y]处插入校 验块, 从而能够获得 T行的第一矩阵。 例如可以获得(D+P)行 *M列的第一矩阵。 由于在不具有独立校验盘的 RAID组织方式中, 需要在第二矩阵中的每一列中插 入校验块, 并且需要将插入校验块的位置的原数据块按行顺序向后移动, 因此, 获得的第一矩阵中 M的值会大于第二矩阵中 N的值。 例如, 如果第一 RAID的组 织方式为 RAID5 , 且校险块为向左对称分布, 则当在图 6-A所示的 4*5的第二矩 阵的每一列中插入校验块后会得到一个如图 6-B所示的 4*7列的第一矩阵。
[00104] 在步骤 215 中, 存储设备 110分别将所述第一矩阵中每一列的数据 块和根据该列数据块计算获得的校验块组成分条, 写入构建所述第一 RAID的磁 盘中。 在实际应用中, 在步骤 215中, 将第一矩阵中的各列数据块按分条写入构 建第一 RAID的磁盘中时, 会出现下面几种情况, 可以分别进行处理。
[00105] 在一种情形下, 当所述第一矩阵的 y列中的数据块和校险块组成的 分条中写满数据时, 可以直接将所述 y 列的数据块和校验块写入构建所述第一 RAID的磁盘中, 其中 y列为所述第一矩阵的 M列中的其中一列。 例如, 当如图 6-B中第 0列写满数据时,即第 0列的数据块和校验块组成的分条中写满数据时, 将第 0列的数据块和校验块组成一个分条写入磁盘中。
[00106] 在另一种情形下, 如果所述第一矩阵中第 y列中的数据块和校险块 组成的分条中未写满数据时, 可以将 y列中没有数据块的位置填充为 0, 并将填 充后的 y列的数据块和校验块组成一个分条写入构建所述第一 RAID的磁盘中。 其中, y列为所述第一矩阵中的某一列。 例如, 当如图 6-B所示的第一矩阵中第 4列中未写满数据时, 即 A [l, 4]的位置没有写数据, 则可以将 A [l, 4]的位置填 充为 0, 然后将第 4列中的数据块和校验块组成一个分条写入磁盘中, 即将数据 块 Fl-4、 0、 F5-3和校验块 P5组成一个分条写入磁盘中。
[00107] 在又一种情形下, 如果所述第一矩阵的 y列中的数据块和校险块组 成的分条中未写满数据时, 如果已达到存储时限, 且没有再接收到其他文件, 则 可以通过图 7所述的方法进行处理。 如图 7所示,该方法包括:
[00108] 在步骤 700中,存储设备 110确定所述 y列中缺少的数据块的数量。
[00109] 例如, 在如图 4-C所示的第一矩阵的第 5列中的数据块和校险块组 成的分条中未写满数据。 例如, 即在第 5列中存在没有写数据的位置 A [0, 5] , 又如, 在如图 6-B所示的第一矩阵的第 y列 (y=4 ) 中也存在没有写数据的位置 A [l, 4]。 如果此时到达存储时限, 则可以确定如图 4-C 所示的第一矩阵中第 5 列中缺少的数据块的数量为 1 , 在如图 6-B所示的第一矩阵中第 4列缺少的数据 块的数量也为 1。 [00110] 在步骤 705中, 存储设备 110顺序从所述第一矩阵的第 M-1列至第 y+1列中选择所述数量的数据块填充到所述 y列中没有数据块的位置。
[00111] 如果 y列中存在没有写数据的位置, 且已到达存储时限, 存储设备 110又没有从主机接收到其他待存储文件, 则为了节省磁盘的存储空间, 存储设 备 110可以顺序从第一矩阵中第 M-1列至第 y+1列中选择相应数量的数据块填充 到 y列中没有数据块的位置。换句话说, 当确定第一矩阵中第 y列中存在没有数 据的位置时,存储设备 110可以从第一矩阵的最后一列开始按照从最后一列到第 0列的方向选择相应数量的数据块填充到第 y列中缺少数据的位置。
[00112] 例如, 存储设备 110可以从图 4-C所示的第一矩阵中第 6列中选择 数据块 F5-4填充到第 5列中缺少数据块的位置, 即将第一矩阵中 A [l , 6]位置的 数据 F5-4填充到 A [0, 5]的位置。 存储设备 110可以从如图 6-B所示的第一矩阵 中第 6列的数据(即数据 F5-4和 F4-5 )中任意选择一个数据填充到第 4列 A [1 , 4] 的位置。
[00113] 在步骤 710中, 存储设备 110根据填充后的 y列中的数据块更新所 述 y列的校验块。
[00114] 由于将 y 列中没有数据的位置填充了新的数据, 因此存储设备 110 需要根据确定的校验算法以及第一矩阵中填充后的 y 列中的所有数据块计算并 更新 y列的校验块。 其中, y的取值随着第一矩阵中缺少数据块的位置的不同而 变化。 例如, 如图 6-B所示, 如果将图 6-B所示的 M-1列的数据 F4-5填充到第 y列中后, 填充后的 y列数据可以如图 6-D所示的第 y列中的数据块所示, 需要 根据填充后的第 y列中的数据: Fl-4、 F4-5和 F5-3重新计算并更新校验块 P5。 可以理解的是,由于如图 6-B所示的第一矩阵中第 y+1列也存在 1个没有数据的 位置,因此存储设备 110也可以从第 M-1列中选择 1个数据填充到第 y+1列中没 有数据的位置, 并根据更新后的 y+1列的数据 Fl-5、 F5-4和 F4-4重新计算并更 新校验块 P6。
[00115] 在步骤 715中, 存储设备 110将所述 y列的数据块和校验块组成分 条, 写入构建所述第一 RAID的 T个磁盘中。
[00116] 当第一矩阵的 y列中缺少数据块的位置被填充上新的数据块, 并更 新 y列的校验块后,存储设备 110可以将更新后的 y列的数据块和校验块组成一 个分条写入所述 τ个磁盘中。
[00117] 可以理解的是, 当釆用图 7 所示的方法后第一矩阵中依然存在没有 数据的位置时,如果已到达存储时限,可以将没有数据的数据块填充为 0后再写 入磁盘, 具体可参见前面的描述, 在此不再赘述。 本领域人员可以知道, 将没有 数据的数据块填充为 0用于表示该数据块没有使用。
[00118] 由上述描述可知, 在将第一矩阵中的数据块写入磁盘中时, 釆用如 图 7所示的方法在保证同一个文件被存储在尽量少的磁盘中的同时,可以节省磁 盘空间。
[00119] 在又一种情形下, 文件通过釆用图 2-A或图 2-B所述的方法进行存 储时, 如果达到存储时限且第一 RAID已经被存满时, 可以将第一矩阵中未写入 第一 RAID的数据写入第二 RAID中。 可以理解的是, 在将第一 RAID未写完的数 据写入第二 RAID时, 如果第二 RAID与第一 RAID的组织方式相同, 且第二 RAID 与第一 RAID中的成员盘数相同, 例如, 第一 RAID和第二 RAID均为 RAID5 , 且 第二 RAID与第一 RAID中的磁盘数量相同。可以将所述第一矩阵未写入所述第一 RAID中的数据按照步骤 215的方法写入构建第二 RAID的磁盘中。如果第二 RAID 与第一 RAID的组织方式不同, 或第二 RAID与第一 RAID中的成员盘数不同, 例 如第一 RAID为 RAID3, 第二 RAID为 RAID5。 则需要重新才艮据上述文件处理方法 将剩余的数据块写入第二 RAID中。
[00120] 图 8 为本发明实施例描述的又一种文件处理方法的流程图。 该方法 只能应用于具有独立校险盘的 RAID的组织方式中。 该方法也可以由图 1-A中所 示的存储设备 110来执行。 如图 8所示, 该方法包括:
[00121] 在步骤 800中,存储设备 110接收待存储于第一 RA I D中的 F个文件。
[00122] 在步骤 805中, 存储设备 110将所述 F个文件按照所述第一 RAID的 条带大小切分成至少两个数据块。
[00123] 步骤 800与步骤 805的相关描述可以参见图 2-A中步骤 200和步骤 205的相关描述。
[00124] 在步骤 810中, 存储设备 110将切分后获得的至少两个数据块排列 成一个数组。 在所述数组中, 属于同一文件的相邻两个数据块之间间隔 (D-1 ) 个位置, 其中, D的值为所述第一 RAID中的数据盘的数量。
[00125] 具体的, 在排列时, 需要根据第一 RAID 的组织方式以及第一 RAID 中的数据盘的数量进行确定。如果第一 RAID为带独立校验盘 RAID组织方式, 例 如 RAID3或 RAID4。 则在排列的数组中, 属于同一文件的相邻两个数据块之间需 要间隔(D-1 )个位置。其中, D的值为所述第一 RAID中的数据盘的数量。例如, 结合图 4-D所示, 第一 RAID为 RAID3的组织方式。 其中, 第一 RAID中有 4块磁 盘, Dl、 D2和 D3为数据盘, D4为独立校验盘。 可以将切分获得的数据块排列为 如图 9所示的数组。其中,文件 F1的数据块 F1-1和 F1-2之间间隔有 1个位置, 文件 F2的数据块 F2-1和 F2-2之间也间隔有 1个位置, 依此类推。
[00126] 在步骤 815中, 存储设备 110顺序将所述数组中的 D个数据块以及 根据所述 D个数据块计算获得的 P个校验块组成分条, 写入构建所述第一 RAID 的磁盘中。 其中所述 P的值为所述第一 RAID中独立校验盘的数量。
[00127] 具体的, 在将数据块存储在构建第一 RAID的磁盘的过程中, 需要根 据第一 RAID的校验算法对从数组中顺序选取的 D个数据进行校验计算, 获得 P 个校验块。顺序将 D个数据以及计算获得的 P个校验块组成分条, 写入构建第一 RAID 的磁盘中。 本领域人员可以知道, 在将校验块写入磁盘时时, 需要将校验 块写入第一 RAID中独立校验盘中。 例如, 将图 9所述的第一数组中的数据写入 磁盘后可以得到如图 4-D所述的存储结构。
[00128] 釆用图 8所述的文件处理方法, 能够使文件并行写入 RAID, 保证了 文件写入的效率, 并且能保证同一个文件被存储在一个磁盘中。并且不同的文件 的数据块构成一个分条, 当一个文件被损坏时,可以才艮据其他文件对损坏的文件 进行修复, 保证了文件存储的安全性。
[00129] 在本发明实施例中,通过上述图 2-A、 图 2-B或图 8所示的文件处理 方法将文件存储于构建 RAID的磁盘中后。 由于在归档的场景下, 存储的文件被 访问的频率较低, 因此, 为了达到节能目的, 通常会将磁盘进行休眠或下电。 在 需要读取文件时, 可以按照图 10所述的方法进行读取。 下面结合图 1-A、 图 1-B 对图 10进行描述。 该方法包括:
[00130] 在步骤 225中, 存储设备 110接收主机 100的访问请求, 所述访问 请求用于读取存储于所述 RAID中的文件。 其中, 所述访问请求中携带有要读取 的文件的逻辑地址。可以理解的是,访问请求中还可以携带要访问的文件的文件 名。
[00131] 在步骤 230中, 存储设备 110根据所述逻辑地址查询存放所述文件 的数据块的物理地址。 通常, 存储设备 110存储数据之后, 会构建一个数据存储 的物理地址与逻辑地址对应关系的映射表。 当接收到读取文件的访问请求后,存 储设备 110可以根据访问请求中携带的逻辑地址查映射表,以查询所述数据在磁 盘上的物理地址。 可以理解的是, 在 RAID中, 对緩存 120以及磁盘 130上的数 据都会建立映射表。 查询物理地址时, 通常会先查询緩存 120的映射表, 再查询 磁盘 130的映射表。 如果数据在緩存中, 则会直接将緩存中的数据返回给主机。
[00132] 在步骤 235 中, 存储设备 110根据所述物理地址确定存储所述文件 的一个磁盘。 由于在本发明实施例中,通过上述实施例中所述的文件处理方法将 文件存储于构建 RAID的磁盘中后, 能够使一个文件被存储于一个磁盘中, 因此 在本步骤中, 存储设备 110能够根据物理地址确定存储文件的一个磁盘。
[00133] 在步骤 240中, 存储设备 110将存储于所述磁盘中的所述文件的数 据块返回给所述主机 100。 具体的, 存储设备 110可以根据所述物理地址唤醒所 述文件所在的一个磁盘 130 , 将并根据获得的物理地址读取磁盘 130 中的数据, 将数据返回给主机 100。
[00134] 在本发明实施例中, 由于文件是按照图 2-A、 图 2-B或图 8所示的方 法存储的, 因此属于同一个文件的数据都被存储在尽可能少的磁盘中。 因此, 在 读取文件时, 只需要唤醒存储该文件的一个磁盘, 并从唤醒的一个磁盘中读取该 文件的数据返回给主机。 从而无需唤醒构建整个 RAID的所有磁盘, 节能效果显 著。
[00135] 本领域人员可以理解的是, 在本发明实施例中, 存放元数据的磁盘 以及緩存 120始终是保持上电状态的,以便于能对主机的访问请求做出及时的响 应。 其中, 本领域人员可以知道, 元数据是描述 RAID中存储的数据及其环境的 数据, 例如元数据中可以包含逻辑地址与物理地址的映射关系。
[00136] 由于磁盘频繁的上电或下电会影响存储系统的节能效果, 同时会影 响磁盘寿命。 为了避免磁盘被频繁的上电或下电, 在实际应用中, 可以将磁盘进 行分级。将少量高性能磁盘始终保持上电状态,大量的高容量磁盘进入节能状态。 其中, 这里的高性能磁盘指访问时延较低或每秒进行读写 ( I/O )操作的次数 (Input/Output Operat ions Per Second, IOPS )较高的磁盘, 例如, 固态硬盘
( Sol id State Di sk, SSD )。 高容量磁盘是指容量比较大的磁盘。 存储后, 可以 根据文件访问情况,将访问频率较高的文件迁移到预留的少量始终上电的磁盘中。 以有效减少磁盘被上电或唤醒的次数, 提升响应速度。
[00137] 进一步的, 为了避免磁盘的频繁上电和下电, 在本发明实施例的存 储系统中还可以提供预警机制和保护机制。 通过统计 RA I D中各磁盘累计上电和 下电的次数, 当预定时间内某个磁盘的上电和下电次数超过预设的阈值时, 系统 进行提示或告警, 并可以釆取一些保护措施。 其中, 设置的阈值例如可以为 10 次 /天或 100次 /月。保护措施可以设置为在设定的时间内不再对该磁盘进行上电 或下电操作等等, 在此不做限定。
[00138] 图 11为本发明实施例一种文件处理装置的结构示意图, 如图 11所 示, 文件处理装置 1100包括:
接收模块 1102 , 用于接收待存储于 RAID中的 F个文件, 所述 RAID由 T个存储器 组成, F为不小于 2的自然数, T为不小于 3的自然数;
划分模块 1104 , 用于将所述 F个文件按照所述 RAID的条带大小划分成至少两 个数据块;
处理模块 1106 , 用于根据所述至少两个数据块获得 T行的第一矩阵, 其中, 属于同一个文件的数据块位于所述第一矩阵的同一行中;
写入模块 1108 , 用于将所述第一矩阵中的每一列的数据块和根据该列数据 块计算获得的校验块组成分条, 写入构建所述 RAID的 T个存储器中。
[00139] 具体的, 所述处理模块 1106用于:
将切分后获得的至少两个数据块排列为 D行的第二矩阵, 其中, 属于同一个 文件的数据块位于所述第二矩阵的同一行中, 所述 D为所述 RAID中的数据存储器 的数量;
分别在所述第二矩阵的每一列中插入校验块, 获得所述 T行的第一矩阵, 其 中,所述插入的校验块是根据所述第一矩阵中校验块所在列的数据块计算获得的。
[00140] 在一种情形下, 当所述 RAID中包括独立校验存储器时, 所述处理模 块具体用于:
根据所述 R A I D中独立校验存储器的位置确定在所述第二矩阵中插入校验块 的位置;
根据所述 RAI D的校验算法分别对所述第二矩阵中每一列的数据块进行计算, 获得每一列数据块的校验块;
根据确定的校验块的位置在第二矩阵的每一列中插入根据该列数据块计算 的校验块, 获得所述 T行的第一矩阵。
[00141] 在另一种情形下, 当所述 RAID中不包括独立校验存储器时, 所述处 理模块具体用于:
确定在所述第二矩阵的各列中插入校验块的位置 A [X, y] ,其中, 所述第二矩 阵具有 N列, X和 y均为整数, X的取值由 0递增到 D-l , y的取值由 0递增到 N-1 ; 将所述第二矩阵的 X行中 y列至 (N-1 ) 列的数据块顺序移动到 X行中(y+1)列 至 N列的位置;
根据所述 RAID的校验算法对所述 y列中的数据块进行校验计算, 获得所述 y 列数据块的校验块;
在所述第二矩阵的 y列中的 A [X, y]的位置插入所述 y列数据块的校险块,获得 所述 T行的第一矩阵。
[00142] 在一种情形下, 所述写入模块 1108具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中写满数据时, 将所述 y列的数据块和所述校验块写入构建所述 RAID的 T个存储器中, 其中, 所述 y列为所述第一矩阵中的其中一列。
[00143] 在另一种情形下, 所述写入模块 1108具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列数据块计算获得的校验块 组成的分条中未写满数据时, 则确定所述 y列中缺少的数据块的数量, 其中, 所 述 y列为所述第一矩阵中的其中一列;
从所述第一矩阵的第 M-1列至第 y+1列中选择所述数量的数据块填充到所述 y 列中没有数据块的位置;
根据填充后的 y列中的数据块更新所述 y列的校验块;
将所述 y列的数据块和所述更新后的 y列的校验块组成分条写入构建所述 RAID的 T个存储器中。
[00144] 在又一种情形下, 所述写入模块 1108具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中未写满数据时,将所述 y列中没有数据块的位置填充为 0, 并将填 充后的 y列的数据块和所述校验块组成分条写入构建所述第一 RAID的存储器中, 其中, 所述 y列为所述第一矩阵中的其中一列。
[00145] 进一步的, 在又一种情形下, 所述接收模块 1102 , 还可以用于: 接 收主机的访问请求, 所述访问请求用于读取存储于所述 RAID中的文件, 所述访 问请求中携带有要访问的文件的逻辑地址;
所述文件处理装置还包括:
读取模块 1110 , 用于根据所述逻辑地址查询存放所述文件的数据块的物理 地址,根据所述物理地址确定存储所述文件的一个存储器, 并将存储于所述存储 器中的所述文件的数据块返回给所述主机。
[00146] 本发明实施例所提供的文件处理装置, 可以设置于前面实施例所描 述的控制器中, 用于执行前面实施例所描述的文件处理方法,各个单元功能的详 细描述可参见方法实施例中的描述, 在此不再赘述。
[00147] 本发明实施例描述的文件处理装置, 能够将属于同一个文件的数据 能够被存储于一个磁盘中。并且,本发明实施例描述的文件处理装置能够将不同 文件的数据块构成一个分条写入磁盘。 当某个数据块被损坏时, 文件处理装置可 以通过同一个分条中的校验块和其他文件的数据块对损坏的数据块进行恢复,提 高了文件存储的安全性。进一步的,本发明实施例描述的文件处理装置在读取文 件时, 只需要将存储该文件的一个磁盘唤醒或上电, 并从该磁盘中读取该文件的 数据返回给主机, 而无需对 RAID中的所有磁盘进行唤醒或上电, 因此达到了较 好的节能效果。
[00148] 本发明实施例还提供一种数据处理的计算机程序产品, 包括存储了 程序代码的计算机可读存储介质,所述程序代码包括的指令用于执行前述任意一 个方法实施例所述的方法流程。本领域普通技术人员可以理解, 前述的存储介质 包括: U盘、移动硬盘、磁碟、光盘、随机存储器 (Random-Acces s Memory, RAM)、 固态硬盘( Sol id State Di sk, SSD )或者非易失性存储器( non-volat i le memory ) 等各种可以存储程序代码的非短暂性的 (non-t rans i tory )机器可读介质。
[00149] 在本申请所提供的几个实施例中, 应该理解到, 所揭露的装置和方 法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的, 例如, 所述模块的划分, 仅仅为一种逻辑功能划分, 实际实现时可以有另外的划 分方式, 例如多个模块或组件可以结合或者可以集成到另一个设备中,或一些特 征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间的耦合或直接耜合或 通信连接可以是通过一些通信接口, 装置或模块的间接耦合或通信连接,可以是 电性, 机 ^¾或其它的形式。
[00150] 所述作为分离部件说明的模块可以是或者也可以不是物理上分开的, 作为模块显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方,或 者也可以分布到多个网络单元上。可以才艮据实际的需要选择其中的部分或者全部 , 模块来实现本实施例方案的目的。
[00151] 另外, 在本发明各个实施例中的各功能模块可以集成在一个处理模 块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个 模块中。
[00152] 最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而 非对其限制; 尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通 技术人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改,或 者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并不使相 应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims

权 利 要 求
1、 一种文件处理方法, 其特征在于, 包括:
接收待存储于独立磁盘冗余阵列(Redundant Array of Independent Di sks , RAID )中的 F个文件, 所述 RAID由 T个存储器组成, F为不小于 2的自然数, Τ为不小 于 3的自然数;
将所述 F个文件按照 RA I D的条带大小划分成至少两个数据块;
根据所述至少两个数据块获得 Τ行的第一矩阵, 其中, 属于同一个文件的数 据块位于所述第一矩阵的同一行中;
将所述第一矩阵中每一列的数据块和根据该列数据块计算获得的校验块组 成分条, 写入构建所述 RAID的 Τ个存储器中。
2、根据权利要求 1所述的方法, 其特征在于, 所述根据所述至少两个数据块 获得 T行的第一矩阵包括:
将切分后获得的至少两个数据块排列为 D行的第二矩阵, 其中, 属于同一个 文件的数据块位于所述第二矩阵的同一行中, 所述 D为所述 RAID中的数据存储器 的数量;
分别在所述第二矩阵的每一列中插入校验块, 获得所述 T行的第一矩阵, 其 中,所述插入的校验块是根据所述第一矩阵中校验块所在列的数据块计算获得的。
3、根据权利要求 2所述的文件处理方法, 其特征在于, 当所述 RAID中包括独 立校验存储器时, 所述分别在所述第二矩阵的每一列中插入校验块, 获得所述 T 行的第一矩阵包括:
根据所述 R A I D中独立校验存储器的位置确定在所述第二矩阵中插入校验块 的位置;
根据所述 RA I D的校验算法分别对所述第二矩阵中每一列的数据块进行校验 计算, 获得每一列数据块的校验块;
根据确定的校验块的位置在第二矩阵的每一列中插入根据该列数据块计算 的校验块, 获得所述 T行的第一矩阵。
4、根据权利要求 2所述的文件处理方法, 其特征在于, 当所述 RAID中不包括 独立校验存储器时, 所述分别在所述第二矩阵的每一列中插入校验块, 获得 T行 的第一矩阵包括:
确定在所述第二矩阵的各列中插入校验块的位置 A [X, y] ,其中, 所述第二矩 阵具有 N列, X和 y均为整数, X的取值由 0递增到 D-l , y的取值由 0递增到 N-1 ; 将所述第二矩阵的 X行中 y列至 (N-1 ) 列的数据块顺序移动到 X行中(y+1)列 至 N列的位置;
根据所述 RAID的校验算法对所述 y列中的数据块进行校验计算, 获得所述 y 列数据块的校验块;
在所述第二矩阵的 y列中的 A [X, y]的位置插入所述 y列数据块的校险块,获得 所述 T行的第一矩阵。
5、根据权利要求 1-4任意一项所述的文件处理方法, 其特征在于, 所述将所 述第一矩阵中每一列的数据块和根据该列数据块计算获得的校验块组成分条,写 入构建所述 RAID的 T个存储器中包括:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中写满数据时, 将所述 y列的数据块和所述校验块写入构建所述 RAID的 T个存储器中, 其中, 所述 y列为所述第一矩阵中的其中一列。
6、根据权利要求 1-4任意一项所述的文件处理方法, 其特征在于, 所述第一 矩阵具有 M列, 所述将所述第一矩阵中每一列的数据块和根据该列数据块计算获 得的校验块组成分条, 写入构建所述 RAID的 T个存储器中包括:
当所述第一矩阵的 y列中的数据块和根据所述 y列数据块计算获得的校验块 组成的分条中未写满数据时, 则确定所述 y列中缺少的数据块的数量, 其中, 所 述 y列为所述第一矩阵中的其中一列;
从所述第一矩阵的第 M-1列至第 y+1列中选择所述数量的数据块填充到所述 y 列中没有数据块的位置;
根据填充后的 y列中的数据块更新所述 y列的校验块;
将所述 y列的数据块和所述更新后的 y列的校验块组成分条写入构建所述 RAID的 T个存储器中。
7、根据权利要求 1-4任意一项所述的文件处理方法, 其特征在于, 所述将所 述第一矩阵中每一列的数据块和根据该列数据块计算获得的校验块组成分条,写 入构建所述 RAID的 T个存储器中包括: 当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中未写满数据时,将所述 y列中没有数据块的位置填充为 0, 并将填 充后的 y列的数据块和所述校验块组成分条写入构建所述 RAID的存储器中,其中, 所述 y列为所述第一矩阵中的其中一列。
8、 根据权利要求 1-7任意一项所述的文件处理方法, 其特征在于, 还包括: 接收主机的访问请求, 所述访问请求用于读取存储于所述 RAID中的文件, 所 述访问请求中携带有要访问的文件的逻辑地址;
根据所述逻辑地址查询存放所述文件的数据块的物理地址;
根据所述物理地址确定存储所述文件的一个存储器;
将存储于所述存储器中的所述文件的数据块返回给所述主机。
9、 一种文件处理方法, 其特征在于, 包括:
接收待存储于独立磁盘冗余阵列(Redundant Array of Independent Di sks ,
RAID ) 中的 F个文件;
将所述 F个文件按照所述 RA I D的条带大小划分成至少两个数据块; 将切分后获得的至少两个数据块排列成一个数组,在所述数组中,属于同一 文件的相邻两个数据块之间间隔 D-1个位置, 其中, 所述 D的值为所述 RAID中的数 据存储器的数量;
顺序将所述数组中的 D个数据块以及根据所述 D个数据块计算获得的 P个校验 块组成分条, 写入构建所述 RAID的存储器中, 其中, 所述 P的值为所述 RAID中独 立校验存储器的数量。
10、 根据权 9所述的方法, 其特征在于, 还包括:
接收主机的访问请求, 所述访问请求用于读取存储于所述 RAID中的文件, 所 述访问请求中携带有要访问的文件的逻辑地址;
根据所述逻辑地址查询存放所述文件的数据块的物理地址;
根据所述物理地址确定存储所述文件的一个存储器;
将存储于所述存储器中的所述文件的数据块返回给所述主机。
11、 一种文件处理装置, 其特征在于, 包括:
接收模块, 用于接收待存储于独立磁盘冗余阵列 (Redundant Array of Independent Di sks , RAID ) 中的 F个文件, 所述 RAID由 T个存储器组成, F为不小 于 2的自然数, T为不小于 3的自然数;
划分模块, 用于将所述 F个文件按照所述 RAID的条带大小划分成至少两个数 据块;
处理模块, 用于根据所述至少两个数据块获得 T行的第一矩阵, 其中, 属于 同一个文件的数据块位于所述第一矩阵的同一行中;
写入模块, 用于将所述第一矩阵中的每一列的数据块和根据该列数据块计 算获得的校验块组成分条, 写入构建所述 RAID的 T个存储器中。
12、根据权利要求 11所述的文件处理装置, 其特在于, 所述处理模块具体用 于:
将切分后获得的至少两个数据块排列为 D行的第二矩阵, 其中, 属于同一个 文件的数据块位于所述第二矩阵的同一行中, 所述 D为所述 RAID中的数据存储器 的数量;
分别在所述第二矩阵的每一列中插入校验块, 获得所述 T行的第一矩阵, 其 中,所述插入的校验块是根据所述第一矩阵中校验块所在列的数据块计算获得的。
13、根据权利要求 12所述的文件处理装置, 其特征在于, 当所述 RAID中包括 独立校验存储器时, 所述处理模块具体用于:
根据所述 R A I D中独立校验存储器的位置确定在所述第二矩阵中插入校验块 的位置;
根据所述 RA I D的校验算法分别对所述第二矩阵中每一列的数据块进行校验 计算, 获得每一列数据块的校验块;
根据确定的校验块的位置在第二矩阵的每一列中插入根据该列数据块计算 的校验块, 获得所述 T行的第一矩阵。
14、根据权利要求 12所述的文件处理装置, 其特征在于, 当所述 RAID中不包 括独立校验存储器时, 所述处理模块具体用于:
确定在所述第二矩阵的各列中插入校验块的位置 A [X, y] ,其中, 所述第二矩 阵具有 N列, X和 y均为整数, X的取值由 0递增到 D-l , y的取值由 0递增到 N-1 ; 将所述第二矩阵的 X行中 y列至 (N-1 ) 列的数据块顺序移动到 X行中(y+1)列 至 N列的位置;
根据所述 RAID的校验算法对所述 y列中的数据块进行校验计算, 获得所述 y 列数据块的校验块;
在所述第二矩阵的 y列中的 A [X, y]的位置插入所述 y列数据块的校险块,获得 所述 T行的第一矩阵。
15、 根据权利要求 11-14任意一项所述的文件处理装置, 其特征在于, 所述 写入模块具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中写满数据时, 将所述 y列的数据块和所述校验块写入构建所述 RAID的 T个存储器中, 其中, 所述 y列为所述第一矩阵中的其中一列。
16、 根据权利要求 11-14任意一项所述的文件处理装置, 其特征在于, 所述 第一矩阵具有 M列, 所述写入模块具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列数据块计算获得的校验块 组成的分条中未写满数据时, 则确定所述 y列中缺少的数据块的数量, 其中, 所 述 y列为所述第一矩阵中的其中一列;
从所述第一矩阵的第 M-1列至第 y+1列中选择所述数量的数据块填充到所述 y 列中没有数据块的位置;
根据填充后的 y列中的数据块更新所述 y列的校验块;
将所述 y列的数据块和所述更新后的 y列的校验块组成分条写入构建所述 RAID的 T个存储器中。
17、 根据权利要求 11-14任意一项所述的文件处理装置, 其特征在于, 所述 写入模块具体用于:
当所述第一矩阵的 y列中的数据块和根据所述 y列的数据块计算获得的校验 块组成的分条中未写满数据时,将所述 y列中没有数据块的位置填充为 0 , 并将填 充后的 y列的数据块和所述校验块组成分条写入构建所述 RAID的存储器中,其中, 所述 y列为所述第一矩阵中的其中一列。
18、 根据权利要求 11-17任意一项所述的文件处理装置, 其特征在于: 所述接收模块, 还用于接收主机的访问请求, 所述访问请求用于读取存储 于所述 RAID中的文件, 所述访问请求中携带有要访问的文件的逻辑地址;
所述文件处理装置还包括:
读取模块, 用于根据所述逻辑地址查询存放所述文件的数据块的物理地址, 根据所述物理地址确定存储所述文件的一个存储器,并将存储于所述 RAID的一个 存储器中的所述文件的数据块返回给所述主机。
19、一种存储设备, 包括控制器和独立磁盘冗余阵列 ( Redundant Array of Independent Di sks , RAID ), 其特征在于:
所述 RAID,用于存储文件;
所述控制器包括:
处理器、 存储器、 通信总线和通信接口, 所述处理器、 所述存储器和所述通 信接口通过所述通信总线连接并完成相互间的通信;
所述通信接口, 用于与主机及所述独立磁盘冗余阵列( Redundant Array of Independent Di sks , RAID )通信
所述存储器, 用于存储计算机执行指令;
所述处理器, 用于运行所述计算机执行指令, 执行如权利要求 1-8任意一项 所述的方法。
20、一种计算机程序产品, 包括存储了程序代码的计算机可读存储介质, 所 述程序代码包括的指令用于执行如权利要求 1 -8任意一项所述的方法。
PCT/CN2013/081182 2013-08-09 2013-08-09 一种文件处理方法、装置及存储设备 WO2015018065A1 (zh)

Priority Applications (9)

Application Number Priority Date Filing Date Title
EP13886152.1A EP3026546A4 (en) 2013-08-09 2013-08-09 FILE PROCESSING METHOD, APPARATUS, AND STORAGE DEVICE
PCT/CN2013/081182 WO2015018065A1 (zh) 2013-08-09 2013-08-09 一种文件处理方法、装置及存储设备
CN201380001800.9A CN103733175B (zh) 2013-08-09 2013-08-09 一种文件处理方法、装置及存储设备
JP2015530281A JP6069742B2 (ja) 2013-08-09 2013-08-09 ファイル処理方法およびファイル処理装置、ならびに記憶デバイス
KR1020147036585A KR101677473B1 (ko) 2013-08-09 2013-08-09 파일 처리 방법 및 장치, 그리고 저장 디바이스
AU2013392019A AU2013392019B2 (en) 2013-08-09 2013-08-09 File processing method and apparatus, and storage device
CA2881618A CA2881618C (en) 2013-08-09 2013-08-09 File processing method and apparatus, and storage device
US14/568,502 US9483194B2 (en) 2013-08-09 2014-12-12 File processing method and apparatus, and storage device
US14/704,514 US9417806B2 (en) 2013-08-09 2015-05-05 File processing method and apparatus, and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/081182 WO2015018065A1 (zh) 2013-08-09 2013-08-09 一种文件处理方法、装置及存储设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/568,502 Continuation US9483194B2 (en) 2013-08-09 2014-12-12 File processing method and apparatus, and storage device

Publications (1)

Publication Number Publication Date
WO2015018065A1 true WO2015018065A1 (zh) 2015-02-12

Family

ID=50455934

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/081182 WO2015018065A1 (zh) 2013-08-09 2013-08-09 一种文件处理方法、装置及存储设备

Country Status (8)

Country Link
US (2) US9483194B2 (zh)
EP (1) EP3026546A4 (zh)
JP (1) JP6069742B2 (zh)
KR (1) KR101677473B1 (zh)
CN (1) CN103733175B (zh)
AU (1) AU2013392019B2 (zh)
CA (1) CA2881618C (zh)
WO (1) WO2015018065A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168087A (zh) * 2022-02-11 2022-03-11 苏州浪潮智能科技有限公司 校验数据生成方法、装置、设备及存储介质
CN114333917A (zh) * 2021-12-30 2022-04-12 山东云海国创云计算装备产业创新中心有限公司 基于rdp纠删算法的数据纠错方法、装置、设备及介质

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160328184A1 (en) * 2015-05-07 2016-11-10 Dell Products L.P. Performance of storage controllers for applications with varying access patterns in information handling systems
JP6690829B2 (ja) * 2015-08-28 2020-04-28 国立大学法人 東京大学 計算機システム、省電力化方法及び計算機
CN105516548B (zh) * 2015-11-27 2019-01-11 中央电视台 一种文件预读方法及装置
WO2017140262A1 (zh) * 2016-02-18 2017-08-24 华为技术有限公司 数据更新技术
CN107168817B (zh) * 2016-03-07 2020-05-08 华为技术有限公司 应用于存储阵列的数据修复方法与装置及存储设备
CN107203559B (zh) * 2016-03-17 2021-01-01 华为技术有限公司 一种划分数据条带的方法和装置
CN111679787B (zh) * 2016-04-27 2023-07-18 慧荣科技股份有限公司 闪存装置、闪存控制器及闪存存储管理方法
US10019314B2 (en) 2016-04-27 2018-07-10 Silicon Motion Inc. Flash memory apparatus and storage management method for flash memory
US10152378B2 (en) * 2016-10-04 2018-12-11 Futurewei Technologies, Inc. Data protection for a cold storage system
CN107357687A (zh) * 2017-07-21 2017-11-17 长沙曙通信息科技有限公司 一种容灾备份新型重复数据删除实现方法
CN107368391A (zh) * 2017-07-21 2017-11-21 长沙曙通信息科技有限公司 一种基于快照新型容灾备份异步远程镜像实现方法
CN107360191B (zh) * 2017-08-28 2021-02-02 腾讯科技(深圳)有限公司 一种文件获取方法、装置及存储设备
US10684915B2 (en) * 2018-07-25 2020-06-16 EMC IP Holding Company LLC Efficient packing of compressed data in storage system implementing data striping
CN111338559B (zh) * 2018-12-19 2023-11-10 深圳市茁壮网络股份有限公司 数据处理方法、用户模块、信息管理模块及系统
CN110471623B (zh) * 2019-07-31 2023-12-29 深圳市博实结科技股份有限公司 硬盘文件写入方法、装置、计算机设备和存储介质
CN111142788B (zh) * 2019-11-29 2021-10-15 浪潮电子信息产业股份有限公司 一种数据迁移方法、装置和计算机可读存储介质
CN113782025B (zh) * 2021-09-27 2024-01-09 北京声智科技有限公司 语音识别方法、装置、终端及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6311251B1 (en) * 1998-11-23 2001-10-30 Storage Technology Corporation System for optimizing data storage in a RAID system
CN101055509A (zh) * 2006-04-14 2007-10-17 中兴通讯股份有限公司 高效流媒体数据读写系统
CN101976175A (zh) * 2010-08-19 2011-02-16 北京同有飞骥科技有限公司 一种水平型分组并行集中校验的磁盘阵列的构建方法
CN102880428A (zh) * 2012-08-20 2013-01-16 华为技术有限公司 分布式独立磁盘冗余阵列的创建方法及装置

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1994029796A1 (en) * 1993-06-03 1994-12-22 Network Appliance Corporation A method for allocating files in a file system integrated with a raid disk sub-system
US5878280A (en) * 1993-09-23 1999-03-02 Philips Electronics North America Corp. Data buffering system for plural data memory arrays
JPH07152498A (ja) * 1993-12-01 1995-06-16 Hitachi Ltd 情報処理システム
US5860090A (en) * 1995-10-20 1999-01-12 Informix Software, Inc. Append-only storage in a disk array using striping and parity caching
JPH11288359A (ja) * 1998-04-02 1999-10-19 Matsushita Electric Ind Co Ltd ファイル管理システムおよび方法
JPH11288387A (ja) * 1998-12-11 1999-10-19 Fujitsu Ltd ディスクキャッシュ装置
US7055058B2 (en) * 2001-12-26 2006-05-30 Boon Storage Technologies, Inc. Self-healing log-structured RAID
US7200715B2 (en) * 2002-03-21 2007-04-03 Network Appliance, Inc. Method for writing contiguous arrays of stripes in a RAID storage system using mapped block writes
JP2004145409A (ja) * 2002-10-22 2004-05-20 Hitachi Ltd 記憶装置および記憶装置サブシステム
US7237062B2 (en) 2004-04-02 2007-06-26 Seagate Technology Llc Storage media data structure system and method
US8521955B2 (en) * 2005-09-13 2013-08-27 Lsi Corporation Aligned data storage for network attached media streaming systems
US8006111B1 (en) * 2007-09-21 2011-08-23 Emc Corporation Intelligent file system based power management for shared storage that migrates groups of files based on inactivity threshold
US20090204758A1 (en) 2008-02-13 2009-08-13 Dell Products, Lp Systems and methods for asymmetric raid devices
US8615681B2 (en) * 2010-12-14 2013-12-24 Western Digital Technologies, Inc. System and method for maintaining a data redundancy scheme in a solid state memory in the event of a power loss
US8463992B2 (en) * 2010-12-18 2013-06-11 Lsi Corporation System and method for handling IO to drives in a raid system based on strip size
US8327185B1 (en) 2012-03-23 2012-12-04 DSSD, Inc. Method and system for multi-dimensional raid
US8554997B1 (en) * 2013-01-18 2013-10-08 DSSD, Inc. Method and system for mirrored multi-dimensional raid

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6311251B1 (en) * 1998-11-23 2001-10-30 Storage Technology Corporation System for optimizing data storage in a RAID system
CN101055509A (zh) * 2006-04-14 2007-10-17 中兴通讯股份有限公司 高效流媒体数据读写系统
CN101976175A (zh) * 2010-08-19 2011-02-16 北京同有飞骥科技有限公司 一种水平型分组并行集中校验的磁盘阵列的构建方法
CN102880428A (zh) * 2012-08-20 2013-01-16 华为技术有限公司 分布式独立磁盘冗余阵列的创建方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3026546A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114333917A (zh) * 2021-12-30 2022-04-12 山东云海国创云计算装备产业创新中心有限公司 基于rdp纠删算法的数据纠错方法、装置、设备及介质
CN114333917B (zh) * 2021-12-30 2023-11-03 山东云海国创云计算装备产业创新中心有限公司 基于rdp纠删算法的数据纠错方法、装置、设备及介质
CN114168087A (zh) * 2022-02-11 2022-03-11 苏州浪潮智能科技有限公司 校验数据生成方法、装置、设备及存储介质
CN114168087B (zh) * 2022-02-11 2022-04-22 苏州浪潮智能科技有限公司 校验数据生成方法、装置、设备及存储介质

Also Published As

Publication number Publication date
US9483194B2 (en) 2016-11-01
US9417806B2 (en) 2016-08-16
CA2881618C (en) 2017-04-18
AU2013392019A1 (en) 2015-02-26
AU2013392019B2 (en) 2016-09-22
KR20150034139A (ko) 2015-04-02
CN103733175B (zh) 2015-05-27
CN103733175A (zh) 2014-04-16
JP6069742B2 (ja) 2017-02-01
EP3026546A1 (en) 2016-06-01
US20150234614A1 (en) 2015-08-20
CA2881618A1 (en) 2015-02-12
US20150100729A1 (en) 2015-04-09
EP3026546A4 (en) 2016-08-17
JP2015528973A (ja) 2015-10-01
KR101677473B1 (ko) 2016-11-18

Similar Documents

Publication Publication Date Title
WO2015018065A1 (zh) 一种文件处理方法、装置及存储设备
US8850114B2 (en) Storage array controller for flash-based storage devices
AU2014236657B2 (en) Synchronous mirroring in non-volatile memory systems
US9081508B2 (en) File processing method and storage device
US9542101B2 (en) System and methods for performing embedded full-stripe write operations to a data volume with data elements distributed across multiple modules
CN103488432B (zh) 一种混合磁盘阵列及其延迟写入校验方法和数据恢复方法
WO2015081690A1 (zh) 一种提高磁盘阵列性能的方法及装置
EP3992769A1 (en) Data storage method and apparatus, computing device, storage system, and storage medium
US10705907B1 (en) Data protection in a heterogeneous random access storage array
AU2015255198B2 (en) File processing method and storage device
Yi et al. CG-Resync: Conversion-guided resynchronization for a SSD-based RAID array
WO2014139390A1 (zh) 存储设备及其访问方法

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 2881618

Country of ref document: CA

WWE Wipo information: entry into national phase

Ref document number: 2013392019

Country of ref document: AU

ENP Entry into the national phase

Ref document number: 20147036585

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2015530281

Country of ref document: JP

Kind code of ref document: A

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

Ref document number: 13886152

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE