WO2024098885A1 - Disk array write processing method and apparatus, device, and medium - Google Patents

Disk array write processing method and apparatus, device, and medium Download PDF

Info

Publication number
WO2024098885A1
WO2024098885A1 PCT/CN2023/114470 CN2023114470W WO2024098885A1 WO 2024098885 A1 WO2024098885 A1 WO 2024098885A1 CN 2023114470 W CN2023114470 W CN 2023114470W WO 2024098885 A1 WO2024098885 A1 WO 2024098885A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
position information
target
write
check
Prior art date
Application number
PCT/CN2023/114470
Other languages
French (fr)
Chinese (zh)
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 苏州元脑智能科技有限公司
Publication of WO2024098885A1 publication Critical patent/WO2024098885A1/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/061Improving I/O performance
    • 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

Definitions

  • the present application relates to the technical field of data storage, and in particular to a disk array write processing method, device, equipment and medium.
  • DRAID5 Redundant Array of Independent Disks
  • strides which are composed of strips (data blocks and check blocks).
  • strips data blocks and check blocks.
  • check block in a stripe is obtained by XORing all data blocks in the stripe.
  • the purpose of this application is to provide a disk array write processing method, device, equipment and medium, which can reduce the time consumption of processing verification data, thereby improving storage performance.
  • the specific scheme is as follows:
  • the present application discloses a disk array write processing method, comprising:
  • the write position information includes the write offset and the write length
  • the full amount of location information of the parity block in each target stripe that is currently to be updated with data is determined based on the information record, including:
  • the write position information is read from the information record in sequence, and each time a write position information is read, the write position information is converted into a page mask form to obtain a page mask corresponding to the write position information, and the page mask is ORed with the target page mask to obtain a position information mask corresponding to the write position information, and the position information mask is recorded as the full amount of position information of the parity block in the target stripe that is currently to be updated with data;
  • the page mask format is a binary code format of a preset number of bits, each bit corresponds to a page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information.
  • all bits in the initial page mask are 0.
  • the target stripe satisfies the verification data reading condition when the number of write position information read reaches a preset number threshold, or the number of write position information read does not reach the preset number threshold, and the information record has no write position information to be read.
  • converting the write position information into a page mask format to obtain a page mask corresponding to the write position information includes:
  • the initial page and page length corresponding to the write position information are calculated and converted into a page mask form to obtain a page mask corresponding to the write position information.
  • recording the write position information of the target data block in each target stripe to the information record corresponding to the target stripe includes:
  • the write position information of each target data block in each target stripe is converted into a node, and the node is added to the linked list in the structure corresponding to the target stripe.
  • reading the write position information from the information record in sequence includes: reading nodes from a linked list in sequence.
  • the write position information is read from the information record in sequence, including:
  • the scheduling thread is used to read and write the position information from the information record in sequence.
  • old data in the target data block is read, and the old data and new data corresponding to the target data block are calculated to obtain an intermediate check value of the target data block.
  • calculation is performed based on the old verification data to obtain new verification data, including:
  • the first target verification data corresponding to the first intermediate verification value read is the old verification data
  • the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
  • New data corresponding to each target data block is written into each target data block based on the write position information of each target data block.
  • the new data is recorded into the buffer area.
  • the present application discloses a DRAID5 write processing device, comprising:
  • the stripe and information determination module is used to determine the target stripe to be written to in DRAID5 and the write position information of the target data block to be written to in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length;
  • a stripe information recording module used to record the write position information of the target data block in each target stripe to the information record corresponding to the target stripe;
  • a location information determination module used to determine the full amount of location information of the check block in each target stripe that is currently to be updated based on the information record;
  • the old check data reading module is used to read data from the corresponding check block based on the current full position information when any target strip meets the check data reading condition, and obtain the old check data corresponding to the current full position information;
  • a new verification data calculation module used to perform calculations based on old verification data to obtain new verification data
  • the new verification data writing module is used to write the new verification data into the corresponding verification block based on the full position information.
  • the present application discloses an electronic device, including a memory and a processor, wherein:
  • Memory used to store computer programs
  • the processor is used to execute a computer program to implement the aforementioned disk array write processing method.
  • the present application discloses a computer non-volatile readable storage medium for storing a computer program, wherein the computer program implements the aforementioned disk array write processing method when executed by a processor.
  • the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded in the information record corresponding to the target stripe, and the full position information of the check block in each target stripe to be updated is determined based on the information record.
  • FIG1 is a schematic diagram of a block layout of a stripe in a disk array provided in an embodiment of the present application
  • FIG2 is a flow chart of a disk array write processing method disclosed in an embodiment of the present application.
  • FIG3 is a schematic diagram of the structure of a disk array write processing device disclosed in an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a structure of an electronic device disclosed in an embodiment of the present application.
  • FIG. 1 is a schematic diagram of the block layout of a stripe in a disk array, including disk 0, disk 1, disk 2, and disk 3.
  • the stripe includes block 0 with a check code of 0, i.e., the check block, and blocks 1, block 2, and block 3 with codes of 1, 2, and 3, i.e., 3 data blocks.
  • Step 1 To ensure the consistency of the stripe, it is necessary to recalculate the new check block of this stripe, read the old data within the stripoffset position count length of the data block of block number 1, and fetch (i.e., obtain from the server) the new data to be written within the stripoffset position count length of the data block of block number 1, and calculate the intermediate check value;
  • Step 2 Write the new data to disk 1, the stripoffset position count length of the data block of block number 1;
  • Step 3 Read the old check data within the stripoffset position count length of the check block in the strip of disk 0;
  • Step 4 XOR the intermediate check value of the first step with the old check data read in the third step to obtain the new check data;
  • Step 5 Start to write the new check data calculated in the fourth step to the disk and write it to the stripoffset position count length of the check block.
  • Step 6 Io ends. It can be understood that when writing data to block codes 1 and 2, it is necessary to read the corresponding offset and length of the check block of the stripe respectively, and it is necessary to read the old check data twice, calculate the new check data twice, and write the new check data twice, which can be completed only once. The process of completing an IO is very complicated, and the problem that comes with it is that performance will also be affected. When the storage starts to initiate the write process, tens of thousands of IOs per second will bring a considerable time-consuming problem. To this end, this application provides a disk array write processing solution that can reduce the time consumption of processing verification data, thereby improving storage performance.
  • the embodiment of the present application discloses a disk array write processing method, including:
  • Step S11 Determine the target stripe to be written to in DRAID5 and the write position information of the target data block to be written to in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length.
  • each IO write request will first be split into stripes and then into blocks to obtain the write offset and write length of each data block.
  • the old data in the target data block can be read based on the write position information of the target data block, and the old data and the new data corresponding to the target data block are calculated to obtain the intermediate check value of the target data block. Specifically, the old data corresponding to the write position information is XORed with the new data to obtain the intermediate check value corresponding to the target data block, and the intermediate check value is recorded.
  • the new data corresponding to each target data block can be written based on the write position information of each target data block. After writing the new data into the target data block, the new data is recorded in the cache area. When the next IO is initiated, if the data block is read, it can be determined whether it hits the cache. If so, the data is read from the cache without reading from the disk.
  • Step S12 Record the write position information of the target data block in each target stripe to the information record corresponding to the target stripe.
  • the information corresponding to each stripe is recorded as a structure; the write position information of each target data block in each target stripe is converted into a node, and the node is added to the linked list in the structure corresponding to the target stripe, waiting for thread scheduling.
  • Step S13 Determine the full amount of location information of the parity blocks in each target stripe that are currently to be updated based on the information record.
  • the write position information is read from the information record in sequence, and each time a write position information is read, the write position information is converted into a page mask form to obtain a page mask corresponding to the write position information, and the page mask is ORed with the target page mask to obtain a position information mask corresponding to the write position information, and the position information mask is recorded as the full amount of position information of the parity block in the target stripe that is currently to be updated with data;
  • the page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
  • the write position information is converted into a page mask format to obtain a page mask corresponding to the write position information.
  • the initial page and page length corresponding to the write position information are calculated, and converted into a page mask format to obtain a page mask corresponding to the write position information.
  • the write offset is the fourth page, and the page length to be written is 2page.
  • the corresponding page mask is 0 (58 zeros are omitted here) 11000.
  • a page mask variable may be used, the page mask variable records the initial page mask, each time the write position information is converted into a page mask, an OR operation is performed with the page mask variable, and the calculation result is updated to the page mask variable.
  • the write position information is read sequentially from the information record using a scheduling thread, and the nodes can be read sequentially from the linked list.
  • Step S14 When any target stripe meets the verification data reading condition, data is read from the corresponding verification block based on the current full position information to obtain old verification data corresponding to the current full position information.
  • the target stripe satisfies the verification data reading condition when the number of read write position information reaches a preset number threshold, or the number of read write position information does not reach the preset number threshold, and the information record has no write position information to be read. For example, when the number of read write position information does not reach 20, the write position information is no longer read.
  • Step S15 Calculate based on the old verification data to obtain new verification data.
  • the intermediate check value corresponding to each target data block may be read in sequence, and after each intermediate check value of a target data block is read, the intermediate check value is XORed with the first target check data to obtain the second target check data, until the intermediate check values of all target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
  • the first target verification data corresponding to the first intermediate verification value read is the old verification data
  • the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
  • the full amount of position information corresponds to 20 pieces of write position information, and then 10 intermediate check values are used in sequence to perform an XOR operation.
  • Step S16 writing the new verification data into the corresponding verification block based on the full position information.
  • the disk array write processing solution provided by the present application is further described below.
  • the algorithm can be implemented using a programming language. Regardless of whether the target data blocks are continuous, the merged reading and writing of the check blocks can be realized, including the following steps:
  • Step 1 Add member variables to the cache structure sce corresponding to the check block: Struct sce ⁇ Queue sce_queue; Uint64PAGE_MASK; ⁇ Among them, queue is of the following type Struct queue ⁇ Struct queue*pre; Struct queue*next; ⁇ Uint64PAGE_MASK is initialized to 0.
  • Each stripe is set with a structure sde, which stores pointer variables of the cache structure sce of all blocks (data blocks and check blocks) in the stripe.
  • Cache structure function When new data is written to the disk, the new data will be moved to the cache area and marked with the sce structure. If the next IO is initiated to read the block, the sce will query the mark to see if the cache hits. If the cache hits, the data does not need to be read from the disk.
  • Step 2 Each time an IO is initiated, the IO will be split into stripes and then into blocks. For each block, a corresponding ipk (a structure that records the offset and length of the data block to be written) and a check block pipk (a structure that records the offset and length of the check block to be written) in the stripe corresponding to the block will be established.
  • the server initiates an IO to the storage, considering the case of multiple IOs, the write offset and write length of the data block are recorded as stripoffset i, count i, then the block offset and write length of the check block corresponding to the data block are stripoffset i, count i, and stripoffset i, count i are recorded in pipk i.
  • Step 3 Read the old data within the length of count i at position stripoffset i in the data block, fetch the new data to be written within the length of count i at position stripoffset i in the data block, and calculate the intermediate checksum paritybuilt i;
  • Step 4 Write new data to the data block stripoffset i position count i length in the stripe corresponding to the disk;
  • Step 5 Find the check block pipk i corresponding to the data block to which the new data is to be written, convert pipk i into a node form and add it to the node position in the Queue sce_queue linked list in the sce structure corresponding to the check block in sde, and wait for the thread scheduling to take out the task from the linked list.
  • Step 6 If there are other io, continue to execute the process of step 5. If other pipk j corresponds to the sce block of the same sde structure as pipk i in the fifth step, then convert this pipk j into a node form and add it to the next node position of the node in the Queue sce_queue linked list, still waiting for thread scheduling.
  • Step 7 The thread scheduling obtains the first node from the Queue sce_queue linked list.
  • Step 10 Read the old verification data from the disk according to the value corresponding to the PAGEMASK code. After reading, execute step 11.
  • Step 11 XOR the old checksum data read in step 10 with the intermediate checksum value calculated in step 3 corresponding to pipk to obtain new checksum data. Go to step 12.
  • Step 12 Determine whether there are other nodes behind the node in the sce structure corresponding to this pipk. If not, it means that there is no verification merge.
  • the new verification data calculated in step 11 is the final new verification data, and go to step 14. If there are other nodes behind the corresponding node and it has not reached 20, it means that there is still verification merge.
  • the new verification data calculated in step 11 is not the final verification data, and go to step 13.
  • Step 13 Take the next node from the linked list and convert it into the corresponding pipk, find its corresponding intermediate check value, and perform XOR operation with the new check data obtained in step 11. After XOR is completed, continue to take the next node from the linked list and continue XOR operation until all nodes corresponding to the old check data in step 10 in the linked list are traversed, and the final new check data is calculated. Go to step 14.
  • Step 14 Start writing the calculated final new verification data to disk.
  • Step 15 Io is completed.
  • the embodiment of the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the current data update to be performed on the check block in each target stripe is determined based on the information record.
  • the embodiment of the present application records each data block to be written in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record.
  • the check data reading condition is met, the check block is read once according to the current full position information, and all the old check data to be updated can be read. Then, calculations are performed and the corresponding check block is written at one time based on the full position information, which reduces the number of check data reading and writing times, can reduce the time spent on processing check data, and thus improves storage performance.
  • a DRAID5 write processing device including:
  • the stripe and information determination module 11 is used to determine the target stripe to be written to in DRAID5 and the write position information of the target data block to be written to in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length;
  • the stripe information recording module 12 is used to record the write position information of the target data block in each target stripe to the information record corresponding to the target stripe;
  • a location information determination module 13 used to determine the full location information of the check blocks in each target stripe that are currently to be updated based on the information record;
  • the old check data reading module 14 is used to read data from the corresponding check block based on the current full position information when any target strip meets the check data reading condition, so as to obtain the old check data corresponding to the current full position information;
  • a new verification data calculation module 15 used to perform calculation based on the old verification data to obtain new verification data
  • the new verification data writing module 16 is used to write the new verification data into the corresponding verification block based on the full position information.
  • the embodiment of the present application determines the write position information of the target stripe to be written to and the target data block to be written to in each target stripe in DRAID5 based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the check block to be updated in each target stripe is determined based on the information record.
  • a data read is performed from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information, and then the calculation is performed based on the old check data to obtain the new check data, and finally the new check data is written to the corresponding check block based on the full position information. That is, after the server initiates an IO write request, the embodiment of the present application records each data block to be written to in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record. When the check data reading condition is met, the current full position information is read according to the current full position information.
  • the position information determination module 13 is specifically used to read the write position information from the information record in sequence, and each time a write position information is read, the write position information is converted into a page mask form to obtain a page mask corresponding to the write position information, and the page mask is ORed with the target page mask to obtain a position information mask corresponding to the write position information, and the position information mask is recorded as the full position information of the parity block in the target stripe that is currently to be updated with data;
  • the page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
  • the target stripe satisfies the verification data reading condition when the number of the read write position information reaches a preset number threshold, or the number of the read write position information does not reach the preset number threshold, and the information record has no write position information to be read.
  • the step of converting the write position information into a page mask format to obtain a page mask corresponding to the write position information includes: calculating an initial page and a page length corresponding to the write position information, and converting the initial page and the page length into a page mask format to obtain a page mask corresponding to the write position information.
  • the stripe information recording module 12 is specifically used to convert the write position information of each target data block in each target stripe into a node, and add the node to the linked list in the structure corresponding to the target stripe. Further, the position information determination module 13 is specifically used to read the nodes from the linked list in sequence.
  • the location information determination module 13 is specifically configured to sequentially read and write location information from information records using a scheduling thread.
  • the device also includes an intermediate check value calculation module, which is used to read old data in the target data block based on the write position information of the target data block, and calculate the old data and the new data corresponding to the target data block to obtain the intermediate check value of the target data block.
  • an intermediate check value calculation module which is used to read old data in the target data block based on the write position information of the target data block, and calculate the old data and the new data corresponding to the target data block to obtain the intermediate check value of the target data block.
  • the new verification data calculation module 15 is used to read the intermediate verification value corresponding to each target data block in turn, and after each intermediate verification value of a target data block is read, the intermediate verification value is XOR-operated with the first target verification data to obtain the second target verification data, until the intermediate verification values of all target data blocks corresponding to the old verification data are calculated, and the current second target verification data is used as the new verification data;
  • the first target verification data corresponding to the first intermediate verification value read is the old verification data
  • the first target verification data corresponding to the first intermediate verification value read is the old verification data
  • the first target verification data corresponding to the intermediate verification value is the second target verification data corresponding to the last read intermediate verification value.
  • the device further comprises a data block writing module, which is used to write new data corresponding to each target data block into each target data block based on the writing position information of each target data block.
  • the device also includes a write cache module, which is used to record the new data into the cache area after writing the new data into the target data block.
  • an embodiment of the present application discloses an electronic device 20, including a processor 21 and a memory 22; wherein the memory 22 is used to store a computer program; and the processor 21 is used to execute the computer program to implement the following steps:
  • the write position information of the target stripe to be written to data in DRAID5 and the target data block to be written to data in each target stripe is determined; the write position information includes the write offset and the write length; the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe respectively; based on the information record, the full position information of the check block in each target stripe to be updated with data is determined; when any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information; calculation is performed based on the old check data to obtain new check data; and the new check data is written into the corresponding check block based on the full position information.
  • the embodiment of the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the current data update to be performed on the check block in each target stripe is determined based on the information record.
  • the embodiment of the present application records each data block to be written in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record.
  • the check data reading condition is met, the check block is read once according to the current full position information, and all the old check data to be updated can be read. Then, calculations are performed and the corresponding check block is written at one time based on the full position information, which reduces the number of check data reading and writing times, can reduce the time spent on processing check data, and thus improves storage performance.
  • the page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
  • the target stripe satisfies the verification data reading condition when the number of the read write position information reaches a preset number threshold, or the number of the read write position information does not reach the preset number threshold, and the information record has no write position information to be read.
  • the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: calculating the initial page and page length corresponding to the write position information, and converting them into a page mask form to obtain a page mask corresponding to the write position information.
  • the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: converting the write position information of each target data block in each target stripe into a node, and adding the node to the linked list in the structure corresponding to the target stripe.
  • the processor 21 executes the computer subroutine stored in the memory 22
  • the following steps may be specifically implemented: using the scheduling thread to sequentially read the write position information from the information record.
  • the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: based on the write position information of the target data block, the old data in the target data block is read, and the old data and the new data corresponding to the target data block are calculated to obtain the intermediate check value of the target data block.
  • the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: sequentially reading the intermediate check value corresponding to each target data block, and after each intermediate check value of a target data block is read, performing an XOR operation on the intermediate check value and the first target check data to obtain the second target check data, until the intermediate check values of all target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
  • the first target verification data corresponding to the first intermediate verification value read is the old verification data
  • the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
  • the processor 21 executes the computer subroutine stored in the memory 22, the following steps may be specifically implemented: based on the write position information of each target data block, new data corresponding to each target data block is written into each target data block.
  • the processor 21 executes the computer subroutine stored in the memory 22 the following steps may be specifically implemented: after writing the new data into the target data block, the new data is recorded into the cache area.
  • the memory 22, as a carrier for storing resources may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.
  • the electronic device 20 also includes a power supply 23, a communication interface 24, an input/output interface 25 and a communication bus 26; wherein the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input/output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
  • an embodiment of the present application discloses a computer non-volatile readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the following steps are implemented:
  • the write position information of the target stripe to be written to data in DRAID5 and the target data block to be written to data in each target stripe is determined; the write position information includes the write offset and the write length; the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe respectively; based on the information record, the full position information of the check block in each target stripe to be updated with data is determined; when any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information; calculation is performed based on the old check data to obtain new check data; based on the full position information, the new check data is written into the corresponding check block.
  • the embodiment of the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the current data update to be performed on the check block in each target stripe is determined based on the information record.
  • the embodiment of the present application records each data block to be written in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record.
  • the check data reading condition is met, the check block is read once according to the current full position information, and all the old check data to be updated can be read. Then, calculations are performed and the corresponding check block is written at one time based on the full position information, which reduces the number of check data reading and writing times, can reduce the time spent on processing check data, and thus improves storage performance.
  • the following steps can be specifically implemented: read the write position information from the information record in sequence, and each time a write position information is read, convert the write position information into a page mask form to obtain a page mask corresponding to the write position information, perform an OR operation on the page mask and the target page mask to obtain a position information mask corresponding to the write position information, and record the position information mask as the full amount of position information of the parity block in the target stripe that is currently to be updated;
  • the page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
  • the target stripe satisfies the verification data reading condition when the number of the read write position information reaches a preset number threshold, or the number of the read write position information does not reach the preset number threshold, and the information record has no write position information to be read.
  • the following steps can be specifically implemented: calculating the initial page and page length corresponding to the write position information, and converting them into a page mask form to obtain the page mask corresponding to the write position information.
  • the following steps can be specifically implemented: converting the write position information of each target data block in each target stripe into a node, and adding the node to the linked list in the structure corresponding to the target stripe.
  • the following steps can be specifically implemented: using the scheduling thread to sequentially read the write position information from the information record.
  • the following steps can be specifically implemented: based on the write position information of the target data block, the old data in the target data block is read, and the old data and the new data corresponding to the target data block are calculated to obtain the intermediate check value of the target data block.
  • the following steps can be specifically implemented: sequentially reading the intermediate check value corresponding to each target data block, and after each intermediate check value of a target data block is read, performing an XOR operation on the intermediate check value and the first target check data to obtain the second target check data, until the intermediate check values of all target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
  • the first target verification data corresponding to the first intermediate verification value read is the old verification data
  • the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
  • the following steps can be specifically implemented: writing new data corresponding to each target data block into each target data block based on the write position information of each target data block.
  • the following steps can be specifically implemented: after writing the new data into the target data block, the new data is recorded into the cache area.
  • each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments.
  • the same or similar parts between the embodiments can be referred to each other.
  • the description is relatively simple, and the relevant parts can be referred to the method part.
  • the steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two.
  • the software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application discloses a disk array write processing method and apparatus, a device, and a medium, which are applied to the technical field of data storage. The method comprises: on the basis of an IO write request, determining a target stride to which data is to be written in DRAID5 and write location information of a target data block to which data is to be written in the target stride; respectively recording the write location information of the target data block in each target stride to a corresponding information record; on the basis of the information record, determining total location information, of a check block in each target stride, on which data updating is to be performed; when any target stride meets a check data reading condition, performing primary data reading from a corresponding check block on the basis of current total location information so as to obtain old check data corresponding to the current total location information; performing calculation on the basis of the old check data to obtain new check data; and writing the new check data to the corresponding check block on the basis of the total location information. The time spent processing check data can be reduced, so that the storage performance is improved.

Description

一种磁盘阵列写处理方法、装置、设备及介质Disk array write processing method, device, equipment and medium
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2022年11月11日提交中国专利局,申请号为202211412299.2,申请名称为“一种磁盘阵列写处理方法、装置、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application filed with the Chinese Patent Office on November 11, 2022, with application number 202211412299.2, and entitled “A disk array write processing method, device, equipment and medium”, all contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及数据存储技术领域,特别涉及一种磁盘阵列写处理方法、装置、设备及介质。The present application relates to the technical field of data storage, and in particular to a disk array write processing method, device, equipment and medium.
背景技术Background technique
在科技飞速发展的信息化时代中,性能逐渐成为存储评估的的主要标准之一。DRAID5(即Redundant Array of Independent Disks独立的磁盘组成的具有冗余性的阵列)是常见的磁盘阵列,该阵列由stride(条带)组成,stride由strip(数据块以及校验块)组成,为保障条带一致性,一个条带内校验块为条带内所有数据块进行异或所得。In the information age with rapid technological development, performance has gradually become one of the main criteria for storage evaluation. DRAID5 (Redundant Array of Independent Disks) is a common disk array, which is composed of strides, which are composed of strips (data blocks and check blocks). To ensure the consistency of stripes, a check block in a stripe is obtained by XORing all data blocks in the stripe.
目前,当服务器发起写IO(即Input/Output,输入/输出)流程,向不同数据块写入数据时,需要分别基于偏移和长度读取每个数据块所在条带校验块中的数据,分别进行新校验数据的计算以及新校验数据的写入,当发起写流程时,每秒可能有万计的IO,这样,会带来不小的耗时,影响存储的性能。Currently, when the server initiates a write IO (Input/Output) process and writes data to different data blocks, it is necessary to read the data in the stripe check block where each data block is located based on the offset and length, calculate the new check data, and write the new check data. When the write process is initiated, there may be tens of thousands of IOs per second, which will take a lot of time and affect storage performance.
发明内容Summary of the invention
有鉴于此,本申请的目的在于提供一种磁盘阵列写处理方法、装置、设备及介质,能够降低处理校验数据的耗时,从而提升存储性能。其具体方案如下:In view of this, the purpose of this application is to provide a disk array write processing method, device, equipment and medium, which can reduce the time consumption of processing verification data, thereby improving storage performance. The specific scheme is as follows:
本申请公开了一种磁盘阵列写处理方法,包括:The present application discloses a disk array write processing method, comprising:
基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度;Determine the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length;
分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录; Recording the write position information of the target data block in each target stripe to the information record corresponding to the target stripe;
基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息;Determine the full amount of location information of the parity block in each target stripe that is currently to be updated based on the information record;
当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据;When any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information;
基于旧校验数据进行计算,得到新校验数据;Perform calculation based on old verification data to obtain new verification data;
基于全量位置信息将新校验数据写入相应的校验块。Write the new verification data into the corresponding verification block based on the full location information.
可选的,基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息,包括:Optionally, the full amount of location information of the parity block in each target stripe that is currently to be updated with data is determined based on the information record, including:
从信息记录依次读取写入位置信息,并每读取到一个写入位置信息,则将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,并将该页掩码与目标页掩码进行或运算,得到该写入位置信息对应的位置信息掩码,并将该位置信息掩码记为该目标条带内校验块当前待进行数据更新的全量位置信息;The write position information is read from the information record in sequence, and each time a write position information is read, the write position information is converted into a page mask form to obtain a page mask corresponding to the write position information, and the page mask is ORed with the target page mask to obtain a position information mask corresponding to the write position information, and the position information mask is recorded as the full amount of position information of the parity block in the target stripe that is currently to be updated with data;
其中,页掩码形式为预设位数的二进制码形式,每位对应一页,并且,读取的首个写入位置信息对应的目标页掩码为初始页掩码,非首个写入位置信息对应的目标页掩码为上一个写入位置信息对应的位置信息掩码。Among them, the page mask format is a binary code format of a preset number of bits, each bit corresponds to a page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information.
可选的,初始页掩码各位均为0。Optionally, all bits in the initial page mask are 0.
可选的,目标条带满足校验数据读取条件为读取到的写入位置信息的数量达到预设数量阈值,或读取到的写入位置信息的数量未达到预设数量阈值,信息记录已没有待读取的写入位置信息。Optionally, the target stripe satisfies the verification data reading condition when the number of write position information read reaches a preset number threshold, or the number of write position information read does not reach the preset number threshold, and the information record has no write position information to be read.
可选的,将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,包括:Optionally, converting the write position information into a page mask format to obtain a page mask corresponding to the write position information includes:
计算该写入位置信息对应的初始页和页长度,并转换为页掩码形式以得到该写入位置信息对应的页掩码。The initial page and page length corresponding to the write position information are calculated and converted into a page mask form to obtain a page mask corresponding to the write position information.
可选的,分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录,包括:Optionally, recording the write position information of the target data block in each target stripe to the information record corresponding to the target stripe includes:
将每个目标条带内的每个目标数据块的写入位置信息转化为一个节点,并将该节点添加至该目标条带对应的结构体中的链表。The write position information of each target data block in each target stripe is converted into a node, and the node is added to the linked list in the structure corresponding to the target stripe.
可选的,从信息记录依次读取写入位置信息,包括:从链表中依次读取节点。Optionally, reading the write position information from the information record in sequence includes: reading nodes from a linked list in sequence.
可选的,从信息记录依次读取写入位置信息,包括:Optionally, the write position information is read from the information record in sequence, including:
利用调度线程从信息记录依次读取写入位置信息。The scheduling thread is used to read and write the position information from the information record in sequence.
可选的,还包括: Optionally, also include:
基于目标数据块的写入位置信息读取目标数据块中的旧数据,并对旧数据和该目标数据块对应的新数据进行计算,得到该目标数据块的中间校验值。Based on the write position information of the target data block, old data in the target data block is read, and the old data and new data corresponding to the target data block are calculated to obtain an intermediate check value of the target data block.
可选的,基于旧校验数据进行计算,得到新校验数据,包括:Optionally, calculation is performed based on the old verification data to obtain new verification data, including:
依次读取每个目标数据块对应的中间校验值,并在每读取到一个目标数据块的中间校验值后,则将该中间校验值与第一目标校验数据进行异或运算,得到第二目标校验数据,直到运算完旧校验数据对应的全部目标数据块的中间值校验值,将当前的第二目标校验数据作为新校验数据;Sequentially read the intermediate check value corresponding to each target data block, and after each intermediate check value of a target data block is read, perform an XOR operation on the intermediate check value and the first target check data to obtain the second target check data, until the intermediate check values of all target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
其中,首个读取到的中间校验值对应的第一目标校验数据为旧校验数据,非首个读取到的中间校验值对应的第一目标校验数据为上一读取到的中间校验值对应的第二目标校验数据。Among them, the first target verification data corresponding to the first intermediate verification value read is the old verification data, and the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
可选的,还包括:Optionally, also include:
基于每个目标数据块的写入位置信息将每个目标数据块对应的新数据写入每个目标数据块。New data corresponding to each target data block is written into each target data block based on the write position information of each target data block.
可选的,还包括:Optionally, also include:
在将新数据写入目标数据块之后,将新数据记录至缓存区。After the new data is written into the target data block, the new data is recorded into the buffer area.
本申请公开了一种DRAID5写处理装置,包括:The present application discloses a DRAID5 write processing device, comprising:
条带及信息确定模块,用于基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度;The stripe and information determination module is used to determine the target stripe to be written to in DRAID5 and the write position information of the target data block to be written to in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length;
条带信息记录模块,用于分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录;A stripe information recording module, used to record the write position information of the target data block in each target stripe to the information record corresponding to the target stripe;
位置信息确定模块,用于基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息;A location information determination module, used to determine the full amount of location information of the check block in each target stripe that is currently to be updated based on the information record;
旧校验数据读取模块,用于当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据;The old check data reading module is used to read data from the corresponding check block based on the current full position information when any target strip meets the check data reading condition, and obtain the old check data corresponding to the current full position information;
新校验数据计算模块,用于基于旧校验数据进行计算,得到新校验数据;A new verification data calculation module, used to perform calculations based on old verification data to obtain new verification data;
新校验数据写入模块,用于基于全量位置信息将新校验数据写入相应的校验块。The new verification data writing module is used to write the new verification data into the corresponding verification block based on the full position information.
本申请公开了一种电子设备,包括存储器和处理器,其中:The present application discloses an electronic device, including a memory and a processor, wherein:
存储器,用于保存计算机程序; Memory, used to store computer programs;
处理器,用于执行计算机程序,以实现前述的磁盘阵列写处理方法。The processor is used to execute a computer program to implement the aforementioned disk array write processing method.
本申请公开了一种计算机非易失性可读存储介质,用于保存计算机程序,其中,计算机程序被处理器执行时实现前述的磁盘阵列写处理方法。The present application discloses a computer non-volatile readable storage medium for storing a computer program, wherein the computer program implements the aforementioned disk array write processing method when executed by a processor.
可见,本申请基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度,分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录,并基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息,当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据,然后基于旧校验数据进行计算,得到新校验数据,最后基于全量位置信息将新校验数据写入相应的校验块。也即,本申请在服务器发起IO写请求后,将每个待进行数据写入的条带中每个待进行数据写入的数据块记录至相应的信息记录,并基于该信息记录确定当前每个条带内校验块当前待进行数据更新的全量位置信息,当满足校验数据读取条件,则根据当前的全量位置信息对校验块进行一次数据读取,就可以读取到全部待更新的旧校验数据,然后进行计算,在基于全量位置信息一次性的写入相应的校验块,减少了校验数据读取和写入次数,能够降低处理校验数据的耗时,从而提升存储性能。It can be seen that the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded in the information record corresponding to the target stripe, and the full position information of the check block in each target stripe to be updated is determined based on the information record. When any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information, and then calculation is performed based on the old check data to obtain new check data, and finally the new check data is written into the corresponding check block based on the full position information. That is, after the server initiates an IO write request, the present application records each data block to be written in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record. When the check data reading condition is met, the check block is read once according to the current full position information, and all the old check data to be updated can be read. After calculation, the corresponding check block is written at one time based on the full position information, which reduces the number of check data reading and writing times, can reduce the time spent on processing check data, and thus improves storage performance.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
图1为本申请实施例提供的一种磁盘阵列中一个条带的分块布局示意图;FIG1 is a schematic diagram of a block layout of a stripe in a disk array provided in an embodiment of the present application;
图2为本申请实施例公开的一种磁盘阵列写处理方法流程图;FIG2 is a flow chart of a disk array write processing method disclosed in an embodiment of the present application;
图3为本申请实施例公开的一种磁盘阵列写处理装置结构示意图;FIG3 is a schematic diagram of the structure of a disk array write processing device disclosed in an embodiment of the present application;
图4为本申请实施例公开的一种电子设备原理结构图。FIG. 4 is a schematic diagram of a structure of an electronic device disclosed in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请 中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
DRAID5中区分数据块和校验块的标准为stripnum(分块编码),数据块的分块编码为大于等1,小于条带内分块总个数的常数,校验块的分块编码为0,参见图1所示,图1为一种磁盘阵列中一个条带的分块布局示意图,包括盘0、盘1、盘2、盘3,条带包括校编码为0的块0即校验块,编码为1、2、3的块1、块2和块3,即3个数据块。当向磁盘1中编号为1的数据块发起写IO流程时,写IO对应的分块内偏移和长度计为stripoffset,count,具体算法如下:The standard for distinguishing data blocks and check blocks in DRAID5 is stripnum (block code). The block code of the data block is a constant greater than 1 and less than the total number of blocks in the stripe. The block code of the check block is 0. See Figure 1. Figure 1 is a schematic diagram of the block layout of a stripe in a disk array, including disk 0, disk 1, disk 2, and disk 3. The stripe includes block 0 with a check code of 0, i.e., the check block, and blocks 1, block 2, and block 3 with codes of 1, 2, and 3, i.e., 3 data blocks. When a write IO process is initiated to the data block numbered 1 in disk 1, the offset and length in the block corresponding to the write IO are counted as stripoffset, count. The specific algorithm is as follows:
第一步:为保证条带一致性,需要重新计算这个条带的新校验块,读取分块编号1的数据块stripoffset位置count长度内的旧数据,并fetch(即从服务器获取)分块编号1的数据块stripoffset位置count长度内要写的新数据,计算中间校验值;第二步:向磁盘1,分块编号1的数据块stripoffset位置count长度内写入新数据;第三步:读取盘0该条带中校验块的stripoffset位置count长度内的旧校验数据;第四步:将第一步的中间校验值与第三步读取到的旧校验数据进行异或运算得到新校验数据;第五步:将第四步计算到的新校验数据开始落盘,写入到校验块的stripoffset位置count长度内。第六步:Io结束。可以理解的是,当要向分块编码1和2写入数据时,需要分别读取所在条带校验块的对应偏移和长度,需要进行2次旧校验数据的读取,2次新校验数据的计算,分2次写入新校验数据,均只需要一次就可以完成。要完成一个IO的流程是非常复杂的,随之带来的问题是性能也会受到影响,当存储开始发起写流程时,每秒万计的IO会带来不小的耗时问题。为此,本申请提供了一种磁盘阵列写处理方案,能够降低处理校验数据的耗时,从而提升存储性能。Step 1: To ensure the consistency of the stripe, it is necessary to recalculate the new check block of this stripe, read the old data within the stripoffset position count length of the data block of block number 1, and fetch (i.e., obtain from the server) the new data to be written within the stripoffset position count length of the data block of block number 1, and calculate the intermediate check value; Step 2: Write the new data to disk 1, the stripoffset position count length of the data block of block number 1; Step 3: Read the old check data within the stripoffset position count length of the check block in the strip of disk 0; Step 4: XOR the intermediate check value of the first step with the old check data read in the third step to obtain the new check data; Step 5: Start to write the new check data calculated in the fourth step to the disk and write it to the stripoffset position count length of the check block. Step 6: Io ends. It can be understood that when writing data to block codes 1 and 2, it is necessary to read the corresponding offset and length of the check block of the stripe respectively, and it is necessary to read the old check data twice, calculate the new check data twice, and write the new check data twice, which can be completed only once. The process of completing an IO is very complicated, and the problem that comes with it is that performance will also be affected. When the storage starts to initiate the write process, tens of thousands of IOs per second will bring a considerable time-consuming problem. To this end, this application provides a disk array write processing solution that can reduce the time consumption of processing verification data, thereby improving storage performance.
参见图2所示,本申请实施例公开了一种磁盘阵列写处理方法,包括:As shown in FIG. 2 , the embodiment of the present application discloses a disk array write processing method, including:
步骤S11:基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度。Step S11: Determine the target stripe to be written to in DRAID5 and the write position information of the target data block to be written to in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length.
可以理解的是,当服务器向存储发起IO写请求,每发起一个IO写请求,均会将该IO先按条带拆分,再按分块进行拆分,得到每个数据块的写入偏移和写入长度。It is understandable that when the server initiates an IO write request to the storage, each IO write request will first be split into stripes and then into blocks to obtain the write offset and write length of each data block.
在一种具体的实施方式中,可以基于目标数据块的写入位置信息读取目标数据块中的旧数据,并对旧数据和该目标数据块对应的新数据进行计算,得到该目标数据块的中间校验值。具体的,将写入位置信息对应的旧数据与新数据进行异或运算,得到该目标数据块对应的中间校验值,并记录中间校验值。In a specific implementation, the old data in the target data block can be read based on the write position information of the target data block, and the old data and the new data corresponding to the target data block are calculated to obtain the intermediate check value of the target data block. Specifically, the old data corresponding to the write position information is XORed with the new data to obtain the intermediate check value corresponding to the target data block, and the intermediate check value is recorded.
进一步的,可以基于每个目标数据块的写入位置信息将每个目标数据块对应的新数据写 入每个目标数据块。并且,在将新数据写入目标数据块之后,将新数据记录至缓存区,当下次发起IO,若读取到该数据块,可以先判断是否命中缓存,若是,则从缓存中读取数据,无需从盘中读数据。Furthermore, the new data corresponding to each target data block can be written based on the write position information of each target data block. After writing the new data into the target data block, the new data is recorded in the cache area. When the next IO is initiated, if the data block is read, it can be determined whether it hits the cache. If so, the data is read from the cache without reading from the disk.
步骤S12:分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录。Step S12: Record the write position information of the target data block in each target stripe to the information record corresponding to the target stripe.
可以理解的是,DRAID5中数据块的写入位置信息和相应的校验块的写入位置信息是相同的。It can be understood that the write position information of the data block and the write position information of the corresponding check block in DRAID5 are the same.
在一种实施方式中,每个条带对应的信息记录为一个结构体;将每个目标条带内的每个目标数据块的写入位置信息转化为一个节点,并将该节点添加至该目标条带对应的结构体中的链表,等待线程调度。In one embodiment, the information corresponding to each stripe is recorded as a structure; the write position information of each target data block in each target stripe is converted into a node, and the node is added to the linked list in the structure corresponding to the target stripe, waiting for thread scheduling.
步骤S13:基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息。Step S13: Determine the full amount of location information of the parity blocks in each target stripe that are currently to be updated based on the information record.
从信息记录依次读取写入位置信息,并每读取到一个写入位置信息,则将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,并将该页掩码与目标页掩码进行或运算,得到该写入位置信息对应的位置信息掩码,并将该位置信息掩码记为该目标条带内校验块当前待进行数据更新的全量位置信息;The write position information is read from the information record in sequence, and each time a write position information is read, the write position information is converted into a page mask form to obtain a page mask corresponding to the write position information, and the page mask is ORed with the target page mask to obtain a position information mask corresponding to the write position information, and the position information mask is recorded as the full amount of position information of the parity block in the target stripe that is currently to be updated with data;
其中,页掩码形式为预设位数的二进制码形式,每位对应一页,并且,读取的首个写入位置信息对应的目标页掩码为初始页掩码,非首个写入位置信息对应的目标页掩码为上一个写入位置信息对应的位置信息掩码。初始页掩码各位均为0。The page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
并且,将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,具体可以为:计算该写入位置信息对应的初始页和页长度,并转换为页掩码形式以得到该写入位置信息对应的页掩码。Furthermore, the write position information is converted into a page mask format to obtain a page mask corresponding to the write position information. Specifically, the initial page and page length corresponding to the write position information are calculated, and converted into a page mask format to obtain a page mask corresponding to the write position information.
以分块大小256kb为例,写入偏移以及写入长度对应的单位为扇区(sector),换算单位为1kb=2sector,1page=4kb,以写入偏移=32sector,写入长度=16sector为例。32sector=4page,16sector=2page,一个分块256kb换算成页page就有64个page,写入偏移为第四个page,要写的页长度为2page。对应的页掩码为0(此处省略58个0)11000。Taking the block size of 256kb as an example, the unit corresponding to the write offset and the write length is sector, and the conversion unit is 1kb=2sector, 1page=4kb. Take the write offset=32sector, and the write length=16sector as an example. 32sector=4page, 16sector=2page, a block of 256kb is converted into pages, which has 64 pages. The write offset is the fourth page, and the page length to be written is 2page. The corresponding page mask is 0 (58 zeros are omitted here) 11000.
可以页掩码变量,页掩码变量记录初始页掩码,每次将写入位置信息转换为页掩码,与页掩码变量进行或运算,并将计算结果更新到页掩码变量中。A page mask variable may be used, the page mask variable records the initial page mask, each time the write position information is converted into a page mask, an OR operation is performed with the page mask variable, and the calculation result is updated to the page mask variable.
在一种实施方式中,利用调度线程从信息记录依次读取写入位置信息。并且,可以从链表中依次读取节点。 In one implementation, the write position information is read sequentially from the information record using a scheduling thread, and the nodes can be read sequentially from the linked list.
步骤S14:当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据。Step S14: When any target stripe meets the verification data reading condition, data is read from the corresponding verification block based on the current full position information to obtain old verification data corresponding to the current full position information.
其中,目标条带满足校验数据读取条件为读取到的写入位置信息的数量达到预设数量阈值,或读取到的写入位置信息的数量未达到预设数量阈值,信息记录已没有待读取的写入位置信息。例如,当读取到的写入位置信息的数量未达到20,则不再进行写入位置信息读取。The target stripe satisfies the verification data reading condition when the number of read write position information reaches a preset number threshold, or the number of read write position information does not reach the preset number threshold, and the information record has no write position information to be read. For example, when the number of read write position information does not reach 20, the write position information is no longer read.
也即,可以确定出当前校验块待进行数据更新的全部位置,一次性读取相应的全部的旧校验数据。That is, all the positions of the current check block where data update is to be performed can be determined, and all the corresponding old check data can be read at one time.
步骤S15:基于旧校验数据进行计算,得到新校验数据。Step S15: Calculate based on the old verification data to obtain new verification data.
在一种实施方式中,可以依次读取每个目标数据块对应的中间校验值,并在每读取到一个目标数据块的中间校验值后,则将该中间校验值与第一目标校验数据进行异或运算,得到第二目标校验数据,直到运算完旧校验数据对应的全部目标数据块的中间值校验值,将当前的第二目标校验数据作为新校验数据;In one implementation, the intermediate check value corresponding to each target data block may be read in sequence, and after each intermediate check value of a target data block is read, the intermediate check value is XORed with the first target check data to obtain the second target check data, until the intermediate check values of all target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
其中,首个读取到的中间校验值对应的第一目标校验数据为旧校验数据,非首个读取到的中间校验值对应的第一目标校验数据为上一读取到的中间校验值对应的第二目标校验数据。Among them, the first target verification data corresponding to the first intermediate verification value read is the old verification data, and the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
比如,全量位置信息对应于20个写入位置信息,则依次利用10个中间校验值进行异或运算。For example, the full amount of position information corresponds to 20 pieces of write position information, and then 10 intermediate check values are used in sequence to perform an XOR operation.
步骤S16:基于全量位置信息将新校验数据写入相应的校验块。Step S16: writing the new verification data into the corresponding verification block based on the full position information.
下面,进一步阐述本申请提供的磁盘阵列写处理方案,可以采用编程语言进行算法实现,无论目标数据块是否连续,均可实现校验块的合并读写,包括以下步骤:The disk array write processing solution provided by the present application is further described below. The algorithm can be implemented using a programming language. Regardless of whether the target data blocks are continuous, the merged reading and writing of the check blocks can be realized, including the following steps:
第一步:在校验块对应的缓存结构体sce中,添加成员变量:
Struct sce{
Queue sce_queue;
Uint64PAGE_MASK;
}
其中,queue为如下类型
Struct queue{
Struct queue*pre;
Struct queue*next;
}
Uint64PAGE_MASK初始化为0。
Step 1: Add member variables to the cache structure sce corresponding to the check block:
Struct sce{
Queue sce_queue;
Uint64PAGE_MASK;
}
Among them, queue is of the following type
Struct queue{
Struct queue*pre;
Struct queue*next;
}
Uint64PAGE_MASK is initialized to 0.
每个条带均设置一个结构体sde,该结构体中存有该条带内所有分块(数据块和校验块)缓存结构sce的指针变量。缓存结构功能:当向盘写完新数据时,会将新数据移到缓存cache区,并用sce结构体进行标记,下次发起io若读取到该分块,sce中查询标记是否缓存命中,缓存命中就可以不去盘上读取数据了。Each stripe is set with a structure sde, which stores pointer variables of the cache structure sce of all blocks (data blocks and check blocks) in the stripe. Cache structure function: When new data is written to the disk, the new data will be moved to the cache area and marked with the sce structure. If the next IO is initiated to read the block, the sce will query the mark to see if the cache hits. If the cache hits, the data does not need to be read from the disk.
Struct sde{Struct sde{
Sce*extension[16]Sce*extension[16]
}。注:一个条带内分块个数最大为16个。Note: The maximum number of blocks in a stripe is 16.
第二步:每发起一个IO,会将此IO先按条带拆分,再按分块进行拆分,对应最后拆成的每个分块建立相应的ipk(记录数据块要写入的偏移和长度的结构体),以及此分块对应的条带内的校验块pipk(记录校验块要写入的偏移和长度的结构体)。当服务器向存储发起IO,考虑多个IO的情况,数据块的写入偏移和写入长度记为stripoffset i、count i,则将数据块对应的校验块的分块偏移和写入长度为stripoffset i,count i,将到stripoffset i,count i记录至pipk i中。Step 2: Each time an IO is initiated, the IO will be split into stripes and then into blocks. For each block, a corresponding ipk (a structure that records the offset and length of the data block to be written) and a check block pipk (a structure that records the offset and length of the check block to be written) in the stripe corresponding to the block will be established. When the server initiates an IO to the storage, considering the case of multiple IOs, the write offset and write length of the data block are recorded as stripoffset i, count i, then the block offset and write length of the check block corresponding to the data block are stripoffset i, count i, and stripoffset i, count i are recorded in pipk i.
第三步:读取数据块stripoffset i位置count i长度内的旧数据,并fetch数据块stripoffset i位置count i长度内要写的新数据,计算中间校验值paritybuilt i;Step 3: Read the old data within the length of count i at position stripoffset i in the data block, fetch the new data to be written within the length of count i at position stripoffset i in the data block, and calculate the intermediate checksum paritybuilt i;
第四步:向所在磁盘对应的条带内的数据块stripoffset i位置count i长度内写入新数据;Step 4: Write new data to the data block stripoffset i position count i length in the stripe corresponding to the disk;
第五步:找到要写入新数据的数据块对应的校验块pipk i,将pipk i转化成节点形式加入到所在sde中校验块对应的sce结构体中的Queue sce_queue链表中的节点位置上等待线程调度从链表取出任务。Step 5: Find the check block pipk i corresponding to the data block to which the new data is to be written, convert pipk i into a node form and add it to the node position in the Queue sce_queue linked list in the sce structure corresponding to the check block in sde, and wait for the thread scheduling to take out the task from the linked list.
第六步:若存在其他io,则继续执行第五步的流程,若其他的pipk j与第五步pipk i对应同一个sde结构体的sce分块,那么将此pipk j转化成节点形式加入到Queue sce_queue链表中的节点的下一个节点位置上,仍旧等待线程调度。Step 6: If there are other io, continue to execute the process of step 5. If other pipk j corresponds to the sce block of the same sde structure as pipk i in the fifth step, then convert this pipk j into a node form and add it to the next node position of the node in the Queue sce_queue linked list, still waiting for thread scheduling.
第七步:线程调度从Queue sce_queue链表中获得第一个节点。Step 7: The thread scheduling obtains the first node from the Queue sce_queue linked list.
第八步:将节点转化成pipk i,记录其stripoffset i,count i。将stripoffset i,count i转化成page对应的pagemask码,与PAGE_MASK进行或运算,并将计算结果更新到PAGE_MASK中。以分块大小256kb为例,stripoffset与count对应单位为扇区sector,换算单位为1kb=2sector,转换成page对应的形式,1page=4kb,以stripoffset i=32sector,count i=16sector为例。32sector=4page,16sector=2page,一个分块256kb换算成页page就有64个page,写入的偏移为第四个page,要写的页长度为2page。对应的pagemask为0(此处省略58个0)11000。 Step 8: Convert the node to pipk i, and record its stripoffset i, count i. Convert stripoffset i, count i into the pagemask code corresponding to the page, perform an OR operation with PAGE_MASK, and update the calculation result to PAGE_MASK. Taking the block size of 256kb as an example, the unit corresponding to stripoffset and count is sector, and the conversion unit is 1kb=2sector. Converted to the form corresponding to page, 1page=4kb, take stripoffset i=32sector, count i=16sector as an example. 32sector=4page, 16sector=2page, a block of 256kb is converted into 64 pages, the offset to be written is the fourth page, and the page length to be written is 2page. The corresponding pagemask is 0 (58 zeros are omitted here) 11000.
第九步:判断此链表中是否还有下一个节点成员,若有,则取出下一个节点,累计合并的数量coalescecount++,限制合并数量的最大值coalescecountmax=20个,若coalescecount=<coalescecountmax,执行第八步;若该节点后无其他节点(即pipk加到sce->queue链表到调度从sce->queue链表取出pipk这一段时间内再无其他pipk加入到该sce->queue链表,即从scequeue链表取下一个节点发现为空,则不在继续等待合并)或合并数量达到coalescecountmax,则执行第十步。Step 9: Determine whether there is a next node member in this linked list. If so, take out the next node, accumulate the number of merges coalescecount++, and limit the maximum value of the merged number coalescecountmax=20. If coalescecount=<coalescecountmax, execute step 8; if there is no other node after this node (that is, no other pipk is added to the sce->queue linked list during the period from pipk being added to the sce->queue linked list to the scheduling of taking out pipk from the sce->queue linked list, that is, if the next node is taken from the scequeue linked list and found to be empty, then no further waiting for merging is done) or the number of merges reaches coalescecountmax, execute step 10.
第十步:根据PAGEMASK码对应的数值,去盘上读取旧的校验数据,读完成执行第十一步。Step 10: Read the old verification data from the disk according to the value corresponding to the PAGEMASK code. After reading, execute step 11.
第十一步:将第十步读取的旧校验数据与pipk对应的第三步计算得到的中间校验值进行异或运算,得到新校验数据。转至十二步。Step 11: XOR the old checksum data read in step 10 with the intermediate checksum value calculated in step 3 corresponding to pipk to obtain new checksum data. Go to step 12.
第十二步:判断此pipk对应的sce结构体中的节点后面是否还有其他节点,若不存在则表示不存在校验合并了,第十一步计算的新校验数据为最终的新校验数据,转至十四步。若对应节点后面还存在其他节点且还未达到20,表示还存在校验合并,第十一步计算的新校验数据不为最终校验数据,转至十三步。Step 12: Determine whether there are other nodes behind the node in the sce structure corresponding to this pipk. If not, it means that there is no verification merge. The new verification data calculated in step 11 is the final new verification data, and go to step 14. If there are other nodes behind the corresponding node and it has not reached 20, it means that there is still verification merge. The new verification data calculated in step 11 is not the final verification data, and go to step 13.
第十三步:从链表取出下一个节点转成对应的pipk,并找出其对应的中间校验值,与第十一步得到的新校验数据进行异或运算,异或完成继续从链表取出下一个节点继续异或运算,直至遍历完链表中第十步旧校验数据对应的全部节点,计算得到最终的新校验数据。转至十四步。Step 13: Take the next node from the linked list and convert it into the corresponding pipk, find its corresponding intermediate check value, and perform XOR operation with the new check data obtained in step 11. After XOR is completed, continue to take the next node from the linked list and continue XOR operation until all nodes corresponding to the old check data in step 10 in the linked list are traversed, and the final new check data is calculated. Go to step 14.
第十四步:将计算到的最终的新校验数据开始落盘。Step 14: Start writing the calculated final new verification data to disk.
第十五步:Io结束完成。Step 15: Io is completed.
这样,针对写流程中校验块读写复杂耗时的问题,能够减少IO中向磁盘发起的读写次数,能够提升存储系统的IOPS(Input/Output Operations Per Second,每秒的输入输出量),有效的提升存储性能。In this way, the problem of complex and time-consuming reading and writing of verification blocks in the write process can be solved, the number of read and write times initiated to the disk in IO can be reduced, the IOPS (Input/Output Operations Per Second) of the storage system can be increased, and storage performance can be effectively improved.
可见,本申请实施例基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度,分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录,并基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息,当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据,然后基于旧校验数据进行计算,得到新校验数据,最后基于全量位置信息将新校验数据写入相应的校验块。 也即,本申请实施例在服务器发起IO写请求后,将每个待进行数据写入的条带中每个待进行数据写入的数据块记录至相应的信息记录,并基于该信息记录确定当前每个条带内校验块当前待进行数据更新的全量位置信息,当满足校验数据读取条件,则根据当前的全量位置信息对校验块进行一次数据读取,就可以读取到全部待更新的旧校验数据,然后进行计算,在基于全量位置信息一次性的写入相应的校验块,减少了校验数据读取和写入次数,能够降低处理校验数据的耗时,从而提升存储性能。It can be seen that the embodiment of the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the current data update to be performed on the check block in each target stripe is determined based on the information record. When any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information, and then calculation is performed based on the old check data to obtain new check data, and finally the new check data is written to the corresponding check block based on the full position information. That is, after the server initiates an IO write request, the embodiment of the present application records each data block to be written in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record. When the check data reading condition is met, the check block is read once according to the current full position information, and all the old check data to be updated can be read. Then, calculations are performed and the corresponding check block is written at one time based on the full position information, which reduces the number of check data reading and writing times, can reduce the time spent on processing check data, and thus improves storage performance.
参见图3所示,本申请实施例公开了一种DRAID5写处理装置,包括:As shown in FIG3 , the embodiment of the present application discloses a DRAID5 write processing device, including:
条带及信息确定模块11,用于基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度;The stripe and information determination module 11 is used to determine the target stripe to be written to in DRAID5 and the write position information of the target data block to be written to in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length;
条带信息记录模块12,用于分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录;The stripe information recording module 12 is used to record the write position information of the target data block in each target stripe to the information record corresponding to the target stripe;
位置信息确定模块13,用于基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息;A location information determination module 13, used to determine the full location information of the check blocks in each target stripe that are currently to be updated based on the information record;
旧校验数据读取模块14,用于当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据;The old check data reading module 14 is used to read data from the corresponding check block based on the current full position information when any target strip meets the check data reading condition, so as to obtain the old check data corresponding to the current full position information;
新校验数据计算模块15,用于基于旧校验数据进行计算,得到新校验数据;A new verification data calculation module 15, used to perform calculation based on the old verification data to obtain new verification data;
新校验数据写入模块16,用于基于全量位置信息将新校验数据写入相应的校验块。The new verification data writing module 16 is used to write the new verification data into the corresponding verification block based on the full position information.
可见,本申请实施例基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度,分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录,并基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息,当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据,然后基于旧校验数据进行计算,得到新校验数据,最后基于全量位置信息将新校验数据写入相应的校验块。也即,本申请实施例在服务器发起IO写请求后,将每个待进行数据写入的条带中每个待进行数据写入的数据块记录至相应的信息记录,并基于该信息记录确定当前每个条带内校验块当前待进行数据更新的全量位置信息,当满足校验数据读取条件,则根据当前的全量位置信息 对校验块进行一次数据读取,就可以读取到全部待更新的旧校验数据,然后进行计算,在基于全量位置信息一次性的写入相应的校验块,减少了校验数据读取和写入次数,能够降低处理校验数据的耗时,从而提升存储性能。It can be seen that the embodiment of the present application determines the write position information of the target stripe to be written to and the target data block to be written to in each target stripe in DRAID5 based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the check block to be updated in each target stripe is determined based on the information record. When any target stripe meets the check data reading condition, a data read is performed from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information, and then the calculation is performed based on the old check data to obtain the new check data, and finally the new check data is written to the corresponding check block based on the full position information. That is, after the server initiates an IO write request, the embodiment of the present application records each data block to be written to in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record. When the check data reading condition is met, the current full position information is read according to the current full position information. By reading the check block once, all the old check data to be updated can be read, and then calculations are performed, and the corresponding check block is written at one time based on the full location information, which reduces the number of times the check data is read and written, and can reduce the time spent on processing the check data, thereby improving storage performance.
在一种实施方式中,位置信息确定模块13,具体用于从信息记录依次读取写入位置信息,并每读取到一个写入位置信息,则将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,并将该页掩码与目标页掩码进行或运算,得到该写入位置信息对应的位置信息掩码,并将该位置信息掩码记为该目标条带内校验块当前待进行数据更新的全量位置信息;In one embodiment, the position information determination module 13 is specifically used to read the write position information from the information record in sequence, and each time a write position information is read, the write position information is converted into a page mask form to obtain a page mask corresponding to the write position information, and the page mask is ORed with the target page mask to obtain a position information mask corresponding to the write position information, and the position information mask is recorded as the full position information of the parity block in the target stripe that is currently to be updated with data;
其中,页掩码形式为预设位数的二进制码形式,每位对应一页,并且,读取的首个写入位置信息对应的目标页掩码为初始页掩码,非首个写入位置信息对应的目标页掩码为上一个写入位置信息对应的位置信息掩码。初始页掩码各位均为0。The page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
并且,目标条带满足校验数据读取条件为读取到的写入位置信息的数量达到预设数量阈值,或读取到的写入位置信息的数量未达到预设数量阈值,信息记录已没有待读取的写入位置信息。Furthermore, the target stripe satisfies the verification data reading condition when the number of the read write position information reaches a preset number threshold, or the number of the read write position information does not reach the preset number threshold, and the information record has no write position information to be read.
其中,将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,包括:计算该写入位置信息对应的初始页和页长度,并转换为页掩码形式以得到该写入位置信息对应的页掩码。The step of converting the write position information into a page mask format to obtain a page mask corresponding to the write position information includes: calculating an initial page and a page length corresponding to the write position information, and converting the initial page and the page length into a page mask format to obtain a page mask corresponding to the write position information.
在一种实施方式中,条带信息记录模块12,具体用于将每个目标条带内的每个目标数据块的写入位置信息转化为一个节点,并将该节点添加至该目标条带对应的结构体中的链表。进一步的,位置信息确定模块13,具体用于从链表中依次读取节点。In one embodiment, the stripe information recording module 12 is specifically used to convert the write position information of each target data block in each target stripe into a node, and add the node to the linked list in the structure corresponding to the target stripe. Further, the position information determination module 13 is specifically used to read the nodes from the linked list in sequence.
在一种实施方式中,位置信息确定模块13,具体用于利用调度线程从信息记录依次读取写入位置信息。In one implementation, the location information determination module 13 is specifically configured to sequentially read and write location information from information records using a scheduling thread.
进一步的,装置还包括中间校验值计算模块,用于基于目标数据块的写入位置信息读取目标数据块中的旧数据,并对旧数据和该目标数据块对应的新数据进行计算,得到该目标数据块的中间校验值。Furthermore, the device also includes an intermediate check value calculation module, which is used to read old data in the target data block based on the write position information of the target data block, and calculate the old data and the new data corresponding to the target data block to obtain the intermediate check value of the target data block.
相应的,新校验数据计算模块15,用于依次读取每个目标数据块对应的中间校验值,并在每读取到一个目标数据块的中间校验值后,则将该中间校验值与第一目标校验数据进行异或运算,得到第二目标校验数据,直到运算完旧校验数据对应的全部目标数据块的中间值校验值,将当前的第二目标校验数据作为新校验数据;Correspondingly, the new verification data calculation module 15 is used to read the intermediate verification value corresponding to each target data block in turn, and after each intermediate verification value of a target data block is read, the intermediate verification value is XOR-operated with the first target verification data to obtain the second target verification data, until the intermediate verification values of all target data blocks corresponding to the old verification data are calculated, and the current second target verification data is used as the new verification data;
其中,首个读取到的中间校验值对应的第一目标校验数据为旧校验数据,非首个读取到 的中间校验值对应的第一目标校验数据为上一读取到的中间校验值对应的第二目标校验数据。The first target verification data corresponding to the first intermediate verification value read is the old verification data, and the first target verification data corresponding to the first intermediate verification value read is the old verification data. The first target verification data corresponding to the intermediate verification value is the second target verification data corresponding to the last read intermediate verification value.
并且,装置还包括数据块写入模块,用于:基于每个目标数据块的写入位置信息将每个目标数据块对应的新数据写入每个目标数据块。Furthermore, the device further comprises a data block writing module, which is used to write new data corresponding to each target data block into each target data block based on the writing position information of each target data block.
另外,装置还包括写缓存模块,用于在将新数据写入目标数据块之后,将新数据记录至缓存区。In addition, the device also includes a write cache module, which is used to record the new data into the cache area after writing the new data into the target data block.
参见图4所示,本申请实施例公开了一种电子设备20,包括处理器21和存储器22;其中,存储器22,用于保存计算机程序;处理器21,用于执行计算机程序,以实现以下步骤:As shown in FIG. 4 , an embodiment of the present application discloses an electronic device 20, including a processor 21 and a memory 22; wherein the memory 22 is used to store a computer program; and the processor 21 is used to execute the computer program to implement the following steps:
基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度;分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录;基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息;当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据;基于旧校验数据进行计算,得到新校验数据;基于全量位置信息将新校验数据写入相应的校验块。Based on the IO write request initiated by the server, the write position information of the target stripe to be written to data in DRAID5 and the target data block to be written to data in each target stripe is determined; the write position information includes the write offset and the write length; the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe respectively; based on the information record, the full position information of the check block in each target stripe to be updated with data is determined; when any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information; calculation is performed based on the old check data to obtain new check data; and the new check data is written into the corresponding check block based on the full position information.
可见,本申请实施例基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度,分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录,并基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息,当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据,然后基于旧校验数据进行计算,得到新校验数据,最后基于全量位置信息将新校验数据写入相应的校验块。也即,本申请实施例在服务器发起IO写请求后,将每个待进行数据写入的条带中每个待进行数据写入的数据块记录至相应的信息记录,并基于该信息记录确定当前每个条带内校验块当前待进行数据更新的全量位置信息,当满足校验数据读取条件,则根据当前的全量位置信息对校验块进行一次数据读取,就可以读取到全部待更新的旧校验数据,然后进行计算,在基于全量位置信息一次性的写入相应的校验块,减少了校验数据读取和写入次数,能够降低处理校验数据的耗时,从而提升存储性能。It can be seen that the embodiment of the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the current data update to be performed on the check block in each target stripe is determined based on the information record. When any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information, and then calculation is performed based on the old check data to obtain new check data, and finally the new check data is written to the corresponding check block based on the full position information. That is, after the server initiates an IO write request, the embodiment of the present application records each data block to be written in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record. When the check data reading condition is met, the check block is read once according to the current full position information, and all the old check data to be updated can be read. Then, calculations are performed and the corresponding check block is written at one time based on the full position information, which reduces the number of check data reading and writing times, can reduce the time spent on processing check data, and thus improves storage performance.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步 骤:从信息记录依次读取写入位置信息,并每读取到一个写入位置信息,则将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,并将该页掩码与目标页掩码进行或运算,得到该写入位置信息对应的位置信息掩码,并将该位置信息掩码记为该目标条带内校验块当前待进行数据更新的全量位置信息;In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: Step: read the write position information from the information record in sequence, and each time a write position information is read, convert the write position information into a page mask form to obtain a page mask corresponding to the write position information, and perform an OR operation on the page mask and the target page mask to obtain a position information mask corresponding to the write position information, and record the position information mask as the full amount of position information of the parity block in the target stripe that is currently to be updated;
其中,页掩码形式为预设位数的二进制码形式,每位对应一页,并且,读取的首个写入位置信息对应的目标页掩码为初始页掩码,非首个写入位置信息对应的目标页掩码为上一个写入位置信息对应的位置信息掩码。初始页掩码各位均为0。The page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
并且,目标条带满足校验数据读取条件为读取到的写入位置信息的数量达到预设数量阈值,或读取到的写入位置信息的数量未达到预设数量阈值,信息记录已没有待读取的写入位置信息。Furthermore, the target stripe satisfies the verification data reading condition when the number of the read write position information reaches a preset number threshold, or the number of the read write position information does not reach the preset number threshold, and the information record has no write position information to be read.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:计算该写入位置信息对应的初始页和页长度,并转换为页掩码形式以得到该写入位置信息对应的页掩码。In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: calculating the initial page and page length corresponding to the write position information, and converting them into a page mask form to obtain a page mask corresponding to the write position information.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:将每个目标条带内的每个目标数据块的写入位置信息转化为一个节点,并将该节点添加至该目标条带对应的结构体中的链表。In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: converting the write position information of each target data block in each target stripe into a node, and adding the node to the linked list in the structure corresponding to the target stripe.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:从链表中依次读取节点。In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps may be specifically implemented: reading nodes from the linked list in sequence.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:利用调度线程从信息记录依次读取写入位置信息。In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps may be specifically implemented: using the scheduling thread to sequentially read the write position information from the information record.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:基于目标数据块的写入位置信息读取目标数据块中的旧数据,并对旧数据和该目标数据块对应的新数据进行计算,得到该目标数据块的中间校验值。In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: based on the write position information of the target data block, the old data in the target data block is read, and the old data and the new data corresponding to the target data block are calculated to obtain the intermediate check value of the target data block.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:依次读取每个目标数据块对应的中间校验值,并在每读取到一个目标数据块的中间校验值后,则将该中间校验值与第一目标校验数据进行异或运算,得到第二目标校验数据,直到运算完旧校验数据对应的全部目标数据块的中间值校验值,将当前的第二目标校验数据作为新校验数据;In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps can be specifically implemented: sequentially reading the intermediate check value corresponding to each target data block, and after each intermediate check value of a target data block is read, performing an XOR operation on the intermediate check value and the first target check data to obtain the second target check data, until the intermediate check values of all target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
其中,首个读取到的中间校验值对应的第一目标校验数据为旧校验数据,非首个读取到的中间校验值对应的第一目标校验数据为上一读取到的中间校验值对应的第二目标校验数 据。The first target verification data corresponding to the first intermediate verification value read is the old verification data, and the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read. according to.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:基于每个目标数据块的写入位置信息将每个目标数据块对应的新数据写入每个目标数据块。In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps may be specifically implemented: based on the write position information of each target data block, new data corresponding to each target data block is written into each target data block.
本实施例中,处理器21执行存储器22中保存的计算机子程序时,可以具体实现以下步骤:在将新数据写入目标数据块之后,将新数据记录至缓存区。In this embodiment, when the processor 21 executes the computer subroutine stored in the memory 22, the following steps may be specifically implemented: after writing the new data into the target data block, the new data is recorded into the cache area.
并且,存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,存储方式可以是短暂存储或者永久存储。Furthermore, the memory 22, as a carrier for storing resources, may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.
另外,电子设备20还包括电源23、通信接口24、输入输出接口25和通信总线26;其中,电源23用于为电子设备20上的各硬件设备提供工作电压;通信接口24能够为电子设备20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In addition, the electronic device 20 also includes a power supply 23, a communication interface 24, an input/output interface 25 and a communication bus 26; wherein the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input/output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
进一步的,本申请实施例公开了一种计算机非易失性可读存储介质,用于保存计算机程序,其中,计算机程序被处理器执行时实现以下步骤:Furthermore, an embodiment of the present application discloses a computer non-volatile readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the following steps are implemented:
基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度;分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录;基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息;当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据;基于旧校验数据进行计算,得到新校验数据;基于全量位置信息将新校验数据写入相应的校验块。Based on the IO write request initiated by the server, the write position information of the target stripe to be written to data in DRAID5 and the target data block to be written to data in each target stripe is determined; the write position information includes the write offset and the write length; the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe respectively; based on the information record, the full position information of the check block in each target stripe to be updated with data is determined; when any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information; calculation is performed based on the old check data to obtain new check data; based on the full position information, the new check data is written into the corresponding check block.
可见,本申请实施例基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个目标条带内待进行数据写入的目标数据块的写入位置信息;写入位置信息包括写入偏移以及写入长度,分别将每个目标条带内的目标数据块的写入位置信息记录至该目标条带对应的信息记录,并基于信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息,当任意目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据,然后基于旧校验数据进行计算,得到新校验数据,最后基于全量位置信息将新校验数据写入相应的校验块。 也即,本申请实施例在服务器发起IO写请求后,将每个待进行数据写入的条带中每个待进行数据写入的数据块记录至相应的信息记录,并基于该信息记录确定当前每个条带内校验块当前待进行数据更新的全量位置信息,当满足校验数据读取条件,则根据当前的全量位置信息对校验块进行一次数据读取,就可以读取到全部待更新的旧校验数据,然后进行计算,在基于全量位置信息一次性的写入相应的校验块,减少了校验数据读取和写入次数,能够降低处理校验数据的耗时,从而提升存储性能。It can be seen that the embodiment of the present application determines the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length, and the write position information of the target data block in each target stripe is recorded to the information record corresponding to the target stripe, and the full position information of the current data update to be performed on the check block in each target stripe is determined based on the information record. When any target stripe meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain the old check data corresponding to the current full position information, and then calculation is performed based on the old check data to obtain new check data, and finally the new check data is written to the corresponding check block based on the full position information. That is, after the server initiates an IO write request, the embodiment of the present application records each data block to be written in each stripe to be written to the corresponding information record, and determines the full position information of the check block to be updated in each stripe based on the information record. When the check data reading condition is met, the check block is read once according to the current full position information, and all the old check data to be updated can be read. Then, calculations are performed and the corresponding check block is written at one time based on the full position information, which reduces the number of check data reading and writing times, can reduce the time spent on processing check data, and thus improves storage performance.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:从信息记录依次读取写入位置信息,并每读取到一个写入位置信息,则将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,并将该页掩码与目标页掩码进行或运算,得到该写入位置信息对应的位置信息掩码,并将该位置信息掩码记为该目标条带内校验块当前待进行数据更新的全量位置信息;In this embodiment, when the computer subroutine stored in the non-volatile computer readable storage medium is executed by the processor, the following steps can be specifically implemented: read the write position information from the information record in sequence, and each time a write position information is read, convert the write position information into a page mask form to obtain a page mask corresponding to the write position information, perform an OR operation on the page mask and the target page mask to obtain a position information mask corresponding to the write position information, and record the position information mask as the full amount of position information of the parity block in the target stripe that is currently to be updated;
其中,页掩码形式为预设位数的二进制码形式,每位对应一页,并且,读取的首个写入位置信息对应的目标页掩码为初始页掩码,非首个写入位置信息对应的目标页掩码为上一个写入位置信息对应的位置信息掩码。初始页掩码各位均为0。The page mask is in the form of a binary code with a preset number of bits, each bit corresponds to one page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information. All bits of the initial page mask are 0.
并且,目标条带满足校验数据读取条件为读取到的写入位置信息的数量达到预设数量阈值,或读取到的写入位置信息的数量未达到预设数量阈值,信息记录已没有待读取的写入位置信息。Furthermore, the target stripe satisfies the verification data reading condition when the number of the read write position information reaches a preset number threshold, or the number of the read write position information does not reach the preset number threshold, and the information record has no write position information to be read.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:计算该写入位置信息对应的初始页和页长度,并转换为页掩码形式以得到该写入位置信息对应的页掩码。In this embodiment, when the computer subroutine stored in the computer non-volatile readable storage medium is executed by the processor, the following steps can be specifically implemented: calculating the initial page and page length corresponding to the write position information, and converting them into a page mask form to obtain the page mask corresponding to the write position information.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:将每个目标条带内的每个目标数据块的写入位置信息转化为一个节点,并将该节点添加至该目标条带对应的结构体中的链表。In this embodiment, when the computer subroutine stored in the computer non-volatile readable storage medium is executed by the processor, the following steps can be specifically implemented: converting the write position information of each target data block in each target stripe into a node, and adding the node to the linked list in the structure corresponding to the target stripe.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:从链表中依次读取节点。In this embodiment, when the computer subroutine stored in the computer non-volatile readable storage medium is executed by the processor, the following steps may be specifically implemented: reading nodes from the linked list in sequence.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:利用调度线程从信息记录依次读取写入位置信息。In this embodiment, when the computer subroutine stored in the computer non-volatile readable storage medium is executed by the processor, the following steps can be specifically implemented: using the scheduling thread to sequentially read the write position information from the information record.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:基于目标数据块的写入位置信息读取目标数据块中的旧数据,并对旧数据和该目标数据块对应的新数据进行计算,得到该目标数据块的中间校验值。 In this embodiment, when the computer subroutine stored in the computer non-volatile readable storage medium is executed by the processor, the following steps can be specifically implemented: based on the write position information of the target data block, the old data in the target data block is read, and the old data and the new data corresponding to the target data block are calculated to obtain the intermediate check value of the target data block.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:依次读取每个目标数据块对应的中间校验值,并在每读取到一个目标数据块的中间校验值后,则将该中间校验值与第一目标校验数据进行异或运算,得到第二目标校验数据,直到运算完旧校验数据对应的全部目标数据块的中间值校验值,将当前的第二目标校验数据作为新校验数据;In this embodiment, when the computer subroutine stored in the non-volatile computer readable storage medium is executed by the processor, the following steps can be specifically implemented: sequentially reading the intermediate check value corresponding to each target data block, and after each intermediate check value of a target data block is read, performing an XOR operation on the intermediate check value and the first target check data to obtain the second target check data, until the intermediate check values of all target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
其中,首个读取到的中间校验值对应的第一目标校验数据为旧校验数据,非首个读取到的中间校验值对应的第一目标校验数据为上一读取到的中间校验值对应的第二目标校验数据。Among them, the first target verification data corresponding to the first intermediate verification value read is the old verification data, and the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:基于每个目标数据块的写入位置信息将每个目标数据块对应的新数据写入每个目标数据块。In this embodiment, when the computer subroutine stored in the computer non-volatile readable storage medium is executed by the processor, the following steps can be specifically implemented: writing new data corresponding to each target data block into each target data block based on the write position information of each target data block.
本实施例中,计算机非易失性可读存储介质中保存的计算机子程序被处理器执行时,可以具体实现以下步骤:在将新数据写入目标数据块之后,将新数据记录至缓存区。In this embodiment, when the computer subroutine stored in the computer non-volatile readable storage medium is executed by the processor, the following steps can be specifically implemented: after writing the new data into the target data block, the new data is recorded into the cache area.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
以上对本申请所提供的一种磁盘阵列写处理方法、装置、设备及介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。 The above is a detailed introduction to a disk array write processing method, device, equipment and medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for a person skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims (20)

  1. 一种磁盘阵列写处理方法,其特征在于,包括:A disk array write processing method, characterized by comprising:
    基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个所述目标条带内待进行数据写入的目标数据块的写入位置信息;所述写入位置信息包括写入偏移以及写入长度;Determine the target stripe to be written to data in DRAID5 and the write position information of the target data block to be written to data in each target stripe based on the IO write request initiated by the server; the write position information includes the write offset and the write length;
    分别将每个所述目标条带内的所述目标数据块的写入位置信息记录至该目标条带对应的信息记录;Recording the write position information of the target data block in each target stripe to the information record corresponding to the target stripe;
    基于所述信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息;Determine the full amount of location information of the parity block in each target stripe that is currently to be updated based on the information record;
    当任意所述目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的所述校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据;When any of the target stripes meets the check data reading condition, data is read from the corresponding check block based on the current full position information to obtain old check data corresponding to the current full position information;
    基于所述旧校验数据进行计算,得到新校验数据;Perform calculation based on the old verification data to obtain new verification data;
    基于所述全量位置信息将所述新校验数据写入相应的所述校验块。The new verification data is written into the corresponding verification block based on the full position information.
  2. 根据权利要求1所述的磁盘阵列写处理方法,其特征在于,所述基于所述信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息,包括:The disk array write processing method according to claim 1, characterized in that the step of determining the full amount of location information of the parity block in each target stripe that is currently to be updated with data based on the information record comprises:
    从信息记录依次读取写入位置信息,并每读取到一个写入位置信息,则将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,并将该页掩码与目标页掩码进行或运算,得到该写入位置信息对应的位置信息掩码,并将该位置信息掩码记为该目标条带内校验块当前待进行数据更新的全量位置信息;The write position information is read from the information record in sequence, and each time a write position information is read, the write position information is converted into a page mask form to obtain a page mask corresponding to the write position information, and the page mask is ORed with the target page mask to obtain a position information mask corresponding to the write position information, and the position information mask is recorded as the full amount of position information of the parity block in the target stripe that is currently to be updated with data;
    其中,页掩码形式为预设位数的二进制码形式,每位对应一页,并且,读取的首个写入位置信息对应的目标页掩码为初始页掩码,非首个写入位置信息对应的目标页掩码为上一个写入位置信息对应的位置信息掩码。Among them, the page mask format is a binary code format of a preset number of bits, each bit corresponds to a page, and the target page mask corresponding to the first write position information read is the initial page mask, and the target page mask corresponding to the non-first write position information is the position information mask corresponding to the previous write position information.
  3. 根据权利要求2所述的磁盘阵列写处理方法,其特征在于,所述初始页掩码各位均为0。The disk array write processing method according to claim 2, characterized in that each bit of the initial page mask is 0.
  4. 根据权利要求2所述的磁盘阵列写处理方法,其特征在于,所述目标条带满足校验数据读取条件为读取到的写入位置信息的数量达到预设数量阈值,或读取到的写入位置信息的数量未达到预设数量阈值,所述信息记录已没有待读取的写入位置信息。The disk array write processing method according to claim 2 is characterized in that the target stripe satisfies the verification data reading condition when the number of write position information read reaches a preset number threshold, or the number of write position information read does not reach the preset number threshold, and the information record has no write position information to be read.
  5. 根据权利要求2所述的磁盘阵列写处理方法,其特征在于,所述将该写入位置信息转换为页掩码形式以得到该写入位置信息对应的页掩码,包括:The disk array write processing method according to claim 2, characterized in that the converting the write position information into a page mask form to obtain a page mask corresponding to the write position information comprises:
    计算该写入位置信息对应的初始页和页长度,并转换为页掩码形式以得到该写入位置信息对应的页掩码。The initial page and page length corresponding to the write position information are calculated and converted into a page mask form to obtain a page mask corresponding to the write position information.
  6. 根据权利要求2所述的磁盘阵列写处理方法,其特征在于,所述分别将每个所述目标条带内的所述目标数据块的写入位置信息记录至该目标条带对应的信息记录,包括:The disk array write processing method according to claim 2, characterized in that the step of recording the write position information of the target data block in each target stripe to the information record corresponding to the target stripe comprises:
    将每个所述目标条带内的每个所述目标数据块的写入位置信息转化为一个节点,并将该节点添加至该目标条带对应的结构体中的链表。The write position information of each target data block in each target stripe is converted into a node, and the node is added to the linked list in the structure corresponding to the target stripe.
  7. 根据权利要求6所述的磁盘阵列写处理方法,其特征在于,所述从信息记录依次读取写入位置信息,包括:从所述链表中依次读取节点。The disk array write processing method according to claim 6, characterized in that the sequentially reading the write position information from the information record comprises: sequentially reading nodes from the linked list.
  8. 根据权利要求2所述的磁盘阵列写处理方法,其特征在于,所述从信息记录依次读取写入位置信息,包括:The disk array write processing method according to claim 2, wherein the step of sequentially reading the write position information from the information records comprises:
    利用调度线程从信息记录依次读取写入位置信息。The scheduling thread is used to read and write the position information from the information record in sequence.
  9. 根据权利要求1至8任一项所述的磁盘阵列写处理方法,其特征在于,还包括:The disk array write processing method according to any one of claims 1 to 8, characterized in that it also includes:
    基于所述目标数据块的写入位置信息读取所述目标数据块中的旧数据,并对所述旧数据和该目标数据块对应的新数据进行计算,得到该目标数据块的中间校验值。 Based on the write position information of the target data block, old data in the target data block is read, and the old data and new data corresponding to the target data block are calculated to obtain an intermediate check value of the target data block.
  10. 根据权利要求9所述的磁盘阵列写处理方法,其特征在于,所述基于所述旧校验数据进行计算,得到新校验数据,包括:The disk array write processing method according to claim 9, wherein the step of calculating based on the old check data to obtain the new check data comprises:
    依次读取每个目标数据块对应的中间校验值,并在每读取到一个目标数据块的中间校验值后,则将该中间校验值与第一目标校验数据进行异或运算,得到第二目标校验数据,直到运算完所述旧校验数据对应的全部所述目标数据块的中间值校验值,将当前的第二目标校验数据作为新校验数据;Sequentially read the intermediate check value corresponding to each target data block, and after each intermediate check value of a target data block is read, perform an XOR operation on the intermediate check value and the first target check data to obtain the second target check data, until the intermediate check values of all the target data blocks corresponding to the old check data are calculated, and the current second target check data is used as the new check data;
    其中,首个读取到的中间校验值对应的第一目标校验数据为所述旧校验数据,非首个读取到的中间校验值对应的第一目标校验数据为上一读取到的中间校验值对应的第二目标校验数据。Among them, the first target verification data corresponding to the first intermediate verification value read is the old verification data, and the first target verification data corresponding to the intermediate verification value not read first is the second target verification data corresponding to the last intermediate verification value read.
  11. 根据权利要求9所述的磁盘阵列写处理方法,其特征在于,还包括:The disk array write processing method according to claim 9, characterized in that it also includes:
    基于每个所述目标数据块的写入位置信息将每个所述目标数据块对应的新数据写入每个所述目标数据块。The new data corresponding to each of the target data blocks is written into each of the target data blocks based on the write position information of each of the target data blocks.
  12. 根据权利要求11所述的磁盘阵列写处理方法,其特征在于,还包括:The disk array write processing method according to claim 11, characterized in that it also includes:
    在将新数据写入目标数据块之后,将新数据记录至缓存区。After the new data is written into the target data block, the new data is recorded into the buffer area.
  13. 根据权利要求12所述的磁盘阵列写处理方法,其特征在于,还包括:The disk array write processing method according to claim 12, characterized in that it also includes:
    在新发起IO读取到所述目标数据块时,判断所述是否命中缓存。When a new IO is initiated to read the target data block, it is determined whether the data block hits the cache.
    响应于命中所述缓存时,从所述缓存中读取数据。In response to hitting the cache, data is read from the cache.
  14. 根据权利要求5所述的磁盘阵列写处理方法,其特征在于,还包括:The disk array write processing method according to claim 5, characterized in that it also includes:
    将所述初始页掩码记录至页掩码变量。The initial page mask is recorded into a page mask variable.
  15. 根据权利要求14所述的磁盘阵列写处理方法,其特征在于,还包括:The disk array write processing method according to claim 14, characterized in that it also includes:
    将所述页掩码与所述初始页掩码进行或运算,将运算结果更新至所述页掩码变量。An OR operation is performed on the page mask and the initial page mask, and the operation result is updated to the page mask variable.
  16. 根据权利要求9所述的磁盘阵列写处理方法,其特征在于,还包括:The disk array write processing method according to claim 9, characterized in that it also includes:
    记录所述中间校验值。The intermediate check value is recorded.
  17. 根据权利要求11所述的磁盘阵列写处理方法,其特征在于,所述目标条带内的所述目标数据块的写入位置信息与所述目标条带内的对应的校验块的写入位置信息相同。The disk array write processing method according to claim 11, characterized in that the write position information of the target data block in the target stripe is the same as the write position information of the corresponding check block in the target stripe.
  18. 一种DRAID5写处理装置,其特征在于,包括:A DRAID5 write processing device, comprising:
    条带及信息确定模块,用于基于服务器发起的IO写请求确定DRAID5中待进行数据写入的目标条带以及每个所述目标条带内待进行数据写入的目标数据块的写入位置信息;所述写入位置信息包括写入偏移以及写入长度;A stripe and information determination module, used to determine the target stripe to be written to in DRAID5 and the write position information of the target data block to be written to in each target stripe based on the IO write request initiated by the server; the write position information includes a write offset and a write length;
    条带信息记录模块,用于分别将每个所述目标条带内的所述目标数据块的写入位置信息记录至该目标条带对应的信息记录;A stripe information recording module, used for recording the write position information of the target data block in each target stripe to the information record corresponding to the target stripe;
    位置信息确定模块,用于基于所述信息记录确定每个目标条带内校验块当前待进行数据更新的全量位置信息;A location information determination module, used to determine the full amount of location information of the check block in each target stripe that is currently to be updated based on the information record;
    旧校验数据读取模块,用于当任意所述目标条带满足校验数据读取条件,则基于当前的全量位置信息从对应的所述校验块中进行一次数据读取,得到当前的全量位置信息对应的旧校验数据;An old check data reading module, used for reading data from the corresponding check block based on the current full position information when any of the target stripes meets the check data reading condition, to obtain the old check data corresponding to the current full position information;
    新校验数据计算模块,用于基于所述旧校验数据进行计算,得到新校验数据;A new verification data calculation module, used to perform calculation based on the old verification data to obtain new verification data;
    新校验数据写入模块,用于基于所述全量位置信息将所述新校验数据写入相应的所述校验块。A new verification data writing module is used to write the new verification data into the corresponding verification block based on the full position information.
  19. 一种电子设备,其特征在于,包括存储器和处理器,其中:An electronic device, comprising a memory and a processor, wherein:
    所述存储器,用于保存计算机程序;The memory is used to store the computer program;
    所述处理器,用于执行所述计算机程序,以实现如权利要求1至17任一项所述的磁盘阵列写处理方法。The processor is used to execute the computer program to implement the disk array write processing method according to any one of claims 1 to 17.
  20. 一种计算机非易失性可读存储介质,其特征在于,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1至17任一项所述的磁盘阵列写处 理方法。 A computer non-volatile readable storage medium, characterized in that it is used to store a computer program, wherein the computer program, when executed by a processor, implements the disk array write processing method according to any one of claims 1 to 17 Management method.
PCT/CN2023/114470 2022-11-11 2023-08-23 Disk array write processing method and apparatus, device, and medium WO2024098885A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211412299.2 2022-11-11
CN202211412299.2A CN115469818B (en) 2022-11-11 2022-11-11 Disk array writing processing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
WO2024098885A1 true WO2024098885A1 (en) 2024-05-16

Family

ID=84338076

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/114470 WO2024098885A1 (en) 2022-11-11 2023-08-23 Disk array write processing method and apparatus, device, and medium

Country Status (2)

Country Link
CN (1) CN115469818B (en)
WO (1) WO2024098885A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115469818B (en) * 2022-11-11 2023-03-24 苏州浪潮智能科技有限公司 Disk array writing processing method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101566924A (en) * 2008-04-23 2009-10-28 中兴通讯股份有限公司 Data read-write method of disk array
CN106293990A (en) * 2016-08-10 2017-01-04 华中科技大学 A kind of RAID method based on batch write check
US20180095824A1 (en) * 2016-10-03 2018-04-05 International Business Machines Corporation Parity delta caching for short writes
CN114610525A (en) * 2022-03-18 2022-06-10 山东云海国创云计算装备产业创新中心有限公司 Data updating method, system and storage medium for disk array
CN115469818A (en) * 2022-11-11 2022-12-13 苏州浪潮智能科技有限公司 Disk array writing processing method, device, equipment and medium

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101763220B (en) * 2008-12-25 2011-06-08 成都市华为赛门铁克科技有限公司 Data updating method, controller and storage system
CN102981927B (en) * 2011-09-06 2015-11-25 阿里巴巴集团控股有限公司 Distributed raid-array storage means and distributed cluster storage system
US9377953B2 (en) * 2014-04-23 2016-06-28 Netapp, Inc. Efficiency sets in a distributed system
CN109725824A (en) * 2017-10-27 2019-05-07 伊姆西Ip控股有限责任公司 Method and apparatus for from the disk array write-in data to storage system
CN109062506B (en) * 2018-07-16 2020-04-10 山东大学 RAID-5 full flash disk array and method for prolonging overall service life of array
CN110874181B (en) * 2018-08-31 2021-12-17 杭州海康威视系统技术有限公司 Data updating method and updating device
CN111124738B (en) * 2018-10-31 2023-08-18 伊姆西Ip控股有限责任公司 Data management method, apparatus and computer program product for redundant array of independent disks
CN111949440A (en) * 2019-05-17 2020-11-17 深圳市茁壮网络股份有限公司 Data recovery method and device
CN110618895B (en) * 2019-09-29 2023-06-09 北京天融信网络安全技术有限公司 Data updating method and device based on erasure codes and storage medium
CN112286453A (en) * 2020-10-26 2021-01-29 苏州浪潮智能科技有限公司 Disk array data reading and writing method, device and storage medium
CN114217736A (en) * 2021-11-18 2022-03-22 新华三大数据技术有限公司 Data writing method and device for reducing pre-reading and storage medium
CN114518846A (en) * 2022-01-10 2022-05-20 阿里巴巴(中国)有限公司 Data processing method and device
CN114442953B (en) * 2022-01-26 2023-07-14 山东云海国创云计算装备产业创新中心有限公司 Data verification method, system, chip and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101566924A (en) * 2008-04-23 2009-10-28 中兴通讯股份有限公司 Data read-write method of disk array
CN106293990A (en) * 2016-08-10 2017-01-04 华中科技大学 A kind of RAID method based on batch write check
US20180095824A1 (en) * 2016-10-03 2018-04-05 International Business Machines Corporation Parity delta caching for short writes
CN114610525A (en) * 2022-03-18 2022-06-10 山东云海国创云计算装备产业创新中心有限公司 Data updating method, system and storage medium for disk array
CN115469818A (en) * 2022-11-11 2022-12-13 苏州浪潮智能科技有限公司 Disk array writing processing method, device, equipment and medium

Also Published As

Publication number Publication date
CN115469818B (en) 2023-03-24
CN115469818A (en) 2022-12-13

Similar Documents

Publication Publication Date Title
JP5603997B2 (en) Storage apparatus and data control method
TWI539277B (en) System, method and computer program product for increasing spare space in memory to extend a lifetime of the memory
WO2024098885A1 (en) Disk array write processing method and apparatus, device, and medium
US7725646B2 (en) Method of using a flash memory for a circular buffer
US11436159B2 (en) Using multi-tiered cache to satisfy input/output requests
US11816015B2 (en) Management of event log information of a memory sub-system
US20190220366A1 (en) Method, apparatus and computer program product for managing data backup
CN111399750B (en) Flash memory data writing method and computer readable storage medium
WO2024119775A1 (en) Raid card node updating method and system, and related apparatus
US20200320015A1 (en) Logical to physical data storage mapping
CN112463020A (en) Data access method, device and equipment based on Flash
US20110296082A1 (en) Method for Improving Service Life of Flash
CN105528183A (en) Data storage method and storage equipment
JPH0744324A (en) Input and output control system for external storage
US11397530B2 (en) Techniques for prolonging lifespan of storage drives
JP6050794B2 (en) FLASH MEMORY MODULE, NONVOLATILE SEMICONDUCTOR MEMORY MODULE, AND STORAGE DEVICE
JP6988231B2 (en) Information processing equipment, information processing system, information processing method and information processing program
TWI747532B (en) Memory apparatus
CN112988037A (en) Static wear leveling method, terminal and computer-readable storage medium
KR102165860B1 (en) Method for logging double header of slotted page and database apparautus
US11698871B2 (en) Method for PRP/SGL handling for out-of-order NVME controllers
CN113703671B (en) Data block erasing method and related device
CN112486854B (en) NAND Flash Nand Flash storage management method and device
CN113934371B (en) Memory, data management method thereof and computer storage medium
RU2636107C1 (en) Method of recording data to digital information drive on basis of nand type flash-memory

Legal Events

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

Ref document number: 23887580

Country of ref document: EP

Kind code of ref document: A1