WO2023102784A1 - Data access method and apparatus, disk controller, disk and data storage system - Google Patents
Data access method and apparatus, disk controller, disk and data storage system Download PDFInfo
- Publication number
- WO2023102784A1 WO2023102784A1 PCT/CN2021/136563 CN2021136563W WO2023102784A1 WO 2023102784 A1 WO2023102784 A1 WO 2023102784A1 CN 2021136563 W CN2021136563 W CN 2021136563W WO 2023102784 A1 WO2023102784 A1 WO 2023102784A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- disk
- target
- instruction
- unit
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 159
- 238000013500 data storage Methods 0.000 title claims abstract description 29
- 230000003111 delayed effect Effects 0.000 claims abstract description 146
- 238000012795 verification Methods 0.000 claims description 68
- 230000008569 process Effects 0.000 claims description 31
- 238000004590 computer program Methods 0.000 claims description 17
- 230000005540 biological transmission Effects 0.000 claims description 5
- 238000012546 transfer Methods 0.000 claims description 3
- 230000002708 enhancing effect Effects 0.000 abstract 1
- 230000006870 function Effects 0.000 description 29
- 238000010586 diagram Methods 0.000 description 18
- 230000003993 interaction Effects 0.000 description 8
- 230000009286 beneficial effect Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000001934 delay Effects 0.000 description 3
- 230000011664 signaling Effects 0.000 description 3
- 239000007787 solid Substances 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000008447 perception Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
Definitions
- the present application relates to the technical field of computer storage, in particular to a data access method, device, disk controller, disk and data storage system.
- a magnetic disk is a memory used to store computer programs or data, and it has the characteristic of keeping data intact after power failure.
- a computer or an application server can save processed data to a disk through a write disk command, or read required data from a disk through a read disk command.
- the disk receives the data that needs to be written by the computer or application server, it executes the data write operation, which will lead to frequent data write operations, increasing system power consumption and resource consumption; Performing a data read operation to read the required data from the disk will increase the read delay and reduce the efficiency of reading data.
- the above data reading and writing process will affect the performance of the data storage system.
- the embodiments of the present application provide a data access method, device, disk controller, disk and data storage system, so as to improve the performance of the data storage system.
- the embodiment of the present application provides a data access method, the method includes: the disk controller in the data storage system obtains the first data to be written into the target disk, and sends the first data to the target disk; When a piece of data satisfies the following setting conditions, the disk controller sends a delayed write instruction for the first data to the target disk; wherein the setting conditions include: writing to the data to be written in the disk array after the first data Including the second data; the disk array includes a plurality of disks controlled by the disk controller; the second data is the data to be written in the target stripe; the target stripe includes multiple stripe units located on different disks, and the multiple stripes The unit includes a target stripe unit used to save the first data in the target disk.
- the disk controller sends a delayed write instruction for the first data to the target disk, so that the target disk delays writing the first data into the non-volatile memory, avoids the disk from frequently performing data write operations, and saves resources brought about by writing data Consumption, improve the performance of the data storage system.
- the disk controller can not only know the data written to the target disk, but also know the data written to other disks in the disk array. Therefore, the disk controller can more accurately determine whether it is necessary to delay writing data to the non-volatile memory of the target disk in conjunction with the situation of writing data to multiple disks.
- the disk controller determines a target disk, a target stripe unit, and a target stripe for storing the first data.
- the target stripe unit is a stripe unit in the target disk
- the target stripe is a stripe including the target stripe unit
- the target stripe includes not only the target stripe unit, but also the stripe unit located in different disks of the disk array. multiple strip units.
- the disk controller can also predict the disks and stripes corresponding to the data to be written into the disk array after the first data.
- the disk controller predicts that after the first data, the data to be written to the disk, including the second stripe
- the disk controller can predict that the When inputting the second data, it is also necessary to read back the first data, and update the parity data of the target stripe based on the first data and the second data. Therefore, the disk controller determines that the first data is to be read back later.
- the disk controller sends a delayed write instruction of the first data to the target disk, so that the target disk saves the first data in the cache unit, and the delayed write non-volatile In storage, reduce the number of write data operations performed by the target disk.
- the disk controller obtains the second data, it can obtain the first data from the target disk, determine the updated parity data based on the first data and the second data, and then send a data write instruction to the target disk again, and the data write The instruction instructs the target disk to write the first data into the target storage address in the non-volatile memory.
- the disk controller predicts that after the first data, the data to be written to the disk also includes The second data of the second stripe unit in the target stripe needs to update the parity data when writing the second data, so the disk controller can determine that the first data is the data to be updated that needs to be updated, and then send The target disk sends a delayed write indication, so that the target disk delays writing the first data.
- the disk controller may determine updated check data based on the second data, which is hereinafter referred to as updated data.
- the disk controller sends a data write instruction for updating data to the target disk, wherein the data write instruction for updating data is used to instruct the target disk to write the update data into the non-volatile memory of the target disk.
- the target disk can Directly write the update data without writing the first data into the non-volatile memory, which can reduce the repeated execution of data write operations for the same stripe unit in the non-volatile memory, reduce the number of erases and writes that consume the disk, and extend the length of the disk. service life.
- the disk controller can be connected between the host and the disk, the host sends the data to be written to the disk to the disk controller through the write disk command, and the disk controller sends the data write command to the disk .
- the first data may be the data carried in the disk write command received by the disk controller, and the disk controller may judge the data writing mode according to the logical addresses in the multiple write disk commands received continuously Whether it is sequential writing, if the data writing mode is sequential writing, and there are other free stripe units in the target stripe besides the target stripe unit, the disk controller can speculate that the data to be written includes the The second data written into the target stripe can further determine that the first data satisfies the set condition.
- the disk controller Since the disk controller is connected between the host and the disk, multiple disks can be managed. Compared with the disk determining whether the first data is data that can be written delayed, the disk controller can write data to multiple disks in combination. In a case, it is more accurately determined whether the first data is data that can be written in a delayed manner, thereby reducing misoperation of the disk.
- the disk controller after the disk controller obtains the first data to be written to the target disk, it sends a data write command containing the first data to the target disk, and the disk controller may carry the delayed write instruction in the In the data write command, send to the target disk. Carrying the delayed write indication in the data write instruction can reduce signaling overhead.
- the disk controller may also carry the delay write instruction in an instruction other than the data write instruction of the first data, and send it to the target disk. For example, the disk controller may send a separate operation instruction including a delayed write instruction to the target disk, so as to increase the degree of freedom in sending the delayed write instruction.
- the delayed write instruction may include a delayed write identifier and a target storage address of the first data, wherein the first The target storage address of a piece of data may be the address of a target stripe unit used to store the first data, so that the target disk can accurately determine which address the data can delay writing.
- the disk controller sends the delayed write instruction to the target disk in an instruction other than the data write instruction of the first data
- the instruction containing the delayed write instruction can be sent to the target disk in the data write instruction of the first data.
- the time interval between the sending time and the sending time of the data write command of the first data is less than the set time threshold, so as to ensure that before the target disk writes the first data into the non-volatile memory, the A delayed write indication for first data is received.
- the embodiment of the present application provides a data access method, the method includes: the disk controller in the data storage system determines the target storage address of the prefetched data and the target disk, and sends the data generated based on the target storage address to the target disk.
- the prefetch data instruction so that the target disk pre-reads the data stored in the target storage address of the non-volatile memory into the cache unit based on the prefetch data instruction, and the subsequent target disk receives the first data for the data
- the data can be read directly from the cache unit without having to read the data in the non-volatile memory, which can greatly reduce the read delay, improve the efficiency of reading data, and improve data storage. system performance.
- the disk controller can determine whether the data read mode is sequential read according to the logical addresses in multiple disk read instructions received continuously, and if the data read mode is sequential read, then according to the current The logical address in the received disk read command determines the target storage address and target disk of the prefetched data. In another possible implementation manner, during the process of repairing the disk to be repaired, the disk controller may determine the target storage address and the target disk of the prefetched data according to the target stripe to which the stripe unit to be repaired belongs.
- the stripe unit to be repaired is the stripe unit in the disk to be repaired
- the target stripe includes a plurality of stripe units located on different disks
- the target storage address can be the stripe unit in the target stripe except the disk to be repaired The address of any stripe unit other than .
- the disk controller Since the disk controller is connected between the host and the disk, it can manage multiple disks. Compared with the data stored in which address is prefetched by the disk, the disk controller can combine the management of multiple disks, which is more accurate. It can accurately determine the data stored in which address needs to be prefetched, thereby reducing the misoperation of the disk.
- the disk controller may carry the prefetch data indication in the second data read command sent to the target disk, and send it to the target disk ;
- the second data read command is used to instruct the target disk to read data from the specified storage address.
- Carrying the prefetch data instruction in the data write instruction or the data read instruction can reduce signaling overhead.
- the disk controller may send a separate operation instruction including the prefetch data indication to the target disk, so as to increase the degree of freedom in sending the prefetch data indication.
- the individual operation instruction may be any access instruction sent by the disk controller to the target disk.
- the embodiment of the present application also provides a data access method, which is applied to a disk, and the method includes:
- the delayed write indication is used to instruct the disk to temporarily store the first data in a cache unit of the disk;
- the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
- the disk may receive a data write instruction sent by the disk controller, and obtain a delayed write instruction carried in the data write instruction; the data write instruction includes the above-mentioned first data.
- the disk may receive an individual operation command sent by the disk controller including a delayed write instruction.
- the disk receives a data write instruction for updating data sent by the disk controller; wherein, the update The data is the updated verification data, and the data write instruction of the updated data instructs the disk to write the updated verification data into the target storage address, and the target storage address is the same as the target storage address of the first data; according to the target storage address, the The update data is written into the non-volatile memory of the disk, and the first data is deleted in the cache unit.
- the embodiment of the present application also provides a data access method, which is applied to a disk, and the method includes:
- the prefetch data instruction is generated by the disk controller based on the target storage address of the prefetch data
- the disk may receive the second data read instruction sent by the disk controller, and acquire the prefetch data instruction carried in the second data read instruction; the second data read instruction is used to instruct the disk to read from Specify the storage address to read data.
- the disk may receive an individual operation command sent by the disk controller including the instruction to prefetch data.
- the embodiment of the present application also provides a data access device, which is applied to a disk controller, and the device includes:
- a data acquisition unit configured to acquire the first data to be written into the target disk
- a sending unit configured to send the first data to the target disk when it is determined that the first data satisfies the set condition, and send a delayed write indication of the first data to the target disk; the delayed write indication is used to indicate the target
- the disk temporarily stores the first data in the cache unit of the target disk.
- the embodiment of the present application also provides a data access device, which is applied to a disk controller, and the device includes:
- the instruction sending unit is used to send to the target disk a prefetch data instruction generated based on the target storage address; the prefetch data instruction is used to instruct the target disk to read the prefetch data from the target storage address into the cache unit; and, to the target disk Send a data read command for prefetched data;
- the data receiving unit is configured to receive the prefetch data obtained and sent by the target disk from the cache unit.
- the embodiment of the present application also provides a data access device, which is applied to a magnetic disk, and the device includes:
- the receiving unit is configured to receive the first data sent by the disk controller, and receive the delayed writing instruction of the first data sent by the disk controller; the delayed writing instruction is used to instruct the disk to temporarily store the first data in the cache unit of the disk ;
- the execution unit is configured to temporarily store the first data in the cache unit of the disk.
- the embodiment of the present application also provides a data access device, which is applied to a magnetic disk, and the device includes:
- the instruction receiving unit is used to receive the prefetch data instruction sent by the disk controller; the prefetch data instruction carries the target storage address of the prefetch data;
- an instruction execution unit configured to read the prefetched data stored in the storage space corresponding to the target storage address into the cache unit of the disk;
- the data transmission unit is configured to receive a first data read instruction for the prefetched data sent by the disk controller, acquire the prefetched data from the cache unit, and send the prefetched data to the disk controller.
- the embodiment of the present application also provides a disk controller, including a memory and a processor, the memory stores a computer program that can run on the processor, when the computer program is executed by the processor When executed, the processor is made to implement any one of the methods described in the above-mentioned first aspect, or any one of the methods described in the above-mentioned second aspect.
- the embodiment of the present application also provides a magnetic disk, including a memory and a processor, the memory stores a computer program that can run on the processor, when the computer program is executed by the processor , so that the processor implements any one of the methods described in the above third aspect, or any one of the methods described in the above fourth aspect.
- the embodiment of the present application further provides a data storage system, including the disk controller provided in the ninth aspect and the disk provided in the tenth aspect.
- an embodiment of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used to make a computer perform any of the above-mentioned first aspects.
- an embodiment of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used to make a computer perform any of the above-mentioned third aspects.
- the embodiment of the present application provides a computer program product, which includes computer-executable instructions, and the computer-executable instructions are used to make a computer execute any method provided in the above-mentioned first aspect, or the method provided in the above-mentioned second aspect. any of the methods.
- the embodiment of the present application provides a computer program product, which includes computer-executable instructions, and the computer-executable instructions are used to make a computer execute any method provided in the third aspect above, or the method provided in the fourth aspect above. any of the methods.
- FIG. 1 is a schematic structural diagram of a data storage system provided by an embodiment of the present application.
- FIG. 2 is a schematic structural diagram of a disk array provided by an embodiment of the present application.
- FIG. 3 is a schematic structural diagram of another data storage system provided by an embodiment of the present application.
- FIG. 4 is an interaction diagram between a disk controller and a target disk in the process of writing data provided by an embodiment of the present application
- FIG. 5 is an interaction diagram between a disk controller and a target disk in another data writing process provided by an embodiment of the present application
- FIG. 6 is an interaction diagram between a disk controller and a target disk in a process of prefetching data provided by an embodiment of the present application
- FIG. 7 is an interaction diagram between a disk controller and a target disk in another process of prefetching data provided by an embodiment of the present application
- FIG. 8 is a flow chart of a data access method performed by a disk controller provided in an embodiment of the present application.
- FIG. 9 is a flow chart of a data access method performed by a disk provided in an embodiment of the present application.
- FIG. 10 is a flow chart of another data access method performed by a disk controller provided in an embodiment of the present application.
- FIG. 11 is a flow chart of another disk-executed data access method provided in the embodiment of the present application.
- FIG. 12 is a structural block diagram of a data access device provided by an embodiment of the present application.
- FIG. 13 is a structural block diagram of another data access device provided by the embodiment of the present application.
- FIG. 14 is a structural block diagram of another data access device provided by the embodiment of the present application.
- FIG. 15 is a structural block diagram of another data access device provided by the embodiment of the present application.
- FIG. 16 is a schematic structural diagram of a disk controller provided by an embodiment of the present application.
- FIG. 17 is a schematic structural diagram of a magnetic disk provided by an embodiment of the present application.
- Redundant array of independent disks a disk array composed of multiple disks (also known as physical disks), also known as a disk group, multiple disks as a whole Provides storage functions and is the basis of virtual disks.
- a virtual disk can be understood as a continuous data storage unit divided by a disk group, which is equivalent to one or more independent disks.
- a RAID system uses a RAID controller to manage multiple disks, and one RAID controller can manage multiple disks.
- the RAID controller obtains redundancy protection by writing the same data to multiple disks at the same time or writing the verification results corresponding to the written data to the disks, thereby improving the reliability of stored data and providing users with higher storage performance and more High data reliability.
- “Multiple” in the embodiment of the present application refers to two or more, in view of this, “multiple” can also be understood as “at least two” in the embodiment of the present application.
- “At least one” can be understood as one or more, such as one, two or more. For example, including at least one means including one, two or more, and does not limit which ones are included, for example, including at least one of A, B and C, then what is included can be A, B, C, A and B, A and C, B and C, or A and B and C.
- “And/or” describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently.
- the character "/" unless otherwise specified, generally indicates that the associated objects before and after are in an "or” relationship.
- ordinal numerals such as “first” and “second” mentioned in the embodiments of the present application are used to distinguish multiple objects, and are not used to limit the sequence, timing, priority or importance of multiple objects.
- an embodiment of the present application provides a data access method.
- the data access method can be applied to the data storage system shown in FIG. 1 or FIG. 3 .
- FIG. 1 is a schematic structural diagram of a data storage system. Due to the ever-increasing business volume that needs to be processed, the data that needs to be run on a single server is also increasing. When a single disk is limited by capacity and security and cannot support system services on the server, multiple disks need to be combined and used as a virtual disk to meet the actual needs of the server.
- the data storage system shown in FIG. 1 may include a server 100, a disk array 300 composed of multiple disks, and a disk controller 200 for managing the disks.
- the disk controller 200 may be a RAID controller connected between the server 100 and multiple disks.
- the server 100 may be referred to as a host (host), and the disk may be a solid state disk (solid state disk, SSD) or a mechanical hard disk, such as a serially attached small computer system interface (serial attached small computer system interface, SAS) disk or Serial advanced technology attachment (SATA) disk.
- a RAID controller and a plurality of disks form a RAID system.
- the RAID controller receives a disk access command sent by a host, and obtains a logical address in the disk access command.
- the logical address may include a logical unit number (LUN).
- the RAID controller converts the logical address in the disk access instruction into the physical address of the disk, and accesses the target disk corresponding to the physical address, and writes data to or reads data from the target disk according to the disk access instruction.
- the host is a server, and in other application scenarios, the host may also be a computer or other electronic equipment.
- the disk array 300 includes three disks, namely disk 301 , disk 302 and disk 303 , and the three disks are managed by the disk controller 200 .
- the disk controller may be a RAID controller, and the RAID controller and three disks form a RAID system, and the RAID controller may manage the three disks according to RAID5 level rules.
- the RAID controller obtains redundancy protection by writing the data and the check results calculated on the data to multiple disks. for different RAID levels. Different RAID levels correspond to different data redundancy strategies; for example, a RAID level 5 RAID system can support one disk failure, and a RAID 6 level RAID system can support two disk failures at the same time.
- a disk fails as long as the number of failed disks does not exceed the tolerance range of the RAID system, the RAID system can restore the data in the failed disk according to the data and parity information in the remaining disks, thus ensuring data consistency.
- Standard RAID levels can be combined to form new extended levels, such as RAID50 level and RAID60.
- the storage space in the disk 301, the disk 302 and the disk 303 can be divided into one or more virtual disks, wherein the logical address corresponding to a virtual disk can be LUN x.
- a virtual disk may include multiple stripes.
- the virtual disk shown in FIG. 2 includes five stripes, namely stripe 1 , stripe 2 , stripe 3 , stripe 4 and stripe 5 .
- Each strip includes a plurality of strip units.
- the multiple stripe units that make up a stripe are located on different disks. Taking strip 1 as an example, strip 1 includes a strip unit 11 , a strip unit 12 and a strip unit 13 .
- the stripe unit 11 is located on the disk 301 , the stripe unit 12 is located on the disk 302 , and the stripe unit 13 is located on the disk 303 .
- the stripe unit 11 located on the disk 301 means that one or more storage units in the disk 301 form the stripe unit 11 .
- the disk 301 further includes a stripe unit 21, a stripe unit 31, a stripe unit 41, and the like.
- Different stripe units in disk 301 are composed of different storage units.
- the storage unit refers to the smallest unit in the disk that can perform read and write operations. Different types of disks have different storage units. For example, the smallest storage unit of an SSD is a page. The smallest storage unit of a mechanical hard disk is a sector.
- the size of the stripe unit which may also be referred to as the stripe length (strip length), can be set according to requirements.
- each stripe unit shown in FIG. 2 can store 128KB of data.
- Multiple stripe units forming the same stripe can be divided into stripe units for storing data and stripe units for storing check values.
- the stripe units used to store data in stripe 1 can be stripe unit 11 and stripe unit 12, and the stripe unit used to store check values can be stripe unit 13;
- the stripe unit for storing data can be stripe unit 21 and stripe unit 23, the stripe unit for storing check value can be stripe unit 22;
- the stripe unit for storing data in stripe 3 can be The stripe unit 32 and the stripe unit 33, the stripe unit used to store the check value may be the stripe unit 31; and so on.
- data LBA0-127 can be stored in stripe unit 11
- data LBA128-255 can be stored in stripe unit 12
- data LBA0-127 and LBA128 can be stored in stripe unit 13. ⁇ 255
- the check result P obtained by XOR calculation.
- the RAID controller and a plurality of disks can communicate with each other through an internal connection path to transmit control and/or data signals, wherein the internal connection path includes a bus, for example, a peripheral component interconnect express (PCIe) or other A bus used to connect different devices.
- the RAID controller stores stripe status information, and the stripe status information is used to record the status of each stripe unit in the RAID system.
- the state of each stripe unit can include an idle state and a valid state.
- a stripe unit in a valid state can also be called a valid stripe unit.
- a valid stripe unit refers to a stripe unit that stores data; a stripe unit in an idle state is also It may be referred to as an idle stripe unit, and an idle stripe unit refers to a stripe unit that currently does not store data.
- an idle stripe unit refers to a stripe unit that currently does not store data.
- the state of the stripe unit 11 is idle, and after the RAID controller sends a data write command for the stripe unit 11 to the disk 301, the stripe The state of the belt unit 11 is changed from the idle state to the active state.
- the data storage system shown in FIG. 3 may include a computer 400 and a disk array 300 composed of multiple disks.
- the computer 400 can be used as a disk controller for managing multiple disks.
- the computer 400 may also be replaced by a server or other electronic devices.
- the structure of the disk array 300 may also be shown in FIG. 2 .
- the process of managing multiple disks by the computer 400 is the same as the process of managing multiple disks by the RAID controller shown in FIG. 1 , and will not be repeated here.
- the performance of the data storage system is improved through the cooperation between the disk controller and the disk.
- the following takes the RAID controller shown in FIG. 1 as an example of the disk controller to describe the specific implementation manners of the data access method provided by the embodiment of the present application in the process of writing data and prefetching data.
- Fig. 4 shows an interaction diagram between the disk controller and the disk during the process of writing data.
- a data access method provided by an embodiment may include the following steps:
- the disk controller acquires first data, and determines a target disk and a data type corresponding to the first data.
- the first data can be understood as data to be written to the target disk.
- the data type of the first data may include delayed write type and non-delayed write type, wherein, delayed write type data may include but not limited to data that needs to be used later, or data that needs to be updated immediately; non-delayed write
- the type of data can also be referred to as data that does not need to be delayed for writing, for example, data that does not need to be used temporarily.
- the RAID controller can determine the target disk and the target stripe to which the target stripe unit for saving the first data belongs, if the data to be written is to be written to one or more disks controlled by the RAID controller after the first data , including the second data to be written into the target stripe, it is determined that the data type of the first data is the delayed write type.
- the RAID controller receives a disk write command from the host, and determines the first data according to data carried in the disk write command.
- the RAID controller can determine the target disk for saving the first data according to the logical address in the disk write command.
- the first data may be the data carried in the above-mentioned write-to-disk instruction.
- the stripe unit corresponding to the logical address in the write-to-disk instruction is the target stripe unit, and the disk to which the target stripe unit belongs is target disk.
- the first data may be a verification result determined according to the data carried in the write to disk command.
- the target stripe to which the stripe unit corresponding to the logical address in the write to disk command belongs may be determined. And determine the target stripe unit used to save the verification result in the target stripe, and the disk to which the target stripe unit belongs is the target disk, which will be described in detail below.
- the RAID controller can also determine whether the current data writing mode is sequential write according to the logical addresses in the multiple write disk commands received continuously, wherein the sequential write refers to the logical addresses in the multiple write disk commands received continuously It is continuous, that is to say, multiple disk write instructions indicate to sequentially write data to each stripe unit in a virtual disk. For example, in an application scenario where a user finishes editing a document and saves the document, the host sends multiple disk write commands to the RAID controller continuously, and the logical addresses in the multiple disk write commands are continuous. It is considered that the current data writing mode is sequential writing, that is, the document data can be sequentially written into each stripe unit indicated by the logical address in each write-to-disk command.
- the current data writing mode is not sequential writing; for example, in the application scenario where the user resets or modifies the parameters of multiple different functions,
- the parameters of each function may be stored in different virtual disks or in non-adjacent stripe units in the same virtual disk.
- the host sends multiple disk write commands to the RAID controller, and multiple The logical addresses in the write-to-disk command are discontinuous. At this time, it can be considered that the current data writing mode is not sequential writing.
- the RAID controller can determine the target stripe unit and the target stripe for storing the first data.
- the RAID controller can determine the state of each stripe unit in the target stripe used to save the first data according to the saved stripe status information, if the target stripe includes an idle stripe other than the target stripe unit unit, it may be determined that the first data is data of a delayed write type, and if there is no other free stripe unit in the target stripe except the target stripe unit, it may be considered that the first data is data of a non-delayed write type.
- the data carried in the disk writing command received by the RAID controller from the host includes data LBA0-127.
- the data to be written may include data LBA0-127 and the verification result P 0 corresponding to the data LBA0-127.
- the RAID controller can determine the storage location corresponding to the data LBA0-127 as the stripe unit 11 according to the logical address in the write disk instruction.
- Band unit 11 is a target stripe unit
- stripe 1 to which stripe unit 11 belongs is a target stripe
- disk 301 to which stripe unit 11 belongs is a target disk. According to the saved stripe status information, the RAID controller can determine that the stripe unit 12 in the target stripe is currently in an idle state.
- the RAID controller can determine that data will be written in the stripe unit 12 in the future, That is, the data to be written includes the second data to be written into the target stripe, and it can be determined that when writing data into the stripe unit 12, the data LBA0-127 and the data to be written into the stripe unit 12 need to be used
- the verification result P is re-determined. Therefore, it can be determined that the data LBA0-127 are data to be used later, that is, the RAID controller determines that the first data is data of the delayed write type.
- the RAID controller can determine the storage location corresponding to the data LBA0-127 carried in the write disk command according to the logical address in the write disk command as the stripe Strip unit 11, the stripe to which stripe unit 11 belongs is stripe 1, and the verification result P 0 and the data LBA0-127 need to be stored in the same stripe, so stripe 1 is the target stripe, and the RAID controller can determine, In the stripe 1, the stripe unit 13 is used to store the verification result, therefore, the stripe unit 13 is the target stripe unit, and the disk 303 to which the stripe unit 13 belongs is the target disk.
- the RAID controller can determine that the stripe unit 12 in the target stripe is currently in an idle state. When writing data to the stripe unit 12 later, it needs to use the data LBA0-127 and the data to be written. The data in the stripe unit 12 re-determines the verification result P, and then it can be determined that the verification result P 0 is data that needs to be updated immediately, that is, the RAID controller determines that the first data is delayed write data.
- the RAID controller has sent a data writing instruction to write data LBA0-127 to the stripe unit 11 to the disk 301, and saves In the stripe status information of the stripe unit 11, the state of the stripe unit 11 is set to the valid state, and the RAID controller has sent the verification result P 0 to the disk 303 to write the data into the stripe unit 13. In the band status information, the status of the stripe unit 13 is set to be valid.
- the data carried by the RAID controller in the disk write command received from the host is data LBA128-255
- the RAID controller can determine the storage location corresponding to the data LBA128-255 as the stripe unit 12 according to the logical address carried in the write disk command.
- the verification result P can be calculated according to the data LBA128-255 and the data LBA0-127 in the stripe unit 11.
- the data to be written may include the data LBA128-255 and the verification result P.
- the data LBA128-255 is the first data
- the storage location corresponding to LBA128-255 is the stripe unit 12 as the target stripe unit
- the stripe 1 to which the stripe unit 12 belongs is the target stripe
- the disk 302 to which the stripe unit 12 belongs is the target disk.
- the RAID controller can determine that all the stripe units except stripe unit 12 in the target stripe are in valid state. At this time, the RAID controller can determine that the data LBA128-255 are temporarily unnecessary
- the used non-delayed write type data that is, the RAID controller may consider the first data as non-delayed write type data.
- the RAID controller can determine that the storage location corresponding to the verification result P is the stripe unit 13 in the stripe 1, and the stripe 1 is the target stripe, The stripe unit 13 is the target stripe unit, and the disk 303 to which the stripe unit 13 belongs is the target disk.
- the RAID controller can determine that data is stored in both the stripe unit 11 and the stripe unit 12 in the target stripe, and all the other stripe units in the target stripe except the stripe unit 13 are valid.
- the RAID The controller may determine that the verification result P is non-delayed write data, that is, the RAID controller may consider the first data as non-delayed write data.
- the RAID controller determines that each stripe unit in the next stripe of the target stripe corresponding to the first data is in an idle state according to the saved stripe state information, it can be determined that There is no need to continue writing data to the disk 302 for the time being, and it can be considered that the current first data does not need to be delayed in writing, and is non-delayed writing data.
- the disk controller If it is determined that the first data is data of a delayed write type, the disk controller generates a data write instruction including a delayed write instruction.
- the disk controller sends a data write instruction to the target disk.
- the data write instruction also includes the above-mentioned first data and a storage address of the first data.
- the storage address of the first data may be an address of a stripe unit for storing the first data.
- the data carried in the data write instruction may not be the above-mentioned first data, but other data to be written and storage addresses of other data to be written.
- data bits at certain fixed positions may be preset as operation identification bits, and the operation identification bits may occupy one data bit or multiple data bits.
- the preset N data bits may carry a target storage address corresponding to a delayed write indication or an immediate write indication, and the target storage address may be is the address of the target stripe unit for saving the first data.
- the target disk is disk 301
- the set N data bits carry the address information of the stripe unit 11, and the operation in the data write command If the flag is “10”, the data writing instruction indicates that the disk 301 can delay writing the first data corresponding to the stripe unit 11 .
- the preset M data bits may carry the disk identifier and the target entry of the corresponding target disk indicating the delayed write indication or the immediate write indication. with the address of the unit.
- the set M data bits carry the disk identification of the disk 301 and the address of the stripe unit 11, and the operation identification bit in the data write instruction If it is “10”, the data writing instruction indicates that the disk 301 can delay writing the first data corresponding to the stripe unit 11 .
- the RAID controller may generate a data write instruction including an immediate write instruction, and send the data write instruction to the target disk.
- the immediate write instruction may also be referred to as a non-delayed write instruction.
- the RAID controller may directly send a data write instruction to the target disk, and the data write instruction may not carry a delayed write instruction or an immediate write instruction.
- the data write command sent by the RAID controller to the target disk may not carry delay Write instructions or write instructions now.
- the disk controller may also include the data delay writing instruction in the data read instruction sent to the target disk, and send it to the target disk.
- the data read instruction may also include the storage address of the data to be read.
- the target disk executes the delayed writing instruction carried in the data writing instruction.
- the disk includes non-volatile memory, and each stripe unit is located in the non-volatile memory.
- a cache unit is also provided in the disk, and the time for accessing the cache unit is much shorter than the time for accessing the non-volatile memory.
- the cache unit may be used to temporarily save data that needs to be written into the non-volatile memory, that is, first data.
- the cache unit may use a cache memory (cache), and the non-volatile memory may use a flash memory (flash).
- the disk 301 receives the data write instruction sent by the RAID controller, and reads the N data bits set in the data write instruction to the stripe unit 11, and read that the operation identification bit in the data write command is "10", then the disk 301 can execute the delay write instruction carried in the data write command, and delay writing to the corresponding stripe unit 11 a data.
- the disk 301 may temporarily store the first data corresponding to the stripe unit 11, that is, the data LBA0-127, in the cache unit, wait for other data to be written to be received, and then perform a data write operation.
- the data are written into the non-volatile memory together, and multiple data are written to the non-volatile memory each time a write operation is performed, thereby avoiding frequent write operations to the non-volatile memory. If within the set duration, no other data to be written is received, the write data operation is performed, and the first data is written into the stripe unit 11 in the non-volatile memory; or, the cache unit of the magnetic disk 301 is full, When part of the data needs to be cleared, the disk 301 executes a data write operation, and writes the first data into the stripe unit 11 in the nonvolatile memory. In some optional embodiments, the disk executes the delayed writing instruction, and after temporarily storing the first data in the cache unit, it may also wait for the first data to be refreshed, and then perform a write data operation, and write the refreshed data to into non-volatile memory.
- the disk 301 receives the data write instruction sent by the RAID controller, and reads the disk identifier of the disk 301 and the stripe unit 11 from the M data bits set in the data write instruction. Address information, and read the operation flag in the data write command is "10", then the disk 301 can execute the delay write instruction carried in the data write command, and delay write to the first corresponding stripe unit 11 data.
- the disk can determine whether to execute the delayed write instruction according to its own state; for example, if the disk If the data storage ratio of the cache unit reaches the set maximum ratio threshold, the disk may not execute the delayed write instruction, but execute the write data operation, and write the first data together with other data stored in the cache unit into the non-volatile in memory.
- the data storage ratio refers to the ratio between the amount of data stored in the cache unit and the data capacity of the cache unit.
- the disk can determine whether to execute the immediate write instruction according to its own state; for example, if the data storage ratio of the cache unit of the disk is If the set minimum ratio threshold is not reached, the disk may not execute the immediate write instruction, and temporarily save the first data in the cache unit, and may execute writing data after the data storage ratio of the cache unit reaches the set minimum ratio threshold The operation is to write the data saved in the cache unit into the non-volatile memory together.
- the disk controller After sending the delayed writing instruction of the first data to the target disk, if the disk controller obtains the second data, then determine the updated verification data based on the second data. verification data, and send a data write instruction for the updated verification data to the target disk; the data write instruction is used to instruct the target disk to write the updated verification data into the non-volatile memory of the target disk. After the target disk temporarily saves the first data in the cache unit, it waits for a set time.
- the target disk receives a data write instruction of the updated verification data sent by the disk controller; the data write instruction Instruct the disk to write the updated verification data into the target storage address, the target storage address is the same as the target storage address of the first data; according to the target storage address, write the updated verification data into the non-volatile memory of the disk , and delete the first data in the cache unit. If the target disk does not receive the data write instruction of the updated verification data within the set time, the target disk will write the first data into the non-volatile memory.
- FIG. 5 shows another interaction diagram between the disk controller and the disk during the process of writing data.
- the data access method provided by another embodiment may include the following steps:
- the disk controller determines a target disk and a data type corresponding to the first data.
- the disk controller If it is determined that the first data is data of a delayed write type, the disk controller generates a delayed operation instruction.
- the check result P 0 is determined according to the data LBA0-127 carried in the write disk command received by the RAID controller from the host.
- the target disk corresponding to the verification result P 0 is disk 303
- the target stripe unit is the stripe unit 13 of stripe 1
- the RAID controller can determine that the verification result P 0 is a delayed write
- the RAID controller generates a delayed operation instruction, where the delayed operation instruction refers to an individual operation instruction including a delayed write instruction.
- the disk controller sends a delayed operation instruction to the target disk.
- the disk controller may send the delay operation instruction to the target disk after sending the data write instruction of the first data to the target disk.
- the delay operation instruction only includes a delay write instruction, and does not include the data to be written and the storage address of the data to be written.
- an operation identification bit and an address identification bit are included in the delayed operation instruction.
- the operation identification bit may be "10", indicating that the operation instruction carries a delayed write instruction. If the operation identification bit in the operation instruction is "01", it can be considered that the operation instruction is an immediate operation instruction.
- N data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate the corresponding target storage address of the delayed write instruction, that is, for saving Address information of the target stripe unit of the first data.
- the delay operation instruction sent by the RAID controller to the disk 303, what N data bits carry is the address information of the stripe unit 13, then the delay operation instruction indicates that the disk 303 can delay writing to the corresponding first stripe unit 13.
- One data that is, the verification result P 0 mentioned above.
- M data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the delayed writing indicates the disk identification and target of the corresponding target disk.
- Address information of the stripe unit For example, in the delayed operation instruction sent by the RAID controller to the disk 303, what M data bits carry is the disk identification of the disk 303 and the address information of the stripe unit 13, then the delayed operation instruction indicates that the disk 303 can delay writing the stripe. Band unit 13 corresponds to the first data.
- the delayed operation instruction may be sent after sending the data write instruction of the first data to the target disk.
- the time interval between the sending time of the delayed operation instruction and the sending time of the data write instruction of the first data is less than the set time threshold, so as to ensure that the first data can be received before the target disk writes the first data into the non-volatile memory.
- a delayed operation instruction for the first data is less than the set time threshold, so as to ensure that the first data can be received before the target disk writes the first data into the non-volatile memory.
- the target disk executes the received delayed operation instruction.
- Both the delayed operation instruction and the immediate operation instruction may be referred to as independent operation instructions.
- the disk 303 receives an individual operation instruction sent by the RAID controller, and reads that the operation identification bit in the individual operation instruction is "10", indicating that the individual operation
- the instruction is a delay operation instruction
- the disk 303 reads the address information of the stripe unit 13 from the N data bits set in the separate operation instruction, then the disk 303 can execute the delay operation instruction to delay writing to the stripe unit 13 corresponds to the first data.
- the disk 303 receives the individual operation instruction sent by the RAID controller, and the operation flag read in the individual operation instruction is "10", indicating that the individual operation instruction is a delayed operation instruction, and,
- the magnetic disk 303 reads the disk identification of the magnetic disk 303 and the address information of the stripe unit 13 from the M data bits set in the separate operation instruction, then the magnetic disk 303 can execute the delayed operation instruction, and the delayed write to the stripe unit 13 corresponds to the first data of .
- the target disk receives the delayed operation instruction sent by the RAID controller, and may also determine whether to execute the delayed operation instruction according to its own state.
- the target disk After executing the received delayed operation instruction, the target disk may choose to return the instruction execution result to the RAID controller, or may not return the instruction execution result to the RAID controller.
- the disk controller updates the first data, and determines a data type of the updated first data.
- the RAID controller when the RAID controller receives the disk write instruction from the host again, the data carried in the disk write instruction is data LBA128-255.
- the RAID controller can determine the data LBA128-255 corresponding to The target stripe is also stripe 1, which is the same as the target stripe corresponding to the first data, that is, the verification result P 0 .
- the RAID controller can update the verification result P 0 according to the data LBA128-255.
- the update process may include: the RAID controller may acquire data LBA0-127 from the disk 301 . It has been explained in the above-mentioned embodiments that the disk 301 executes the delay write instruction issued by the RAID controller, temporarily stores the data LBA0-127 in the cache unit, and receives the read instruction of the RAID controller for the data LBA0-127, the disk 301 The 301 can directly obtain the data LBA0 ⁇ 127 from the cache unit, and transfer the data LBA0 ⁇ 127 to the RAID controller; without reading data from the non-volatile memory, it can greatly save the time for reading data and reduce the RAID level. Latency for the controller to access the disk. After the RAID controller acquires the data LBA0-127, the verification result P calculated according to the data LBA0-127 and the data LBA128-255 is used as the updated first data.
- the update process may include: the RAID controller may acquire the verification result P 0 from the disk 303 . It can be seen from the above that the disk 303 executes the delayed write instruction issued by the RAID controller, temporarily stores the verification result P 0 in the cache unit, and receives the read instruction of the RAID controller for the verification result P 0 , the disk 303 The verification result P 0 can be obtained directly from the cache unit, and the verification result P 0 can be transmitted to the RAID controller; without reading data from the non-volatile memory, it can greatly save the time for reading data and reduce the Latency for the RAID controller to access disks.
- the RAID controller After the RAID controller obtains the verification result P 0 , it determines the verification result P according to the verification result P 0 and data LBA128-255; for example, the RAID controller can reversely calculate the data LBA0-127 according to the verification result P
- the verification result P obtained by calculating the data LBA0-127 and the data LBA128-255 uses the verification result P as the updated first data.
- the RAID controller can determine that the verification result P is data of the non-delayed write type, since the data corresponding to each stripe unit of the target stripe, that is, stripe 1, has been determined.
- the disk controller sends a data write instruction including the updated first data to the target disk.
- the corresponding target disk is the disk 303 .
- the RAID controller sends a data write instruction to the disk 303, the data write instruction includes the verification result P, and the address information of the target stripe unit used to save the verification result P; wherein, the target stripe unit is a stripe unit 13.
- the disk controller If it is determined that the updated first data is non-delayed write data, the disk controller generates an immediate operation instruction.
- the disk controller sends an immediate operation instruction to the target disk.
- the RAID controller sends an immediate operation command to the disk 303 .
- the immediate operation instruction includes an operation identification bit and an address identification bit.
- the operation identification bit may be "01", indicating that the operation instruction carries an immediate write instruction.
- N data bits may be preset as address identification bits, and the information in the address identification bits is used to indicate that the address information indicating the corresponding target stripe unit is immediately written or The address information of the target storage address.
- the immediate operation instruction sent by the RAID controller to the disk 303 what N data bits carry is the address information of the stripe unit 13, and then the immediate operation instruction indicates that the disk 303 can immediately write into the corresponding first stripe unit 13.
- M data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the disk identification and target of the corresponding target disk are written immediately.
- the address information of the stripe unit, or the disk identification of the target disk and the address information of the target storage address For example, in the immediate operation instruction sent by the RAID controller to the disk 303, what M data bits carry is the disk identification of the disk 303 and the address information of the stripe unit 13, and then the immediate operation instruction indicates that the disk 303 can write the stripe immediately.
- the disk controller may not send an immediate operation instruction to the target disk, so as to save signaling overhead.
- the target disk executes the received immediate operation instruction.
- the disk 303 receives an individual operation instruction sent by the RAID controller, and reads that the operation identification bit in the individual operation instruction is "01", indicating that the individual operation
- the instruction is an immediate operation instruction
- the disk 303 reads the address information of the stripe unit 13 from the N data bits set in the separate operation instruction, then the disk 303 can execute the immediate operation instruction, and the stripe unit 13 corresponds to The data to be written, that is, the verification result P is written into the stripe unit 13 of the non-volatile memory.
- the disk 303 receives the individual operation instruction sent by the RAID controller, and the operation identification bit read in the individual operation instruction is "01", indicating that the individual operation instruction is an immediate operation instruction, and,
- the magnetic disk 303 reads the disk identification of the magnetic disk 303 and the address information of the stripe unit 13 from the M data bits set in the separate operation instruction, and then the magnetic disk 303 can execute the immediate operation instruction, and the corresponding standby of the stripe unit 13 Writing data, that is, the verification result P is written into the stripe unit 13 of the non-volatile memory.
- the disk receives the immediate operation instruction sent by the RAID controller, and may also determine whether to execute the immediate operation instruction according to its own state.
- the target disk sends an instruction execution result to the disk controller.
- the RAID controller After the RAID controller sends an immediate operation command to the target disk, it waits for the target disk to feed back an execution result of the command.
- the target disk determines that the received immediate operation command is an individual operation command, and after executing the immediate operation command sent by the RAID controller, sends the command execution result to the RAID controller, and the command execution result can include information that the command has been executed or the command has been successfully executed .
- the RAID controller receives the command execution result fed back by the target disk, it can end the data writing process.
- the target disk may not send the command execution result to the disk controller.
- the disk controller that manages the disk determines the data type of the data to be written. If the disk controller determines that the data to be written is data that needs to be used later or data that is updated immediately, it can send a delay to the disk.
- the write instruction indicates that the disk can delay writing data into the non-volatile memory, thereby avoiding frequent disk write operations, helping to reduce the occupation of memory bandwidth resources, and can also reduce power consumption. If the data to be written is data that will be updated immediately, by delaying the writing of data, the operation of repeatedly writing data to the same storage address can be reduced, and the service life of the disk can be improved. Compared with determining whether to delay data writing to the non-volatile memory by the disk, since the disk controller has a better perception capability for upper-layer services, it may be more accurate to perform this step by the disk controller.
- the disk receives 64KB of data to be written and executes a disk write operation once
- the host needs to write 1TB of data into the three disks of the RAID system in a sequential manner
- the method provided in the embodiment of this application at most It can reduce the repeated writing of 0.5TB data. It can be seen that through the method provided by the embodiment of the present application, the data writing operation of the disk can be greatly reduced, the power consumption can be reduced while the performance is improved, and the service life of the disk can be improved.
- Fig. 6 shows an interaction diagram between the disk controller and the disk during the process of prefetching data.
- a data access method provided by an embodiment may include the following steps:
- the disk controller determines a target storage address and a target disk of prefetched data.
- the RAID controller can determine whether the current data reading mode is a sequential read according to the logical addresses in the multiple read disk instructions received continuously, wherein the sequential read refers to multiple read disks received continuously
- the logical addresses in the instructions are continuous, that is to say, multiple disk read instructions indicate to read data from each stripe unit in a virtual disk sequentially.
- the current data read mode can be considered as sequential Read means that the data of the document can be sequentially read from each strip unit indicated by the logical address in each disk read command, and sent to the host for display.
- the host needs to read the parameters of each function, The parameters of each function may be stored in different virtual disks, so it is necessary to read data from different virtual disks or non-adjacent stripe units in the same virtual disk.
- the host sends multiple read disks to the RAID controller command, and the logical addresses in multiple disk read commands are discontinuous, at this time, it can be considered that the current data reading mode is not sequential reading.
- the RAID controller determines that the current data reading mode is sequential reading, then according to the logical address in the currently received disk read command, determine the target storage corresponding to the subsequent data that needs to be read.
- the address and the target disk are the target storage address and the target disk of the prefetched data, and the target storage address can also be understood as the address of the target stripe unit.
- the RAID controller determines that the current data reading mode is sequential reading, then determine the disk corresponding to the currently read data according to the logical address in the currently received disk read instruction; The disk corresponding to the currently read data is used as the target disk, and the target storage address of the data that still needs to be read in the future is determined for the target disk, that is, the target storage address of the prefetched data.
- the currently read data is data LBA0-127
- the data LBA0-127 are stored in the stripe unit 11 of the magnetic disk 301.
- the disk 301 is the target disk. Since the current read is sequential, the RAID controller can determine that the data to be read later is the data stored in the stripe unit 21, and can determine that the stripe unit 21 is the target stripe unit.
- the RAID controller starts the background service, and determines the target storage address and the target disk of the data to be prefetched according to the currently executed service.
- the RAID controller can start the service of repairing the disk according to the operation of repairing the disk by the user, and can also automatically start the service of repairing the disk when it detects that a certain disk fails.
- the RAID controller detects that the disk 302 fails, and starts the business of repairing the disk 302, that is, according to the data stored in each stripe unit of the disk 301 and the disk 303, determine each stripe unit of the disk 302 correct data stored in the disk 302, and write the correct data into each stripe unit of the disk 302.
- the RAID controller can determine the stripe unit 12 of the disk 302 according to the data LBA0-127 stored in the stripe unit 11 of the disk 301 and the verification result P stored in the stripe unit 13 of the disk 303. correct data stored in .
- the disk to be repaired is disk 302
- the stripe unit to be repaired is stripe unit 12
- the target stripe to which stripe unit 12 belongs is stripe 1
- stripe 1 includes stripe unit 11 and stripe unit 13
- the disk 301 may be used as the target disk
- the address of the stripe unit 11 may be used as the target storage address
- the disk 303 may be used as the target disk
- the address of the stripe unit 13 may be used as the target storage address.
- the process of executing the data prefetch instruction when the disk 303 is used as the target disk is the same as the process of executing the data prefetch instruction when the disk 301 is used as the target disk.
- the disk controller generates a data access instruction including a prefetch data instruction according to the address information of the target storage address.
- the disk controller sends a data access instruction to the target disk.
- the data access command may be a data read command or a data write command.
- the RAID controller receives a disk read command from the host, and sends a data access command to the target disk, or, the RAID controller can actively send a data read command to the target disk according to a currently executed service.
- the data read instruction may include address information of the currently read data, and may also include a prefetch data instruction.
- data bits at certain fixed positions may be preset as operation identification bits, and the operation identification bits may occupy one data bit or multiple data bits. In the following, the operation identification bit occupies 2 data bits as an example for illustration. If the operation identification bit is "00", it indicates that the data read instruction carries a prefetch data instruction.
- pre-set N data bits may also carry address information indicating a corresponding target storage address of the prefetched data. For example, assuming that the target disk is disk 301, in the data read instruction sent by the RAID controller to disk 301, the set N data bits carry the address of the stripe unit 11, and the operation identifier in the data read instruction If the bit is “00”, the data read instruction instructs the disk 301 to prefetch the data stored in the stripe unit 11 .
- pre-set M data bits may carry address information indicating the disk ID of the corresponding target disk and the target storage address of the prefetched data.
- the set M data bits carry the disk identification of the disk 301 and the address of the stripe unit 11, and the operation identification bit in the data read instruction is “00”, the data read instruction instructs the disk 301 to prefetch the data stored in the stripe unit 11 .
- the RAID controller receives a disk write command from the host and sends the data write command to the target disk, or the RAID controller can actively send the data write command to the target disk according to the currently executed service.
- the data writing instruction includes the data to be written and the address information of the stripe unit to be written for saving the data to be written.
- the data write instruction may also include a prefetch data instruction.
- data bits at certain fixed positions may be preset as operation identification bits, and the operation identification bits may occupy one data bit or multiple data bits. For example, the operation identification bit occupies 2 data bits, and if the operation identification bit is "00", it indicates that the data write instruction carries a prefetch data instruction.
- pre-set N data bits may also carry address information indicating the corresponding target storage address of the prefetched data.
- pre-set M data bits may carry address information indicating the disk ID of the corresponding target disk and the target storage address of the prefetched data.
- the target disk executes the prefetch data instruction carried in the data access instruction.
- the disk 301 receives the data access instruction sent by the RAID controller, and reads the N data bits set in the data access instruction to the stripe unit 11 address information, and read that the operation identification bit in the data access instruction is "00", then the disk 301 can determine that the data access instruction carries a prefetch data indication, indicating that the data stored in the stripe unit 11 Data is prefetched.
- the disk 301 receives the data access instruction sent by the RAID controller, and reads the disk identifier of the disk 301 and the stripe unit 11 from the M data bits set in the data access instruction. address information, and read the operation flag in the data access instruction as "00", then the disk 301 can determine that the data access instruction carries a prefetch data instruction, indicating that the data stored in the stripe unit 11 is to be prefetched. Prefetching.
- the disk 301 can first judge whether the data stored in the stripe unit 11 is stored in the cache unit, and if it has been stored in the cache unit, the operation can be ended; if not stored in the cache unit, The data stored in the stripe unit 11 is then read from the non-volatile memory and stored in the cache unit. When the subsequent disk controller reads the data, the disk 301 can directly obtain the data from the cache unit without reading the data from the non-volatile memory, so the read delay of the disk can be reduced and the data can be quickly returned to the disk controller.
- the disk reads data from the non-volatile memory and returns it to the disk controller, it takes 60us each time; the disk reads data from the cache unit and returns it to the disk controller, and it takes 10us each time. Then every time data is read, the read delay of 50us can be reduced.
- FIG. 7 shows another interaction diagram between the disk controller and the disk in the process of prefetching data.
- a data access method that may include the following steps:
- the disk controller determines a target storage address and a target disk of data to be prefetched.
- the disk controller generates a prefetch data instruction according to the address information of the target storage address.
- the disk controller sends a data prefetch instruction to the target disk.
- the prefetch data indication is included in the prefetch data instruction.
- an operation identification bit and an address identification bit are included in the prefetch data instruction.
- the operation identification bit may be "00", indicating that the operation instruction carries a prefetch data instruction.
- N data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the prefetch data indicates the address information of the corresponding target stripe unit .
- the prefetch data instruction is one of the independent operation instructions. For example, in the individual operation instruction sent by the RAID controller to the disk 301, the N data bits carry the address information of the stripe unit 11, and the operation identification bit in the individual operation instruction is "00", then the individual operation The command is a data prefetch command, which is used to instruct the disk 301 to prefetch the data stored in the stripe unit 11 .
- M data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the prefetch data indicates the disk identification and the corresponding target disk. Address information of the target stripe unit.
- the M data bits carry the disk identification of the disk 301 and the address information of the stripe unit 11, and the operation identification bit in the individual operation instruction is "00 ”, then the single operation command is a data prefetch command, which is used to instruct the disk 301 to prefetch the data stored in the stripe unit 11 .
- the target disk executes the received prefetch data instruction.
- the disk 301 receives an individual operation instruction sent by the RAID controller, and reads that the operation identification bit in the individual operation instruction is "00", indicating that the individual operation
- the instruction is a prefetch data instruction
- the magnetic disk 301 reads the address information of the stripe unit 11 from the N data bits set in the separate operation instruction, then the magnetic disk 301 can execute the prefetch data instruction, and the stripe unit The data saved in 11 is prefetched.
- the disk 301 receives an individual operation instruction sent by the RAID controller, and the operation identification bit read in the individual operation instruction is "00", indicating that the individual operation instruction is a data prefetch instruction, and , the magnetic disk 301 reads the disk identification of the magnetic disk 301 and the address information of the stripe unit 11 from the M data bits set in the separate operation instruction, and then the magnetic disk 301 can execute the prefetch data instruction, and the data in the stripe unit 11 Saved data is prefetched.
- the target disk sends an instruction execution result to the disk controller.
- the RAID controller After the RAID controller sends the data prefetch command to the target disk, it waits for the target disk to feed back an execution result of the command.
- the target disk determines that the received prefetch data command is an independent operation command.
- After executing the prefetch data command sent by the RAID controller it sends the command execution result to the RAID controller.
- the command execution result can include that the command has been executed or the command has been successfully executed. Information.
- the RAID controller receives the instruction execution result fed back by the target disk, it can end the process of prefetching data.
- the target disk may not send the command execution result to the disk controller.
- the disk controller that manages the disk determines the data that needs to be prefetched, sends a prefetch data indication to the disk, and instructs the disk to read the data that needs to be prefetched into the cache unit, so as to reduce the number of read data.
- the read latency of the disk can be shortened to improve system performance.
- the disk controller has a better perception of the upper-layer business, the data that needs to be prefetched by the disk controller can be determined more accurately and reduce the misjudgment caused by prefetch. Power consumption generated by additional data movement, thus reducing system power consumption.
- the disk For example, suppose it takes 60us for the disk to read 64KB of data from the non-volatile memory. If the 1TB capacity RAID system needs to be expanded from 6 disks (stripe unit size is 64KB) to 7 disks, each 1280KB For example, if the read operation is reduced by 60us, the time to complete 1TB disk expansion can be saved by about 50s. It can be seen that the method provided by the embodiment of the present application can effectively save time in the disk expansion business scenario.
- the data access method provided in the embodiment of the present application can not only be applied to RAID controllers, but also can be used by other nodes that can identify data that needs to be used later, including but not limited to hosts, smart network cards, computers, etc.
- the method performed by the disk controller can refer to the method shown in Figure 8, including the following steps:
- the delayed writing indication is used to instruct the target disk to temporarily store the first data in the cache unit of the target disk.
- the first data meets the following setting conditions: the first data is the data to be written to the first stripe unit of the target disk, and the data to be written after the first data includes the second stripe unit to be written to the second stripe unit. Data; the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks.
- the disk controller sends an indication of delayed writing of the first data to the target disk.
- the setting condition includes that the first data is data to be read back; whether the first data satisfies the setting condition is determined by the following method: if the first data is the data to be written into the target disk The data of the first stripe unit, and it is predicted that the data to be written after the first data includes the second data to be written into the second stripe unit, then determine that the first data is the data to be read back; the second The strip unit and the first strip unit belong to the same target strip, and the second strip unit and the first strip unit belong to different disks; or, the setting conditions include that the first data is data to be updated; the first Whether the data meets the set condition: if the first data is the verification data of the third stripe unit to be written to the target disk, and it is predicted that the data to be written after the first data includes the second stripe to be written If the second data of the unit is the second data, it is determined that the first data is the data to be updated; the second stripe unit and the third stripe unit belong to the same target stripe,
- the first data may be the data carried in the received write disk instruction.
- the disk controller can determine whether the data write mode is sequential write according to the logical addresses in multiple write disk commands received continuously. If the data write mode is sequential write, and the target stripe includes If there is no free stripe unit outside, it is determined that the data to be written includes the second data to be written into the target stripe.
- the disk controller after the disk controller obtains the first data to be written to the target disk, it sends a data write command containing the first data to the target disk, and the disk controller may carry the delayed write instruction in the data write command. command, sent to the target disk.
- the disk controller may send a first operation instruction including a delayed write instruction to the target disk, and the first operation instruction may be any instruction other than the data write instruction of the first data.
- the delayed writing indication includes a delayed writing identifier and a target storage address of the first data. If the disk controller sends the delayed write instruction to the target disk in an instruction other than the data write instruction of the first data, the instruction containing the delayed write instruction can be sent to the target disk in the data write instruction of the first data.
- the time interval between the sending time and the sending time of the data write command of the first data is less than the set time threshold, so as to ensure that before the target disk writes the first data into the non-volatile memory, the A delayed write indication for first data is received.
- the disk controller determines the updated verification data based on the second data.
- the test data that is, the update data
- the method performed by the disk can refer to the method shown in Figure 9, including the following steps:
- S901. Receive first data sent by a disk controller, and receive a delayed writing indication of the first data sent by the disk controller.
- the first data satisfies the following setting conditions: the first data is the data to be written to the first stripe unit of the target disk, and the data to be written after the first data includes the data to be written to the second stripe unit.
- the second data the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks.
- the disk may receive a data write instruction of the first data sent by the disk controller, and obtain the first data and the delayed write indication of the first data from the data write instruction; the data write The command contains the data to be written to the disk.
- the disk may receive the data write command of other data sent by the disk controller again, and obtain the first data write command carried in the data write command.
- a separate operation instruction including a delayed write instruction sent by the disk controller is received.
- the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
- the magnetic disk executes the delayed writing instruction, temporarily stores the first data in the cache unit of the magnetic disk according to the target storage address of the first data, and delays writing into the non-volatile memory of the magnetic disk.
- the disk receives a data write instruction for updating data sent by the disk controller; the updating data is updated check data; the data writing of updating data
- the input command instructs the disk to write the update data into the target storage address, which is the same as the target storage address of the verification data; according to the target storage address, the update data is written into the non-volatile memory of the disk, and stored in the cache unit Delete the verification data.
- the method performed by the disk controller can refer to the method shown in Figure 10, including the following steps:
- the disk controller determines that the data read mode is sequential reading according to the logical addresses in multiple disk read instructions received continuously, then it can be determined according to the logical addresses in the currently received disk read instructions The target storage address and target disk of the prefetched data.
- the target storage address and the target disk of the prefetched data may be determined according to the target stripe to which the stripe unit to be repaired belongs, wherein the stripe to be repaired The unit is a stripe unit in the disk to be repaired, and the target stripe includes multiple stripe units located on different disks.
- the target disk includes a cache unit
- the prefetch data indication is used to instruct the target disk to read the prefetch data from the target storage address into the cache unit.
- the disk controller may carry the prefetch data indication in the data read instruction sent to the target disk, and send it to the target disk; the data read instruction includes the storage address of the data to be read. In some other embodiments, the disk controller may send a separate operation command including an instruction to prefetch data to the target disk.
- the method performed by the disk can refer to the method shown in Figure 11, including the following steps:
- the prefetch data indication carries a target storage address of the prefetch data.
- the disk may receive the second data read instruction sent by the disk controller, and acquire the prefetch data instruction carried in the data read instruction; the second data read instruction includes the storage address of the data to be read.
- the disk may receive a second operation instruction including a prefetch data instruction sent by the disk controller, and the second operation instruction is an instruction other than the second data read instruction.
- the embodiment of the present application also provides a data access device, which can be applied to a disk controller, and the disk controller can be the above-mentioned RAID controller, host, equipment such as computers or servers.
- the data access device can be used to implement the functions of the data access method embodiments executed by the above-mentioned disk controller, and thus can realize the beneficial effects of the above-mentioned data access method embodiments.
- the data access device 1200 provided in the embodiment of the present application may include a data obtaining unit 1201 and a sending unit 1202 .
- the data access device is used to implement the functions in the method embodiment shown in FIG. 8 above.
- the data acquiring unit 1201 may be used to perform S801
- the sending unit 1202 may be used to perform S802.
- the data obtaining unit 1201 is used to obtain the first data to be written into the target disk
- the sending unit 1202 is used to send the first data to the target disk when it is determined that the first data meets the set conditions, and send the first data to the target disk.
- the disk sends a delayed write indication of the first data
- the setting conditions include: the first data is the data to be written to the first stripe unit of the target disk, and the data to be written after the first data includes the data to be written Enter the second data of the second stripe unit; the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks.
- the first data is the data carried in the received write disk instruction; the data acquisition unit 1201 can be specifically configured to: determine the Whether the data writing mode is sequential writing, if the data writing mode is sequential writing, and the target stripe includes free stripe units other than the target stripe unit, then it is determined that the data to be written includes the target stripe unit to be written with the second data.
- the sending unit 1202 may be specifically configured to: carry the delayed write indication in the data write instruction of the first data sent to the target disk, and send it to the target disk; or, send the instruction to the target disk Sending a first operation instruction including a delayed write instruction, where the first operation instruction is an instruction other than the first data write instruction.
- the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
- the data access device 1300 provided in the embodiment of the present application may include a prediction unit 1301 , an indication sending unit 1302 and a data receiving unit 1303 .
- the data access device is used to implement the functions in the method embodiment shown in FIG. 9 above.
- the predicting unit 1301 can be used to perform S1001
- the instruction sending unit 1302 can be used to perform S1002 and S1003
- the data receiving unit 1303 can be used to perform S1004 .
- the prediction unit 1301 is used to determine the target storage address and the target disk of the prefetched data;
- the target disk includes a cache unit;
- the instruction sending unit 1302 is used to send the prefetch data indication generated based on the target storage address to the target disk;
- prefetch The data indication is used to instruct the target disk to read the prefetch data from the target storage address into the cache unit; and, send the first data read instruction for the prefetch data to the target disk;
- the data receiving unit 1303 is used to receive the target disk Prefetched data fetched and sent from the cache unit.
- the predicting unit 1301 can be specifically configured to: determine whether the data reading mode is sequential reading according to the logical addresses in multiple disk read instructions received continuously, and if the data reading mode is sequential For reading, determine the target storage address and target disk of the prefetched data according to the logical address in the currently received disk read instruction.
- the predicting unit 1301 may be specifically configured to: during the process of repairing the disk to be repaired, determine the target storage address and The target disk; the stripe unit to be repaired is a stripe unit in the disk to be repaired; the target stripe includes multiple stripe units located on different disks.
- the instruction sending unit 1302 can be specifically configured to: carry the prefetch data instruction in the second data read instruction sent to the target disk, and send it to the target disk; the second data read instruction It is used to instruct the target disk to read data from a specified storage address; or, to send a second operation instruction including a prefetch data instruction to the target disk; the second operation instruction is an instruction other than the second data read instruction.
- the embodiment of the present application also provides a data access device, which can be applied to a magnetic disk.
- the data access device can be used to implement the functions of the embodiments of the data access method performed by the above-mentioned disk, and thus can realize the beneficial effects of the embodiments of the above-mentioned data access method.
- the data access device 1400 provided in the embodiment of the present application may include a receiving unit 1401 and an executing unit 1402 .
- the data access device is used to implement the functions in the method embodiment shown in FIG. 9 above.
- the receiving unit 1401 may be used to perform S901
- the execution unit 1402 may be used to perform S902.
- the receiving unit 1401 is configured to receive the first data sent by the disk controller, and receive the delayed writing indication of the first data sent by the disk controller; the delayed writing indication is used to instruct the target disk to temporarily store the first data in the target In the cache unit of the disk;
- the execution unit 1402 is configured to temporarily store the first data in the cache unit of the disk, wherein the first data satisfies the following condition: the first data is the data to be written into the first stripe unit of the target disk , the disk controller predicts that after the first data, the to-be-written data written to the disk includes the second data to be written to the second stripe unit, wherein the second stripe unit and the first stripe unit belong to For the same target stripe, the second stripe unit and the first stripe unit belong to different disks.
- the receiving unit 1401 may be specifically configured to: receive a data write instruction of the first data sent by the disk controller, and acquire a delayed write instruction carried in the data write instruction of the first data;
- the data writing instruction of the first data includes the first data; or, receiving a first operation instruction including a delayed writing instruction sent by the disk controller, the first operation instruction is an instruction other than the data writing instruction of the first data.
- the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
- the data access device 1500 may include an instruction receiving unit 1501 , an instruction executing unit 1502 and a data transmission unit 1503 .
- the data access device is used to implement the functions in the method embodiment shown in FIG. 11 above.
- the instruction receiving unit 1501 can be used to execute S1101
- the instruction execution unit 1502 can be used to execute S1102
- the data transmission unit 1503 can be used to execute S1103 and S1104.
- the instruction receiving unit 1501 is used to receive the prefetch data instruction sent by the disk controller; the prefetch data instruction is generated by the disk controller based on the target storage address of the prefetch data; the instruction execution unit 1502 is used to transfer the prefetch data Indicate that the prefetch data stored in the target storage address carried is read into the cache unit of the disk; the data transmission unit 1503 is configured to receive the first data read instruction for the prefetch data sent by the disk controller, and read the instruction from the cache unit Get the prefetched data and send the prefetched data to the disk controller.
- the instruction receiving unit 1501 may be specifically configured to: receive the second data read instruction sent by the disk controller, obtain the prefetch data indication carried in the data read instruction; The command is used to instruct the target disk to read data from a specified storage address; or, to receive a separate operation command sent by the disk controller including the prefetch data instruction.
- the embodiments of the present application also provide a disk controller, which can be used to realize the functions of the above-mentioned method embodiments, so that the beneficial features of the above-mentioned method embodiments can be realized. Effect.
- the disk controller may be the above-mentioned RAID controller, a host, a computer, or a server.
- the structure of the disk controller 1600 may be as shown in FIG. 16 , including a processor 1601 and a memory 1602 connected to the processor 1601 .
- the processor 1601 and the memory 1602 may be connected to each other through a bus, and the processor 1601 may be a general processor, such as a microprocessor, or other conventional processors.
- the bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like.
- PCI peripheral component interconnect
- EISA extended industry standard architecture
- the bus can be divided into address bus, data bus, control bus and so on.
- the memory 1602 is used to store instructions or programs executed by the processor 1601, or store input data required by the processor 1601 to run the instructions or programs, or store data generated after the processor 1601 runs the instructions or programs.
- the processor 1601 may include one or more processing units, and different processing units may be independent devices or integrated into one or more processors.
- the processor 1601 may further include a controller, and the controller may generate an operation control signal according to the instruction operation code and the timing signal, and complete the control of fetching and executing instructions.
- the processor 1601 in the disk controller 1600 is configured to execute instructions or programs stored in the memory 1602 to execute the functions in the method embodiment shown in FIG. 8 or FIG. 10 .
- the processor 1601 is used to execute the functions of the above data acquisition unit 1201 and the sending unit 1202 .
- the processor 1601 is used to execute the functions of the prediction unit 1301 , the indication sending unit 1302 and the data receiving unit 1303 .
- the embodiments of the present application further provide a disk, which can be used to implement the functions of the above-mentioned method embodiments, and thus can realize the beneficial effects of the above-mentioned method embodiments.
- the disk can be a solid state drive or a mechanical hard drive.
- the structure of the disk 1700 may be as shown in FIG. 17 , including a processor 1710 and a memory 1720 connected to the processor 1710 , where the memory 1720 may include a cache unit 1721 and a non-volatile memory 1722 .
- the processor 1710 and the memory 1720 may be connected to each other through a bus, and the processor 1710 may be a general processor, such as a microprocessor, or other conventional processors.
- the bus can be a PCI bus or an EISA bus or the like.
- the cache unit 1721 in the memory 1720 may be used to temporarily store data to be written into the non-volatile memory 1722 or data to be read from the non-volatile memory 1722 .
- the non-volatile memory 1722 can be used to provide data storage services and store data used in various business scenarios.
- the memory 1720 may also be used to store instructions or programs executed by the processor 1710, or store input data required by the processor 1710 to run the instructions or programs, or store data generated after the processor 1710 runs the instructions or programs.
- the instructions or programs executed by the processor 1710 can be stored in the non-volatile memory 1722, the processor 1710 can include one or more processing units, different processing units can be independent devices, and can also be integrated in one or more processing units. device.
- the processor 1710 in the disk 1700 can run instructions or programs stored in the memory 1720 to execute the functions in the method embodiment shown in FIG. 9 or FIG. 11 .
- the processor 1701 is used to execute the functions of the above-mentioned receiving unit 1401 and executing unit 1402 .
- the processor 1701 is used to execute the functions of the above instruction receiving unit 1501 , instruction executing unit 1502 and data transmitting unit 1503 .
- the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the computing device.
- the computing device may include more or fewer components than shown, or combine some components, or separate some components, or arrange different components.
- the illustrated components can be realized in hardware, software or a combination of software and hardware.
- the method steps in the embodiments of the present application may be implemented by means of hardware, or may be implemented by means of a processor executing computer programs or instructions.
- a computer program or instructions may constitute a computer program product.
- the embodiment of the present application also provides a computer program product including computer executable instructions.
- the computer-executable instructions are used to cause a computer to execute the functions in the method embodiment shown in FIG. 8 or FIG. 10 .
- the computer-executable instructions are used to cause the computer to execute the functions in the method embodiment shown in FIG. 9 or FIG. 11 .
- Computer-executable instructions may be stored in a computer-readable storage medium, and the embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores executable instructions.
- the computer-executable instructions are used to cause a computer to execute the functions in the method embodiment shown in FIG. 8 or FIG. 10 .
- the computer-executable instructions are used to cause the computer to execute the functions in the method embodiment shown in FIG. 9 or FIG. 11 .
- the computer-readable storage medium may be random access memory (random access memory, RAM), flash memory, read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), Erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable programmable read-only memory (electrically ePROM, EEPROM), registers, hard disk, removable hard disk, CD-ROM or any other form known in the art computer readable storage medium.
- RAM random access memory
- ROM read-only memory
- programmable read-only memory programmable read-only memory
- PROM Erasable programmable read-only memory
- EPROM Erasable programmable read-only memory
- electrically erasable programmable read-only memory electrically erasable programmable read-only memory (electrically ePROM, EEPROM), registers, hard disk, removable hard disk, CD-ROM or any other form known in the art computer readable storage medium.
- Computer-executable instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer programs or instructions may be transmitted from a website, computer, server or A data center transmits to another website site, computer, server, or data center via wired or wireless means.
- the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrating one or more available media.
- the available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disc (digital video disc, DVD); it may also be a semiconductor medium, such as a solid-state hard disk.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Disclosed in the present application are a data access method and apparatus, a disk controller, a disk and a data storage system. The data access method comprises: a disk controller acquiring first data to be written to a target disk and sending the first data to the target disk; when it has been determined that the writing of the first data needs to be delayed, the disk controller sending the target disk a delayed writing instruction for the first data, so as to prevent the target disk from frequently executing data writing operations to reduce the resource consumption caused by said operations; or the disk controller determining a target storage address and a target disk for prefetched data, and sending the target disk a data prefetching instruction generated on the basis of the target storage address, so that the target disk stores in a cache unit the data stored in a non-volatile memory, enabling the data to subsequently be directly read from the cache unit without needing to be read from the non-volatile memory, and thereby greatly reducing the reading latency, enhancing the data reading efficiency and improving the performance of the data storage system.
Description
本申请涉及计算机存储技术领域,尤其涉及一种数据存取方法、装置、磁盘控制器、磁盘和数据存储系统。The present application relates to the technical field of computer storage, in particular to a data access method, device, disk controller, disk and data storage system.
磁盘是用于存储计算机程序或数据的存储器,具有断电后保持数据不丢失的特点。在数据存储系统中,计算机或应用服务器可以通过写磁盘指令将经过处理的数据保存至磁盘中,也可以通过读磁盘指令从磁盘中读取所需要的数据。A magnetic disk is a memory used to store computer programs or data, and it has the characteristic of keeping data intact after power failure. In a data storage system, a computer or an application server can save processed data to a disk through a write disk command, or read required data from a disk through a read disk command.
然而,如果磁盘接收到计算机或应用服务器需要写入的数据就执行写数据操作,会导致频繁执行写数据操作,增加系统功耗和资源消耗;如果磁盘接收到计算机或应用服务器的读磁盘指令再执行读数据操作,从磁盘中读取所需要的数据,则会增加读时延,降低读取数据的效率。上述数据读写过程,均会影响数据存储系统的性能。However, if the disk receives the data that needs to be written by the computer or application server, it executes the data write operation, which will lead to frequent data write operations, increasing system power consumption and resource consumption; Performing a data read operation to read the required data from the disk will increase the read delay and reduce the efficiency of reading data. The above data reading and writing process will affect the performance of the data storage system.
发明内容Contents of the invention
本申请实施例提供一种数据存取方法、装置、磁盘控制器、磁盘和数据存储系统,用以提高数据存储系统的性能。The embodiments of the present application provide a data access method, device, disk controller, disk and data storage system, so as to improve the performance of the data storage system.
第一方面,本申请实施例提供一种数据存取方法,该方法包括:数据存储系统中的磁盘控制器获取待写入目标磁盘的第一数据,向目标磁盘发送第一数据;在确定第一数据满足如下设定条件的情况下,磁盘控制器向目标磁盘发送针对第一数据的延迟写入指示;其中,设定条件包括:在第一数据之后写入磁盘阵列的待写入数据中包括第二数据;磁盘阵列包括由磁盘控制器控制的多个磁盘;第二数据为待写入目标条带中的数据;目标条带包括位于不同磁盘的多个条带单元,多个条带单元中包括目标磁盘中用于保存第一数据的目标条带单元。In the first aspect, the embodiment of the present application provides a data access method, the method includes: the disk controller in the data storage system obtains the first data to be written into the target disk, and sends the first data to the target disk; When a piece of data satisfies the following setting conditions, the disk controller sends a delayed write instruction for the first data to the target disk; wherein the setting conditions include: writing to the data to be written in the disk array after the first data Including the second data; the disk array includes a plurality of disks controlled by the disk controller; the second data is the data to be written in the target stripe; the target stripe includes multiple stripe units located on different disks, and the multiple stripes The unit includes a target stripe unit used to save the first data in the target disk.
磁盘控制器向目标磁盘发送针对第一数据的延迟写入指示,以使目标磁盘延迟将第一数据写入非易失性存储器中,避免磁盘频繁执行写数据操作,节约写数据带来的资源消耗,提高数据存储系统的性能。The disk controller sends a delayed write instruction for the first data to the target disk, so that the target disk delays writing the first data into the non-volatile memory, avoids the disk from frequently performing data write operations, and saves resources brought about by writing data Consumption, improve the performance of the data storage system.
与由目标磁盘来判断是否延迟将数据写入非易失性存储器相比,磁盘控制器除可以获知向目标磁盘写入数据的情况之外,也可以获知向磁盘阵列中的其他磁盘写入数据的情况,因此,磁盘控制器结合向多个磁盘写入数据的情况,可以更准确地确定是否需要延迟将数据写入目标磁盘的非易失性存储器。Compared with the target disk judging whether to delay writing data to the non-volatile memory, the disk controller can not only know the data written to the target disk, but also know the data written to other disks in the disk array. Therefore, the disk controller can more accurately determine whether it is necessary to delay writing data to the non-volatile memory of the target disk in conjunction with the situation of writing data to multiple disks.
示例性地,磁盘控制器获取第一数据之后,确定用于保存第一数据的目标磁盘、目标条带单元和目标条带。其中,目标条带单元为目标磁盘中的条带单元,目标条带为包括该目标条带单元的条带,目标条带除包括目标条带单元之外,还包括位于磁盘阵列的不同磁盘中的多个条带单元。磁盘控制器还可以预测在第一数据之后,待写入磁盘阵列的数据对应的磁盘和条带。Exemplarily, after acquiring the first data, the disk controller determines a target disk, a target stripe unit, and a target stripe for storing the first data. Wherein, the target stripe unit is a stripe unit in the target disk, the target stripe is a stripe including the target stripe unit, and the target stripe includes not only the target stripe unit, but also the stripe unit located in different disks of the disk array. multiple strip units. The disk controller can also predict the disks and stripes corresponding to the data to be written into the disk array after the first data.
例如,如果第一数据为待写入目标磁盘的第一条带单元的数据,磁盘控制器预测到在第一数据之后,写入磁盘的待写入数据中,包括待写入第二条带单元的第二数据,其中, 第二条带单元与第一条带单元属于同一目标条带,第二条带单元与第一条带单元属于不同的磁盘,则磁盘控制器可以预测到在写入第二数据时,还需要读回第一数据,基于第一数据和第二数据对目标条带的校验数据进行更新,因此,磁盘控制器确定第一数据为后续需要读回的待读回数据,从而确定第一数据满足设定条件,磁盘控制器向目标磁盘发送第一数据的延迟写入指示,以使目标磁盘将第一数据保存在缓存单元中,延迟写入非易失性存储器中,减少目标磁盘执行写数据操作的次数。磁盘控制器获取到第二数据后,可以从目标磁盘获取第一数据,基于第一数据和第二数据确定更新后的校验数据,然后再次向目标磁盘发送数据写入指令,该数据写入指令指示目标磁盘将第一数据写入非易失性存储器中的目标存储地址。For example, if the first data is the data to be written to the first stripe unit of the target disk, the disk controller predicts that after the first data, the data to be written to the disk, including the second stripe The second data of the unit, where the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks, the disk controller can predict that the When inputting the second data, it is also necessary to read back the first data, and update the parity data of the target stripe based on the first data and the second data. Therefore, the disk controller determines that the first data is to be read back later. return the data, so as to determine that the first data satisfies the set condition, the disk controller sends a delayed write instruction of the first data to the target disk, so that the target disk saves the first data in the cache unit, and the delayed write non-volatile In storage, reduce the number of write data operations performed by the target disk. After the disk controller obtains the second data, it can obtain the first data from the target disk, determine the updated parity data based on the first data and the second data, and then send a data write instruction to the target disk again, and the data write The instruction instructs the target disk to write the first data into the target storage address in the non-volatile memory.
再如,如果第一数据为待写入目标磁盘的第三条带单元的校验数据,磁盘控制器预测到在第一数据之后,写入磁盘的待写入数据中,还包括待写入目标条带中的第二条带单元的第二数据,在写入第二数据时,需要对校验数据进行更新,因此磁盘控制器可以确定第一数据为需要更新的待更新数据,则向该目标磁盘发送延迟写入指示,以使目标磁盘延迟写入第一数据。磁盘控制器获取到第二数据后,可以基于第二数据确定更新后的校验数据,下文称为更新数据。磁盘控制器向目标磁盘发送更新数据的数据写入指令,其中,更新数据的数据写入指令用于指示目标磁盘将更新数据写入目标磁盘的非易失性存储器中,此时,目标磁盘可以直接写入更新数据,而不需要将第一数据写入非易失性存储器,可以减少针对非易失性存储器中同一条带单元重复执行写数据操作,减少消耗磁盘的擦写次数,延长磁盘的使用寿命。For another example, if the first data is the parity data to be written to the third stripe unit of the target disk, the disk controller predicts that after the first data, the data to be written to the disk also includes The second data of the second stripe unit in the target stripe needs to update the parity data when writing the second data, so the disk controller can determine that the first data is the data to be updated that needs to be updated, and then send The target disk sends a delayed write indication, so that the target disk delays writing the first data. After acquiring the second data, the disk controller may determine updated check data based on the second data, which is hereinafter referred to as updated data. The disk controller sends a data write instruction for updating data to the target disk, wherein the data write instruction for updating data is used to instruct the target disk to write the update data into the non-volatile memory of the target disk. At this time, the target disk can Directly write the update data without writing the first data into the non-volatile memory, which can reduce the repeated execution of data write operations for the same stripe unit in the non-volatile memory, reduce the number of erases and writes that consume the disk, and extend the length of the disk. service life.
在一种可能的实现方式中,磁盘控制器可以连接在主机和磁盘之间,主机将需要写入磁盘的数据通过写磁盘指令发送至磁盘控制器,由磁盘控制器向磁盘发送数据写入指令。在本申请实施例中,第一数据可以是磁盘控制器接收到的写磁盘指令中携带的数据,磁盘控制器可以根据连续接收到的多个写磁盘指令中的逻辑地址,判断数据写入模式是否为顺序写,如果数据写入模式为顺序写,并且在目标条带中除目标条带单元之外,还存在其他的空闲条带单元,则磁盘控制器可以推测待写入数据中包括待写入该目标条带的第二数据,进而可以确定第一数据满足设定条件。In a possible implementation, the disk controller can be connected between the host and the disk, the host sends the data to be written to the disk to the disk controller through the write disk command, and the disk controller sends the data write command to the disk . In the embodiment of the present application, the first data may be the data carried in the disk write command received by the disk controller, and the disk controller may judge the data writing mode according to the logical addresses in the multiple write disk commands received continuously Whether it is sequential writing, if the data writing mode is sequential writing, and there are other free stripe units in the target stripe besides the target stripe unit, the disk controller can speculate that the data to be written includes the The second data written into the target stripe can further determine that the first data satisfies the set condition.
由于磁盘控制器连接在主机和磁盘之间,可以对多个磁盘进行管理,与由磁盘确定第一数据是否为可以延迟写入的数据相比,磁盘控制器可以结合向多个磁盘写入数据的情况,更准确地确定第一数据是否为可以延迟写入的数据,从而减少磁盘的误操作。Since the disk controller is connected between the host and the disk, multiple disks can be managed. Compared with the disk determining whether the first data is data that can be written delayed, the disk controller can write data to multiple disks in combination. In a case, it is more accurately determined whether the first data is data that can be written in a delayed manner, thereby reducing misoperation of the disk.
在一种可能的实现方式中,磁盘控制器获取待写入目标磁盘的第一数据之后,向目标磁盘发送包含第一数据的数据写入指令,磁盘控制器可以将延迟写入指示携带在该数据写入指令中,发送至目标磁盘。将延迟写入指示携带在数据写入指令中,可以减少信令开销。在另一种可能的实现方式中,磁盘控制器也可以将延迟写入指示携带在第一数据的数据写入指令之外的指令中,发送至目标磁盘。例如,磁盘控制器可以向目标磁盘发送包含延迟写入指示的单独操作指令,以增加发送延迟写入指示的自由度。无论延迟写入指示是通过数据写入指令发送至目标磁盘,还是通过单独操作指令发送至目标磁盘,延迟写入指示中均可以包括延迟写入标识和第一数据的目标存储地址,其中,第一数据的目标存储地址可以是用于保存第一数据的目标条带单元的地址,以使目标磁盘可以准确地确定哪个地址的数据可以延迟写入。In a possible implementation manner, after the disk controller obtains the first data to be written to the target disk, it sends a data write command containing the first data to the target disk, and the disk controller may carry the delayed write instruction in the In the data write command, send to the target disk. Carrying the delayed write indication in the data write instruction can reduce signaling overhead. In another possible implementation manner, the disk controller may also carry the delay write instruction in an instruction other than the data write instruction of the first data, and send it to the target disk. For example, the disk controller may send a separate operation instruction including a delayed write instruction to the target disk, so as to increase the degree of freedom in sending the delayed write instruction. Regardless of whether the delayed write instruction is sent to the target disk through a data write command or through a separate operation command, the delayed write instruction may include a delayed write identifier and a target storage address of the first data, wherein the first The target storage address of a piece of data may be the address of a target stripe unit used to store the first data, so that the target disk can accurately determine which address the data can delay writing.
如果磁盘控制器将延迟写入指示携带在第一数据的数据写入指令之外的指令中,发送 至目标磁盘,该包含延迟写入指示的指令可以在向目标磁盘发送第一数据的数据写入指令之后发送,其发送时间与第一数据的数据写入指令的发送时间之间的时间间隔小于设定时间阈值,以确保在目标磁盘将第一数据写入非易失性存储器之前,可以接收到针对第一数据的延迟写入指示。If the disk controller sends the delayed write instruction to the target disk in an instruction other than the data write instruction of the first data, the instruction containing the delayed write instruction can be sent to the target disk in the data write instruction of the first data. After sending the command, the time interval between the sending time and the sending time of the data write command of the first data is less than the set time threshold, so as to ensure that before the target disk writes the first data into the non-volatile memory, the A delayed write indication for first data is received.
第二方面,本申请实施例提供一种数据存取方法,该方法包括:数据存储系统中的磁盘控制器确定预取数据的目标存储地址和目标磁盘,向目标磁盘发送基于目标存储地址生成的预取数据指示,以使目标磁盘基于该预取数据指示将非易失性存储器的目标存储地址中存储的数据预先读取至缓存单元中,后续目标磁盘再接收到针对该数据的第一数据读取指令时,可以直接从缓存单元中读取该数据,而无需再到非易失性存储器中读取该数据,可以大幅度地降低读时延,提高读取数据的效率,提高数据存储系统的性能。In the second aspect, the embodiment of the present application provides a data access method, the method includes: the disk controller in the data storage system determines the target storage address of the prefetched data and the target disk, and sends the data generated based on the target storage address to the target disk. The prefetch data instruction, so that the target disk pre-reads the data stored in the target storage address of the non-volatile memory into the cache unit based on the prefetch data instruction, and the subsequent target disk receives the first data for the data When reading instructions, the data can be read directly from the cache unit without having to read the data in the non-volatile memory, which can greatly reduce the read delay, improve the efficiency of reading data, and improve data storage. system performance.
在一种可能的实现方式中,磁盘控制器可以根据连续接收到的多个读磁盘指令中的逻辑地址,确定数据读取模式是否为顺序读,如果数据读取模式为顺序读,则根据当前接收到的读磁盘指令中的逻辑地址,确定预取数据的目标存储地址和目标磁盘。在另一种可能的实现方式中,磁盘控制器在对待修复磁盘进行修复的过程中,可以根据待修复的条带单元所属的目标条带,确定预取数据的目标存储地址和目标磁盘。其中,待修复的条带单元为待修复磁盘中的条带单元,目标条带包括位于不同磁盘的多个条带单元,目标存储地址可以是目标条带中除待修复磁盘中的条带单元之外的任意一个条带单元的地址。In a possible implementation, the disk controller can determine whether the data read mode is sequential read according to the logical addresses in multiple disk read instructions received continuously, and if the data read mode is sequential read, then according to the current The logical address in the received disk read command determines the target storage address and target disk of the prefetched data. In another possible implementation manner, during the process of repairing the disk to be repaired, the disk controller may determine the target storage address and the target disk of the prefetched data according to the target stripe to which the stripe unit to be repaired belongs. Wherein, the stripe unit to be repaired is the stripe unit in the disk to be repaired, the target stripe includes a plurality of stripe units located on different disks, and the target storage address can be the stripe unit in the target stripe except the disk to be repaired The address of any stripe unit other than .
由于磁盘控制器连接在主机和磁盘之间,可以对多个磁盘进行管理,与由磁盘确定预取哪个地址存储的数据相比,磁盘控制器可以结合对多个磁盘进行管理的情况,更准确地确定需要预取哪个地址存储的数据,从而减少磁盘的误操作。Since the disk controller is connected between the host and the disk, it can manage multiple disks. Compared with the data stored in which address is prefetched by the disk, the disk controller can combine the management of multiple disks, which is more accurate. It can accurately determine the data stored in which address needs to be prefetched, thereby reducing the misoperation of the disk.
在一种可能的实现方式中,磁盘控制器确定预取数据的目标存储地址和目标磁盘之后,可以将预取数据指示携带在向目标磁盘发送的第二数据读取指令中,发送至目标磁盘;第二数据读取指令用于指示目标磁盘从指定存储地址读取数据。将预取数据指示携带在数据写入指令或数据读取指令中,可以减少信令开销。在另一种可能的实现方式中,磁盘控制器可以向目标磁盘发送包含该预取数据指示的单独操作指令,以增加发送预取数据指示的自由度。其中,单独操作指令可以是磁盘控制器向目标磁盘发送的任意访问指令。In a possible implementation, after the disk controller determines the target storage address of the prefetched data and the target disk, it may carry the prefetch data indication in the second data read command sent to the target disk, and send it to the target disk ; The second data read command is used to instruct the target disk to read data from the specified storage address. Carrying the prefetch data instruction in the data write instruction or the data read instruction can reduce signaling overhead. In another possible implementation manner, the disk controller may send a separate operation instruction including the prefetch data indication to the target disk, so as to increase the degree of freedom in sending the prefetch data indication. Wherein, the individual operation instruction may be any access instruction sent by the disk controller to the target disk.
第三方面,本申请实施例还提供一种数据存取方法,应用于磁盘,该方法包括:In the third aspect, the embodiment of the present application also provides a data access method, which is applied to a disk, and the method includes:
接收磁盘控制器发送的第一数据,并接收磁盘控制器发送的第一数据的延迟写入指示;延迟写入指示用于指示该磁盘将第一数据暂存在磁盘的缓存单元中;receiving the first data sent by the disk controller, and receiving a delayed write indication of the first data sent by the disk controller; the delayed write indication is used to instruct the disk to temporarily store the first data in a cache unit of the disk;
将第一数据暂存在磁盘的缓存单元中。Temporarily store the first data in the cache unit of the disk.
在一种可能的实现方式中,延迟写入指示中包括延迟写入标识和第一数据的目标存储地址。In a possible implementation manner, the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
在一种可能的实现方式中,磁盘可以接收磁盘控制器发送的数据写入指令,获取数据写入指令中携带的延迟写入指示;数据写入指令包含上述第一数据。在另一种可能的实现方式中,磁盘可以接收磁盘控制器发送的包含延迟写入指示的单独操作指令。In a possible implementation manner, the disk may receive a data write instruction sent by the disk controller, and obtain a delayed write instruction carried in the data write instruction; the data write instruction includes the above-mentioned first data. In another possible implementation manner, the disk may receive an individual operation command sent by the disk controller including a delayed write instruction.
在一种可能的实现方式中,如果第一数据为校验数据,将第一数据暂存在磁盘的缓存单元中之后,磁盘接收到磁盘控制器发送的更新数据的数据写入指令;其中,更新数据为更新后的校验数据,更新数据的数据写入指令指示磁盘将更新后的校验数据写入目标存储地址,目标存储地址与第一数据的目标存储地址相同;根据目标存储地址,将更新数据写入磁盘的非易失性存储器中,并在缓存单元中删除第一数据。In a possible implementation, if the first data is verification data, after the first data is temporarily stored in the cache unit of the disk, the disk receives a data write instruction for updating data sent by the disk controller; wherein, the update The data is the updated verification data, and the data write instruction of the updated data instructs the disk to write the updated verification data into the target storage address, and the target storage address is the same as the target storage address of the first data; according to the target storage address, the The update data is written into the non-volatile memory of the disk, and the first data is deleted in the cache unit.
第四方面,本申请实施例还提供一种数据存取方法,应用于磁盘,该方法包括:In the fourth aspect, the embodiment of the present application also provides a data access method, which is applied to a disk, and the method includes:
接收磁盘控制器发送的预取数据指示;该预取数据指示是磁盘控制器基于预取数据的目标存储地址生成的;receiving the prefetch data instruction sent by the disk controller; the prefetch data instruction is generated by the disk controller based on the target storage address of the prefetch data;
将预取数据指示携带的目标存储地址中保存的预取数据读取至磁盘的缓存单元中;Reading the prefetch data stored in the target storage address carried by the prefetch data indication into the cache unit of the disk;
接收磁盘控制器发送的针对预取数据的第一数据读取指令;receiving a first data read instruction for prefetched data sent by the disk controller;
从缓存单元中获取预取数据,并将预取数据发送至磁盘控制器。Get the prefetched data from the cache unit, and send the prefetched data to the disk controller.
在一种可能的实现方式中,磁盘可以接收磁盘控制器发送的第二数据读取指令,获取第二数据读取指令中携带的预取数据指示;第二数据读取指令用于指示磁盘从指定存储地址读取数据。在另一种可能的实现方式中,磁盘可以接收磁盘控制器发送的包含预取数据指示的单独操作指令。In a possible implementation manner, the disk may receive the second data read instruction sent by the disk controller, and acquire the prefetch data instruction carried in the second data read instruction; the second data read instruction is used to instruct the disk to read from Specify the storage address to read data. In another possible implementation manner, the disk may receive an individual operation command sent by the disk controller including the instruction to prefetch data.
第五方面,本申请实施例还提供一种数据存取装置,应用于磁盘控制器,该装置包括:In the fifth aspect, the embodiment of the present application also provides a data access device, which is applied to a disk controller, and the device includes:
数据获取单元,用于获取待写入目标磁盘的第一数据;a data acquisition unit, configured to acquire the first data to be written into the target disk;
发送单元,用于在确定所述第一数据满足设定条件的情况下,向目标磁盘发送第一数据,并向目标磁盘发送第一数据的延迟写入指示;延迟写入指示用于指示目标磁盘将所述第一数据暂存在目标磁盘的缓存单元中。A sending unit, configured to send the first data to the target disk when it is determined that the first data satisfies the set condition, and send a delayed write indication of the first data to the target disk; the delayed write indication is used to indicate the target The disk temporarily stores the first data in the cache unit of the target disk.
第六方面,本申请实施例还提供一种数据存取装置,应用于磁盘控制器,该装置包括:In the sixth aspect, the embodiment of the present application also provides a data access device, which is applied to a disk controller, and the device includes:
预测单元,用于确定预取数据的目标存储地址和目标磁盘;目标磁盘包括缓存单元;A prediction unit for determining a target storage address and a target disk for prefetching data; the target disk includes a cache unit;
指示发送单元,用于向目标磁盘发送基于目标存储地址生成的预取数据指示;预取数据指示用于指示目标磁盘将预取数据从目标存储地址读取至缓存单元中;以及,向目标磁盘发送针对预取数据的数据读取指令;The instruction sending unit is used to send to the target disk a prefetch data instruction generated based on the target storage address; the prefetch data instruction is used to instruct the target disk to read the prefetch data from the target storage address into the cache unit; and, to the target disk Send a data read command for prefetched data;
数据接收单元,用于接收目标磁盘从缓存单元中获取并发送的预取数据。The data receiving unit is configured to receive the prefetch data obtained and sent by the target disk from the cache unit.
第七方面,本申请实施例还提供一种数据存取装置,应用于磁盘,该装置包括:In the seventh aspect, the embodiment of the present application also provides a data access device, which is applied to a magnetic disk, and the device includes:
接收单元,用于接收磁盘控制器发送的第一数据,并接收磁盘控制器发送的第一数据的延迟写入指示;延迟写入指示用于指示磁盘将第一数据暂存在磁盘的缓存单元中;The receiving unit is configured to receive the first data sent by the disk controller, and receive the delayed writing instruction of the first data sent by the disk controller; the delayed writing instruction is used to instruct the disk to temporarily store the first data in the cache unit of the disk ;
执行单元,用于将第一数据暂存在磁盘的缓存单元中。The execution unit is configured to temporarily store the first data in the cache unit of the disk.
第八方面,本申请实施例还提供一种数据存取装置,应用于磁盘,该装置包括:In the eighth aspect, the embodiment of the present application also provides a data access device, which is applied to a magnetic disk, and the device includes:
指令接收单元,用于接收磁盘控制器发送的预取数据指示;预取数据指示携带预取数据的目标存储地址;The instruction receiving unit is used to receive the prefetch data instruction sent by the disk controller; the prefetch data instruction carries the target storage address of the prefetch data;
指令执行单元,用于将所述目标存储地址对应的存储空间中保存的预取数据读取至磁盘的缓存单元中;an instruction execution unit, configured to read the prefetched data stored in the storage space corresponding to the target storage address into the cache unit of the disk;
数据传输单元,用于接收磁盘控制器发送的针对预取数据的第一数据读取指令,从缓存单元中获取预取数据,并将预取数据发送至磁盘控制器。The data transmission unit is configured to receive a first data read instruction for the prefetched data sent by the disk controller, acquire the prefetched data from the cache unit, and send the prefetched data to the disk controller.
第九方面,本申请实施例还提供一种磁盘控制器,包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器实现上述第一方面记载的任一种方法,或者上述第二方面记载的任一种方法。In the ninth aspect, the embodiment of the present application also provides a disk controller, including a memory and a processor, the memory stores a computer program that can run on the processor, when the computer program is executed by the processor When executed, the processor is made to implement any one of the methods described in the above-mentioned first aspect, or any one of the methods described in the above-mentioned second aspect.
第十方面,本申请实施例还提供一种磁盘,包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器实现上述第三方面记载的任一种方法,或者上述第四方面记载的任一种方法。In the tenth aspect, the embodiment of the present application also provides a magnetic disk, including a memory and a processor, the memory stores a computer program that can run on the processor, when the computer program is executed by the processor , so that the processor implements any one of the methods described in the above third aspect, or any one of the methods described in the above fourth aspect.
第十一方面,本申请实施例还提供一种数据存储系统,包括第九方面提供的磁盘控制 器和第十方面提供的磁盘。In the eleventh aspect, the embodiment of the present application further provides a data storage system, including the disk controller provided in the ninth aspect and the disk provided in the tenth aspect.
第十二方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机可执行指令,该计算机可执行指令用于使计算机执行上述第一方面提供的任一种方法,或者上述第二方面提供的任一种方法。In a twelfth aspect, an embodiment of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used to make a computer perform any of the above-mentioned first aspects. A method, or any method provided in the second aspect above.
第十三方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机可执行指令,该计算机可执行指令用于使计算机执行上述第三方面提供的任一种方法,或者上述第四方面提供的任一种方法。In a thirteenth aspect, an embodiment of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used to make a computer perform any of the above-mentioned third aspects. A method, or any method provided in the fourth aspect above.
第十四方面,本申请实施例提供一种计算机程序产品,包含有计算机可执行指令,该计算机可执行指令用于使计算机执行上述第一方面提供的任一种方法,或者上述第二方面提供的任一种方法。In a fourteenth aspect, the embodiment of the present application provides a computer program product, which includes computer-executable instructions, and the computer-executable instructions are used to make a computer execute any method provided in the above-mentioned first aspect, or the method provided in the above-mentioned second aspect. any of the methods.
第十五方面,本申请实施例提供一种计算机程序产品,包含有计算机可执行指令,该计算机可执行指令用于使计算机执行上述第三方面提供的任一种方法,或者上述第四方面提供的任一种方法。In the fifteenth aspect, the embodiment of the present application provides a computer program product, which includes computer-executable instructions, and the computer-executable instructions are used to make a computer execute any method provided in the third aspect above, or the method provided in the fourth aspect above. any of the methods.
上述第三方面至第十五方面中任一方面可以达到的技术效果可以参照上述第一方面或第二方面中有益效果的描述,此处不再重复赘述。For the technical effects that can be achieved by any one of the third aspect to the fifteenth aspect above, reference can be made to the description of the beneficial effects in the first aspect or the second aspect above, and will not be repeated here.
图1为本申请实施例提供的一种数据存储系统的结构示意图;FIG. 1 is a schematic structural diagram of a data storage system provided by an embodiment of the present application;
图2为本申请实施例提供的一种磁盘阵列的结构示意图;FIG. 2 is a schematic structural diagram of a disk array provided by an embodiment of the present application;
图3为本申请实施例提供的另一种数据存储系统的结构示意图;FIG. 3 is a schematic structural diagram of another data storage system provided by an embodiment of the present application;
图4为本申请实施例提供的一种写入数据过程中磁盘控制器与目标磁盘之间的交互图;FIG. 4 is an interaction diagram between a disk controller and a target disk in the process of writing data provided by an embodiment of the present application;
图5为本申请实施例提供的另一种写入数据过程中磁盘控制器与目标磁盘之间的交互图;FIG. 5 is an interaction diagram between a disk controller and a target disk in another data writing process provided by an embodiment of the present application;
图6为本申请实施例提供的一种预取数据过程中磁盘控制器与目标磁盘之间的交互图;FIG. 6 is an interaction diagram between a disk controller and a target disk in a process of prefetching data provided by an embodiment of the present application;
图7为本申请实施例提供的另一种预取数据过程中磁盘控制器与目标磁盘之间的交互图;FIG. 7 is an interaction diagram between a disk controller and a target disk in another process of prefetching data provided by an embodiment of the present application;
图8为本申请实施例提供的一种磁盘控制器执行的数据存取方法的流程图;FIG. 8 is a flow chart of a data access method performed by a disk controller provided in an embodiment of the present application;
图9为本申请实施例提供的一种磁盘执行的数据存取方法的流程图;FIG. 9 is a flow chart of a data access method performed by a disk provided in an embodiment of the present application;
图10为本申请实施例提供的另一种磁盘控制器执行的数据存取方法的流程图;FIG. 10 is a flow chart of another data access method performed by a disk controller provided in an embodiment of the present application;
图11为本申请实施例提供的另一种磁盘执行的数据存取方法的流程图;FIG. 11 is a flow chart of another disk-executed data access method provided in the embodiment of the present application;
图12为本申请实施例提供的一种数据存取装置的结构框图;FIG. 12 is a structural block diagram of a data access device provided by an embodiment of the present application;
图13为本申请实施例提供的另一种数据存取装置的结构框图;FIG. 13 is a structural block diagram of another data access device provided by the embodiment of the present application;
图14为本申请实施例提供的另一种数据存取装置的结构框图;FIG. 14 is a structural block diagram of another data access device provided by the embodiment of the present application;
图15为本申请实施例提供的另一种数据存取装置的结构框图;FIG. 15 is a structural block diagram of another data access device provided by the embodiment of the present application;
图16为本申请实施例提供的一种磁盘控制器的结构示意图;FIG. 16 is a schematic structural diagram of a disk controller provided by an embodiment of the present application;
图17为本申请实施例提供的一种磁盘的结构示意图。FIG. 17 is a schematic structural diagram of a magnetic disk provided by an embodiment of the present application.
为了使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图,对本申请 实施例进行详细描述。本申请的实施方式部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。显然,所描述的实施例仅仅是本申请一部分实施例,并不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. The terms used in the embodiments of the present application are only used to explain specific embodiments of the present application, and are not intended to limit the present application. Apparently, the described embodiments are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
在介绍本申请实施例提供的具体方案之前,对本申请中的部分用语进行解释说明,以便于本领域技术人员理解,并不对本申请中的用语进行限定。Before introducing the specific solutions provided by the embodiments of this application, some terms in this application will be explained to facilitate understanding by those skilled in the art, and the terms in this application will not be limited.
(1)独立磁盘冗余阵列(redundant array of independent disks,RAID)系统:包括多个磁盘(也可称为物理磁盘)组成的磁盘阵列,也可以称为磁盘组,多个磁盘作为一个整体对外提供存储功能,是虚拟磁盘的基础。虚拟磁盘,可以理解为使用磁盘组划分出来的连续的数据存储单元,相当于一个或多个独立的磁盘。RAID系统采用RAID控制器对多个磁盘进行管理,一个RAID控制器可以管理多个磁盘。(1) Redundant array of independent disks (RAID) system: a disk array composed of multiple disks (also known as physical disks), also known as a disk group, multiple disks as a whole Provides storage functions and is the basis of virtual disks. A virtual disk can be understood as a continuous data storage unit divided by a disk group, which is equivalent to one or more independent disks. A RAID system uses a RAID controller to manage multiple disks, and one RAID controller can manage multiple disks.
RAID控制器通过将相同数据同时写入多个磁盘或将写入数据对应的校验结果写入磁盘来得到冗余保护,从而提升存储数据的可靠性,为用户提供更高的存储性能和更高的数据可靠性。The RAID controller obtains redundancy protection by writing the same data to multiple disks at the same time or writing the verification results corresponding to the written data to the disks, thereby improving the reliability of stored data and providing users with higher storage performance and more High data reliability.
本申请实施例中“多个”是指两个或两个以上,鉴于此,本申请实施例中也可以将“多个”理解为“至少两个”。“至少一个”,可理解为一个或多个,例如理解为一个、两个或更多个。例如,包括至少一个,是指包括一个、两个或更多个,而且不限制包括的是哪几个,例如,包括A、B和C中的至少一个,那么包括的可以是A、B、C、A和B、A和C、B和C、或A和B和C。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,字符“/”,如无特殊说明,一般表示前后关联对象是一种“或”的关系。"Multiple" in the embodiment of the present application refers to two or more, in view of this, "multiple" can also be understood as "at least two" in the embodiment of the present application. "At least one" can be understood as one or more, such as one, two or more. For example, including at least one means including one, two or more, and does not limit which ones are included, for example, including at least one of A, B and C, then what is included can be A, B, C, A and B, A and C, B and C, or A and B and C. "And/or" describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B may indicate: A exists alone, A and B exist simultaneously, and B exists independently. In addition, the character "/", unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship.
除非有相反的说明,本申请实施例提及“第一”、“第二”等序数词用于对多个对象进行区分,不用于限定多个对象的顺序、时序、优先级或者重要程度。Unless otherwise specified, ordinal numerals such as "first" and "second" mentioned in the embodiments of the present application are used to distinguish multiple objects, and are not used to limit the sequence, timing, priority or importance of multiple objects.
为了提升数据存储系统的性能,本申请实施例提供一种数据存取方法。该数据存取方法可以适用于图1或图3所示的数据存储系统中。In order to improve the performance of a data storage system, an embodiment of the present application provides a data access method. The data access method can be applied to the data storage system shown in FIG. 1 or FIG. 3 .
图1为一种数据存储系统的结构示意图。由于需要处理的业务量的与日俱增,单台服务器上需要运行的数据也日益增多。当单个磁盘受到容量和安全性的限制,不足以支持服务器上的系统业务时,就需要将多个磁盘联合起来,对外作为一个虚拟磁盘来使用,以满足服务器的实际需要。FIG. 1 is a schematic structural diagram of a data storage system. Due to the ever-increasing business volume that needs to be processed, the data that needs to be run on a single server is also increasing. When a single disk is limited by capacity and security and cannot support system services on the server, multiple disks need to be combined and used as a virtual disk to meet the actual needs of the server.
图1所示的数据存储系统可以包括服务器100,多个磁盘组成的磁盘阵列300和用于对磁盘进行管理的磁盘控制器200。其中,磁盘控制器200可以是RAID控制器,连接在服务器100和多个磁盘之间。服务器100可以称为主机(host),磁盘可以是固态硬盘(solid state disk,SSD),也可以是机械硬盘,如串行连接的小型计算机系统接口(serial attached small computer system interface,SAS)磁盘或串行高级技术附件(serial advanced technology attachment,SATA)磁盘。RAID控制器和多个磁盘组成RAID系统,RAID控制器接收主机发送的访问磁盘指令,获取访问磁盘指令中的逻辑地址,其中,逻辑地址中可以包括逻辑单元号(logical unit number,LUN)。RAID控制器将访问磁盘指令中的逻辑地址转换为磁盘的物理地址,并访问该物理地址对应的目标磁盘,根据该访问磁盘指令向该目标磁盘写入数据或从该目标磁盘读出数据。图1所示的应用场景中,主机为服务器,在另一些应 用场景中,主机也可以是计算机或其他电子设备。The data storage system shown in FIG. 1 may include a server 100, a disk array 300 composed of multiple disks, and a disk controller 200 for managing the disks. Wherein, the disk controller 200 may be a RAID controller connected between the server 100 and multiple disks. The server 100 may be referred to as a host (host), and the disk may be a solid state disk (solid state disk, SSD) or a mechanical hard disk, such as a serially attached small computer system interface (serial attached small computer system interface, SAS) disk or Serial advanced technology attachment (SATA) disk. A RAID controller and a plurality of disks form a RAID system. The RAID controller receives a disk access command sent by a host, and obtains a logical address in the disk access command. The logical address may include a logical unit number (LUN). The RAID controller converts the logical address in the disk access instruction into the physical address of the disk, and accesses the target disk corresponding to the physical address, and writes data to or reads data from the target disk according to the disk access instruction. In the application scenario shown in Figure 1, the host is a server, and in other application scenarios, the host may also be a computer or other electronic equipment.
示例性地,如图2所示,假设磁盘阵列300中包括3个磁盘,分别为磁盘301、磁盘302和磁盘303,3个磁盘由磁盘控制器200进行管理。例如,磁盘控制器可以是RAID控制器,RAID控制器和3个磁盘组成RAID系统,RAID控制器可以按照RAID5级别规则对3个磁盘进行管理。Exemplarily, as shown in FIG. 2 , it is assumed that the disk array 300 includes three disks, namely disk 301 , disk 302 and disk 303 , and the three disks are managed by the disk controller 200 . For example, the disk controller may be a RAID controller, and the RAID controller and three disks form a RAID system, and the RAID controller may manage the three disks according to RAID5 level rules.
在RAID系统中,RAID控制器通过将数据和对数据计算出的校验结果写入多个磁盘来得到冗余保护,根据采用的校验计算方法或数据排布的不同,对磁盘的管理分为不同的RAID级别。不同的RAID级别对应的数据冗余策略不同;比如RAID5级别的RAID系统可以支持一个磁盘故障,RAID6级别的RAID系统可以支持两块磁盘同时发生故障。当磁盘发生故障时,只要故障磁盘的数量未超过RAID系统的容忍范围,RAID系统均可以根据剩余磁盘中的数据和校验信息恢复故障盘中的数据,从而保证了数据的一致性。目前,七个标准的RAID级别分别是RAID0级别、RAID1级别、RAID2级别、RAID3级别、RAID4级别、RAID5级别、RAID6级别。标准的RAID级别间可以组合,形成新的引申级别,如RAID50级别、RAID60。In a RAID system, the RAID controller obtains redundancy protection by writing the data and the check results calculated on the data to multiple disks. for different RAID levels. Different RAID levels correspond to different data redundancy strategies; for example, a RAID level 5 RAID system can support one disk failure, and a RAID 6 level RAID system can support two disk failures at the same time. When a disk fails, as long as the number of failed disks does not exceed the tolerance range of the RAID system, the RAID system can restore the data in the failed disk according to the data and parity information in the remaining disks, thus ensuring data consistency. Currently, seven standard RAID levels are RAID0 level, RAID1 level, RAID2 level, RAID3 level, RAID4 level, RAID5 level, and RAID6 level. Standard RAID levels can be combined to form new extended levels, such as RAID50 level and RAID60.
如图2所示,磁盘301、磁盘302和磁盘303中的存储空间可以被分割至一个或多个虚拟磁盘,其中,一个虚拟磁盘对应的逻辑地址可以是LUN x。一个虚拟磁盘可以包括多个条带(strip),图2所示的虚拟磁盘包括条带1、条带2、条带3、条带4和条带5共五个条带。每个条带包括多个条带单元(strip unit)。组成一个条带的多个条带单元分别位于不同的磁盘。以条带1为例,条带1中包括条带单元11、条带单元12和条带单元13。条带单元11位于磁盘301,条带单元12位于磁盘302,条带单元13位于磁盘303。以条带单元11为例,条带单元11位于磁盘301是指,磁盘301中的一个或多个存储单位组成条带单元11。磁盘301中除条带单元11外,还包括条带单元21、条带单元31、条带单元41等。磁盘301中的不同条带单元是由不同的存储单位组成的。存储单位是指磁盘中能够进行读写操作的最小单元。不同类型的磁盘的存储单位不同。例如,SSD的最小存储单位为页(page)。机械硬盘的最小存储单位为扇区。As shown in FIG. 2, the storage space in the disk 301, the disk 302 and the disk 303 can be divided into one or more virtual disks, wherein the logical address corresponding to a virtual disk can be LUN x. A virtual disk may include multiple stripes. The virtual disk shown in FIG. 2 includes five stripes, namely stripe 1 , stripe 2 , stripe 3 , stripe 4 and stripe 5 . Each strip includes a plurality of strip units. The multiple stripe units that make up a stripe are located on different disks. Taking strip 1 as an example, strip 1 includes a strip unit 11 , a strip unit 12 and a strip unit 13 . The stripe unit 11 is located on the disk 301 , the stripe unit 12 is located on the disk 302 , and the stripe unit 13 is located on the disk 303 . Taking the stripe unit 11 as an example, the stripe unit 11 located on the disk 301 means that one or more storage units in the disk 301 form the stripe unit 11 . In addition to the stripe unit 11, the disk 301 further includes a stripe unit 21, a stripe unit 31, a stripe unit 41, and the like. Different stripe units in disk 301 are composed of different storage units. The storage unit refers to the smallest unit in the disk that can perform read and write operations. Different types of disks have different storage units. For example, the smallest storage unit of an SSD is a page. The smallest storage unit of a mechanical hard disk is a sector.
条带单元的大小,也可以称为条带长度(strip length),可以按照需求设定,例如,图2所示的每个条带单元可以存储128KB的数据。组成同一条带的多个条带单元可以分为用于存储数据的条带单元和用于存储校验值的条带单元。例如,条带1中的用于存储数据的条带单元可以为条带单元11和条带单元12,用于存储校验值的条带单元可以为条带单元13;条带2中的用于存储数据的条带单元可以为条带单元21和条带单元23,用于存储校验值的条带单元可以为条带单元22;条带3中的用于存储数据的条带单元可以为条带单元32和条带单元33,用于存储校验值的条带单元可以为条带单元31;依此类推。以条带1为例,条带单元11中可以存储数据LBA0~127,共128KB的数据,条带单元12中可以存储数据LBA128~255,条带单元13中用于存储由LBA0~127与LBA128~255通过异或计算得到的校验结果P。The size of the stripe unit, which may also be referred to as the stripe length (strip length), can be set according to requirements. For example, each stripe unit shown in FIG. 2 can store 128KB of data. Multiple stripe units forming the same stripe can be divided into stripe units for storing data and stripe units for storing check values. For example, the stripe units used to store data in stripe 1 can be stripe unit 11 and stripe unit 12, and the stripe unit used to store check values can be stripe unit 13; The stripe unit for storing data can be stripe unit 21 and stripe unit 23, the stripe unit for storing check value can be stripe unit 22; the stripe unit for storing data in stripe 3 can be The stripe unit 32 and the stripe unit 33, the stripe unit used to store the check value may be the stripe unit 31; and so on. Taking stripe 1 as an example, data LBA0-127 can be stored in stripe unit 11, a total of 128KB of data, data LBA128-255 can be stored in stripe unit 12, and data LBA0-127 and LBA128 can be stored in stripe unit 13. ~255 The check result P obtained by XOR calculation.
RAID控制器与多个磁盘之间可以通过内部连接通路互相通信,传递控制和/或数据信号,其中,内部连接通路包括总线,例如,外围部件互连标准(peripheral component interconnect express,PCIe)或其他用于连接不同器件的总线。RAID控制器中保存有条带状态信息,条带状态信息用于记录该RAID系统中每个条带单元的状态。每个条带单元的状态可以包括空闲态和有效态,有效态的条带单元也可以称为有效条带单元,有效条带单元 指存储有数据的条带单元;空闲态的条带单元也可以称为空闲条带单元,空闲条带单元指当前没有存储数据的条带单元。例如,对于条带单元11,当条带单元11中未存储数据时,条带单元11的状态为空闲态,RAID控制器向磁盘301发送针对条带单元11的数据写入指令后,将条带单元11的状态由空闲态变更为有效态。The RAID controller and a plurality of disks can communicate with each other through an internal connection path to transmit control and/or data signals, wherein the internal connection path includes a bus, for example, a peripheral component interconnect express (PCIe) or other A bus used to connect different devices. The RAID controller stores stripe status information, and the stripe status information is used to record the status of each stripe unit in the RAID system. The state of each stripe unit can include an idle state and a valid state. A stripe unit in a valid state can also be called a valid stripe unit. A valid stripe unit refers to a stripe unit that stores data; a stripe unit in an idle state is also It may be referred to as an idle stripe unit, and an idle stripe unit refers to a stripe unit that currently does not store data. For example, for the stripe unit 11, when no data is stored in the stripe unit 11, the state of the stripe unit 11 is idle, and after the RAID controller sends a data write command for the stripe unit 11 to the disk 301, the stripe The state of the belt unit 11 is changed from the idle state to the active state.
图3所示的数据存储系统可以包括计算机400和多个磁盘组成的磁盘阵列300。其中,计算机400可以作为磁盘控制器,用于对多个磁盘进行管理。其中,计算机400也可以由服务器或其他电子设备替代。磁盘阵列300的结构也可以参照图2所示,计算机400对多个磁盘进行管理的过程与图1所示的RAID控制器对多个磁盘进行管理的过程相同,在此不再赘述。The data storage system shown in FIG. 3 may include a computer 400 and a disk array 300 composed of multiple disks. Wherein, the computer 400 can be used as a disk controller for managing multiple disks. Wherein, the computer 400 may also be replaced by a server or other electronic devices. The structure of the disk array 300 may also be shown in FIG. 2 . The process of managing multiple disks by the computer 400 is the same as the process of managing multiple disks by the RAID controller shown in FIG. 1 , and will not be repeated here.
本申请实施例通过磁盘控制器与磁盘之间的配合,来提升数据存储系统的性能。为便于理解,下文以磁盘控制器为图1中所示的RAID控制器为例,分别说明本申请实施例提供的数据存取方法在写入数据和预取数据的过程中的具体实现方式。In the embodiment of the present application, the performance of the data storage system is improved through the cooperation between the disk controller and the disk. For ease of understanding, the following takes the RAID controller shown in FIG. 1 as an example of the disk controller to describe the specific implementation manners of the data access method provided by the embodiment of the present application in the process of writing data and prefetching data.
图4示出了一种在写入数据的过程中磁盘控制器与磁盘之间的交互图。如图4所示,在写入数据的过程中,一种实施例提供的数据存取方法,可以包括如下步骤:Fig. 4 shows an interaction diagram between the disk controller and the disk during the process of writing data. As shown in Figure 4, in the process of writing data, a data access method provided by an embodiment may include the following steps:
S401,磁盘控制器获取第一数据,并确定第一数据对应的目标磁盘和数据类型。S401. The disk controller acquires first data, and determines a target disk and a data type corresponding to the first data.
第一数据可以理解为待写入目标磁盘的数据。第一数据的数据类型可以包括延迟写入类型和非延迟写入类型,其中,延迟写入类型的数据可以包括但不限于后续需要使用的数据,或者,需要立即更新的数据;非延迟写入类型的数据也可以称为无需延迟写入类型的数据,比如,暂时不需要使用的数据。The first data can be understood as data to be written to the target disk. The data type of the first data may include delayed write type and non-delayed write type, wherein, delayed write type data may include but not limited to data that needs to be used later, or data that needs to be updated immediately; non-delayed write The type of data can also be referred to as data that does not need to be delayed for writing, for example, data that does not need to be used temporarily.
RAID控制器可以确定用于保存第一数据的目标条带单元所属的目标磁盘和目标条带,如果在第一数据之后要写入由RAID控制器控制的一个或多个磁盘的待写入数据中,包括待写入目标条带的第二数据,则确定第一数据的数据类型为延迟写入类型。The RAID controller can determine the target disk and the target stripe to which the target stripe unit for saving the first data belongs, if the data to be written is to be written to one or more disks controlled by the RAID controller after the first data , including the second data to be written into the target stripe, it is determined that the data type of the first data is the delayed write type.
示例性地,在一些实施例中,RAID控制器接收到主机的写磁盘指令,根据写磁盘指令中携带的数据确定第一数据。RAID控制器可以根据写磁盘指令中的逻辑地址确定用于保存第一数据的目标磁盘。在一种实施例中,第一数据可以是上述写磁盘指令中携带的数据,此时,写磁盘指令中的逻辑地址对应的条带单元为目标条带单元,目标条带单元所属的磁盘为目标磁盘。在另一种实施例中,第一数据可以是根据写磁盘指令中携带的数据确定的校验结果,此时,可以确定写磁盘指令中的逻辑地址对应的条带单元所属的目标条带,并确定该目标条带中用于保存校验结果的目标条带单元,目标条带单元所属的磁盘为目标磁盘,下文将针对该情况进行详细说明。Exemplarily, in some embodiments, the RAID controller receives a disk write command from the host, and determines the first data according to data carried in the disk write command. The RAID controller can determine the target disk for saving the first data according to the logical address in the disk write command. In one embodiment, the first data may be the data carried in the above-mentioned write-to-disk instruction. At this time, the stripe unit corresponding to the logical address in the write-to-disk instruction is the target stripe unit, and the disk to which the target stripe unit belongs is target disk. In another embodiment, the first data may be a verification result determined according to the data carried in the write to disk command. At this time, the target stripe to which the stripe unit corresponding to the logical address in the write to disk command belongs may be determined. And determine the target stripe unit used to save the verification result in the target stripe, and the disk to which the target stripe unit belongs is the target disk, which will be described in detail below.
RAID控制器还可以根据连续接收到的多个写磁盘指令中的逻辑地址,确定当前的数据写入模式是否为顺序写,其中,顺序写指连续接收到的多个写磁盘指令中的逻辑地址是连续的,也就是说,多个写磁盘指令指示向一个虚拟磁盘中的各个条带单元顺次写入数据。例如,在用户对某个文档编辑完成,保存该文档的应用场景中,主机向RAID控制器连续发送多个写磁盘指令,且多个写磁盘指令中的逻辑地址是连续的,此时,可以认为当前的数据写入模式为顺序写,即可以将文档数据依次写入各个写磁盘指令中的逻辑地址指示的各个条带单元中。如果多个写磁盘指令中的逻辑地址是不连续的,可以确定当前的数据写入模式不是顺序写;例如,在用户对多个不同的功能的参数进行重新设定或修改的应用场景中,每个功能的参数可能保存在不同的虚拟磁盘中或同一虚拟磁盘内不相邻的条带单元 中,在保存各个功能的参数时,主机向RAID控制器发送多个写磁盘指令,且多个写磁盘指令中的逻辑地址是不连续的,此时,可以认为当前的数据写入模式不是顺序写。The RAID controller can also determine whether the current data writing mode is sequential write according to the logical addresses in the multiple write disk commands received continuously, wherein the sequential write refers to the logical addresses in the multiple write disk commands received continuously It is continuous, that is to say, multiple disk write instructions indicate to sequentially write data to each stripe unit in a virtual disk. For example, in an application scenario where a user finishes editing a document and saves the document, the host sends multiple disk write commands to the RAID controller continuously, and the logical addresses in the multiple disk write commands are continuous. It is considered that the current data writing mode is sequential writing, that is, the document data can be sequentially written into each stripe unit indicated by the logical address in each write-to-disk command. If the logical addresses in multiple disk write instructions are discontinuous, it can be determined that the current data writing mode is not sequential writing; for example, in the application scenario where the user resets or modifies the parameters of multiple different functions, The parameters of each function may be stored in different virtual disks or in non-adjacent stripe units in the same virtual disk. When saving the parameters of each function, the host sends multiple disk write commands to the RAID controller, and multiple The logical addresses in the write-to-disk command are discontinuous. At this time, it can be considered that the current data writing mode is not sequential writing.
上文中已经说明,RAID控制器可以确定用于保存第一数据的目标条带单元和目标条带,在一种可选的实施例中,如果RAID控制器确定当前的数据写入模式为顺序写,则RAID控制器可以根据保存的条带状态信息,确定用于保存第一数据的目标条带中各个条带单元的状态,如果目标条带中包括除目标条带单元之外的空闲条带单元,可以确定第一数据是延迟写入类型的数据,如果目标条带中除目标条带单元之外,没有其他的空闲条带单元,可以认为第一数据是非延迟写入类型的数据。例如,假设当前的数据写入模式为顺序写,RAID控制器接收到主机的写磁盘指令中携带的数据包括数据LBA0~127。此时,待写入的数据可以包括数据LBA0~127,以及数据LBA0~127对应的校验结果P
0。
It has been explained above that the RAID controller can determine the target stripe unit and the target stripe for storing the first data. In an optional embodiment, if the RAID controller determines that the current data writing mode is sequential writing , the RAID controller can determine the state of each stripe unit in the target stripe used to save the first data according to the saved stripe status information, if the target stripe includes an idle stripe other than the target stripe unit unit, it may be determined that the first data is data of a delayed write type, and if there is no other free stripe unit in the target stripe except the target stripe unit, it may be considered that the first data is data of a non-delayed write type. For example, assuming that the current data writing mode is sequential writing, the data carried in the disk writing command received by the RAID controller from the host includes data LBA0-127. At this time, the data to be written may include data LBA0-127 and the verification result P 0 corresponding to the data LBA0-127.
在写入数据LBA0~127时,数据LBA0~127为第一数据,RAID控制器根据写磁盘指令中的逻辑地址,可以确定数据LBA0~127对应的存储位置为条带单元11,此时,条带单元11为目标条带单元,条带单元11所属的条带1为目标条带,条带单元11所属的磁盘301为目标磁盘。RAID控制器根据保存的条带状态信息,可以确定目标条带中的条带单元12当前为空闲态,由于当前为顺序写,RAID控制器可以确定后续将向条带单元12中写入数据,即待写入数据中包括待写入目标条带的第二数据,并且可以确定在向条带单元12中写入数据时,需要使用数据LBA0~127与将写入条带单元12中的数据重新确定校验结果P,因此,可以确定数据LBA0~127为后续需要使用的数据,即,RAID控制器确定第一数据为延迟写入类型的数据。When writing data LBA0-127, the data LBA0-127 is the first data, and the RAID controller can determine the storage location corresponding to the data LBA0-127 as the stripe unit 11 according to the logical address in the write disk instruction. Band unit 11 is a target stripe unit, stripe 1 to which stripe unit 11 belongs is a target stripe, and disk 301 to which stripe unit 11 belongs is a target disk. According to the saved stripe status information, the RAID controller can determine that the stripe unit 12 in the target stripe is currently in an idle state. Since it is currently written sequentially, the RAID controller can determine that data will be written in the stripe unit 12 in the future, That is, the data to be written includes the second data to be written into the target stripe, and it can be determined that when writing data into the stripe unit 12, the data LBA0-127 and the data to be written into the stripe unit 12 need to be used The verification result P is re-determined. Therefore, it can be determined that the data LBA0-127 are data to be used later, that is, the RAID controller determines that the first data is data of the delayed write type.
在写入校验结果P
0时,校验结果P
0为第一数据,RAID控制器根据写磁盘指令中的逻辑地址,可以确定写磁盘指令中携带的数据LBA0~127对应的存储位置为条带单元11,条带单元11所属的条带是条带1,校验结果P
0与数据LBA0~127需要保存在同一条带中,因此条带1为目标条带,RAID控制器可以确定,在条带1中,条带单元13用于存储校验结果,所以,条带单元13为目标条带单元,条带单元13所属的磁盘303为目标磁盘。RAID控制器根据保存的条带状态信息,可以确定目标条带中的条带单元12当前为空闲态,后续在向条带单元12中写入数据时,需要使用数据LBA0~127与将写入条带单元12中的数据重新确定校验结果P,进而可以确定校验结果P
0为需要立即更新的数据,即,RAID控制器确定第一数据为延迟写入类型的数据。
When writing the verification result P 0 , the verification result P 0 is the first data, and the RAID controller can determine the storage location corresponding to the data LBA0-127 carried in the write disk command according to the logical address in the write disk command as the stripe Strip unit 11, the stripe to which stripe unit 11 belongs is stripe 1, and the verification result P 0 and the data LBA0-127 need to be stored in the same stripe, so stripe 1 is the target stripe, and the RAID controller can determine, In the stripe 1, the stripe unit 13 is used to store the verification result, therefore, the stripe unit 13 is the target stripe unit, and the disk 303 to which the stripe unit 13 belongs is the target disk. According to the saved stripe status information, the RAID controller can determine that the stripe unit 12 in the target stripe is currently in an idle state. When writing data to the stripe unit 12 later, it needs to use the data LBA0-127 and the data to be written. The data in the stripe unit 12 re-determines the verification result P, and then it can be determined that the verification result P 0 is data that needs to be updated immediately, that is, the RAID controller determines that the first data is delayed write data.
在另一种可选的实施例中,假设当前的数据写入模式为顺序写,RAID控制器已经向磁盘301发送将数据LBA0~127写入条带单元11的数据写入指令,并在保存的条带状态信息中将条带单元11的状态设置为有效态,并且,RAID控制器已经向磁盘303发送校验结果P
0写入条带单元13的数据写入指令,并在保存的条带状态信息中将条带单元13的状态设置为有效态。RAID控制器在接收到主机的写磁盘指令中携带的数据为数据LBA128~255时,RAID控制器可以根据写磁盘指令中携带的逻辑地址,确定数据LBA128~255对应的存储位置为条带单元12,可以根据数据LBA128~255与条带单元11中的数据LBA0~127计算得到校验结果P。此时,待写入的数据可以包括数据LBA128~255,以及校验结果P。
In another optional embodiment, assuming that the current data writing mode is sequential writing, the RAID controller has sent a data writing instruction to write data LBA0-127 to the stripe unit 11 to the disk 301, and saves In the stripe status information of the stripe unit 11, the state of the stripe unit 11 is set to the valid state, and the RAID controller has sent the verification result P 0 to the disk 303 to write the data into the stripe unit 13. In the band status information, the status of the stripe unit 13 is set to be valid. When the data carried by the RAID controller in the disk write command received from the host is data LBA128-255, the RAID controller can determine the storage location corresponding to the data LBA128-255 as the stripe unit 12 according to the logical address carried in the write disk command. , the verification result P can be calculated according to the data LBA128-255 and the data LBA0-127 in the stripe unit 11. At this time, the data to be written may include the data LBA128-255 and the verification result P.
在写入数据LBA128~255时,数据LBA128~255为第一数据,LBA128~255对应的存储位置为条带单元12为目标条带单元,条带单元12所属的条带1为目标条带,条带单元12所属的磁盘302为目标磁盘。RAID控制器根据保存的条带状态信息,可以确定目标条 带中除条带单元12之外,其余条带单元均为有效态,此时,RAID控制器可以确定数据LBA128~255为暂时不需要使用的非延迟写入类型的数据,即,RAID控制器可以认为第一数据为非延迟写入类型的数据。When writing data LBA128-255, the data LBA128-255 is the first data, the storage location corresponding to LBA128-255 is the stripe unit 12 as the target stripe unit, and the stripe 1 to which the stripe unit 12 belongs is the target stripe, The disk 302 to which the stripe unit 12 belongs is the target disk. According to the saved stripe state information, the RAID controller can determine that all the stripe units except stripe unit 12 in the target stripe are in valid state. At this time, the RAID controller can determine that the data LBA128-255 are temporarily unnecessary The used non-delayed write type data, that is, the RAID controller may consider the first data as non-delayed write type data.
在写入校验结果P时,校验结果P为第一数据,RAID控制器可以确定校验结果P对应的存储位置为条带1中的条带单元13,条带1为目标条带,条带单元13为目标条带单元,条带单元13所属的磁盘303为目标磁盘。RAID控制器可以确定目标条带中的条带单元11和条带单元12中均存储有数据,目标条带中除条带单元13之外的其余条带单元均为有效态,此时,RAID控制器可以确定校验结果P为非延迟写入类型的数据,即,RAID控制器可以认为第一数据为非延迟写入类型的数据。When writing the verification result P, the verification result P is the first data, and the RAID controller can determine that the storage location corresponding to the verification result P is the stripe unit 13 in the stripe 1, and the stripe 1 is the target stripe, The stripe unit 13 is the target stripe unit, and the disk 303 to which the stripe unit 13 belongs is the target disk. The RAID controller can determine that data is stored in both the stripe unit 11 and the stripe unit 12 in the target stripe, and all the other stripe units in the target stripe except the stripe unit 13 are valid. At this time, the RAID The controller may determine that the verification result P is non-delayed write data, that is, the RAID controller may consider the first data as non-delayed write data.
在执行对磁盘302进行修复的业务时,如果RAID控制器根据保存的条带状态信息,确定第一数据对应的目标条带的下一条带中的各个条带单元均为空闲态,则可以确定暂时不需要继续向磁盘302写入数据,可以认为当前第一数据无需延迟写入,是非延迟写入类型的数据。When performing the business of repairing the disk 302, if the RAID controller determines that each stripe unit in the next stripe of the target stripe corresponding to the first data is in an idle state according to the saved stripe state information, it can be determined that There is no need to continue writing data to the disk 302 for the time being, and it can be considered that the current first data does not need to be delayed in writing, and is non-delayed writing data.
S402,若确定第一数据为延迟写入类型的数据,则磁盘控制器生成包含延迟写入指示的数据写入指令。S402. If it is determined that the first data is data of a delayed write type, the disk controller generates a data write instruction including a delayed write instruction.
S403,磁盘控制器向目标磁盘发送数据写入指令。S403, the disk controller sends a data write instruction to the target disk.
数据写入指令中除包含延迟写入指示之外,还包含上述第一数据以及第一数据的存储地址,第一数据的存储地址可以是用于保存第一数据的条带单元的地址。在另一些实施例中,数据写入指令中携带的数据也可以不是上述第一数据,而是其他的待写入数据以及其他的待写入数据的存储地址。In addition to the delayed write instruction, the data write instruction also includes the above-mentioned first data and a storage address of the first data. The storage address of the first data may be an address of a stripe unit for storing the first data. In other embodiments, the data carried in the data write instruction may not be the above-mentioned first data, but other data to be written and storage addresses of other data to be written.
示例性地,在数据写入指令的数据结构中,可以预先设定某些固定位置的数据位为操作标识位,操作标识位可以占用1个数据位,也可以占用多个数据位。下文以操作标识位占用2个数据位为例进行说明,如果该操作标识位为“10”,表明该标识为延迟写入标识,该数据写入指令携带的是延迟写入指示;如果该操作标识位为“01”,表明该标识为立即写入标识,该数据写入指令携带的是立即写入指示,也可以称为非延迟写入指示。Exemplarily, in the data structure of the data write instruction, data bits at certain fixed positions may be preset as operation identification bits, and the operation identification bits may occupy one data bit or multiple data bits. The following is an example of an operation flag occupying 2 data bits. If the operation flag is "10", it indicates that the flag is a delayed write flag, and the data write command carries a delayed write instruction; if the operation The flag bit is "01", indicating that the flag is an immediate write flag, and the data write instruction carries an immediate write instruction, which may also be called a non-delayed write instruction.
在一种实施例中,在数据写入指令的数据结构中,可以在预先设定的N个数据位中,携带延迟写入指示或立即写入指示对应的目标存储地址,该目标存储地址可以是用于保存第一数据的目标条带单元的地址。例如,假设目标磁盘为磁盘301,在RAID控制器向磁盘301发送的数据写入指令中,设定的N个数据位携带的是条带单元11的地址信息,且数据写入指令中的操作标识位为“10”,则该数据写入指令指示磁盘301可以延迟写入条带单元11对应的第一数据。In one embodiment, in the data structure of the data write instruction, the preset N data bits may carry a target storage address corresponding to a delayed write indication or an immediate write indication, and the target storage address may be is the address of the target stripe unit for saving the first data. For example, assuming that the target disk is disk 301, in the data write command sent by the RAID controller to disk 301, the set N data bits carry the address information of the stripe unit 11, and the operation in the data write command If the flag is “10”, the data writing instruction indicates that the disk 301 can delay writing the first data corresponding to the stripe unit 11 .
在另一种实施例中,在数据写入指令的数据结构中,可以在预先设定的M个数据位中,携带延迟写入指示或立即写入指示对应的目标磁盘的磁盘标识和目标条带单元的地址。例如,在RAID控制器向磁盘301发送的数据写入指令中,设定的M个数据位携带的是磁盘301的磁盘标识和条带单元11的地址,且数据写入指令中的操作标识位为“10”,则该数据写入指令指示磁盘301可以延迟写入条带单元11对应的第一数据。In another embodiment, in the data structure of the data write instruction, the preset M data bits may carry the disk identifier and the target entry of the corresponding target disk indicating the delayed write indication or the immediate write indication. with the address of the unit. For example, in the data write instruction sent by the RAID controller to the disk 301, the set M data bits carry the disk identification of the disk 301 and the address of the stripe unit 11, and the operation identification bit in the data write instruction If it is “10”, the data writing instruction indicates that the disk 301 can delay writing the first data corresponding to the stripe unit 11 .
在另一些实施例中,如果确定第一数据为非延迟写入类型的数据,则RAID控制器可以生成包含立即写入指示的数据写入指令,并向目标磁盘发送该数据写入指令。其中,立即写入指示也可以称为非延迟写入指示。例如,假设目标磁盘为磁盘301,在RAID控制器向磁盘301发送的数据写入指令中,设定的M个数据位携带的是磁盘301的磁盘标识和 条带单元11的地址,且数据写入指令中的操作标识位为“01”,则该数据写入指令指示磁盘301可以立即写入条带单元11对应的第一数据。或者,如果确定第一数据为非延迟写入类型的数据,则RAID控制器可以直接向目标磁盘发送数据写入指令,数据写入指令中可以不携带延迟写入指示或立即写入指示。In some other embodiments, if it is determined that the first data is non-delayed write data, the RAID controller may generate a data write instruction including an immediate write instruction, and send the data write instruction to the target disk. Wherein, the immediate write instruction may also be referred to as a non-delayed write instruction. For example, assuming that the target disk is disk 301, in the data write command sent by the RAID controller to disk 301, the set M data bits carry the disk identification of disk 301 and the address of stripe unit 11, and the data write If the operation identification bit in the write command is “01”, the data write command indicates that the disk 301 can write the first data corresponding to the stripe unit 11 immediately. Alternatively, if it is determined that the first data is non-delayed write data, the RAID controller may directly send a data write instruction to the target disk, and the data write instruction may not carry a delayed write instruction or an immediate write instruction.
在另一些实施例中,如果RAID控制器无法确定第一数据是延迟写入类型的数据,还是非延迟写入类型的数据,RAID控制器向目标磁盘发送的数据写入指令中可以不携带延迟写入指示或立即写入指示。In other embodiments, if the RAID controller cannot determine whether the first data is delayed write type data or non-delayed write type data, the data write command sent by the RAID controller to the target disk may not carry delay Write instructions or write instructions now.
在另一些实施例中,磁盘控制器也可以将数据的延迟写入指示携带在向目标磁盘发送的数据读取指令中,发送至目标磁盘。数据读取指令中除包含延迟写入指示之外,还可以包含待读取数据的存储地址。In some other embodiments, the disk controller may also include the data delay writing instruction in the data read instruction sent to the target disk, and send it to the target disk. In addition to the delayed write instruction, the data read instruction may also include the storage address of the data to be read.
S404,目标磁盘执行数据写入指令中携带的延迟写入指示。S404, the target disk executes the delayed writing instruction carried in the data writing instruction.
磁盘中包括非易失性存储器,各个条带单元均位于非易失性存储器中。为了降低RAID控制器访问磁盘的时延,磁盘中还设有缓存单元,访问缓存单元的时长远远小于访问非易失性存储器的时长。缓存单元可以用于临时保存需要写入非易失性存储器中的数据,即第一数据。示例性地,缓存单元可以采用高速缓冲存储器(cache),非易失性存储器可以采用闪存(flash)。The disk includes non-volatile memory, and each stripe unit is located in the non-volatile memory. In order to reduce the time delay for the RAID controller to access the disk, a cache unit is also provided in the disk, and the time for accessing the cache unit is much shorter than the time for accessing the non-volatile memory. The cache unit may be used to temporarily save data that needs to be written into the non-volatile memory, that is, first data. Exemplarily, the cache unit may use a cache memory (cache), and the non-volatile memory may use a flash memory (flash).
以目标磁盘为磁盘301为例,在一种实施例中,磁盘301接收到RAID控制器发送的数据写入指令,从该数据写入指令中设定的N个数据位读取到条带单元11的地址,并读取到数据写入指令中的操作标识位为“10”,则磁盘301可以执行该数据写入指令中携带的延迟写入指示,延迟写入条带单元11对应的第一数据。示例性地,磁盘301可以将条带单元11对应的第一数据,即数据LBA0~127暂时保存在缓存单元中,等待接收到其他待写入数据后,执行写数据操作,与其他待写入数据一起写入非易失性存储器中,每次执行写操作时都会写多个数据到写入非易失性存储器,避免了向非易失性存储器的频繁写入操作。如果在设定时长内,未接收到其他待写入数据,则执行写数据操作,将第一数据写入非易失性存储器中的条带单元11;或者,磁盘301的缓存单元已满,需清除部分数据时,磁盘301执行写数据操作,将第一数据写入非易失性存储器中的条带单元11。在一些可选的实施例中,磁盘执行延迟写入指示,将第一数据暂时保存在缓存单元中后,还可以等待该第一数据被刷新后,执行写数据操作,将刷新后的数据写入非易失性存储器中。Taking the target disk as the disk 301 as an example, in one embodiment, the disk 301 receives the data write instruction sent by the RAID controller, and reads the N data bits set in the data write instruction to the stripe unit 11, and read that the operation identification bit in the data write command is "10", then the disk 301 can execute the delay write instruction carried in the data write command, and delay writing to the corresponding stripe unit 11 a data. Exemplarily, the disk 301 may temporarily store the first data corresponding to the stripe unit 11, that is, the data LBA0-127, in the cache unit, wait for other data to be written to be received, and then perform a data write operation. The data are written into the non-volatile memory together, and multiple data are written to the non-volatile memory each time a write operation is performed, thereby avoiding frequent write operations to the non-volatile memory. If within the set duration, no other data to be written is received, the write data operation is performed, and the first data is written into the stripe unit 11 in the non-volatile memory; or, the cache unit of the magnetic disk 301 is full, When part of the data needs to be cleared, the disk 301 executes a data write operation, and writes the first data into the stripe unit 11 in the nonvolatile memory. In some optional embodiments, the disk executes the delayed writing instruction, and after temporarily storing the first data in the cache unit, it may also wait for the first data to be refreshed, and then perform a write data operation, and write the refreshed data to into non-volatile memory.
在另一种实施例中,磁盘301接收到RAID控制器发送的数据写入指令,从该数据写入指令中设定的M个数据位读取到磁盘301的磁盘标识和条带单元11的地址信息,并读取到数据写入指令中的操作标识位为“10”,则磁盘301可以执行该数据写入指令中携带的延迟写入指示,延迟写入条带单元11对应的第一数据。In another embodiment, the disk 301 receives the data write instruction sent by the RAID controller, and reads the disk identifier of the disk 301 and the stripe unit 11 from the M data bits set in the data write instruction. Address information, and read the operation flag in the data write command is "10", then the disk 301 can execute the delay write instruction carried in the data write command, and delay write to the first corresponding stripe unit 11 data.
在另一些实施例中,如果磁盘接收到RAID控制器发送的数据写入指令,数据写入指令中携带延迟写入指示,磁盘可以根据自身状态确定是否执行该延迟写入指示;例如,如果磁盘的缓存单元的数据存储比例达到设定最大比例阈值,则磁盘可以不执行该延迟写入指示,而执行写数据操作,将第一数据与缓存单元中保存的其他数据一起写入非易失性存储器中。数据存储比例指缓存单元中存储的数据量与缓存单元的数据容量之间的比值。如果磁盘接收到RAID控制器发送的数据写入指令,数据写入指令中携带立即写入指示,磁盘可以根据自身状态确定是否执行该立即写入指示;例如,如果磁盘的缓存单元的数据存储比例未达到设定最小比例阈值,则磁盘可以不执行该立即写入指示,将第一数据暂时保 存在缓存单元中,可以在缓存单元的数据存储比例达到设定最小比例阈值后,再执行写数据操作,将缓存单元中保存的数据一起写入非易失性存储器中。In some other embodiments, if the disk receives a data write instruction sent by the RAID controller, and the data write instruction carries a delayed write instruction, the disk can determine whether to execute the delayed write instruction according to its own state; for example, if the disk If the data storage ratio of the cache unit reaches the set maximum ratio threshold, the disk may not execute the delayed write instruction, but execute the write data operation, and write the first data together with other data stored in the cache unit into the non-volatile in memory. The data storage ratio refers to the ratio between the amount of data stored in the cache unit and the data capacity of the cache unit. If the disk receives the data write instruction sent by the RAID controller, and the data write instruction carries an immediate write instruction, the disk can determine whether to execute the immediate write instruction according to its own state; for example, if the data storage ratio of the cache unit of the disk is If the set minimum ratio threshold is not reached, the disk may not execute the immediate write instruction, and temporarily save the first data in the cache unit, and may execute writing data after the data storage ratio of the cache unit reaches the set minimum ratio threshold The operation is to write the data saved in the cache unit into the non-volatile memory together.
在一些实施例中,如果第一数据为校验数据,在向目标磁盘发送第一数据的延迟写入指示之后,如果磁盘控制器获取到第二数据,则基于第二数据确定更新后的校验数据,向目标磁盘发送针对更新后的校验数据的数据写入指令;该数据写入指令用于指示目标磁盘将更新后的校验数据写入目标磁盘的非易失性存储器中。目标磁盘将第一数据暂时保存在缓存单元之后,等待设定时间,如果在设定时间内,目标磁盘接收到磁盘控制器发送的更新后的校验数据的数据写入指令;数据写入指令指示磁盘将更新后的校验数据写入目标存储地址,目标存储地址与第一数据的目标存储地址相同;根据目标存储地址,将更新后的校验数据写入磁盘的非易失性存储器中,并在缓存单元中删除第一数据。如果目标磁盘在设定时间之内未接收到更新后的校验数据的数据写入指令,则目标磁盘将第一数据写入非易失性存储器中。In some embodiments, if the first data is verification data, after sending the delayed writing instruction of the first data to the target disk, if the disk controller obtains the second data, then determine the updated verification data based on the second data. verification data, and send a data write instruction for the updated verification data to the target disk; the data write instruction is used to instruct the target disk to write the updated verification data into the non-volatile memory of the target disk. After the target disk temporarily saves the first data in the cache unit, it waits for a set time. If within the set time, the target disk receives a data write instruction of the updated verification data sent by the disk controller; the data write instruction Instruct the disk to write the updated verification data into the target storage address, the target storage address is the same as the target storage address of the first data; according to the target storage address, write the updated verification data into the non-volatile memory of the disk , and delete the first data in the cache unit. If the target disk does not receive the data write instruction of the updated verification data within the set time, the target disk will write the first data into the non-volatile memory.
图5示出了另一种在写入数据的过程中磁盘控制器与磁盘之间的交互图。如图5所示,在写入数据的过程中,另一实施例提供的数据存取方法,可以包括如下步骤:FIG. 5 shows another interaction diagram between the disk controller and the disk during the process of writing data. As shown in Figure 5, in the process of writing data, the data access method provided by another embodiment may include the following steps:
S501,磁盘控制器确定第一数据对应的目标磁盘和数据类型。S501. The disk controller determines a target disk and a data type corresponding to the first data.
S502,若确定第一数据为延迟写入类型的数据,则磁盘控制器生成延迟操作指令。S502. If it is determined that the first data is data of a delayed write type, the disk controller generates a delayed operation instruction.
例如,假设第一数据是上述的校验结果P
0,校验结果P
0是RAID控制器接收到主机的写磁盘指令,根据写磁盘指令中携带的数据LBA0~127确定的。参见上文中步骤S401中的说明,校验结果P
0对应的目标磁盘为磁盘303,目标条带单元是条带1的条带单元13,并且RAID控制器可以确定校验结果P
0是延迟写入类型的数据,RAID控制器生成延迟操作指令,延迟操作指令指包含延迟写入指示的单独操作指令。
For example, assuming that the first data is the above-mentioned check result P 0 , the check result P 0 is determined according to the data LBA0-127 carried in the write disk command received by the RAID controller from the host. Referring to the description in step S401 above, the target disk corresponding to the verification result P 0 is disk 303, the target stripe unit is the stripe unit 13 of stripe 1, and the RAID controller can determine that the verification result P 0 is a delayed write For input type data, the RAID controller generates a delayed operation instruction, where the delayed operation instruction refers to an individual operation instruction including a delayed write instruction.
S503,磁盘控制器向目标磁盘发送延迟操作指令。S503, the disk controller sends a delayed operation instruction to the target disk.
在一种实施例中,磁盘控制器可以在向目标磁盘发送第一数据的数据写入指令之后,在向目标磁盘发送延迟操作指令。In an embodiment, the disk controller may send the delay operation instruction to the target disk after sending the data write instruction of the first data to the target disk.
延迟操作指令中仅包含延迟写入指示,不包含待写入数据和待写入数据的存储地址。示例性地,在延迟操作指令中,包括操作标识位和地址标识位。例如,在延迟操作指令中,操作标识位可以为“10”,表明该操作指令中携带的是延迟写入指示。如果操作指令中的操作标识位是“01”,则可以认为该操作指令为立即操作指令。The delay operation instruction only includes a delay write instruction, and does not include the data to be written and the storage address of the data to be written. Exemplarily, in the delayed operation instruction, an operation identification bit and an address identification bit are included. For example, in the delayed operation instruction, the operation identification bit may be "10", indicating that the operation instruction carries a delayed write instruction. If the operation identification bit in the operation instruction is "01", it can be considered that the operation instruction is an immediate operation instruction.
在一种实施例中,在延迟操作指令中,可以在预先设定N个数据位作为地址标识位,地址标识位中的信息用于指示延迟写入指示对应的目标存储地址,即用于保存第一数据的目标条带单元的地址信息。例如,在RAID控制器向磁盘303发送的延迟操作指令中,N个数据位携带的是条带单元13的地址信息,则该延迟操作指令指示磁盘303可以延迟写入条带单元13对应的第一数据,即上述的校验结果P
0。
In one embodiment, in the delayed operation instruction, N data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate the corresponding target storage address of the delayed write instruction, that is, for saving Address information of the target stripe unit of the first data. For example, in the delay operation instruction sent by the RAID controller to the disk 303, what N data bits carry is the address information of the stripe unit 13, then the delay operation instruction indicates that the disk 303 can delay writing to the corresponding first stripe unit 13. One data, that is, the verification result P 0 mentioned above.
在另一种实施例中,在延迟操作指令中,可以在预先设定M个数据位作为地址标识位,地址标识位中的信息用于指示延迟写入指示对应的目标磁盘的磁盘标识和目标条带单元的地址信息。例如,在RAID控制器向磁盘303发送的延迟操作指令中,M个数据位携带的是磁盘303的磁盘标识和条带单元13的地址信息,则该延迟操作指令指示磁盘303可以延迟写入条带单元13对应的第一数据。In another embodiment, in the delayed operation instruction, M data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the delayed writing indicates the disk identification and target of the corresponding target disk. Address information of the stripe unit. For example, in the delayed operation instruction sent by the RAID controller to the disk 303, what M data bits carry is the disk identification of the disk 303 and the address information of the stripe unit 13, then the delayed operation instruction indicates that the disk 303 can delay writing the stripe. Band unit 13 corresponds to the first data.
如果磁盘控制器向目标磁盘发送延迟操作指令,该延迟操作指令可以在向目标磁盘发送第一数据的数据写入指令之后发送。该延迟操作指令的发送时间与第一数据的数据写入 指令的发送时间之间的时间间隔小于设定时间阈值,以确保在目标磁盘将第一数据写入非易失性存储器之前可以接收到针对第一数据的延迟操作指令。If the disk controller sends the delayed operation instruction to the target disk, the delayed operation instruction may be sent after sending the data write instruction of the first data to the target disk. The time interval between the sending time of the delayed operation instruction and the sending time of the data write instruction of the first data is less than the set time threshold, so as to ensure that the first data can be received before the target disk writes the first data into the non-volatile memory. A delayed operation instruction for the first data.
S504,目标磁盘执行接收到的延迟操作指令。S504, the target disk executes the received delayed operation instruction.
延迟操作指令和立即操作指令均可以称为单独操作指令。Both the delayed operation instruction and the immediate operation instruction may be referred to as independent operation instructions.
以目标磁盘为磁盘303为例,在一种实施例中,磁盘303接收到RAID控制器发送的单独操作指令,读取到该单独操作指令中的操作标识位为“10”,表明该单独操作指令是延迟操作指令,并且,磁盘303从该单独操作指令中设定的N个数据位读取到条带单元13的地址信息,则磁盘303可以执行该延迟操作指令,延迟写入条带单元13对应的第一数据。Taking the target disk as the disk 303 as an example, in one embodiment, the disk 303 receives an individual operation instruction sent by the RAID controller, and reads that the operation identification bit in the individual operation instruction is "10", indicating that the individual operation The instruction is a delay operation instruction, and the disk 303 reads the address information of the stripe unit 13 from the N data bits set in the separate operation instruction, then the disk 303 can execute the delay operation instruction to delay writing to the stripe unit 13 corresponds to the first data.
在另一种实施例中,磁盘303接收到RAID控制器发送的单独操作指令,读取到该单独操作指令中的操作标识位为“10”,表明该单独操作指令是延迟操作指令,并且,磁盘303从该单独操作指令中设定的M个数据位读取到磁盘303的磁盘标识和条带单元13的地址信息,则磁盘303可以执行该延迟操作指令,延迟写入条带单元13对应的第一数据。In another embodiment, the disk 303 receives the individual operation instruction sent by the RAID controller, and the operation flag read in the individual operation instruction is "10", indicating that the individual operation instruction is a delayed operation instruction, and, The magnetic disk 303 reads the disk identification of the magnetic disk 303 and the address information of the stripe unit 13 from the M data bits set in the separate operation instruction, then the magnetic disk 303 can execute the delayed operation instruction, and the delayed write to the stripe unit 13 corresponds to the first data of .
在另一些实施例中,目标磁盘接收到RAID控制器发送的延迟操作指令,也可以根据自身状态确定是否执行该延迟操作指令。In some other embodiments, the target disk receives the delayed operation instruction sent by the RAID controller, and may also determine whether to execute the delayed operation instruction according to its own state.
目标磁盘在执行接收到的延迟操作指令之后,可以选择向RAID控制器返回指令执行结果,也可以不向RAID控制器返回指令执行结果。After executing the received delayed operation instruction, the target disk may choose to return the instruction execution result to the RAID controller, or may not return the instruction execution result to the RAID controller.
S505,磁盘控制器更新第一数据,并确定更新的第一数据的数据类型。S505. The disk controller updates the first data, and determines a data type of the updated first data.
可选地,RAID控制器再次接收到主机的写磁盘指令时,写磁盘指令中携带的数据是数据LBA128~255,参见上文中步骤S401中的说明,RAID控制器可以确定数据LBA128~255对应的目标条带也是条带1,与上述第一数据即校验结果P
0对应的目标条带相同,此时,RAID控制器可以根据数据LBA128~255对校验结果P
0进行更新。
Optionally, when the RAID controller receives the disk write instruction from the host again, the data carried in the disk write instruction is data LBA128-255. Referring to the description in step S401 above, the RAID controller can determine the data LBA128-255 corresponding to The target stripe is also stripe 1, which is the same as the target stripe corresponding to the first data, that is, the verification result P 0 . At this time, the RAID controller can update the verification result P 0 according to the data LBA128-255.
在一些实施例中,更新过程可以包括:RAID控制器可以从磁盘301中获取数据LBA0~127。在上述实施例中已经说明,磁盘301执行RAID控制器下发的延迟写入指示,将数据LBA0~127暂时保存在缓存单元中,接收到RAID控制器针对数据LBA0~127的读取指令,磁盘301可以直接从缓存单元中获取数据LBA0~127,并将数据LBA0~127传输给RAID控制器;而无需从非易失性存储器中读取数据,可以大幅度节省读取数据的时间,降低RAID控制器访问磁盘的时延。RAID控制器获取数据LBA0~127之后,根据数据LBA0~127和数据LBA128~255计算得到的校验结果P,将校验结果P作为更新的第一数据。In some embodiments, the update process may include: the RAID controller may acquire data LBA0-127 from the disk 301 . It has been explained in the above-mentioned embodiments that the disk 301 executes the delay write instruction issued by the RAID controller, temporarily stores the data LBA0-127 in the cache unit, and receives the read instruction of the RAID controller for the data LBA0-127, the disk 301 The 301 can directly obtain the data LBA0~127 from the cache unit, and transfer the data LBA0~127 to the RAID controller; without reading data from the non-volatile memory, it can greatly save the time for reading data and reduce the RAID level. Latency for the controller to access the disk. After the RAID controller acquires the data LBA0-127, the verification result P calculated according to the data LBA0-127 and the data LBA128-255 is used as the updated first data.
在另一些实施例中,更新过程可以包括:RAID控制器可以从磁盘303中获取校验结果P
0。由上述内容可知,磁盘303执行RAID控制器下发的延迟写入指示,将校验结果P
0暂时保存在缓存单元中,接收到RAID控制器针对校验结果P
0的读取指令,磁盘303可以直接从缓存单元中获取校验结果P
0,并将校验结果P
0传输给RAID控制器;而无需从非易失性存储器中读取数据,可以大幅度节省读取数据的时间,降低RAID控制器访问磁盘的时延。RAID控制器获取校验结果P
0之后,根据校验结果P
0和数据LBA128~255确定校验结果P;例如,RAID控制器可以根据校验结果P
0反向推算出数据LBA0~127,根据数据LBA0~127和数据LBA128~255计算得到的校验结果P,将校验结果P作为更新的第一数据。
In some other embodiments, the update process may include: the RAID controller may acquire the verification result P 0 from the disk 303 . It can be seen from the above that the disk 303 executes the delayed write instruction issued by the RAID controller, temporarily stores the verification result P 0 in the cache unit, and receives the read instruction of the RAID controller for the verification result P 0 , the disk 303 The verification result P 0 can be obtained directly from the cache unit, and the verification result P 0 can be transmitted to the RAID controller; without reading data from the non-volatile memory, it can greatly save the time for reading data and reduce the Latency for the RAID controller to access disks. After the RAID controller obtains the verification result P 0 , it determines the verification result P according to the verification result P 0 and data LBA128-255; for example, the RAID controller can reversely calculate the data LBA0-127 according to the verification result P The verification result P obtained by calculating the data LBA0-127 and the data LBA128-255 uses the verification result P as the updated first data.
确定更新的第一数据之后,由于目标条带即条带1的各个条带单元对应保存的数据均 已确定,RAID控制器可以确定校验结果P为非延迟写入类型的数据。After the updated first data is determined, the RAID controller can determine that the verification result P is data of the non-delayed write type, since the data corresponding to each stripe unit of the target stripe, that is, stripe 1, has been determined.
S506,磁盘控制器向目标磁盘发送包含更新的第一数据的数据写入指令。S506, the disk controller sends a data write instruction including the updated first data to the target disk.
例如,针对校验结果P,其对应的目标磁盘为磁盘303。RAID控制器向磁盘303发送数据写入指令,数据写入指令中包括校验结果P,以及用于保存校验结果P的目标条带单元的地址信息;其中,目标条带单元为条带单元13。For example, for the verification result P, the corresponding target disk is the disk 303 . The RAID controller sends a data write instruction to the disk 303, the data write instruction includes the verification result P, and the address information of the target stripe unit used to save the verification result P; wherein, the target stripe unit is a stripe unit 13.
S507,若确定更新的第一数据为非延迟写入类型的数据,则磁盘控制器生成立即操作指令。S507. If it is determined that the updated first data is non-delayed write data, the disk controller generates an immediate operation instruction.
S508,磁盘控制器向目标磁盘发送立即操作指令。S508, the disk controller sends an immediate operation instruction to the target disk.
由于校验结果P为非延迟写入类型的数据,因此RAID控制器向磁盘303发送立即操作指令。示例性地,在立即操作指令中,包括操作标识位和地址标识位。操作标识位可以为“01”,表明该操作指令中携带的是立即写入指示。Since the verification result P is non-delayed write data, the RAID controller sends an immediate operation command to the disk 303 . Exemplarily, the immediate operation instruction includes an operation identification bit and an address identification bit. The operation identification bit may be "01", indicating that the operation instruction carries an immediate write instruction.
在一种实施例中,在立即操作指令中,可以在预先设定N个数据位作为地址标识位,地址标识位中的信息用于指示立即写入指示对应的目标条带单元的地址信息或目标存储地址的地址信息。例如,在RAID控制器向磁盘303发送的立即操作指令中,N个数据位携带的是条带单元13的地址信息,则该立即操作指令指示磁盘303可以立即写入条带单元13对应的第一数据,即更新的第一数据:校验结果P。In one embodiment, in the immediate operation instruction, N data bits may be preset as address identification bits, and the information in the address identification bits is used to indicate that the address information indicating the corresponding target stripe unit is immediately written or The address information of the target storage address. For example, in the immediate operation instruction sent by the RAID controller to the disk 303, what N data bits carry is the address information of the stripe unit 13, and then the immediate operation instruction indicates that the disk 303 can immediately write into the corresponding first stripe unit 13. One data, that is, updated first data: verification result P.
在另一种实施例中,在立即操作指令中,可以在预先设定M个数据位作为地址标识位,地址标识位中的信息用于指示立即写入指示对应的目标磁盘的磁盘标识和目标条带单元的地址信息,或目标磁盘的磁盘标识和目标存储地址的地址信息。例如,在RAID控制器向磁盘303发送的立即操作指令中,M个数据位携带的是磁盘303的磁盘标识和条带单元13的地址信息,则该立即操作指令指示磁盘303可以立即写入条带单元13对应的待写入数据,即校验结果P。In another embodiment, in the immediate operation instruction, M data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the disk identification and target of the corresponding target disk are written immediately. The address information of the stripe unit, or the disk identification of the target disk and the address information of the target storage address. For example, in the immediate operation instruction sent by the RAID controller to the disk 303, what M data bits carry is the disk identification of the disk 303 and the address information of the stripe unit 13, and then the immediate operation instruction indicates that the disk 303 can write the stripe immediately. The data to be written corresponding to the tape unit 13, that is, the verification result P.
在另一些实施例中,磁盘控制器在确定更新的第一数据为非延迟写入类型的数据后,与可以不向目标磁盘发送立即操作指令,以节省信令开销。In some other embodiments, after the disk controller determines that the updated first data is non-delayed write data, it may not send an immediate operation instruction to the target disk, so as to save signaling overhead.
S509,目标磁盘执行接收到的立即操作指令。S509, the target disk executes the received immediate operation instruction.
以目标磁盘为磁盘303为例,在一种实施例中,磁盘303接收到RAID控制器发送的单独操作指令,读取到该单独操作指令中的操作标识位为“01”,表明该单独操作指令是立即操作指令,并且,磁盘303从该单独操作指令中设定的N个数据位读取到条带单元13的地址信息,则磁盘303可以执行该立即操作指令,将条带单元13对应的待写入数据,即校验结果P写入非易失性存储器的条带单元13中。Taking the target disk as the disk 303 as an example, in one embodiment, the disk 303 receives an individual operation instruction sent by the RAID controller, and reads that the operation identification bit in the individual operation instruction is "01", indicating that the individual operation The instruction is an immediate operation instruction, and the disk 303 reads the address information of the stripe unit 13 from the N data bits set in the separate operation instruction, then the disk 303 can execute the immediate operation instruction, and the stripe unit 13 corresponds to The data to be written, that is, the verification result P is written into the stripe unit 13 of the non-volatile memory.
在另一种实施例中,磁盘303接收到RAID控制器发送的单独操作指令,读取到该单独操作指令中的操作标识位为“01”,表明该单独操作指令是立即操作指令,并且,磁盘303从该单独操作指令中设定的M个数据位读取到磁盘303的磁盘标识和条带单元13的地址信息,则磁盘303可以执行该立即操作指令,将条带单元13对应的待写入数据,即校验结果P写入非易失性存储器的条带单元13中。In another embodiment, the disk 303 receives the individual operation instruction sent by the RAID controller, and the operation identification bit read in the individual operation instruction is "01", indicating that the individual operation instruction is an immediate operation instruction, and, The magnetic disk 303 reads the disk identification of the magnetic disk 303 and the address information of the stripe unit 13 from the M data bits set in the separate operation instruction, and then the magnetic disk 303 can execute the immediate operation instruction, and the corresponding standby of the stripe unit 13 Writing data, that is, the verification result P is written into the stripe unit 13 of the non-volatile memory.
在另一些实施例中,磁盘接收到RAID控制器发送的立即操作指令,也可以根据自身状态确定是否执行该立即操作指令。In some other embodiments, the disk receives the immediate operation instruction sent by the RAID controller, and may also determine whether to execute the immediate operation instruction according to its own state.
S510,目标磁盘向磁盘控制器发送指令执行结果。S510, the target disk sends an instruction execution result to the disk controller.
RAID控制器在向目标磁盘发送立即操作指令之后,等待目标磁盘反馈指令执行结果。目标磁盘确定接收到的立即操作指令为单独操作指令,在执行RAID控制器发送的立即操 作指令后,向RAID控制器发送指令执行结果,指令执行结果中可以包含指令已执行或指令执行成功的信息。RAID控制器接收到目标磁盘反馈的指令执行结果后,可以结束本次数据写入过程。After the RAID controller sends an immediate operation command to the target disk, it waits for the target disk to feed back an execution result of the command. The target disk determines that the received immediate operation command is an individual operation command, and after executing the immediate operation command sent by the RAID controller, sends the command execution result to the RAID controller, and the command execution result can include information that the command has been executed or the command has been successfully executed . After the RAID controller receives the command execution result fed back by the target disk, it can end the data writing process.
在另一些实施例中,目标磁盘也可以不向磁盘控制器发送指令执行结果。In some other embodiments, the target disk may not send the command execution result to the disk controller.
上述对图5所示的数据存取方法的描述,重点说明与图4所示的数据存取方法的不同之处,与图4所示的数据存取方法相同的地方,可以参照图4所示的数据存取方法执行,未再进行赘述。The above description of the data access method shown in Figure 5 focuses on the differences from the data access method shown in Figure 4, and the same place as the data access method shown in Figure 4 can be referred to in Figure 4 Execution of the data access method shown, no more details.
本申请实施例中,由对磁盘进行管理的磁盘控制器确定待写入数据的数据类型,若磁盘控制器确定待写入数据为后续需要使用的数据或立即更新的数据,可以向磁盘发送延迟写入指示,指示磁盘可以延迟将数据写入非易失性存储器中,从而可以避免频繁地写磁盘操作,有助于减少对存储器带宽资源的占用,还可以降低功耗。如果待写入数据是后续立即更新的数据,通过延迟写入数据,可以减少针对同一存储地址重复写入数据的操作,提高磁盘的使用寿命。与由磁盘确定是否延迟数据写入非易失性存储器相比,由于磁盘控制器对上层业务具有更好的感知能力,因此,由磁盘控制器执行该步骤,可以更准确。In the embodiment of the present application, the disk controller that manages the disk determines the data type of the data to be written. If the disk controller determines that the data to be written is data that needs to be used later or data that is updated immediately, it can send a delay to the disk. The write instruction indicates that the disk can delay writing data into the non-volatile memory, thereby avoiding frequent disk write operations, helping to reduce the occupation of memory bandwidth resources, and can also reduce power consumption. If the data to be written is data that will be updated immediately, by delaying the writing of data, the operation of repeatedly writing data to the same storage address can be reduced, and the service life of the disk can be improved. Compared with determining whether to delay data writing to the non-volatile memory by the disk, since the disk controller has a better perception capability for upper-layer services, it may be more accurate to perform this step by the disk controller.
例如,假设磁盘每接收到64KB的待写入数据执行一次写磁盘操作,如果主机需要将1TB数据按照顺序写的方式写入RAID系统的3个磁盘中,使用本申请实施例提供的方法,最多可以减少0.5TB数据的重复写入。可见,通过本申请实施例提供的方法,可以大幅度减少磁盘的写数据操作,在提高性能的同时降低功耗,提升磁盘的使用寿命。For example, assuming that the disk receives 64KB of data to be written and executes a disk write operation once, if the host needs to write 1TB of data into the three disks of the RAID system in a sequential manner, using the method provided in the embodiment of this application, at most It can reduce the repeated writing of 0.5TB data. It can be seen that through the method provided by the embodiment of the present application, the data writing operation of the disk can be greatly reduced, the power consumption can be reduced while the performance is improved, and the service life of the disk can be improved.
图6示出了一种在预取数据的过程中磁盘控制器与磁盘之间的交互图。如图6所示,在预取数据的过程中,一种实施例提供的数据存取方法,可以包括如下步骤:Fig. 6 shows an interaction diagram between the disk controller and the disk during the process of prefetching data. As shown in FIG. 6, in the process of prefetching data, a data access method provided by an embodiment may include the following steps:
S601,磁盘控制器确定预取数据的目标存储地址和目标磁盘。S601. The disk controller determines a target storage address and a target disk of prefetched data.
在一些实施例中,RAID控制器可以根据连续接收到的多个读磁盘指令中的逻辑地址,确定当前的数据读取模式是否为顺序读,其中,顺序读指连续接收到的多个读磁盘指令中的逻辑地址是连续的,也就是说,多个读磁盘指令指示顺序从一个虚拟磁盘中的各个条带单元读出数据。例如,在用户打开某个文档时,主机向RAID控制器连续发送多个读磁盘指令,且多个读磁盘指令中的逻辑地址是连续的,此时,可以认为当前的数据读取模式为顺序读,即可以将该文档的数据顺次从各个读磁盘指令中的逻辑地址指示的各个条带单元中读出,并发送到主机进行显示。如果多个读磁盘指令中的逻辑地址是不连续的,可以确定当前的数据读取模式不是顺序读;例如,在用户同时操作多个不同的功能时,主机需要读取每个功能的参数,每个功能的参数可能保存在不同的虚拟磁盘中,因此需要从不同的虚拟磁盘或同一虚拟磁盘内不相邻的条带单元读取数据,此时,主机向RAID控制器发送多个读磁盘指令,且多个读磁盘指令中的逻辑地址是不连续的,此时,可以认为当前的数据读取模式不是顺序读。In some embodiments, the RAID controller can determine whether the current data reading mode is a sequential read according to the logical addresses in the multiple read disk instructions received continuously, wherein the sequential read refers to multiple read disks received continuously The logical addresses in the instructions are continuous, that is to say, multiple disk read instructions indicate to read data from each stripe unit in a virtual disk sequentially. For example, when a user opens a file, the host sends multiple read disk commands to the RAID controller continuously, and the logical addresses in the multiple read disk commands are continuous. At this time, the current data read mode can be considered as sequential Read means that the data of the document can be sequentially read from each strip unit indicated by the logical address in each disk read command, and sent to the host for display. If the logical addresses in multiple read disk commands are discontinuous, it can be determined that the current data read mode is not sequential read; for example, when the user operates multiple different functions at the same time, the host needs to read the parameters of each function, The parameters of each function may be stored in different virtual disks, so it is necessary to read data from different virtual disks or non-adjacent stripe units in the same virtual disk. At this time, the host sends multiple read disks to the RAID controller command, and the logical addresses in multiple disk read commands are discontinuous, at this time, it can be considered that the current data reading mode is not sequential reading.
在一种可选的实施例中,如果RAID控制器确定当前的数据读取模式为顺序读,则根据当前接收到的读磁盘指令中的逻辑地址,确定后续需要读取的数据对应的目标存储地址和目标磁盘,即预取数据的目标存储地址和目标磁盘,目标存储地址也可以理解为目标条带单元的地址。在另一种可选的实施例中,如果RAID控制器确定当前的数据读取模式为顺序读,则根据当前接收到的读磁盘指令中的逻辑地址,确定当前读取的数据对应的磁盘;将当前读取的数据对应的磁盘作为目标磁盘,确定针对该目标磁盘后续仍需要读取的数据的目标存储地址,即预取数据的目标存储地址。例如,假设当前读取的数据是数据 LBA0~127,数据LBA0~127保存在磁盘301的条带单元11中。磁盘301为目标磁盘,由于当前为顺序读,RAID控制器可以确定后续需要读取的数据是条带单元21中保存的数据,可以确定条带单元21为目标条带单元。In an optional embodiment, if the RAID controller determines that the current data reading mode is sequential reading, then according to the logical address in the currently received disk read command, determine the target storage corresponding to the subsequent data that needs to be read. The address and the target disk are the target storage address and the target disk of the prefetched data, and the target storage address can also be understood as the address of the target stripe unit. In another optional embodiment, if the RAID controller determines that the current data reading mode is sequential reading, then determine the disk corresponding to the currently read data according to the logical address in the currently received disk read instruction; The disk corresponding to the currently read data is used as the target disk, and the target storage address of the data that still needs to be read in the future is determined for the target disk, that is, the target storage address of the prefetched data. For example, assume that the currently read data is data LBA0-127, and the data LBA0-127 are stored in the stripe unit 11 of the magnetic disk 301. The disk 301 is the target disk. Since the current read is sequential, the RAID controller can determine that the data to be read later is the data stored in the stripe unit 21, and can determine that the stripe unit 21 is the target stripe unit.
在另一些实施例中,RAID控制器启动后台业务,根据当前执行的业务确定需要预取的数据的目标存储地址和目标磁盘。RAID控制器可以根据用户的修复磁盘操作启动对磁盘进行修复的业务,也可以在监测到某个磁盘发生故障时,自动启动对磁盘进行修复的业务。示例性地,假设RAID控制器监测到磁盘302发生故障,启动对磁盘302进行修复的业务,也就是根据磁盘301和磁盘303的各个条带单元中存储的数据,确定磁盘302的各个条带单元中存储的正确数据,并将正确数据写入磁盘302的各个条带单元中。比如,对于条带1,RAID控制器可以根据磁盘301的条带单元11中存储的数据LBA0~127和磁盘303的条带单元13中存储的校验结果P,确定磁盘302的条带单元12中存储的正确数据。此时,待修复磁盘是磁盘302,待修复的条带单元是条带单元12,条带单元12所属的目标条带是条带1,条带1包括条带单元11和条带单元13,可以将磁盘301作为目标磁盘,条带单元11的地址作为目标存储地址,还可以将磁盘303作为目标磁盘,条带单元13作为的地址作为目标存储地址。磁盘303作为目标磁盘时执行预取数据指示的过程,与磁盘301作为目标磁盘时执行预取数据指示的过程相同,下文以磁盘301作为目标磁盘为例,进行说明。In some other embodiments, the RAID controller starts the background service, and determines the target storage address and the target disk of the data to be prefetched according to the currently executed service. The RAID controller can start the service of repairing the disk according to the operation of repairing the disk by the user, and can also automatically start the service of repairing the disk when it detects that a certain disk fails. Exemplarily, it is assumed that the RAID controller detects that the disk 302 fails, and starts the business of repairing the disk 302, that is, according to the data stored in each stripe unit of the disk 301 and the disk 303, determine each stripe unit of the disk 302 correct data stored in the disk 302, and write the correct data into each stripe unit of the disk 302. For example, for stripe 1, the RAID controller can determine the stripe unit 12 of the disk 302 according to the data LBA0-127 stored in the stripe unit 11 of the disk 301 and the verification result P stored in the stripe unit 13 of the disk 303. correct data stored in . At this time, the disk to be repaired is disk 302, the stripe unit to be repaired is stripe unit 12, the target stripe to which stripe unit 12 belongs is stripe 1, and stripe 1 includes stripe unit 11 and stripe unit 13, The disk 301 may be used as the target disk, the address of the stripe unit 11 may be used as the target storage address, and the disk 303 may be used as the target disk, and the address of the stripe unit 13 may be used as the target storage address. The process of executing the data prefetch instruction when the disk 303 is used as the target disk is the same as the process of executing the data prefetch instruction when the disk 301 is used as the target disk.
S602,磁盘控制器根据目标存储地址的地址信息,生成包含预取数据指示的数据存取指令。S602. The disk controller generates a data access instruction including a prefetch data instruction according to the address information of the target storage address.
S603,磁盘控制器向目标磁盘发送数据存取指令。S603, the disk controller sends a data access instruction to the target disk.
该数据存取指令可以是数据读取指令,也可以是数据写入指令。The data access command may be a data read command or a data write command.
在一些实施例中,RAID控制器接收到主机的读磁盘指令,向目标磁盘发送数据存取指令,或者,RAID控制器可以根据当前执行的业务主动向目标磁盘发送数据读取指令。数据读取指令中可以包含当前读取的数据的地址信息,还可以包含预取数据指示。示例性地,在数据读取指令的数据结构中,可以预先设定某些固定位置的数据位为操作标识位,操作标识位可以占用1个数据位,也可以占用多个数据位。下文以操作标识位占用2个数据位为例进行说明,如果该操作标识位为“00”,表明该数据读取指令携带的是预取数据指示。In some embodiments, the RAID controller receives a disk read command from the host, and sends a data access command to the target disk, or, the RAID controller can actively send a data read command to the target disk according to a currently executed service. The data read instruction may include address information of the currently read data, and may also include a prefetch data instruction. Exemplarily, in the data structure of the data read instruction, data bits at certain fixed positions may be preset as operation identification bits, and the operation identification bits may occupy one data bit or multiple data bits. In the following, the operation identification bit occupies 2 data bits as an example for illustration. If the operation identification bit is "00", it indicates that the data read instruction carries a prefetch data instruction.
在一种实施例中,在数据读取指令的数据结构中,还可以在预先设定的N个数据位中,携带预取数据指示对应的目标存储地址的地址信息。例如,假设目标磁盘为磁盘301,在RAID控制器向磁盘301发送的数据读取指令中,设定的N个数据位携带的是条带单元11的地址,且数据读取指令中的操作标识位为“00”,则该数据读取指令指示磁盘301对条带单元11中保存的数据进行预取。In an embodiment, in the data structure of the data read instruction, pre-set N data bits may also carry address information indicating a corresponding target storage address of the prefetched data. For example, assuming that the target disk is disk 301, in the data read instruction sent by the RAID controller to disk 301, the set N data bits carry the address of the stripe unit 11, and the operation identifier in the data read instruction If the bit is “00”, the data read instruction instructs the disk 301 to prefetch the data stored in the stripe unit 11 .
在另一种实施例中,在数据读取指令的数据结构中,可以在预先设定的M个数据位中,携带预取数据指示对应的目标磁盘的磁盘标识和目标存储地址的地址信息。例如,在RAID控制器向磁盘301发送的数据读取指令中,设定的M个数据位携带的是磁盘301的磁盘标识和条带单元11的地址,且数据读取指令中的操作标识位为“00”,则该数据读取指令指示磁盘301对条带单元11中保存的数据进行预取。In another embodiment, in the data structure of the data read instruction, pre-set M data bits may carry address information indicating the disk ID of the corresponding target disk and the target storage address of the prefetched data. For example, in the data read instruction sent by the RAID controller to the disk 301, the set M data bits carry the disk identification of the disk 301 and the address of the stripe unit 11, and the operation identification bit in the data read instruction is “00”, the data read instruction instructs the disk 301 to prefetch the data stored in the stripe unit 11 .
在另一些实施例中,RAID控制器接收到主机的写磁盘指令,向目标磁盘发送数据写入指令,或者,RAID控制器可以根据当前执行的业务主动向目标磁盘发送数据写入指令。 数据写入指令中包含待写入数据,以及用于保存待写入数据的待写入条带单元的地址信息。数据写入指令中还可以包含预取数据指示。示例性地,在数据写入指令的数据结构中,可以预先设定某些固定位置的数据位为操作标识位,操作标识位可以占用1个数据位,也可以占用多个数据位。例如,操作标识位占用2个数据位,如果该操作标识位为“00”,表明该数据写入指令携带的是预取数据指示。In some other embodiments, the RAID controller receives a disk write command from the host and sends the data write command to the target disk, or the RAID controller can actively send the data write command to the target disk according to the currently executed service. The data writing instruction includes the data to be written and the address information of the stripe unit to be written for saving the data to be written. The data write instruction may also include a prefetch data instruction. Exemplarily, in the data structure of the data write instruction, data bits at certain fixed positions may be preset as operation identification bits, and the operation identification bits may occupy one data bit or multiple data bits. For example, the operation identification bit occupies 2 data bits, and if the operation identification bit is "00", it indicates that the data write instruction carries a prefetch data instruction.
与数据读取指令相同,一种实施例中,在数据写入指令的数据结构中,还可以在预先设定的N个数据位中,携带预取数据指示对应的目标存储地址的地址信息。在另一种实施例中,在数据写入指令的数据结构中,可以在预先设定的M个数据位中,携带预取数据指示对应的目标磁盘的磁盘标识和目标存储地址的地址信息。Same as the data read instruction, in an embodiment, in the data structure of the data write instruction, pre-set N data bits may also carry address information indicating the corresponding target storage address of the prefetched data. In another embodiment, in the data structure of the data write instruction, pre-set M data bits may carry address information indicating the disk ID of the corresponding target disk and the target storage address of the prefetched data.
S604,目标磁盘执行数据存取指令中携带的预取数据指示。S604, the target disk executes the prefetch data instruction carried in the data access instruction.
以目标磁盘为磁盘301为例,在一种实施例中,磁盘301接收到RAID控制器发送的数据存取指令,从该数据存取指令中设定的N个数据位读取到条带单元11的地址信息,并读取到数据存取指令中的操作标识位为“00”,则磁盘301可以确定该数据存取指令中携带的是预取数据指示,指示对条带单元11保存的数据进行预取。Taking the target disk as the disk 301 as an example, in one embodiment, the disk 301 receives the data access instruction sent by the RAID controller, and reads the N data bits set in the data access instruction to the stripe unit 11 address information, and read that the operation identification bit in the data access instruction is "00", then the disk 301 can determine that the data access instruction carries a prefetch data indication, indicating that the data stored in the stripe unit 11 Data is prefetched.
在另一种实施例中,磁盘301接收到RAID控制器发送的数据存取指令,从该数据存取指令中设定的M个数据位读取到磁盘301的磁盘标识和条带单元11的地址信息,并读取到数据存取指令中的操作标识位为“00”,则磁盘301可以确定该数据存取指令中携带的是预取数据指示,指示对条带单元11保存的数据进行预取。In another embodiment, the disk 301 receives the data access instruction sent by the RAID controller, and reads the disk identifier of the disk 301 and the stripe unit 11 from the M data bits set in the data access instruction. address information, and read the operation flag in the data access instruction as "00", then the disk 301 can determine that the data access instruction carries a prefetch data instruction, indicating that the data stored in the stripe unit 11 is to be prefetched. Prefetching.
在执行预取数据指示时,磁盘301可以先判断条带单元11保存的数据是否保存在缓存单元中,如果已保存在缓存单元中,则可以结束此次操作;如果未保存在缓存单元中,则从非易失性存储器中读取条带单元11保存的数据,保存在缓存单元中。在后续磁盘控制器读取该数据时,磁盘301可以直接从缓存单元获取该数据,而无需再从非易失性存储器中读取数据,因此可以降低磁盘的读时延,快速将数据返回给磁盘控制器。例如,假设磁盘从非易失性存储器读取数据,返回给磁盘控制器,每次需要的时间为60us;磁盘从缓存单元读取数据,返回给磁盘控制器,每次需要的时间为10us,则每次读取数据,可以减少50us的读时延。When executing the prefetch data instruction, the disk 301 can first judge whether the data stored in the stripe unit 11 is stored in the cache unit, and if it has been stored in the cache unit, the operation can be ended; if not stored in the cache unit, The data stored in the stripe unit 11 is then read from the non-volatile memory and stored in the cache unit. When the subsequent disk controller reads the data, the disk 301 can directly obtain the data from the cache unit without reading the data from the non-volatile memory, so the read delay of the disk can be reduced and the data can be quickly returned to the disk controller. For example, assuming that the disk reads data from the non-volatile memory and returns it to the disk controller, it takes 60us each time; the disk reads data from the cache unit and returns it to the disk controller, and it takes 10us each time. Then every time data is read, the read delay of 50us can be reduced.
图7示出了另一种在预取数据的过程中磁盘控制器与磁盘之间的交互图。如图7所示,在预取数据的过程中,另一种实施例提供的数据存取方法,可以包括如下步骤:FIG. 7 shows another interaction diagram between the disk controller and the disk in the process of prefetching data. As shown in FIG. 7, in the process of prefetching data, another embodiment provides a data access method that may include the following steps:
S701,磁盘控制器确定需要预取的数据的目标存储地址和目标磁盘。S701. The disk controller determines a target storage address and a target disk of data to be prefetched.
S702,磁盘控制器根据目标存储地址的地址信息,生成预取数据指令。S702. The disk controller generates a prefetch data instruction according to the address information of the target storage address.
S703,磁盘控制器向目标磁盘发送预取数据指令。S703, the disk controller sends a data prefetch instruction to the target disk.
预取数据指令中仅包含预取数据指示。示例性地,在预取数据指令中,包括操作标识位和地址标识位。例如,在预取数据指令中,操作标识位可以为“00”,表明该操作指令中携带的是预取数据指示。Only the prefetch data indication is included in the prefetch data instruction. Exemplarily, in the data prefetching instruction, an operation identification bit and an address identification bit are included. For example, in the prefetch data instruction, the operation identification bit may be "00", indicating that the operation instruction carries a prefetch data instruction.
在一种实施例中,在预取数据指令中,可以在预先设定N个数据位作为地址标识位,地址标识位中的信息用于指示预取数据指示对应的目标条带单元的地址信息。预取数据指令属于单独操作指令中的一种。例如,在RAID控制器向磁盘301发送的单独操作指令中,N个数据位携带的是条带单元11的地址信息,且该单独操作指令中的操作标识位为“00”,则该单独操作指令为预取数据指令,用于指示磁盘301对条带单元11中保存的数据进行预取。In one embodiment, in the prefetch data instruction, N data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the prefetch data indicates the address information of the corresponding target stripe unit . The prefetch data instruction is one of the independent operation instructions. For example, in the individual operation instruction sent by the RAID controller to the disk 301, the N data bits carry the address information of the stripe unit 11, and the operation identification bit in the individual operation instruction is "00", then the individual operation The command is a data prefetch command, which is used to instruct the disk 301 to prefetch the data stored in the stripe unit 11 .
在另一种实施例中,在预取数据指令中,可以在预先设定M个数据位作为地址标识位,地址标识位中的信息用于指示预取数据指示对应的目标磁盘的磁盘标识和目标条带单元的地址信息。例如,在RAID控制器向磁盘301发送的单独操作指令中,M个数据位携带的是磁盘301的磁盘标识和条带单元11的地址信息,且该单独操作指令中的操作标识位为“00”,则该单独操作指令为预取数据指令,用于指示磁盘301对条带单元11中保存的数据进行预取。In another embodiment, in the prefetch data instruction, M data bits can be preset as address identification bits, and the information in the address identification bits is used to indicate that the prefetch data indicates the disk identification and the corresponding target disk. Address information of the target stripe unit. For example, in the individual operation instruction sent by the RAID controller to the disk 301, the M data bits carry the disk identification of the disk 301 and the address information of the stripe unit 11, and the operation identification bit in the individual operation instruction is "00 ”, then the single operation command is a data prefetch command, which is used to instruct the disk 301 to prefetch the data stored in the stripe unit 11 .
S704,目标磁盘执行接收到的预取数据指令。S704, the target disk executes the received prefetch data instruction.
以目标磁盘为磁盘301为例,在一种实施例中,磁盘301接收到RAID控制器发送的单独操作指令,读取到该单独操作指令中的操作标识位为“00”,表明该单独操作指令是预取数据指令,并且,磁盘301从该单独操作指令中设定的N个数据位读取到条带单元11的地址信息,则磁盘301可以执行该预取数据指令,对条带单元11中保存的数据进行预取。Taking the target disk as the disk 301 as an example, in one embodiment, the disk 301 receives an individual operation instruction sent by the RAID controller, and reads that the operation identification bit in the individual operation instruction is "00", indicating that the individual operation The instruction is a prefetch data instruction, and the magnetic disk 301 reads the address information of the stripe unit 11 from the N data bits set in the separate operation instruction, then the magnetic disk 301 can execute the prefetch data instruction, and the stripe unit The data saved in 11 is prefetched.
在另一种实施例中,磁盘301接收到RAID控制器发送的单独操作指令,读取到该单独操作指令中的操作标识位为“00”,表明该单独操作指令是预取数据指令,并且,磁盘301从该单独操作指令中设定的M个数据位读取到磁盘301的磁盘标识和条带单元11的地址信息,则磁盘301可以执行该预取数据指令,对条带单元11中保存的数据进行预取。In another embodiment, the disk 301 receives an individual operation instruction sent by the RAID controller, and the operation identification bit read in the individual operation instruction is "00", indicating that the individual operation instruction is a data prefetch instruction, and , the magnetic disk 301 reads the disk identification of the magnetic disk 301 and the address information of the stripe unit 11 from the M data bits set in the separate operation instruction, and then the magnetic disk 301 can execute the prefetch data instruction, and the data in the stripe unit 11 Saved data is prefetched.
S705,目标磁盘向磁盘控制器发送指令执行结果。S705, the target disk sends an instruction execution result to the disk controller.
RAID控制器在向目标磁盘发送预取数据指令之后,等待目标磁盘反馈指令执行结果。目标磁盘确定接收到的预取数据指令为单独操作指令,在执行RAID控制器发送的预取数据指令后,向RAID控制器发送指令执行结果,指令执行结果中可以包含指令已执行或指令执行成功的信息。RAID控制器接收到目标磁盘反馈的指令执行结果后,可以结束本次预取数据过程。After the RAID controller sends the data prefetch command to the target disk, it waits for the target disk to feed back an execution result of the command. The target disk determines that the received prefetch data command is an independent operation command. After executing the prefetch data command sent by the RAID controller, it sends the command execution result to the RAID controller. The command execution result can include that the command has been executed or the command has been successfully executed. Information. After the RAID controller receives the instruction execution result fed back by the target disk, it can end the process of prefetching data.
在另一些实施例中,目标磁盘也可以不向磁盘控制器发送指令执行结果。In some other embodiments, the target disk may not send the command execution result to the disk controller.
上述对图7所示的数据存取方法的描述,重点说明与图6所示的数据存取方法的不同之处,与图6所示的数据存取方法相同的地方,可以参照图6所示的数据存取方法执行,未再进行赘述。The above description of the data access method shown in Figure 7 focuses on the differences from the data access method shown in Figure 6, and the same place as the data access method shown in Figure 6 can be referred to in Figure 6 Execution of the data access method shown, no more details.
本申请实施例中,由对磁盘进行管理的磁盘控制器确定需要预取的数据,向磁盘发送预取数据指示,指示磁盘将需要预取的数据读取至缓存单元中,以降低读取数据时磁盘的读时延,提高系统性能。与由磁盘确定需要预取的数据相比,由于磁盘控制器对上层业务具有更好的感知能力,因此,由磁盘控制器确定需要预取的数据,可以更准确,减少因预取误判导致额外的数据搬移所产生的功耗,因而可以降低系统功耗。In the embodiment of the present application, the disk controller that manages the disk determines the data that needs to be prefetched, sends a prefetch data indication to the disk, and instructs the disk to read the data that needs to be prefetched into the cache unit, so as to reduce the number of read data. The read latency of the disk can be shortened to improve system performance. Compared with the data that needs to be prefetched determined by the disk, because the disk controller has a better perception of the upper-layer business, the data that needs to be prefetched by the disk controller can be determined more accurately and reduce the misjudgment caused by prefetch. Power consumption generated by additional data movement, thus reducing system power consumption.
例如,假设磁盘从非易失性存储器读取64KB数据的需要的时间为60us,如果需要将1TB容量的RAID系统由6个磁盘(条带单元大小为64KB)扩展至7个磁盘,以每1280KB的读操作减少60us为例,则完成1TB扩盘可节约时间约50s。可见,通过本申请实施例提供的方法,在磁盘扩展业务场景中,可以有效节约时间。For example, suppose it takes 60us for the disk to read 64KB of data from the non-volatile memory. If the 1TB capacity RAID system needs to be expanded from 6 disks (stripe unit size is 64KB) to 7 disks, each 1280KB For example, if the read operation is reduced by 60us, the time to complete 1TB disk expansion can be saved by about 50s. It can be seen that the method provided by the embodiment of the present application can effectively save time in the disk expansion business scenario.
本申请实施例提供的数据存取方法,不仅可以应用于RAID控制器,其他可以识别后续需要使用的数据的节点均可以使用该方法,包括但不限于主机、智能网卡、计算机等。The data access method provided in the embodiment of the present application can not only be applied to RAID controllers, but also can be used by other nodes that can identify data that needs to be used later, including but not limited to hosts, smart network cards, computers, etc.
在本申请实施例中,写入数据的过程中,磁盘控制器执行的方法可以参照图8所示,包括如下步骤:In the embodiment of the present application, during the process of writing data, the method performed by the disk controller can refer to the method shown in Figure 8, including the following steps:
S801,获取待写入目标磁盘的第一数据。S801. Acquire first data to be written into a target disk.
S802,在确定第一数据满足设定条件的情况下,向目标磁盘发送第一数据和第一数据 的延迟写入指示。S802. When it is determined that the first data satisfies the set condition, send the first data and a delayed writing indication of the first data to the target disk.
其中,延迟写入指示用于指示目标磁盘将第一数据暂存在目标磁盘的缓存单元中。第一数据满足如下设定条件:第一数据为待写入目标磁盘的第一条带单元的数据,在第一数据之后的待写入数据中包括待写入第二条带单元的第二数据;第二条带单元与第一条带单元属于同一目标条带,第二条带单元与第一条带单元属于不同磁盘。Wherein, the delayed writing indication is used to instruct the target disk to temporarily store the first data in the cache unit of the target disk. The first data meets the following setting conditions: the first data is the data to be written to the first stripe unit of the target disk, and the data to be written after the first data includes the second stripe unit to be written to the second stripe unit. Data; the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks.
在确定第一数据满足上述设定条件的情况下,磁盘控制器向目标磁盘发送第一数据的延迟写入指示。In a case where it is determined that the first data satisfies the above-mentioned setting condition, the disk controller sends an indication of delayed writing of the first data to the target disk.
在一种可选的实施例中,设定条件包括第一数据为待读回数据;通过如下方式,确定所述第一数据是否满足设定条件:若第一数据为待写入目标磁盘的第一条带单元的数据,且预测到在第一数据之后的待写入数据中包括待写入第二条带单元的第二数据,则确定第一数据为待读回数据;第二条带单元与第一条带单元属于同一目标条带,第二条带单元与第一条带单元属于不同磁盘;或者,设定条件包括第一数据为待更新数据;通过如下方式,确定第一数据是否满足设定条件:若第一数据为待写入目标磁盘的第三条带单元的校验数据,且预测到在第一数据之后的待写入数据中包括待写入第二条带单元的第二数据,则确定第一数据为待更新数据;第二条带单元与第三条带单元属于同一目标条带,第二条带单元与第三条带单元属于不同磁盘。In an optional embodiment, the setting condition includes that the first data is data to be read back; whether the first data satisfies the setting condition is determined by the following method: if the first data is the data to be written into the target disk The data of the first stripe unit, and it is predicted that the data to be written after the first data includes the second data to be written into the second stripe unit, then determine that the first data is the data to be read back; the second The strip unit and the first strip unit belong to the same target strip, and the second strip unit and the first strip unit belong to different disks; or, the setting conditions include that the first data is data to be updated; the first Whether the data meets the set condition: if the first data is the verification data of the third stripe unit to be written to the target disk, and it is predicted that the data to be written after the first data includes the second stripe to be written If the second data of the unit is the second data, it is determined that the first data is the data to be updated; the second stripe unit and the third stripe unit belong to the same target stripe, and the second stripe unit and the third stripe unit belong to different disks.
在一种可选的实施例中,第一数据可以是为接收到的写磁盘指令中携带的数据。磁盘控制器可以根据连续接收到的多个写磁盘指令中的逻辑地址,确定数据写入模式是否为顺序写,如果数据写入模式为顺序写,且目标条带中包括除目标条带单元之外的空闲条带单元,则确定待写入数据中包括待写入目标条带的第二数据。In an optional embodiment, the first data may be the data carried in the received write disk instruction. The disk controller can determine whether the data write mode is sequential write according to the logical addresses in multiple write disk commands received continuously. If the data write mode is sequential write, and the target stripe includes If there is no free stripe unit outside, it is determined that the data to be written includes the second data to be written into the target stripe.
在一些实施例中,磁盘控制器获取待写入目标磁盘的第一数据之后,向目标磁盘发送包含第一数据的数据写入指令,磁盘控制器可以将延迟写入指示携带在该数据写入指令中,发送至目标磁盘。在另一些实施例中,磁盘控制器可以向目标磁盘发送包含延迟写入指示的第一操作指令,第一操作指令可以是第一数据的数据写入指令之外的任意指令。延迟写入指示中包括延迟写入标识和第一数据的目标存储地址。如果磁盘控制器将延迟写入指示携带在第一数据的数据写入指令之外的指令中,发送至目标磁盘,该包含延迟写入指示的指令可以在向目标磁盘发送第一数据的数据写入指令之后发送,其发送时间与第一数据的数据写入指令的发送时间之间的时间间隔小于设定时间阈值,以确保在目标磁盘将第一数据写入非易失性存储器之前,可以接收到针对第一数据的延迟写入指示。In some embodiments, after the disk controller obtains the first data to be written to the target disk, it sends a data write command containing the first data to the target disk, and the disk controller may carry the delayed write instruction in the data write command. command, sent to the target disk. In some other embodiments, the disk controller may send a first operation instruction including a delayed write instruction to the target disk, and the first operation instruction may be any instruction other than the data write instruction of the first data. The delayed writing indication includes a delayed writing identifier and a target storage address of the first data. If the disk controller sends the delayed write instruction to the target disk in an instruction other than the data write instruction of the first data, the instruction containing the delayed write instruction can be sent to the target disk in the data write instruction of the first data. After sending the command, the time interval between the sending time and the sending time of the data write command of the first data is less than the set time threshold, so as to ensure that before the target disk writes the first data into the non-volatile memory, the A delayed write indication for first data is received.
在一些实施例中,如果第一数据为校验数据,在向目标磁盘发送第一数据的延迟写入指示之后,如果磁盘控制器获取到第二数据,则基于第二数据确定更新后的校验数据,即更新数据,向目标磁盘发送针对更新数据的数据写入指令;更新数据的数据写入指令用于指示目标磁盘将更新数据写入目标磁盘的非易失性存储器中。In some embodiments, if the first data is verification data, after sending the delayed writing instruction of the first data to the target disk, if the disk controller obtains the second data, then determine the updated verification data based on the second data. The test data, that is, the update data, sends a data write instruction for the update data to the target disk; the data write instruction for update data is used to instruct the target disk to write the update data into the non-volatile memory of the target disk.
在本申请实施例中,写入数据的过程中,磁盘执行的方法可以参照图9所示,包括如下步骤:In the embodiment of the present application, during the process of writing data, the method performed by the disk can refer to the method shown in Figure 9, including the following steps:
S901,接收磁盘控制器发送的第一数据,并接收磁盘控制器发送的第一数据的延迟写入指示。S901. Receive first data sent by a disk controller, and receive a delayed writing indication of the first data sent by the disk controller.
其中,第一数据满足如下设定条件:第一数据为待写入目标磁盘的第一条带单元的数据,在第一数据之后的待写入数据中包括待写入第二条带单元的第二数据;第二条带单元与第一条带单元属于同一目标条带,第二条带单元与第一条带单元属于不同磁盘。Wherein, the first data satisfies the following setting conditions: the first data is the data to be written to the first stripe unit of the target disk, and the data to be written after the first data includes the data to be written to the second stripe unit. The second data: the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks.
在一种可能的实施例中,磁盘可以接收磁盘控制器发送的第一数据的数据写入指令,从该数据写入指令中获取第一数据和第一数据的延迟写入指示;数据写入指令包含待写入该磁盘的数据。在另一种可能的实施例中,磁盘可能在接收到第一数据的数据写入指令之后,再次接收到磁盘控制器发送的其他数据的数据写入指令,获取数据写入指令中携带的第一数据的延迟写入指示;数据写入指令包含待写入该磁盘的数据。在另一种可能的实施例中,接收磁盘控制器发送的包含延迟写入指示的单独操作指令。In a possible embodiment, the disk may receive a data write instruction of the first data sent by the disk controller, and obtain the first data and the delayed write indication of the first data from the data write instruction; the data write The command contains the data to be written to the disk. In another possible embodiment, after receiving the data write command of the first data, the disk may receive the data write command of other data sent by the disk controller again, and obtain the first data write command carried in the data write command. A data delay write instruction; the data write instruction includes data to be written to the disk. In another possible embodiment, a separate operation instruction including a delayed write instruction sent by the disk controller is received.
S902,将第一数据暂存在磁盘的缓存单元中。S902. Temporarily store the first data in the cache unit of the disk.
延迟写入指示中包括延迟写入标识和第一数据的目标存储地址。磁盘执行该延迟写入指示,根据第一数据的目标存储地址,将第一数据暂存在磁盘的缓存单元中,延迟写入磁盘的非易失性存储器中。The delayed writing indication includes a delayed writing identifier and a target storage address of the first data. The magnetic disk executes the delayed writing instruction, temporarily stores the first data in the cache unit of the magnetic disk according to the target storage address of the first data, and delays writing into the non-volatile memory of the magnetic disk.
在一些实施例中,将第一数据暂存在磁盘的缓存单元中之后,如果磁盘接收磁盘控制器发送的更新数据的数据写入指令;更新数据为更新后的校验数据;更新数据的数据写入指令指示磁盘将更新数据写入目标存储地址,目标存储地址与校验数据的目标存储地址相同;根据该目标存储地址,将更新数据写入磁盘的非易失性存储器中,并在缓存单元中删除校验数据。In some embodiments, after the first data is temporarily stored in the cache unit of the disk, if the disk receives a data write instruction for updating data sent by the disk controller; the updating data is updated check data; the data writing of updating data The input command instructs the disk to write the update data into the target storage address, which is the same as the target storage address of the verification data; according to the target storage address, the update data is written into the non-volatile memory of the disk, and stored in the cache unit Delete the verification data.
在本申请实施例中,预取数据的过程中,磁盘控制器执行的方法可以参照图10所示,包括如下步骤:In the embodiment of the present application, in the process of prefetching data, the method performed by the disk controller can refer to the method shown in Figure 10, including the following steps:
S1001,确定预取数据的目标存储地址和目标磁盘。S1001. Determine a target storage address and a target disk of prefetched data.
在一些实施例中,如果磁盘控制器根据连续接收到的多个读磁盘指令中的逻辑地址,确定数据读取模式为顺序读,则可以根据当前接收到的读磁盘指令中的逻辑地址,确定预取数据的目标存储地址和目标磁盘。In some embodiments, if the disk controller determines that the data read mode is sequential reading according to the logical addresses in multiple disk read instructions received continuously, then it can be determined according to the logical addresses in the currently received disk read instructions The target storage address and target disk of the prefetched data.
在另一些实施例中,在对待修复磁盘进行修复的过程中,可以根据待修复的条带单元所属的目标条带,确定预取数据的目标存储地址和目标磁盘,其中,待修复的条带单元为待修复磁盘中的条带单元,目标条带包括位于不同磁盘的多个条带单元。In some other embodiments, during the process of repairing the disk to be repaired, the target storage address and the target disk of the prefetched data may be determined according to the target stripe to which the stripe unit to be repaired belongs, wherein the stripe to be repaired The unit is a stripe unit in the disk to be repaired, and the target stripe includes multiple stripe units located on different disks.
S1002,向目标磁盘发送基于目标存储地址生成的预取数据指示。S1002. Send the prefetch data instruction generated based on the target storage address to the target disk.
其中,目标磁盘包括缓存单元,预取数据指示用于指示目标磁盘将预取数据从目标存储地址读取至缓存单元中。Wherein, the target disk includes a cache unit, and the prefetch data indication is used to instruct the target disk to read the prefetch data from the target storage address into the cache unit.
在一些实施例中,磁盘控制器可以将预取数据指示携带在向目标磁盘发送的数据读取指令中,发送至目标磁盘;数据读取指令中包含待读取数据的存储地址。在另一些实施例中,磁盘控制器可以向目标磁盘发送包含预取数据指示的单独操作指令。In some embodiments, the disk controller may carry the prefetch data indication in the data read instruction sent to the target disk, and send it to the target disk; the data read instruction includes the storage address of the data to be read. In some other embodiments, the disk controller may send a separate operation command including an instruction to prefetch data to the target disk.
S1003,向目标磁盘发送针对预取数据的第一数据读取指令。S1003. Send a first data read instruction for the prefetched data to the target disk.
S1004,接收目标磁盘从缓存单元中获取并发送的预取数据。S1004. Receive the prefetched data acquired and sent by the target disk from the cache unit.
在本申请实施例中,预取数据的过程中,磁盘执行的方法可以参照图11所示,包括如下步骤:In the embodiment of this application, during the process of prefetching data, the method performed by the disk can refer to the method shown in Figure 11, including the following steps:
S1101,接收磁盘控制器发送的预取数据指示。S1101. Receive a prefetch data instruction sent by a disk controller.
其中,预取数据指示中携带有预取数据的目标存储地址。Wherein, the prefetch data indication carries a target storage address of the prefetch data.
在一些实施例中,磁盘可以接收磁盘控制器发送的第二数据读取指令,获取数据读取指令中携带的预取数据指示;第二数据读取指令中包含待读取数据的存储地址。在另一些实施例中,磁盘可以接收磁盘控制器发送的包含预取数据指示的第二操作指令,第二操作指令为第二数据读取指令之外的指令。In some embodiments, the disk may receive the second data read instruction sent by the disk controller, and acquire the prefetch data instruction carried in the data read instruction; the second data read instruction includes the storage address of the data to be read. In some other embodiments, the disk may receive a second operation instruction including a prefetch data instruction sent by the disk controller, and the second operation instruction is an instruction other than the second data read instruction.
S1102,将目标存储地址对应的存储空间中保存的预取数据读取至磁盘的缓存单元中。S1102. Read the prefetched data stored in the storage space corresponding to the target storage address into the cache unit of the disk.
S1103,接收磁盘控制器发送的针对预取数据的第一数据读取指令。S1103. Receive a first data read instruction for the prefetched data sent by the disk controller.
S1104,从缓存单元中获取预取数据,并将预取数据发送至磁盘控制器。S1104. Acquire the prefetched data from the cache unit, and send the prefetched data to the disk controller.
与上述方法实施例基于相同的发明构思,本申请实施例还提供一种数据存取装置,该数据存取装置可以应用于磁盘控制器中,该磁盘控制器可以是上述RAID控制器、主机、计算机或服务器等设备。数据存取装置可以用于实现上述磁盘控制器执行的数据存取方法实施例的功能,因此可以实现上述数据存取方法的实施例所具备的有益效果。Based on the same inventive concept as the above-mentioned method embodiment, the embodiment of the present application also provides a data access device, which can be applied to a disk controller, and the disk controller can be the above-mentioned RAID controller, host, equipment such as computers or servers. The data access device can be used to implement the functions of the data access method embodiments executed by the above-mentioned disk controller, and thus can realize the beneficial effects of the above-mentioned data access method embodiments.
在一种实施例中,如图12所示,本申请实施例提供的数据存取装置1200可以包括数据获取单元1201和发送单元1202。数据存取装置用于实现上述图8中所示的方法实施例中的功能。当数据存取装置用于实现图8所示的方法实施例的功能时:数据获取单元1201可以用于执行S801,发送单元1202可以用于执行S802。比如:数据获取单元1201,用于获取待写入目标磁盘的第一数据;发送单元1202,用于在确定第一数据满足设定条件的情况下,向目标磁盘发送第一数据,并向目标磁盘发送第一数据的延迟写入指示,其中,设定条件包括:第一数据为待写入目标磁盘的第一条带单元的数据,在第一数据之后的待写入数据中包括待写入第二条带单元的第二数据;第二条带单元与第一条带单元属于同一目标条带,所述第二条带单元与第一条带单元属于不同磁盘。In one embodiment, as shown in FIG. 12 , the data access device 1200 provided in the embodiment of the present application may include a data obtaining unit 1201 and a sending unit 1202 . The data access device is used to implement the functions in the method embodiment shown in FIG. 8 above. When the data access device is used to implement the functions of the method embodiment shown in FIG. 8: the data acquiring unit 1201 may be used to perform S801, and the sending unit 1202 may be used to perform S802. For example: the data obtaining unit 1201 is used to obtain the first data to be written into the target disk; the sending unit 1202 is used to send the first data to the target disk when it is determined that the first data meets the set conditions, and send the first data to the target disk. The disk sends a delayed write indication of the first data, wherein the setting conditions include: the first data is the data to be written to the first stripe unit of the target disk, and the data to be written after the first data includes the data to be written Enter the second data of the second stripe unit; the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks.
在一种可能的实现方式中,第一数据为接收到的写磁盘指令中携带的数据;数据获取单元1201,具体可以用于:根据连续接收到的多个写磁盘指令中的逻辑地址,确定数据写入模式是否为顺序写,如果数据写入模式为顺序写,且目标条带中包括除目标条带单元之外的空闲条带单元,则确定待写入数据中包括待写入目标条带的第二数据。In a possible implementation manner, the first data is the data carried in the received write disk instruction; the data acquisition unit 1201 can be specifically configured to: determine the Whether the data writing mode is sequential writing, if the data writing mode is sequential writing, and the target stripe includes free stripe units other than the target stripe unit, then it is determined that the data to be written includes the target stripe unit to be written with the second data.
在一种可能的实现方式中,发送单元1202,具体可以用于:将延迟写入指示携带在向目标磁盘发送的第一数据的数据写入指令中,发送至目标磁盘;或者,向目标磁盘发送包含延迟写入指示的第一操作指令,第一操作指令为第一数据写入指令之外的指令。其中,延迟写入指示中包括延迟写入标识和第一数据的目标存储地址。In a possible implementation manner, the sending unit 1202 may be specifically configured to: carry the delayed write indication in the data write instruction of the first data sent to the target disk, and send it to the target disk; or, send the instruction to the target disk Sending a first operation instruction including a delayed write instruction, where the first operation instruction is an instruction other than the first data write instruction. Wherein, the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
在另一种实施例中,如图13所示,本申请实施例提供的数据存取装置1300可以包括预测单元1301、指示发送单元1302和数据接收单元1303。数据存取装置用于实现上述图9中所示的方法实施例中的功能。当数据存取装置用于实现图10所示的方法实施例的功能时:预测单元1301可以用于执行S1001,指示发送单元1302可以用于执行S1002和S1003,数据接收单元1303可以用于执行S1004。比如:预测单元1301,用于确定预取数据的目标存储地址和目标磁盘;目标磁盘包括缓存单元;指示发送单元1302,用于向目标磁盘发送基于目标存储地址生成的预取数据指示;预取数据指示用于指示目标磁盘将预取数据从目标存储地址读取至缓存单元中;以及,向目标磁盘发送针对预取数据的第一数据读取指令;数据接收单元1303,用于接收目标磁盘从缓存单元中获取并发送的预取数据。In another embodiment, as shown in FIG. 13 , the data access device 1300 provided in the embodiment of the present application may include a prediction unit 1301 , an indication sending unit 1302 and a data receiving unit 1303 . The data access device is used to implement the functions in the method embodiment shown in FIG. 9 above. When the data access device is used to realize the function of the method embodiment shown in FIG. 10: the predicting unit 1301 can be used to perform S1001, the instruction sending unit 1302 can be used to perform S1002 and S1003, and the data receiving unit 1303 can be used to perform S1004 . For example: the prediction unit 1301 is used to determine the target storage address and the target disk of the prefetched data; the target disk includes a cache unit; the instruction sending unit 1302 is used to send the prefetch data indication generated based on the target storage address to the target disk; prefetch The data indication is used to instruct the target disk to read the prefetch data from the target storage address into the cache unit; and, send the first data read instruction for the prefetch data to the target disk; the data receiving unit 1303 is used to receive the target disk Prefetched data fetched and sent from the cache unit.
在一种可能的实现方式中,预测单元1301,具体可以用于:根据连续接收到的多个读磁盘指令中的逻辑地址,确定数据读取模式是否为顺序读,如果数据读取模式为顺序读,则根据当前接收到的读磁盘指令中的逻辑地址,确定预取数据的目标存储地址和目标磁盘。In a possible implementation manner, the predicting unit 1301 can be specifically configured to: determine whether the data reading mode is sequential reading according to the logical addresses in multiple disk read instructions received continuously, and if the data reading mode is sequential For reading, determine the target storage address and target disk of the prefetched data according to the logical address in the currently received disk read instruction.
在一种可能的实现方式中,预测单元1301,具体可以用于:在对待修复磁盘进行修复的过程中,根据待修复的条带单元所属的目标条带,确定预取数据的目标存储地址和目标磁盘;待修复的条带单元为待修复磁盘中的条带单元;目标条带包括位于不同磁盘的多个条带单元。In a possible implementation manner, the predicting unit 1301 may be specifically configured to: during the process of repairing the disk to be repaired, determine the target storage address and The target disk; the stripe unit to be repaired is a stripe unit in the disk to be repaired; the target stripe includes multiple stripe units located on different disks.
在一种可能的实现方式中,指示发送单元1302,具体可以用于:将预取数据指示携带在向目标磁盘发送的第二数据读取指令中,发送至目标磁盘;第二数据读取指令用于指示目标磁盘从指定存储地址读取数据;或者,向目标磁盘发送包含预取数据指示的第二操作指令;第二操作指令为第二数据读取指令之外的指令。In a possible implementation manner, the instruction sending unit 1302 can be specifically configured to: carry the prefetch data instruction in the second data read instruction sent to the target disk, and send it to the target disk; the second data read instruction It is used to instruct the target disk to read data from a specified storage address; or, to send a second operation instruction including a prefetch data instruction to the target disk; the second operation instruction is an instruction other than the second data read instruction.
与上述方法实施例基于相同的发明构思,本申请实施例还提供一种数据存取装置,该数据存取装置可以应用于磁盘中。数据存取装置可以用于实现上述磁盘执行的数据存取方法实施例的功能,因此可以实现上述数据存取方法的实施例所具备的有益效果。Based on the same inventive concept as the above method embodiment, the embodiment of the present application also provides a data access device, which can be applied to a magnetic disk. The data access device can be used to implement the functions of the embodiments of the data access method performed by the above-mentioned disk, and thus can realize the beneficial effects of the embodiments of the above-mentioned data access method.
在一种实施例中,如图14所示,本申请实施例提供的数据存取装置1400可以包括接收单元1401和执行单元1402。数据存取装置用于实现上述图9中所示的方法实施例中的功能。当数据存取装置用于实现图9所示的方法实施例的功能时:接收单元1401可以用于执行S901,执行单元1402可以用于执行S902。比如:接收单元1401,用于接收磁盘控制器发送的第一数据,并接收磁盘控制器发送的第一数据的延迟写入指示;延迟写入指示用于指示目标磁盘将第一数据暂存在目标磁盘的缓存单元中;执行单元1402,用于将第一数据暂存在磁盘的缓存单元中,其中,第一数据满足如下条件:第一数据为待写入目标磁盘的第一条带单元的数据,磁盘控制器预测到在第一数据之后,写入磁盘的待写入数据中,包括待写入第二条带单元的第二数据,其中,第二条带单元与第一条带单元属于同一目标条带,第二条带单元与第一条带单元属于不同的磁盘。In one embodiment, as shown in FIG. 14 , the data access device 1400 provided in the embodiment of the present application may include a receiving unit 1401 and an executing unit 1402 . The data access device is used to implement the functions in the method embodiment shown in FIG. 9 above. When the data access device is used to implement the functions of the method embodiment shown in FIG. 9: the receiving unit 1401 may be used to perform S901, and the execution unit 1402 may be used to perform S902. For example: the receiving unit 1401 is configured to receive the first data sent by the disk controller, and receive the delayed writing indication of the first data sent by the disk controller; the delayed writing indication is used to instruct the target disk to temporarily store the first data in the target In the cache unit of the disk; the execution unit 1402 is configured to temporarily store the first data in the cache unit of the disk, wherein the first data satisfies the following condition: the first data is the data to be written into the first stripe unit of the target disk , the disk controller predicts that after the first data, the to-be-written data written to the disk includes the second data to be written to the second stripe unit, wherein the second stripe unit and the first stripe unit belong to For the same target stripe, the second stripe unit and the first stripe unit belong to different disks.
在一种可能的实现方式中,接收单元1401,具体可以用于:接收磁盘控制器发送的第一数据的数据写入指令,获取第一数据的数据写入指令中携带的延迟写入指示;第一数据的数据写入指令包含第一数据;或者,接收磁盘控制器发送的包含延迟写入指示的第一操作指令,第一操作指令为第一数据的数据写入指令之外的指令。其中,延迟写入指示中包括延迟写入标识和第一数据的目标存储地址。In a possible implementation manner, the receiving unit 1401 may be specifically configured to: receive a data write instruction of the first data sent by the disk controller, and acquire a delayed write instruction carried in the data write instruction of the first data; The data writing instruction of the first data includes the first data; or, receiving a first operation instruction including a delayed writing instruction sent by the disk controller, the first operation instruction is an instruction other than the data writing instruction of the first data. Wherein, the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
在另一种实施例中,如图15所示,本申请实施例提供的数据存取装置1500可以包括指令接收单元1501、指令执行单元1502和数据传输单元1503。数据存取装置用于实现上述图11中所示的方法实施例中的功能。当数据存取装置用于实现图11所示的方法实施例的功能时:指令接收单元1501可以用于执行S1101,指令执行单元1502可以用于执行S1102,数据传输单元1503可以用于执行S1103和S1104。比如:指令接收单元1501,用于接收磁盘控制器发送的预取数据指示;预取数据指示是磁盘控制器基于预取数据的目标存储地址生成的;指令执行单元1502,用于将预取数据指示携带的目标存储地址中保存的预取数据读取至磁盘的缓存单元中;数据传输单元1503,用于接收磁盘控制器发送的针对预取数据的第一数据读取指令,从缓存单元中获取预取数据,并将预取数据发送至磁盘控制器。In another embodiment, as shown in FIG. 15 , the data access device 1500 provided in the embodiment of the present application may include an instruction receiving unit 1501 , an instruction executing unit 1502 and a data transmission unit 1503 . The data access device is used to implement the functions in the method embodiment shown in FIG. 11 above. When the data access device is used to realize the function of the method embodiment shown in FIG. 11: the instruction receiving unit 1501 can be used to execute S1101, the instruction execution unit 1502 can be used to execute S1102, and the data transmission unit 1503 can be used to execute S1103 and S1104. For example: the instruction receiving unit 1501 is used to receive the prefetch data instruction sent by the disk controller; the prefetch data instruction is generated by the disk controller based on the target storage address of the prefetch data; the instruction execution unit 1502 is used to transfer the prefetch data Indicate that the prefetch data stored in the target storage address carried is read into the cache unit of the disk; the data transmission unit 1503 is configured to receive the first data read instruction for the prefetch data sent by the disk controller, and read the instruction from the cache unit Get the prefetched data and send the prefetched data to the disk controller.
在一种可能的实现方式中,指令接收单元1501,具体可以用于:接收磁盘控制器发送的第二数据读取指令,获取数据读取指令中携带的预取数据指示;第二数据读取指令用于指示目标磁盘从指定存储地址读取数据;或者,接收磁盘控制器发送的包含预取数据指示的单独操作指令。In a possible implementation manner, the instruction receiving unit 1501 may be specifically configured to: receive the second data read instruction sent by the disk controller, obtain the prefetch data indication carried in the data read instruction; The command is used to instruct the target disk to read data from a specified storage address; or, to receive a separate operation command sent by the disk controller including the prefetch data instruction.
与上述方法实施例基于相同的发明构思,本申请实施例中还提供一种磁盘控制器,该磁盘控制器可以用于实现上述方法实施例的功能,因此可以实现上述方法实施例所具备的有益效果。该磁盘控制器可以是上述RAID控制器、主机、计算机或服务器等设备。Based on the same inventive concept as the above-mentioned method embodiments, the embodiments of the present application also provide a disk controller, which can be used to realize the functions of the above-mentioned method embodiments, so that the beneficial features of the above-mentioned method embodiments can be realized. Effect. The disk controller may be the above-mentioned RAID controller, a host, a computer, or a server.
在一些实施例中,该磁盘控制器1600的结构可以如图16所示,包括处理器1601以及与处理器1601连接的存储器1602。In some embodiments, the structure of the disk controller 1600 may be as shown in FIG. 16 , including a processor 1601 and a memory 1602 connected to the processor 1601 .
可选地,处理器1601和存储器1602之间可以通过总线相互连接,处理器1601可以是通用处理器,如微处理器,或其他常规的处理器。总线可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。Optionally, the processor 1601 and the memory 1602 may be connected to each other through a bus, and the processor 1601 may be a general processor, such as a microprocessor, or other conventional processors. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like. The bus can be divided into address bus, data bus, control bus and so on.
存储器1602用于存储处理器1601执行的指令或程序,或存储处理器1601运行指令或程序所需要的输入数据,或存储处理器1601运行指令或程序后产生的数据。处理器1601可以包括一个或多个处理单元,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。处理器1601中还可以包括控制器,控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The memory 1602 is used to store instructions or programs executed by the processor 1601, or store input data required by the processor 1601 to run the instructions or programs, or store data generated after the processor 1601 runs the instructions or programs. The processor 1601 may include one or more processing units, and different processing units may be independent devices or integrated into one or more processors. The processor 1601 may further include a controller, and the controller may generate an operation control signal according to the instruction operation code and the timing signal, and complete the control of fetching and executing instructions.
示例性地,磁盘控制器1600中的处理器1601用于运行存储器1602存储的指令或者程序,执行图8或图10所示的方法实施例中的功能。比如,当磁盘控制器1600用于实现图8所示的方法时,处理器1601用于执行上述数据获取单元1201和发送单元1202的功能。当磁盘控制器1600用于实现图10所示的方法时,处理器1601用于执行上述预测单元1301、指示发送单元1302和数据接收单元1303的功能。Exemplarily, the processor 1601 in the disk controller 1600 is configured to execute instructions or programs stored in the memory 1602 to execute the functions in the method embodiment shown in FIG. 8 or FIG. 10 . For example, when the disk controller 1600 is used to implement the method shown in FIG. 8 , the processor 1601 is used to execute the functions of the above data acquisition unit 1201 and the sending unit 1202 . When the disk controller 1600 is used to implement the method shown in FIG. 10 , the processor 1601 is used to execute the functions of the prediction unit 1301 , the indication sending unit 1302 and the data receiving unit 1303 .
与上述方法实施例基于相同的发明构思,本申请实施例中还提供一种磁盘,该磁盘可以用于实现上述方法实施例的功能,因此可以实现上述方法实施例所具备的有益效果。磁盘可以是固态硬盘,也可以是机械硬盘。Based on the same inventive concept as the above-mentioned method embodiments, the embodiments of the present application further provide a disk, which can be used to implement the functions of the above-mentioned method embodiments, and thus can realize the beneficial effects of the above-mentioned method embodiments. The disk can be a solid state drive or a mechanical hard drive.
在一些实施例中,该磁盘1700的结构可以如图17所示,包括处理器1710以及与处理器1710连接的存储器1720,其中存储器1720可以包括缓存单元1721和非易失性存储器1722。In some embodiments, the structure of the disk 1700 may be as shown in FIG. 17 , including a processor 1710 and a memory 1720 connected to the processor 1710 , where the memory 1720 may include a cache unit 1721 and a non-volatile memory 1722 .
可选地,处理器1710和存储器1720之间可以通过总线相互连接,处理器1710可以是通用处理器,如微处理器,或其他常规的处理器。总线可以是PCI总线或EISA总线等。Optionally, the processor 1710 and the memory 1720 may be connected to each other through a bus, and the processor 1710 may be a general processor, such as a microprocessor, or other conventional processors. The bus can be a PCI bus or an EISA bus or the like.
存储器1720中的缓存单元1721可以用于暂存即将写入非易失性存储器1722中的数据,或者从非易失性存储器1722中读取的数据。非易失性存储器1722可以用于提供数据存储服务,保存各种业务场景中使用的数据。The cache unit 1721 in the memory 1720 may be used to temporarily store data to be written into the non-volatile memory 1722 or data to be read from the non-volatile memory 1722 . The non-volatile memory 1722 can be used to provide data storage services and store data used in various business scenarios.
存储器1720还可以用于存储处理器1710执行的指令或程序,或存储处理器1710运行指令或程序所需要的输入数据,或存储处理器1710运行指令或程序后产生的数据。处理器1710执行的指令或程序可以保存在非易失性存储器1722中,处理器1710可以包括一个或多个处理单元,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The memory 1720 may also be used to store instructions or programs executed by the processor 1710, or store input data required by the processor 1710 to run the instructions or programs, or store data generated after the processor 1710 runs the instructions or programs. The instructions or programs executed by the processor 1710 can be stored in the non-volatile memory 1722, the processor 1710 can include one or more processing units, different processing units can be independent devices, and can also be integrated in one or more processing units. device.
在一种实施例中,磁盘1700中的处理器1710可以运行存储器1720存储的指令或者程序,执行图9或图11所示的方法实施例中的功能。比如,当磁盘1700用于实现图9所示的方法时,处理器1701用于执行上述接收单元1401和执行单元1402的功能。当磁盘1700用于实现图11所示的方法时,处理器1701用于执行上述指令接收单元1501、指令执行单元1502和数据传输单元1503的功能。In one embodiment, the processor 1710 in the disk 1700 can run instructions or programs stored in the memory 1720 to execute the functions in the method embodiment shown in FIG. 9 or FIG. 11 . For example, when the disk 1700 is used to implement the method shown in FIG. 9 , the processor 1701 is used to execute the functions of the above-mentioned receiving unit 1401 and executing unit 1402 . When the disk 1700 is used to implement the method shown in FIG. 11 , the processor 1701 is used to execute the functions of the above instruction receiving unit 1501 , instruction executing unit 1502 and data transmitting unit 1503 .
可以理解的是,本申请实施例示意的结构并不构成对计算设备的具体限定。在本申请另一些实施例中,计算设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the computing device. In other embodiments of the present application, the computing device may include more or fewer components than shown, or combine some components, or separate some components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.
本申请的实施例中的方法步骤可以通过硬件的方式来实现,也可以由处理器执行计算 机程序或指令的方式来实现。计算机程序或指令可以构成计算机程序产品。本申请实施例还提供一种计算机程序产品,包含有计算机可执行指令。在一种实施例中,该计算机可执行指令用于使计算机执行图8或图10所示的方法实施例中的功能。在另一种实施例中,该计算机可执行指令用于使计算机执行图9或图11所示的方法实施例中的功能。The method steps in the embodiments of the present application may be implemented by means of hardware, or may be implemented by means of a processor executing computer programs or instructions. A computer program or instructions may constitute a computer program product. The embodiment of the present application also provides a computer program product including computer executable instructions. In one embodiment, the computer-executable instructions are used to cause a computer to execute the functions in the method embodiment shown in FIG. 8 or FIG. 10 . In another embodiment, the computer-executable instructions are used to cause the computer to execute the functions in the method embodiment shown in FIG. 9 or FIG. 11 .
计算机可执行指令可以被存放于计算机可读存储介质中,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质内存储有可执行指令。在一种实施例中,该计算机可执行指令用于使计算机执行图8或图10所示的方法实施例中的功能。在另一种实施例中,该计算机可执行指令用于使计算机执行图9或图11所示的方法实施例中的功能。Computer-executable instructions may be stored in a computer-readable storage medium, and the embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores executable instructions. In one embodiment, the computer-executable instructions are used to cause a computer to execute the functions in the method embodiment shown in FIG. 8 or FIG. 10 . In another embodiment, the computer-executable instructions are used to cause the computer to execute the functions in the method embodiment shown in FIG. 9 or FIG. 11 .
本申请实施例提供的计算机可读存储介质可以是随机存取存储器(random access memory,RAM)、闪存、只读存储器(read-only memory,ROM)、可编程只读存储器(programmableROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically ePROM,EEPROM)、寄存器、硬盘、移动硬盘、CD-ROM或者本领域熟知的任何其它形式的计算机可读存储介质。The computer-readable storage medium provided by the embodiment of the present application may be random access memory (random access memory, RAM), flash memory, read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), Erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable programmable read-only memory (electrically ePROM, EEPROM), registers, hard disk, removable hard disk, CD-ROM or any other form known in the art computer readable storage medium.
计算机可执行指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机程序或指令可以从一个网站站点、计算机、服务器或数据中心通过有线或无线方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是集成一个或多个可用介质的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,例如,软盘、硬盘、磁带;也可以是光介质,例如,数字视频光盘(digital video disc,DVD);还可以是半导体介质,例如,固态硬盘。Computer-executable instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer programs or instructions may be transmitted from a website, computer, server or A data center transmits to another website site, computer, server, or data center via wired or wireless means. The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrating one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disc (digital video disc, DVD); it may also be a semiconductor medium, such as a solid-state hard disk.
在本申请的各个实施例中,如果没有特殊说明以及逻辑冲突,不同的实施例之间的术语和/或描述具有一致性、且可以相互引用,不同的实施例中的技术特征根据其内在的逻辑关系可以组合形成新的实施例。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元。方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。In each embodiment of the present application, if there is no special explanation and logical conflict, the terms and/or descriptions between different embodiments are consistent and can be referred to each other, and the technical features in different embodiments are based on their inherent Logical relationships can be combined to form new embodiments. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, of a sequence of steps or elements. A method, system, product or device is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to the process, method, product or device.
尽管结合具体特征及其实施例对本申请进行了描述,显而易见的,在不脱离本申请的精神和范围的情况下,可对其进行各种修改和组合。相应地,本说明书和附图仅仅是所附权利要求所界定的方案进行示例性说明,且视为已覆盖本申请范围内的任意和所有修改、变化、组合或等同物。Although the application has been described in conjunction with specific features and embodiments thereof, it will be apparent that various modifications and combinations can be made thereto without departing from the spirit and scope of the application. Accordingly, the specification and drawings are merely illustrative of the solutions defined by the appended claims, and are deemed to cover any and all modifications, changes, combinations or equivalents within the scope of the application.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的范围。这样,倘若本申请实施例的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Apparently, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. In this way, if the modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims (27)
- 一种数据存取方法,其特征在于,应用于磁盘控制器,所述方法包括:A data access method, characterized in that it is applied to a disk controller, the method comprising:获取待写入目标磁盘的第一数据;Obtain the first data to be written into the target disk;在确定所述第一数据满足设定条件的情况下,向所述目标磁盘发送所述第一数据和所述第一数据的延迟写入指示;所述延迟写入指示用于指示所述目标磁盘将所述第一数据暂存在所述目标磁盘的缓存单元中。When it is determined that the first data satisfies the set condition, send the first data and a delayed write indication of the first data to the target disk; the delayed write indication is used to indicate the target The disk temporarily stores the first data in the cache unit of the target disk.
- 根据权利要求1所述的方法,其特征在于,所述设定条件包括:所述第一数据为待写入目标磁盘的第一条带单元的数据,在所述第一数据之后的待写入数据中包括待写入第二条带单元的第二数据;所述第二条带单元与所述第一条带单元属于同一目标条带,所述第二条带单元与所述第一条带单元属于不同磁盘。The method according to claim 1, wherein the setting conditions include: the first data is the data to be written into the first stripe unit of the target disk, and the data to be written after the first data The input data includes the second data to be written into the second stripe unit; the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit The stripe units belong to different disks.
- 根据权利要求1所述的方法,其特征在于,所述设定条件包括:method according to claim 1, is characterized in that, described setting condition comprises:若第一数据为待写入目标磁盘的第一条带单元的数据,且预测到在所述第一数据之后的待写入数据中包括待写入第二条带单元的第二数据,则确定所述第一数据满足所述设定条件;所述第二条带单元与所述第一条带单元属于同一目标条带,所述第二条带单元与所述第一条带单元属于不同磁盘;或者,If the first data is the data to be written into the first stripe unit of the target disk, and it is predicted that the data to be written after the first data includes the second data to be written into the second stripe unit, then determining that the first data satisfies the set condition; the second stripe unit and the first stripe unit belong to the same target stripe, and the second stripe unit and the first stripe unit belong to different disks; or,所述设定条件包括The set conditions include若第一数据为待写入目标磁盘的第三条带单元的校验数据,且预测到在所述第一数据之后的待写入数据中包括待写入第二条带单元的第二数据,则确定所述第一数据满足所述设定条件;所述第二条带单元与所述第三条带单元属于同一目标条带,所述第二条带单元与所述第三条带单元属于不同磁盘。If the first data is the verification data to be written to the third stripe unit of the target disk, and it is predicted that the data to be written after the first data includes the second data to be written to the second stripe unit , it is determined that the first data satisfies the set condition; the second stripe unit and the third stripe unit belong to the same target stripe, and the second stripe unit and the third stripe unit Cells belong to different disks.
- 根据权利要求2或3所述的方法,其特征在于,所述第一数据为接收到的写磁盘指令中携带的数据;所述方法还包括:The method according to claim 2 or 3, wherein the first data is the data carried in the received write disk instruction; the method further comprises:若确定数据写入模式为顺序写,且所述目标条带中包括除所述目标条带单元之外的空闲条带单元,则确定所述待写入数据中包括所述第二数据。If it is determined that the data writing mode is sequential writing, and the target stripe includes an idle stripe unit other than the target stripe unit, then it is determined that the data to be written includes the second data.
- 根据权利要求4所述的方法,其特征在于,通过如下方式,确定数据写入模式是否为顺序写:The method according to claim 4, characterized in that, by the following manner, determine whether the data writing mode is sequential writing:根据连续接收到的多个写磁盘指令中的逻辑地址,确定所述数据写入模式是否为顺序写。Determine whether the data writing mode is sequential writing according to the logical addresses in the multiple disk writing instructions received continuously.
- 根据权利要求1~5中任一项所述的方法,其特征在于,所述延迟写入指示中包括延迟写入标识和所述第一数据的目标存储地址。The method according to any one of claims 1 to 5, wherein the delayed writing instruction includes a delayed writing identifier and a target storage address of the first data.
- 根据权利要求1~6中任一项所述的方法,其特征在于,所述向所述目标磁盘发送所述第一数据的延迟写入指示,包括:The method according to any one of claims 1-6, wherein the sending the delayed writing instruction of the first data to the target disk comprises:将所述延迟写入指示携带在第一数据写入指令中,发送至所述目标磁盘;所述第一数 据写入指令包含所述第一数据;或者,Carrying the delayed write instruction in a first data write instruction and sending it to the target disk; the first data write instruction includes the first data; or,向所述目标磁盘发送包含所述延迟写入指示的第一操作指令;所述第一操作指令为所述第一数据写入指令之外的指令。Sending a first operation instruction including the delayed write instruction to the target disk; the first operation instruction is an instruction other than the first data write instruction.
- 根据权利要求1~7中任一项所述的方法,其特征在于,所述第一数据为校验数据,所述向所述目标磁盘发送所述第一数据的延迟写入指示之后,所述方法还包括:The method according to any one of claims 1-7, wherein the first data is verification data, and after sending the delayed writing instruction of the first data to the target disk, the The method also includes:若获取到所述第二数据,则基于所述第二数据确定更新数据;所述更新数据为更新后的校验数据;If the second data is acquired, update data is determined based on the second data; the update data is updated verification data;向所述目标磁盘发送第二数据写入指令,所述第二数据写入指令包含所述更新数据;所述第二数据写入指令用于指示所述目标磁盘将所述更新数据写入所述目标磁盘的非易失性存储器中。sending a second data write instruction to the target disk, the second data write instruction including the update data; the second data write instruction is used to instruct the target disk to write the update data into the in the non-volatile memory of the target disk described above.
- 一种数据存取方法,其特征在于,应用于磁盘控制器,所述方法包括:A data access method, characterized in that it is applied to a disk controller, the method comprising:确定预取数据的目标存储地址和目标磁盘;所述目标磁盘包括缓存单元;Determining a target storage address and a target disk for prefetching data; the target disk includes a cache unit;向所述目标磁盘发送基于所述目标存储地址生成的预取数据指示;所述预取数据指示用于指示所述目标磁盘将所述预取数据从所述目标存储地址读取至所述缓存单元中;sending a prefetch data indication generated based on the target storage address to the target disk; the prefetch data indication is used to instruct the target disk to read the prefetch data from the target storage address to the cache in the unit;向所述目标磁盘发送针对所述预取数据的第一数据读取指令;sending a first data read instruction for the prefetched data to the target disk;接收所述目标磁盘从所述缓存单元中获取并发送的所述预取数据。receiving the prefetch data obtained and sent by the target disk from the cache unit.
- 根据权利要求9所述的方法,其特征在于,所述确定预取数据的目标存储地址和目标磁盘,包括:The method according to claim 9, wherein said determining the target storage address and target disk of the prefetched data comprises:若根据连续接收到的多个读磁盘指令中的逻辑地址,确定数据读取模式为顺序读,则根据当前接收到的读磁盘指令中的逻辑地址,确定预取数据的所述目标存储地址和所述目标磁盘。If the data read mode is determined to be sequential reading according to the logical addresses in multiple read disk instructions received continuously, then determine the target storage address and address of the prefetched data according to the logical addresses in the currently received disk read instructions The target disk.
- 根据权利要求9所述的方法,其特征在于,所述确定预取数据的目标存储地址和目标磁盘,包括:The method according to claim 9, wherein said determining the target storage address and target disk of the prefetched data comprises:在对待修复磁盘进行修复的过程中,根据待修复的条带单元所属的目标条带,确定所述预取数据的目标存储地址和目标磁盘;所述待修复的条带单元为所述待修复磁盘中的条带单元;所述目标条带包括位于不同磁盘的多个条带单元。In the process of repairing the disk to be repaired, the target storage address and the target disk of the prefetched data are determined according to the target stripe to which the stripe unit to be repaired belongs; the stripe unit to be repaired is the A stripe unit in a disk; the target stripe includes a plurality of stripe units located on different disks.
- 根据权利要求9~11中任一项所述的方法,其特征在于,所述向所述目标磁盘发送基于所述目标存储地址生成的预取数据指示,包括:The method according to any one of claims 9-11, wherein the sending the prefetch data instruction generated based on the target storage address to the target disk comprises:将所述预取数据指示携带在向所述目标磁盘发送的第二数据读取指令中,发送至所述目标磁盘;所述第二数据读取指令用于指示所述目标磁盘从指定存储地址读取数据;或者,Carrying the prefetch data instruction in a second data read instruction sent to the target disk, and sending it to the target disk; the second data read instruction is used to instruct the target disk to read from a specified storage address read data; or,向所述目标磁盘发送包含所述预取数据指示的第二操作指令;所述第二操作指令为所述第二数据读取指令之外的指令。Sending a second operation instruction including the prefetch data indication to the target disk; the second operation instruction is an instruction other than the second data read instruction.
- 一种数据存取方法,其特征在于,应用于磁盘,所述方法包括:A data access method, characterized in that it is applied to a disk, the method comprising:接收磁盘控制器发送的第一数据,并接收所述磁盘控制器发送的所述第一数据的延迟 写入指示;所述延迟写入指示用于指示所述磁盘将所述第一数据暂存在所述磁盘的缓存单元中;receiving the first data sent by the disk controller, and receiving a delayed write indication of the first data sent by the disk controller; the delayed write indication is used to instruct the disk to temporarily store the first data In the cache unit of the disk;将所述第一数据暂存在所述磁盘的缓存单元中。Temporarily storing the first data in a cache unit of the disk.
- 根据权利要求13所述的方法,其特征在于,所述延迟写入指示中包括延迟写入标识和所述第一数据的目标存储地址。The method according to claim 13, wherein the delayed writing indication includes a delayed writing identifier and a target storage address of the first data.
- 根据权利要求13或14所述的方法,其特征在于,所述接收所述磁盘控制器发送的所述第一数据的延迟写入指示,包括:The method according to claim 13 or 14, wherein the receiving the delayed writing indication of the first data sent by the disk controller comprises:接收所述磁盘控制器发送的第一数据写入指令,获取所述第一数据写入指令中携带的所述延迟写入指示;所述第一数据写入指令包含所述第一数据;或者,receiving a first data write instruction sent by the disk controller, and acquiring the delayed write instruction carried in the first data write instruction; the first data write instruction includes the first data; or ,接收所述磁盘控制器发送的包含所述延迟写入指示的第一操作指令;所述第一操作指令为所述第一数据写入指令之外的指令。receiving a first operation instruction sent by the disk controller and including the delayed write instruction; the first operation instruction is an instruction other than the first data write instruction.
- 根据权利要求13~15任一项所述的方法,其特征在于,所述第一数据为校验数据,所述将所述第一数据暂存在所述磁盘的缓存单元中之后,所述方法还包括:The method according to any one of claims 13-15, wherein the first data is verification data, and after the first data is temporarily stored in the cache unit of the disk, the method Also includes:接收所述磁盘控制器发送的更新数据的第二数据写入指令;所述更新数据为更新后的校验数据;所述第二数据写入指令指示所述磁盘将所述更新数据写入目标存储地址,所述目标存储地址与所述校验数据的目标存储地址相同;receiving a second data write instruction for update data sent by the disk controller; the update data is updated check data; the second data write instruction instructs the disk to write the update data into a target storage address, the target storage address is the same as the target storage address of the verification data;根据所述目标存储地址,将所述更新数据写入所述磁盘的非易失性存储器中,并在所述缓存单元中删除所述校验数据。According to the target storage address, the update data is written into the non-volatile memory of the magnetic disk, and the verification data is deleted in the cache unit.
- 一种数据存取方法,其特征在于,应用于磁盘,所述方法包括:A data access method, characterized in that it is applied to a disk, the method comprising:接收磁盘控制器发送的预取数据指示;所述预取数据指示携带预取数据的目标存储地址;receiving a prefetch data indication sent by the disk controller; the prefetch data indication carries a target storage address of the prefetch data;将所述目标存储地址对应的存储空间中保存的所述预取数据读取至所述磁盘的缓存单元中;reading the prefetched data stored in the storage space corresponding to the target storage address into the cache unit of the disk;接收所述磁盘控制器发送的针对所述预取数据的第一数据读取指令;receiving a first data read instruction for the prefetched data sent by the disk controller;从所述缓存单元中获取所述预取数据,并将所述预取数据发送至所述磁盘控制器。Acquire the prefetch data from the cache unit, and send the prefetch data to the disk controller.
- 根据权利要求17所述的方法,其特征在于,所述接收磁盘控制器发送的预取数据指示,包括:The method according to claim 17, wherein the receiving the prefetch data indication sent by the disk controller comprises:接收所述磁盘控制器发送的第二数据读取指令,获取所述第二数据读取指令中携带的所述预取数据指示;所述第二数据读取指令用于指示所述磁盘从指定存储地址读取数据;或者,receiving a second data read instruction sent by the disk controller, and obtaining the prefetch data instruction carried in the second data read instruction; the second data read instruction is used to instruct the disk to read from a specified store address to read data; or,接收所述磁盘控制器发送的包含所述预取数据指示的第二操作指令;所述第二操作指令为所述第二数据读取指令之外的指令。receiving a second operation instruction sent by the disk controller and including the instruction to prefetch data; the second operation instruction is an instruction other than the second data read instruction.
- 一种数据存取装置,其特征在于,应用于磁盘控制器,所述装置包括:A data access device is characterized in that it is applied to a disk controller, and the device includes:数据获取单元,用于获取待写入目标磁盘的第一数据;a data acquisition unit, configured to acquire the first data to be written into the target disk;发送单元,用于在确定所述第一数据满足设定条件的情况下,向所述目标磁盘发送所述第一数据和所述第一数据的延迟写入指示;所述延迟写入指示用于指示所述目标磁盘将所述第一数据暂存在所述目标磁盘的缓存单元中。A sending unit, configured to send the first data and a delayed write indication of the first data to the target disk when it is determined that the first data satisfies a set condition; the delayed write indication is used and instructing the target disk to temporarily store the first data in a cache unit of the target disk.
- 一种数据存取装置,其特征在于,应用于磁盘控制器,所述装置包括:A data access device is characterized in that it is applied to a disk controller, and the device includes:预测单元,用于确定预取数据的目标存储地址和目标磁盘;所述目标磁盘包括缓存单元;A prediction unit, configured to determine a target storage address and a target disk for prefetching data; the target disk includes a cache unit;指示发送单元,用于向所述目标磁盘发送基于所述目标存储地址生成的预取数据指示;所述预取数据指示用于指示所述目标磁盘将所述预取数据从所述目标存储地址读取至所述缓存单元中;以及,向所述目标磁盘发送针对所述预取数据的第一数据读取指令;an instruction sending unit, configured to send to the target disk a prefetch data instruction generated based on the target storage address; the prefetch data instruction is used to instruct the target disk to transfer the prefetch data from the target storage address read into the cache unit; and, send a first data read instruction for the prefetched data to the target disk;数据接收单元,用于接收所述目标磁盘从所述缓存单元中获取并发送的所述预取数据。A data receiving unit, configured to receive the prefetch data obtained and sent by the target disk from the cache unit.
- 一种数据存取装置,其特征在于,应用于磁盘,所述装置包括:A data access device is characterized in that it is applied to a magnetic disk, and the device includes:接收单元,用于接收磁盘控制器发送的第一数据,并接收所述磁盘控制器发送的所述第一数据的延迟写入指示;所述延迟写入指示用于指示所述磁盘将所述第一数据暂存在所述磁盘的缓存单元中;a receiving unit, configured to receive the first data sent by the disk controller, and receive a delayed writing indication of the first data sent by the disk controller; the delayed writing indication is used to instruct the disk to write the temporarily storing the first data in the cache unit of the disk;执行单元,用于将所述第一数据暂存在所述磁盘的缓存单元中。The execution unit is configured to temporarily store the first data in the cache unit of the disk.
- 一种数据存取装置,其特征在于,应用于磁盘,所述装置包括:A data access device is characterized in that it is applied to a magnetic disk, and the device includes:指令接收单元,用于接收磁盘控制器发送的预取数据指示;所述预取数据指示携带预取数据的目标存储地址;An instruction receiving unit, configured to receive a prefetch data indication sent by the disk controller; the prefetch data indication carries a target storage address of the prefetch data;指令执行单元,用于将所述目标存储地址对应的存储空间中保存的所述预取数据读取至所述磁盘的缓存单元中;an instruction execution unit, configured to read the prefetched data stored in the storage space corresponding to the target storage address into the cache unit of the disk;数据传输单元,用于接收所述磁盘控制器发送的针对所述预取数据的第一数据读取指令,从所述缓存单元中获取所述预取数据,并将所述预取数据发送至所述磁盘控制器。a data transmission unit, configured to receive a first data read instruction for the prefetched data sent by the disk controller, obtain the prefetched data from the cache unit, and send the prefetched data to The disk controller.
- 一种磁盘控制器,其特征在于,包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器实现权利要求1~8中任一项所述的方法,或者权利要求9~12中任一项所述的方法。A disk controller, characterized by comprising a memory and a processor, the memory stores a computer program that can run on the processor, and when the computer program is executed by the processor, the The processor implements the method described in any one of claims 1-8, or the method described in any one of claims 9-12.
- 一种磁盘,其特征在于,包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器实现权利要求13~16中任一项所述的方法,或者权利要求17~18中任一项所述的方法。A magnetic disk, characterized by comprising a memory and a processor, the memory stores a computer program that can run on the processor, and when the computer program is executed by the processor, the processor Implement the method according to any one of claims 13-16, or the method according to any one of claims 17-18.
- 一种数据存储系统,其特征在于,包括:A data storage system, characterized in that it comprises:如权利要求23所述的磁盘控制器,以及如权利要求24所述的磁盘。A disk controller as claimed in claim 23, and a disk as claimed in claim 24.
- 一种计算机可读存储介质,其特征在于,存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如权利要求1至12中任一项所述的方法,或者执行如权利要求13至18中任一项所述的方法。A computer-readable storage medium, characterized in that computer-executable instructions are stored, and the computer-executable instructions are used to cause a computer to execute the method according to any one of claims 1 to 12, or to execute the method according to any one of claims The method described in any one of 13 to 18.
- 一种计算机程序产品,其特征在于,包含有计算机可执行指令,所述计算机可执行指令用于使计算机执行如权利要求1至12中任一项所述的方法,或者执行如权利要求13至18中任一项所述的方法。A computer program product, characterized in that it contains computer-executable instructions, the computer-executable instructions are used to make a computer execute the method according to any one of claims 1 to 12, or execute the method according to any one of claims 13 to 12 The method of any one of 18.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2021/136563 WO2023102784A1 (en) | 2021-12-08 | 2021-12-08 | Data access method and apparatus, disk controller, disk and data storage system |
CN202180031237.4A CN116583827A (en) | 2021-12-08 | 2021-12-08 | Data access method, device, disk controller, disk and data storage system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2021/136563 WO2023102784A1 (en) | 2021-12-08 | 2021-12-08 | Data access method and apparatus, disk controller, disk and data storage system |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023102784A1 true WO2023102784A1 (en) | 2023-06-15 |
Family
ID=86729263
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/136563 WO2023102784A1 (en) | 2021-12-08 | 2021-12-08 | Data access method and apparatus, disk controller, disk and data storage system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN116583827A (en) |
WO (1) | WO2023102784A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118244997B (en) * | 2024-05-28 | 2024-08-30 | 山东云海国创云计算装备产业创新中心有限公司 | Solid state disk data processing method and device, electronic equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5522065A (en) * | 1991-08-30 | 1996-05-28 | Compaq Computer Corporation | Method for performing write operations in a parity fault tolerant disk array |
WO2002001365A2 (en) * | 2000-06-23 | 2002-01-03 | Intel Corporation | Non-volatile cache |
US20030084252A1 (en) * | 2001-11-01 | 2003-05-01 | Talagala Nisha D. | Disk drive employing adaptive flushing of a write cache |
US20090150614A1 (en) * | 2007-12-07 | 2009-06-11 | Auerbach Daniel J | Non-volatile cache in disk drive emulation |
CN107402890A (en) * | 2017-07-24 | 2017-11-28 | 华中科技大学 | A kind of data processing method and system based on Solid-state disc array and caching |
-
2021
- 2021-12-08 WO PCT/CN2021/136563 patent/WO2023102784A1/en active Application Filing
- 2021-12-08 CN CN202180031237.4A patent/CN116583827A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5522065A (en) * | 1991-08-30 | 1996-05-28 | Compaq Computer Corporation | Method for performing write operations in a parity fault tolerant disk array |
WO2002001365A2 (en) * | 2000-06-23 | 2002-01-03 | Intel Corporation | Non-volatile cache |
US20030084252A1 (en) * | 2001-11-01 | 2003-05-01 | Talagala Nisha D. | Disk drive employing adaptive flushing of a write cache |
US20090150614A1 (en) * | 2007-12-07 | 2009-06-11 | Auerbach Daniel J | Non-volatile cache in disk drive emulation |
CN107402890A (en) * | 2017-07-24 | 2017-11-28 | 华中科技大学 | A kind of data processing method and system based on Solid-state disc array and caching |
Also Published As
Publication number | Publication date |
---|---|
CN116583827A (en) | 2023-08-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10042563B2 (en) | Segmenting read requests and interleaving segmented read and write requests to reduce latency and maximize throughput in a flash storage device | |
US9116638B2 (en) | Method and apparatus for reading and writing data in file system | |
US10795599B2 (en) | Data migration method, host and solid state disk | |
US10296255B1 (en) | Data migration techniques | |
US8284627B2 (en) | Reducing energy consumption and optimizing workload and performance in multi-tier storage systems using extent-level dynamic tiering | |
US9229870B1 (en) | Managing cache systems of storage systems | |
US20220057954A1 (en) | Storage system, memory management method, and management node | |
CN109791522B (en) | Data migration method and system and intelligent network card | |
US9182912B2 (en) | Method to allow storage cache acceleration when the slow tier is on independent controller | |
US9037793B1 (en) | Managing data storage | |
US20220261172A1 (en) | Offloaded data migration between storage devices | |
US9311207B1 (en) | Data storage system optimizations in a multi-tiered environment | |
WO2013097618A1 (en) | Storage virtualization device, storage system and data storage method and system | |
US8775766B2 (en) | Extent size optimization | |
WO2020019267A1 (en) | Data processing method and device | |
US20190243758A1 (en) | Storage control device and storage control method | |
WO2023102784A1 (en) | Data access method and apparatus, disk controller, disk and data storage system | |
US9798661B2 (en) | Storage system and cache control method | |
US8799580B2 (en) | Storage apparatus and data processing method | |
US10154113B2 (en) | Computer system | |
WO2022262345A1 (en) | Data management method and apparatus, and storage space management method and apparatus | |
US20210311654A1 (en) | Distributed Storage System and Computer Program Product | |
CN114860625A (en) | Data access method, device, equipment and readable storage medium | |
US9317419B1 (en) | System and method for thin provisioning | |
CN116917873A (en) | Data access method, memory controller and memory device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
WWE | Wipo information: entry into national phase |
Ref document number: 202180031237.4 Country of ref document: CN |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21966708 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |