A data writing method, device, equipment and medium
By marking DDR data as dirty data in RAID and judging the tag, discarding historical data and replacing it with dirty data, the low write performance problem of RAID-5 and RAID-6 is solved and more efficient write performance is achieved.
Patent Information
- Application Number
- CN202310064517.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-16
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2043-01-16
AI Technical Summary
When writing data to existing RAID-5 and RAID-6 disk arrays, traditional write-back operations result in wasted read operations, reducing write performance to one-third of the single-disk write performance.
By obtaining the data in the DDR and marking it as dirty data in the dirty RAM, reading the historical data and transmitting the write operation to the AXI Slave, it is determined whether the write operation hits the tag in the RAID storage resource. If it hits, the historical data overwritten by the dirty data is discarded according to the dirty flag in the dirty RAM, so that the historical data in the cache is replaced by the dirty data, and the remaining historical data is written to the DDR.
It avoids unnecessary write-back operations, improves the write performance of the disk array, reduces the waste of reading data, and increases the write speed.
Smart Images

Figure CN116126242B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a data writing method, apparatus, device and medium. Background Art
[0002] With the rapid development of Redundant Arrays of Independent Disks (RAID), RAID-5 or RAID-6 arrays are commonly used in existing devices. Existing algorithms for RAID-5 or RAID-6 arrays typically schedule data based on user-defined "stripe" units. When new data is written to a stripe, the old data in the same row of the stripe is read from the disk into random-access memory (RAM) and computed with the new data to generate parity data. Both the new data and the generated parity data are then written to the disk. A write-back operation is typically used during data writes. However, traditional write-back operations require reading all old data into the cache when a cache line is first accessed and misses a match. This overwrites the new data and / or parity data, wasting the read operation and reducing write performance to at least one-third of the performance of a single disk.
[0003] In view of the above problems, finding a way to avoid wasting data reading operations and improve the write performance of the disk array is a problem that those skilled in the art are trying their best to solve. Summary of the Invention
[0004] The purpose of this application is to provide a data writing method, apparatus, device and medium, which can avoid wasting data reading operations and improve the writing performance of a disk array.
[0005] To solve the above technical problems, the present application provides a data writing method, which is applied to a RAID configured with DDR, comprising:
[0006] Get the data in DDR and mark it as dirty data in dirty RAM;
[0007] Read historical data and transmit the disk write operation to DDR to AXI Slave;
[0008] Determine whether the write operation hits the tag set in the storage resource of the RAID;
[0009] If the write operation does not hit the tag, the write operation is directly output;
[0010] If a write operation hits a tag, the historical data overwritten by the dirty data is discarded according to the dirty flag stored in the dirty RAM, so that the historical data in a CacheLine in the cache is replaced by the dirty data, where the dirty data is the data transmitted corresponding to the write operation;
[0011] The remaining historical data is transferred and written to DDR according to the write operation.
[0012] Preferably, after transmitting the write operation of the disk to the DDR to the AXI Slave and before determining whether the write operation hits the tag set in the storage resource of the RAID, the method further includes:
[0013] The upper 32 bits of the write address corresponding to the write operation received by the AXI Slave are replaced with the upper 32 bits of the write address corresponding to the DDR, so that dirty data can be written to the DDR.
[0014] Preferably, when a write operation hits a tag, before discarding historical data overwritten by dirty data according to the dirty flag stored in the dirty RAM, the process further includes:
[0015] Get the tag number corresponding to the tag hit by the write operation stored in the tag RAM.
[0016] Preferably, discarding historical data overwritten by dirty data according to the dirty flag stored in the dirty RAM includes:
[0017] Determine whether the sector has been overwritten by dirty data based on the dirty flag;
[0018] If the dirty flag is not 1, it is determined that the sector is not overwritten by dirty data;
[0019] If the dirty flag is 1, it is determined that the sector has been overwritten by dirty data.
[0020] Preferably, after obtaining the tag number corresponding to the tag hit by the write operation stored in the tag RAM, and before discarding the historical data overwritten by the dirty data according to the dirty flag stored in the dirty RAM, the method further includes:
[0021] Query and obtain the corresponding dirty_base according to the tag number. The dirty_base is used to represent the starting address of all sectors in the dirty RAM corresponding to the tag hit by the write operation;
[0022] Read dirty_word according to dirty_base. Dirty_word is 32-bit data and is used to represent the rewrite status of the data stored in the sector corresponding to the tag. Dirty_word is 32-bit data.
[0023] The dirty flag is selected according to dirty_word. The dirty flag is used to determine whether the sector has been overwritten by dirty data.
[0024] Preferably, after determining that the sector is not covered by dirty data, the method further includes:
[0025] The historical data obtained by the write-back operation is written to the entire sector.
[0026] Preferably, after determining that the sector has been overwritten by dirty data, the method further includes:
[0027] Discards historical data obtained by writeback operations.
[0028] To solve the above technical problems, the present application further provides a data writing device, which is applied to a RAID configured with DDR, comprising:
[0029] The first acquisition module is used to obtain data in the DDR and mark the data as dirty data in the dirty RAM;
[0030] The first reading module is used to read historical data and write the disk to the DDR to the AXI Slave;
[0031] A first judgment module is used to judge whether the write operation hits the tag set in the storage resource of the RAID;
[0032] If the write operation does not hit the tag, the output module is triggered to directly output the write operation;
[0033] If the write operation hits the tag, the overwrite and discard module is triggered to discard the historical data overwritten by the dirty data according to the dirty flag stored in the dirty RAM, so that the historical data in a CacheLine in the cache is replaced by the dirty data, where the dirty data is the data transmitted corresponding to the write operation;
[0034] The transmission module is used to transmit and write the remaining historical data into the DDR according to the write operation.
[0035] In addition, the device includes the following modules:
[0036] Preferably, after transmitting the write operation of the disk to the DDR to the AXI Slave and before determining whether the write operation hits the tag set in the storage resource of the RAID, the method further includes:
[0037] The replacement module is used to replace the upper 32 bits of the write address corresponding to the write operation received by the AXI Slave with the upper 32 bits of the write address corresponding to the DDR, so that dirty data can be written to the DDR.
[0038] Preferably, when a write operation hits a tag, before discarding historical data overwritten by dirty data according to the dirty flag stored in the dirty RAM, the process further includes:
[0039] The second acquisition module is used to obtain the tag number corresponding to the tag hit by the write operation stored in the Tag RAM.
[0040] Preferably, discarding historical data overwritten by dirty data according to the dirty flag stored in the dirty RAM includes:
[0041] The second judgment module is used to judge whether the sector has been overwritten by dirty data according to the dirty flag;
[0042] If the dirty flag is not 1, it is determined that the sector is not overwritten by dirty data;
[0043] If the dirty flag is 1, it is determined that the sector has been overwritten by dirty data.
[0044] Preferably, after obtaining the tag number corresponding to the tag hit by the write operation stored in the tag RAM, and before discarding the historical data overwritten by the dirty data according to the dirty flag stored in the dirty RAM, the method further includes:
[0045] The query and acquisition module is used to query and obtain the corresponding dirty_base according to the tag number. The dirty_base is used to represent the starting address of all sectors in the dirty RAM corresponding to the tag hit by the write operation;
[0046] The second reading module is used to read dirty_word according to dirty_base, where dirty_word is 32-bit data and is used to represent the rewrite status of the data stored in the sector corresponding to the tag, and dirty_word is 32-bit data;
[0047] The selection module is used to select the dirty flag according to dirty_word. The dirty flag is used to determine whether the sector has been overwritten by dirty data.
[0048] Preferably, after determining that the sector is not covered by dirty data, the method further includes:
[0049] The write module is used to fill the sectors with historical data obtained by the write-back operation.
[0050] Preferably, after determining that the sector has been overwritten by dirty data, the method further includes:
[0051] The discard module is used to discard historical data obtained by write-back operation.
[0052] To solve the above technical problems, the present application further provides a data writing device, comprising:
[0053] memory for storing computer programs;
[0054] The processor is used to point to the computer program to implement the steps of the data writing method.
[0055] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements all the steps of the above-mentioned data writing method.
[0056] The present application provides a data writing method for a RAID configured with DDR, comprising: obtaining data in the DDR and marking the data as dirty data in a dirty RAM (dirty RAM); reading historical data and transmitting a write operation from a disk to the DDR to an AXI slave; determining whether the write operation hits a tag set in a storage resource of the RAID; if the write operation does not hit the tag, directly outputting the write operation; if the write operation hits the tag, discarding historical data overwritten by the dirty data based on the dirty flag stored in the dirty RAM, so that historical data in a cache line in the cache is replaced by dirty data, where the dirty data is the data transmitted corresponding to the write operation; and transmitting the remaining historical data to the DDR based on the write operation. Compared to existing data writing methods, which require complex scheduling to partially rewrite a RAID cache line, more time is required to determine which parts of the cache line should be retained and which should be overwritten. Furthermore, when the data written to the cache line is divided into multiple segments, the RAID needs to perform multiple discontinuous read operations to fill the cache line. This performance loss is particularly significant for mechanical hard drives with extremely slow data processing speeds. Determining that a hit tag requires data processing, and the dirty flag avoids unnecessary write-back operations and improves the write performance of write data. Therefore, this application avoids the waste of reading data operations by determining the hit tag and the dirty flag, and improves the write performance of write data.
[0057] The present application also provides a data writing device, equipment and medium, with the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0059] Figure 1 This is a schematic diagram of the RAID structure;
[0060] Figure 2 A flow chart of a data writing method provided in an embodiment of the present application;
[0061] Figure 3 A structural diagram of a data writing device provided in an embodiment of the present application;
[0062] Figure 4 This is a structural diagram of a data writing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0064] The core of this application is to provide a data writing method, apparatus, device and medium, which can avoid wasting data reading operations and improve the writing performance of the disk array.
[0065] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0066] RAID is generally a storage system composed of multiple disks, with the data storage relationship between the disks defined by an algorithm. Common RAID algorithms include 0, 1, 5, 6, 10, 50, and 60, each of which stores data differently on the disks. It should be noted that RAID-5 and / or RAID-6 are scheduled based on user-defined "stripe" units. A stripe is a user-defined unit of data length and is the unit used in the RAID algorithm to split addresses and rotate data between different array members.
[0067] Figure 1 This is a schematic diagram of the RAID structure, as shown in Figure 1As shown, the RAID should be configured with three buses: the AHB bus for CPU configuration and data access; the AXI Slave bus for receiving disk write requests; and the AXI Master bus for forwarding write requests to the DDR. It should be further explained that the resources within the cache can be divided into three categories: storage resources, including configuration registers (the Reg module in the figure), Tag RAM, Dirty RAM, etc.; triggered algorithms, which are acceleration functions actively invoked by the CPU through configuration registers; and spontaneous algorithms, which automatically start when receiving hardware access, namely the Dirty Merge algorithm. This algorithm module automatically filters and forwards disk write requests.
[0068] The specific content of the tag in the storage resource is as follows:
[0069] 0x30200000, Tag RAM: 256 * (16 dwords), stores the disk sectors and attributes of 256 tags. Each tag consists of: a 48-bit virtual disk start sector (64 bits); a 48-bit virtual disk end sector (64 bits); a 48-bit physical disk start sector (64 bits); a 32-bit dirty_base pointer, which records the starting address of the dirty RAM corresponding to the tag; 32-bit attributes, which record software scheduling information such as locks; and an 8*32-bit reserved placeholder. 0x30280000, Addr64 Array: 256 * (64 bits), stores the DDR addresses of the 256 tags. 0x302C0000, Valid Array: 256 * (1 bit), indicates whether the 256 tags are occupied. 0x302E0000, LRU Array: 256 * (8 bits), records the order in which the 256 tags were last accessed. 0x302A0000, Size Mapping Array: 256 * (3 bits), records which of the 8 sizes the 256 tags are mapped to. 0x30000990, Size Array: 8 * (32 bits), records up to 8 sizes for selection.
[0070] The specific content of Dirty in the storage resource is as follows:
[0071] 0x30100000, Dirty RAM: 8Mbit, records the data rewrite status of up to 8M sectors in the cache. The data area of the cache is a dedicated DDR address range allocated by software for storing cached data.
[0072] It's also important to note that the Dirty Merge algorithm evaluates each DDR write operation initiated by the disk controller, queries the corresponding dirty bit based on the write address, and discards any historical data marked dirty = 1. To achieve this, each CacheLine must store its DDR address mapping range in a hardware register. An address range is uniquely determined by its starting address and length. The starting address of each CacheLine is stored in the Address64 Array, while the length is determined by a two-level mapping between the Mapping and Size Arrays. Typically, each CacheLine within a RAID is of equal length and is an integer multiple of the number of disks and the stripe size. This simplifies management and allows the calculation of the CacheLine number and physical disk address from the virtual disk address. The RAID structure diagram mentioned above can also be used with other RAID algorithms, but the performance improvement will not be as significant as with RAID-5 or RAID-6.
[0073] Figure 2 A flow chart of a data writing method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the data writing method is applied to a RAID configured with DDR, and includes:
[0074] S20: Get the data in DDR and mark the data as dirty data in dirty RAM;
[0075] S21: Read historical data and transmit the disk's write operation to DDR to AXI Slave;
[0076] S22: Determine whether the write operation hits the tag set in the storage resource of the RAID;
[0077] If the write operation does not hit the tag, then go to step S23: directly output the write operation;
[0078] If the write operation hits the tag, the process proceeds to step S24: discarding the historical data overwritten by the dirty data according to the dirty flag stored in the dirty RAM;
[0079] So that the historical data in a certain CacheLine in the Cache is replaced by dirty data, wherein the dirty data is the historical data transmitted corresponding to the write operation S25: the remaining historical data is transmitted and written into the DDR according to the write operation.
[0080] In this embodiment, in order to improve the write performance of RAID-5 and / or RAID-6, the DDR mentioned should be a large-capacity DDR, and the DDR is used as a cache, where a CacheLine is a data row in the cache, a group of data with consecutive addresses, and data enters or exits the cache in units of rows; dirty data refers to valid data newly written to the cache by the CPU, which is the latest data that needs to be retained. It should be noted that the write operations issued by the CPU are managed in the form of a CacheLine. After merging scattered write operations (total size is usually less than 1MB, and may be less than 100KB after being distributed to each disk) into large-package write operations of the size of a CacheLine (no less than 1MB after being distributed to each disk), the number of disk reads and writes can be reduced, improving the overall system performance.
[0081] The present application provides a data writing method for a RAID configured with DDR, comprising: obtaining data in the DDR and marking the data as dirty data in a dirty RAM (dirty RAM); reading historical data and transmitting a write operation from a disk to the DDR to an AXI slave; determining whether the write operation hits a tag set in a storage resource of the RAID; if the write operation does not hit the tag, directly outputting the write operation; if the write operation hits the tag, discarding historical data overwritten by the dirty data based on the dirty flag stored in the dirty RAM, so that historical data in a cache line in the cache is replaced by dirty data, where the dirty data is the data transmitted corresponding to the write operation; and transmitting the remaining historical data to the DDR based on the write operation. Compared to existing data writing methods, which require complex scheduling to partially rewrite a RAID cache line, more time is required to determine which parts of the cache line should be retained and which should be overwritten. Furthermore, when the data written to the cache line is divided into multiple segments, the RAID needs to perform multiple discontinuous read operations to fill the cache line. This performance loss is particularly significant for mechanical hard drives with extremely slow data processing speeds. Determining that a hit tag requires data processing, and the dirty flag avoids unnecessary write-back operations and improves the write performance of write data. Therefore, this application avoids the waste of reading data operations by determining the hit tag and the dirty flag, and improves the write performance of write data.
[0082] Based on the above embodiment, as a more preferred embodiment, after transmitting the write operation of the disk to the DDR to the AXI Slave, and before determining whether the write operation hits the tag set in the storage resource of the RAID, the following is further included:
[0083] The upper 32 bits of the write address corresponding to the write operation received by the AXI Slave are replaced with the upper 32 bits of the write address corresponding to the DDR, so that dirty data can be written to the DDR.
[0084] In addition, when a write operation hits a tag, before discarding the historical data that will be overwritten by the dirty data based on the dirty flag stored in the dirty RAM, the following steps are also included:
[0085] Get the tag number corresponding to the tag hit by the write operation stored in the tag RAM.
[0086] When a write operation falls within a certain interval (e.g., the i-th one), we say that the write operation "hit" tag i. The comparison circuit outputs the hit status, the hit tag number i, and the hit interval start address Addr64[i] to the upper-level circuit for subsequent judgment.
[0087] At this time, historical data that is overwritten by dirty data and discarded based on the dirty flag stored in the dirty RAM includes:
[0088] Determine whether the sector has been overwritten by dirty data based on the dirty flag;
[0089] If the dirty flag is not 1, it is determined that the sector is not overwritten by dirty data;
[0090] If the dirty flag is 1, it is determined that the sector has been overwritten by dirty data.
[0091] Preferably, after obtaining the tag number corresponding to the tag hit by the write operation stored in the tag RAM, and before discarding the historical data overwritten by the dirty data according to the dirty flag stored in the dirty RAM, the method further includes:
[0092] Query and obtain the corresponding dirty_base according to the tag number. The dirty_base is used to represent the starting address of all sectors in the dirty RAM corresponding to the tag hit by the write operation;
[0093] Read dirty_word according to dirty_base. Dirty_word is 32-bit data and is used to represent the rewrite status of the data stored in the sector corresponding to the tag. Dirty_word is 32-bit data.
[0094] The dirty flag is selected according to dirty_word. The dirty flag is used to determine whether the sector has been overwritten by dirty data.
[0095] It should be noted that after determining that the sector is not overwritten by dirty data, the process further includes: writing the sector fully with historical data obtained by the write-back operation. Similarly, after determining that the sector is overwritten by dirty data, the process further includes: discarding the historical data obtained by the write-back operation.
[0096] Specifically, Dirty Merge outputs write operations that do not match any tags as is. This data is not managed by the cache and may be a Command List writeback from the disk or other control information.
[0097] For a write operation that hits the i-th tag, Dirty Merge subtracts the corresponding Addr64[i] from the address to determine the sector number in CacheLine i to which the address corresponds (Note: When the CPU reads and writes data in RAID, the sector must be used as the minimum unit, and one sector equals 512KB). The dirty flag of the sector is then read from the corresponding address in the Dirty RAM. If the sector is dirty = 1, it indicates that new data already exists in this sector, and the old data from the disk should be discarded. If the sector is dirty = 0, the old data should be written to the DDR.
[0098] In addition, when Dirty Merge receives two write operations, the specific process is as follows:
[0099] When there is no data stored in the cache, the dirty data corresponding to the first write operation is placed in a CacheLine in the cache. When the second write operation is received, the dirty data corresponding to the second write operation is placed in a CacheLine in the cache. The CacheLine where the dirty data corresponding to the second write operation is placed is different from the CacheLine where the dirty data corresponding to the first write operation is placed. When the dirty data corresponding to the two write operations are all placed, the historical data is used to fill the remaining cache space with a write-back operation, and the historical data and dirty data are verified to generate verification data. The final cache should contain historical data, dirty data, and verification data.
[0100] When the data is stored in the Cache, the dirty data corresponding to the first write operation covers the history data, and the dirty data is placed in a CacheLine in the Cache. When the second write operation is received, the dirty data corresponding to the second write operation covers the history data, and the dirty data is placed in a CacheLine in the Cache. The CacheLine in which the dirty data corresponding to the second write operation is placed is different from the CacheLine in which the dirty data corresponding to the first write operation is placed. When the dirty data corresponding to the two write operations is completely placed, the history data and the dirty data are checked to generate check data, and finally the Cache contains the history data, the dirty data and the check data.
[0101] In the above embodiment, the write data method is described in detail, and the application also provides a corresponding embodiment of a write data device. It should be noted that the application describes the embodiment of the device part from two angles, one is based on the functional module angle, and the other is based on the hardware angle.
[0102] Figure 3 A structure diagram of a write data device provided in the embodiment of the application is shown in FIG. 1, and the application also provides a write data device applied to a RAID provided with a DDR, which comprises: Figure 3
[0103] A first obtaining module 30 is configured to obtain data in the DDR and mark the data as dirty data in a dirty RAM.
[0104] A first reading module 31 is configured to read history data and transmit the write operation of the disk to the DDR to the AXI Slave.
[0105] A first judging module 32 is configured to judge whether the write operation hits a Tag provided in a storage resource of the RAID.
[0106] If the write operation does not hit the Tag, a triggering output module 33 is triggered to directly output the write operation.
[0107] If the write operation hits the Tag, a covering and discarding module 34 is triggered to discard history data to be covered by dirty data according to a dirty mark stored in the dirty RAM, so that the history data in a certain CacheLine in the Cache is replaced by the dirty data, wherein the dirty data is data transmitted corresponding to the write operation.
[0108] A transmitting module 35 is configured to transmit and write the remaining history data into the DDR according to the write operation.
[0109] In addition, the device further comprises the following modules:
[0110] Preferably, after transmitting the write operation of the disk to the DDR to the AXI Slave and before determining whether the write operation hits the tag set in the storage resource of the RAID, the method further includes:
[0111] The replacement module is used to replace the upper 32 bits of the write address corresponding to the write operation received by the AXI Slave with the upper 32 bits of the write address corresponding to the DDR, so that dirty data can be written to the DDR.
[0112] Preferably, when a write operation hits a tag, before discarding historical data overwritten by dirty data according to the dirty flag stored in the dirty RAM, the process further includes:
[0113] The second acquisition module is used to obtain the tag number corresponding to the tag hit by the write operation stored in the Tag RAM.
[0114] Preferably, discarding historical data overwritten by dirty data according to the dirty flag stored in the dirty RAM includes:
[0115] The second judgment module is used to judge whether the sector has been overwritten by dirty data according to the dirty flag;
[0116] If the dirty flag is not 1, it is determined that the sector is not overwritten by dirty data;
[0117] If the dirty flag is 1, it is determined that the sector has been overwritten by dirty data.
[0118] Preferably, after obtaining the tag number corresponding to the tag hit by the write operation stored in the tag RAM, and before discarding the historical data overwritten by the dirty data according to the dirty flag stored in the dirty RAM, the method further includes:
[0119] The query and acquisition module is used to query and obtain the corresponding dirty_base according to the tag number. The dirty_base is used to represent the starting address of all sectors in the dirty RAM corresponding to the tag hit by the write operation;
[0120] The second reading module is used to read dirty_word according to dirty_base, where dirty_word is 32-bit data and is used to represent the rewrite status of the data stored in the sector corresponding to the tag, and dirty_word is 32-bit data;
[0121] The selection module is used to select the dirty flag according to dirty_word. The dirty flag is used to determine whether the sector has been overwritten by dirty data.
[0122] Preferably, after determining that the sector is not covered by dirty data, the method further includes:
[0123] The write module is used to fill the sectors with historical data obtained by the write-back operation.
[0124] Preferably, after determining that the sector has been overwritten by dirty data, the method further includes:
[0125] The discard module is used to discard historical data obtained by write-back operation.
[0126] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, and they will not be repeated here.
[0127] Figure 4 This is a structural diagram of a data writing device provided in an embodiment of the present application, such as Figure 4 As shown, a data writing device includes:
[0128] Memory 40, for storing computer programs;
[0129] The processor 41 is configured to implement the steps of the data writing method mentioned in the above embodiment when executing a computer program.
[0130] The data writing device provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0131] Among them, the processor 41 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 41 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 41 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 41 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 41 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0132] The memory 40 may include one or more computer-readable storage media, which may be non-transitory. The memory 40 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 40 is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor 41, it can implement the relevant steps of the data writing method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 40 may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include but is not limited to data writing devices, etc.
[0133] In some embodiments, the data writing device may further include a display screen, an input and output interface, a communication interface, a power supply, and a communication bus.
[0134] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the data writing device, and may include more or fewer components than shown in the figure.
[0135] The data writing device provided in the embodiment of the present application includes a memory 40 and a processor 41. When the processor 41 executes the program stored in the memory 40, it can implement the data writing method.
[0136] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiment.
[0137] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium and executes all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory), ROM, random access memory (Random Access Memory, RAM), disk or optical disk, and other media that can store program code.
[0138] The above is a detailed introduction to a data writing method, device, equipment and medium provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0139] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
Claims
1. A data writing method, characterized in that: Applicable to RAID configurations with DDR, including: Obtain data in the DDR and mark the data as dirty data in the dirty RAM; Read historical data and transmit the disk's write operation to the DDR to the AXI Slave; Determine whether the write operation hits a tag set in a storage resource of the RAID; If the write operation does not hit the tag, the write operation is directly output; If the write operation hits the tag, the historical data overwritten by the dirty data is discarded according to the dirty flag stored in the dirty RAM, so that the historical data in a certain CacheLine in the cache is replaced by the dirty data, wherein the dirty data is the data transmitted corresponding to the write operation; The remaining historical data are transmitted and written into the DDR according to the write operation.
2. The data writing method according to claim 1, wherein: After transmitting the write operation of the disk to the DDR to the AXI Slave and before determining whether the write operation hits the tag set in the storage resource of the RAID, the method further includes: The upper 32 bits of the write address corresponding to the write operation received by the AXI Slave are replaced with the upper 32 bits of the write address corresponding to the DDR, so that the dirty data is written into the DDR.
3. The data writing method according to claim 1, wherein: When the write operation hits the tag, before discarding the historical data that is to be overwritten by the dirty data according to the dirty flag stored in the dirty RAM, the method further includes: Obtain a tag number corresponding to the tag hit by the write operation and stored in the tag RAM.
4. The data writing method according to claim 3, wherein: The discarding of the historical data to be overwritten by the dirty data according to the dirty flag stored in the dirty RAM includes: Determine whether the sector has been overwritten by the dirty data according to the dirty flag; If the dirty flag is not 1, it is determined that the sector is not overwritten by the dirty data; If the dirty flag is 1, it is determined that the sector has been overwritten by the dirty data.
5. The data writing method according to claim 4, characterized in that: After obtaining the tag number corresponding to the tag hit by the write operation stored in the tag RAM, and before discarding the historical data that is overwritten by the dirty data according to the dirty flag stored in the dirty RAM, the method further includes: Query and obtain the corresponding dirty_base according to the tag number, where the dirty_base is used to represent the starting addresses of all sectors in the dirty RAM corresponding to the tag hit by the write operation; Reading dirty_word according to the dirty_base, wherein the dirty_word is 32-bit data and is used to represent the rewrite status of the data stored in the sector corresponding to the tag, and the dirty_word is 32-bit data; A dirty flag is selected according to the dirty_word, and the dirty flag is used to determine whether the sector has been overwritten by the dirty data.
6. The data writing method according to claim 5, characterized in that: After determining that the sector is not covered by the dirty data, the method further includes: The historical data obtained by the write-back operation is written to fill the sector.
7. The data writing method according to claim 5, characterized in that: After determining that the sector has been covered by the dirty data, the method further includes: The historical data obtained by the write-back operation is discarded.
8. A data writing device, characterized in that: Applicable to RAID configurations with DDR, including: A first acquisition module is used to acquire data in the DDR and mark the data as dirty data in the dirty RAM; A first reading module is used to read historical data and transmit the write operation of the disk to the DDR to the AXI Slave; A first judgment module is used to judge whether the write operation hits a tag set in the storage resource of the RAID; If the write operation does not hit the tag, the output module is triggered to directly output the write operation; If the write operation hits the tag, the overwriting and discarding module is triggered to discard the historical data overwritten by the dirty data according to the dirty flag stored in the dirty RAM, so that the historical data in a certain CacheLine in the cache is replaced by the dirty data, wherein the dirty data is the data transmitted corresponding to the write operation; A transmission module is used to transmit and write the remaining historical data into the DDR according to the write operation.
9. A data writing device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data writing method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data writing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Device and method for executing write hit operation of high-speed buffer memory at single period
CN102646071A
CACHE refreshing method and device
CN115268781A