CN117093160A - Data processing method and device of Cache, computer equipment and medium - Google Patents

Data processing method and device of Cache, computer equipment and medium Download PDF

Info

Publication number
CN117093160A
CN117093160A CN202311348634.1A CN202311348634A CN117093160A CN 117093160 A CN117093160 A CN 117093160A CN 202311348634 A CN202311348634 A CN 202311348634A CN 117093160 A CN117093160 A CN 117093160A
Authority
CN
China
Prior art keywords
cache
command
mode
data
read
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311348634.1A
Other languages
Chinese (zh)
Other versions
CN117093160B (en
Inventor
巨新刚
闫鑫
陈静静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202311348634.1A priority Critical patent/CN117093160B/en
Publication of CN117093160A publication Critical patent/CN117093160A/en
Application granted granted Critical
Publication of CN117093160B publication Critical patent/CN117093160B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0842Multiuser, multiprocessor or multiprocessing cache systems for multiprocessing or multitasking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • G06F12/0871Allocation or management of cache space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • G06F12/0873Mapping of cache memory to specific storage devices or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0683Plurality of storage devices
    • G06F3/0689Disk arrays, e.g. RAID, JBOD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to a data processing method, a data processing device, computer equipment and a medium of a Cache. The method comprises the following steps: receiving a Cache command; performing Cache searching according to the Cache command to obtain a searching result; determining a pre-configured Cache operation mode according to a Cache command and a search result; when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into the magnet, and executing the Cache update. By adopting the method, more complex RAID Cache application scenes can be supported.

Description

Data processing method and device of Cache, computer equipment and medium
Technical Field
The present application relates to the field of data storage technologies, and in particular, to a data processing method and apparatus for a Cache, a computer device, and a medium.
Background
With the development of data storage technology, RAID (Redundant Array of Independent Disks, redundant array of disk) technology has emerged, where a plurality of independent disk devices are combined in different manners to form a storage array group, so that higher storage performance than a single disk can be provided, and redundancy is increased to achieve different levels of data protection. In order to further improve IO performance of the RAID system, RAID Cache technology is adopted. RAID controllers typically plug in DRAM (dynamic random Access memory) as a buffer space for I/O data.
In the traditional technology, for write Cache, the host IO data is written into the DRAM to complete the current IO write operation, and a completion mark can be fed back to the host. However, in the conventional technology, only a simple write Cache flow can be achieved, a more complex write Cache flow cannot be supported, and the requirement of the RAID Controller on the RAID Cache in a more complex application scene cannot be met.
Disclosure of Invention
Based on the foregoing, it is necessary to provide a data processing method, apparatus, computer device and medium for a Cache.
A data processing method of Cache includes:
receiving a Cache command;
performing Cache searching according to the Cache command to obtain a searching result;
determining a pre-configured Cache operation mode according to a Cache command and a search result;
when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into a disk, and executing Cache updating.
In one embodiment, determining the Cache operation mode according to the Cache command and the search result includes:
according to the Cache commands, the search results and the pre-established configuration data, determining the Cache operation modes, wherein the configuration data comprises the command information of each Cache operation mode and each Cache command and the mapping relation of each search result.
In one embodiment, the performing the Cache lookup according to the Cache command to obtain the lookup result includes:
carrying out hash calculation according to the Cache command to obtain a hash value;
reading a target hash table item corresponding to a hash value in a hash table which is created in advance, wherein the target hash table item comprises state information of a Cache;
when the state information of the Cache indicates that the disk data is in the Cache, determining that the search result is that the data corresponding to the Cache command is hit in the Cache.
In one embodiment, the state information of the Cache includes a plurality of state information bits and corresponding values, and the recovering the Cache resource according to the search result includes:
and updating the value of each state information bit to be invalid so as to recover the Cache resources.
In one embodiment, the status information bits include a write lock status and a modification status, and before writing the data corresponding to the Cache command into the Cache, the method further includes:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and the search result is that the data corresponding to the Cache command is hit in the Cache, updating the writing locking state and the modification state in the target hash table to be effective;
When the Cache operation mode is a mode that the write Cache does not recycle the Cache resources and the search result is that the data corresponding to the Cache command is not hit in the Cache, the write locking state is updated to be effective.
In one embodiment, the status information bit further includes a status of whether the disk data is in the Cache, and when the status of the disk data is valid, the executing the Cache update includes:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and whether the disk data in the target hash table item are in the Cache state, the write locking state and the modification state are valid or not, updating the write locking state to be invalid so as to execute the Cache update;
when the Cache operation mode is a mode that the Cache is written and the Cache resources are not recycled, and whether the disk data is in the Cache state and the modification state is invalid, if the write locking state is valid, whether the disk data is updated in the Cache state is valid, and if the write locking update is invalid, executing the Cache update.
In one embodiment, the above state information bit further includes a Cache storage address, and when the Cache operation mode is a mode in which the write Cache does not recycle the Cache resource and the search result is that the data corresponding to the Cache command hits in the Cache, writing the data corresponding to the Cache command into the Cache includes:
Writing data corresponding to the Cache command into a space corresponding to the Cache storage address;
the mode of writing the Cache and not recycling the Cache resources comprises a mode of writing the Cache and distributing, and when the Cache operation mode is the mode of writing the Cache and distributing, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the method further comprises the following steps:
distributing a new Cache storage address according to the search result;
writing data corresponding to the Cache command into the Cache, including:
and writing the data corresponding to the Cache command into a space corresponding to the new Cache storage address.
In one embodiment, the method further comprises:
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address and the search result is that the data corresponding to the Cache command is hit in the Cache, the data in the designated space of the read Cache storage address is written back to the host, and the Cache update is executed;
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command in the read disk is returned to the host, and the Cache update is executed.
In one embodiment, the method further comprises:
When the Cache operation mode is a mode of reading the Cache and distributing the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command is read from the disk and returned to the host, a new Cache storage address is distributed, the data corresponding to the Cache command is written into the new Cache storage address, and the Cache update is executed.
In one embodiment, the state information further includes a read unassigned locking state, and before the data in the memory address assignment space of the read Cache is written back to the host, the method further includes:
the read unassigned lock state is asserted.
When the Cache operation mode is a mode that the read Cache does not allocate a Cache storage address, and the search result is that data corresponding to a Cache command hits in the Cache, the executing the Cache update includes:
the read unassigned lock state is set to invalid.
In one embodiment, the status information bit further includes a read allocation lock status, and before the data corresponding to the read Cache command from the disk is returned to the host, the method further includes:
setting the read allocation lock state to active;
when the Cache operation mode is a mode of reading the Cache and allocating a Cache storage address, and the search result is that data corresponding to a Cache command is missed in the Cache, the executing the Cache update includes:
The read allocation lock state is set to invalid.
In one embodiment, the method further comprises:
when the Cache operation mode is the disk-dropping operation and the search result is that the data corresponding to the Cache command is not hit in the Cache, writing the data in the space corresponding to the Cache storage address into a disk, and updating the value of each state information bit to be invalid so as to recover the Cache resources.
The data processing system of disk array Cache includes disk array controller and disk, the above-mentioned disk array controller is connected with disk, the above-mentioned disk array controller includes Cache processing device and read-write device, in which the Cache processing device is connected with read-write device,
the Cache processing device is used for receiving the Cache command, executing Cache searching according to the Cache command to obtain a searching result, determining a Cache operation mode according to the Cache command and the searching result, and recovering the Cache resource according to the searching result when the Cache operation mode is a mode of writing the Cache and recovering the Cache resource and the searching result is that the data corresponding to the Cache command is hit in the Cache;
the read-write device is used for writing data corresponding to the Cache command into the disk;
the Cache processing device is also used for executing Cache updating.
In one embodiment, the above-mentioned Cache command includes a plurality of Cache processing devices, the Cache processing device includes a command queue, a Hash management unit, and a Cache processing unit, the command queue is connected to the Hash management unit, the Hash management unit is connected to the Cache processing unit, where,
the command queue is used for storing a plurality of Cache commands, determining the Cache operation mode of each Cache command and distributing each Cache command to the Hash management unit;
the Hash management unit is used for carrying out Hash calculation according to the Cache command and distributing the Cache command to the Cache processing unit according to the Hash value obtained by calculation;
the Cache processing unit is used for executing Cache searching according to each Cache command to obtain a searching result, and when the Cache operation mode of the target Cache command is a mode of writing the Cache and recovering the Cache resources and the searching result of the target Cache command is that the data corresponding to the Cache command hits in the Cache, the Cache resources are recovered according to the searching result.
In one embodiment, the Hash management unit includes a mutex lock, a plurality of buffers, and a Hash calculation unit corresponding to each buffer, the Cache processing unit includes a Cache lookup subunit, a Cache update subunit, and a Cache recovery subunit,
The command queue is also used for determining the Cache operation type corresponding to each Cache command according to each Cache command, and distributing each Cache command to the corresponding buffer according to the Cache operation type corresponding to each Cache command and the association relation between each buffer and the Cache operation type, wherein the operation type comprises a Cache searching operation, a Cache updating operation and a Cache recycling operation;
the hash calculation unit is used for reading each Cache command from the corresponding buffer and calculating the hash value of each Cache command;
the mutual exclusion lock is used for locking according to hash values corresponding to all the Cache commands, and when the target Cache commands are locked, the target Cache commands are distributed to corresponding subunits in the Cache processing unit according to Cache operation types corresponding to the target Cache commands;
the Cache searching subunit is used for executing Cache searching according to each Cache command to obtain a searching result;
the operation type of the Cache updating subunit for processing is Cache updating operation;
the Cache recovery subunit is configured to, when the Cache operation mode of the target Cache command is a mode of writing the Cache and recovering the Cache resource, and the search result of the target Cache command is that the data corresponding to the Cache command hits in the Cache, recover the Cache resource according to the search result.
In one embodiment, the number of at least one subunit in the Cache lookup subunit includes a plurality of subunits.
The data processing device of a kind of disk array Cache, the above-mentioned device is applied to the disk array controller, the disk array controller is connected with host computer, the disk array controller is still connected with magnetic disk, the disk array controller includes the Cache, the above-mentioned device includes:
the receiving module is used for receiving the Cache command;
the searching module is used for executing the Cache searching according to the Cache command to obtain a searching result;
the determining module is used for determining a pre-configured Cache operation mode according to the Cache command and the search result;
and the read-write module is used for recovering the Cache resources according to the search result when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command is hit in the Cache, writing the data corresponding to the Cache command into the disk and executing the Cache update.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
receiving a Cache command sent by a host;
Performing Cache searching according to the Cache command to obtain a searching result;
determining a pre-configured Cache operation mode according to a Cache command and a search result;
when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into a disk, and executing Cache updating.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
receiving a Cache command sent by a host;
performing Cache searching according to the Cache command to obtain a searching result;
determining a pre-configured Cache operation mode according to a Cache command and a search result;
when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into a disk, and executing Cache updating.
According to the data processing method, the device, the computer equipment and the medium of the Cache, the Cache is carried out according to the Cache command sent by the host through the disk array controller, the Cache operation mode is determined according to the search result, and is different from the simple read-write mode in the traditional technology. The application can process more complex write Cache flow and support more complex application scenes.
Drawings
FIG. 1 is an application environment diagram of a data processing method of a Cache in one embodiment;
FIG. 2 is a schematic diagram of a data processing flow of a RAID WriteBack mode in one embodiment;
FIG. 3 is a schematic diagram of a data processing flow of RAID Write Through mode in one embodiment;
FIG. 4 is a schematic diagram of a data processing flow of RAID Write Allocate mode in one embodiment;
FIG. 5 is a schematic diagram of a data processing flow of RAID No Write Allocate mode in one embodiment;
FIG. 6 is a schematic diagram of a data processing flow of a RAID ReadBack mode in one embodiment;
FIG. 7 is a schematic diagram of a data processing flow of RAID Read Through mode in one embodiment;
FIG. 8 is a schematic diagram of a data processing flow of RAID Read Allocate mode in one embodiment;
FIG. 9 is a schematic diagram of a data processing flow of a disk-drop Cache in one embodiment;
FIG. 10 is a block diagram of a data processing system of a disk array Cache in another embodiment;
FIG. 11 is a block diagram of a Cache processing device in one embodiment;
FIG. 12 is a schematic diagram of an operation flow of a write Cache-nricycle scheme in one embodiment;
FIG. 13 is a schematic diagram of an operational flow of RAID No Write Allocate mode in one embodiment;
FIG. 14 is a schematic flow diagram of the operation of a RAID Read Back mode in one embodiment;
FIG. 15 is a schematic flow chart of the RAID Read Through mode of operation in one embodiment;
FIG. 16 is a schematic flow diagram of the operation of the Read allocation mode in one embodiment;
FIG. 17 is a schematic diagram of an operation flow of a disk-drop Cache in one embodiment;
FIG. 18 is a block diagram of a data processing apparatus of a disk array Cache in one embodiment;
fig. 19 is an internal structural view of the computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In one embodiment, as shown in fig. 1, a data processing method of a Cache is provided, where the method includes:
s11, receiving a Cache command.
In the application, the method can be applied to a disk array controller, the disk array controller is connected with a host, the disk array controller is also connected with a disk, and the disk array controller comprises a Cache. Specifically, the disk array Controller may be a RAID Controller. The Cache is a memory on the RAID Controller for storing temporary data that is small and needs to be accessed quickly. In the application, the RAID Controller uses the Cache to store the data written into the RAID array, thereby avoiding frequent access to the disk and improving the performance of the system. When the RAID Controller receives a write request, it will store the data in the Cache and then write the data to disk periodically.
The host sends an IO (Input/Output) command to the disk array controller, and the disk array controller analyzes the IO to obtain the Cache command.
S12, executing Cache searching according to the Cache command to obtain a searching result.
The Cache searching refers to searching from the hash table according to the Cache command to find out whether the data corresponding to the Cache command hits in the Cache. The hash table is created in advance for managing the Cache data structure.
Further, the search results may include hit caches and miss caches. The hit of the Cache means that the data corresponding to the Cache command is hit in the Cache. The missing Cache refers to that data corresponding to a Cache command is missed in the Cache.
S13, determining a pre-configured Cache operation mode according to the Cache command and the search result.
The above-mentioned Cache operation mode refers to a processing flow mode of the Cache determined according to information of the Cache command. Specifically, a plurality of Cache operation modes are preconfigured in the application, wherein the Cache operation modes not only comprise a read Cache and a write Cache in the traditional technology, but also comprise a mode for further subdividing the read Cache and the write Cache modes. For example, the write Cache may include a write Cache-cycle mode, which corresponds to the write Cache and recovery of Cache resources described above.
Further, the Write Cache-nricycle scheme here may also include a RAID Write Back scheme and a RAID Write Through scheme. The RAID Write Back mode herein refers to an operation of writing data of a Write command into the RAID Cache when the Cache hit (Cache lookup result miss) is written. The RAID Write Through mode refers to an operation of writing data of a write command into the RAID Cache and then writing the data into the disk when writing the Cache hit.
S14, when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into a disk, and executing Cache updating.
In the application, a plurality of Cache operation modes and operation flows corresponding to the Cache operation modes are pre-configured, wherein the operation flows comprise a mode of writing the Cache and recovering the Cache resources. Specifically, in the mode of writing the Cache and recovering the Cache resource, the operation flow to be executed is as follows: and (3) firstly searching the Cache, if the Cache hit (corresponding to the hit Cache) is found, performing Cache recovery processing, otherwise, not processing, and writing the data of the write command into the disk after the completion of the recovery processing. The above-mentioned Cache update refers to updating state data of the Cache, specifically, updating operation of the hash table after the Cache is read or written.
In one embodiment, determining the Cache operation mode according to the Cache command and the search result may include:
according to the Cache commands, the search results and the pre-established configuration data, determining the Cache operation modes, wherein the configuration data comprises the command information of each Cache operation mode and each Cache command and the mapping relation of each search result.
In the application, the Cache command comprises the command type, the address information of the disk data to be accessed, the data size and other information. The command types herein may include read commands and write commands, among others. The address information here may include the start address of the logical block in the disk. The search result may include a Cache hit (Cache hit) and a Cache miss (Cache miss), where the Cache hit refers to that the disk data that needs to be accessed by the input and output hits in the Cache. The Cache miss refers to that the disk data which is input and output and needs to be accessed is missed in the Cache.
The configuration data comprises various reference Cache operation modes and corresponding Cache operation flows under the reference Cache operation modes. The Cache operation flow comprises a search result and a Cache operation type. The Cache operation types can comprise Cache searching, cache updating and Cache recycling. Specifically, the Cache operation flow may further include writing Cache, reading Cache, writing disk, reading disk, allocating Cache storage address, and the like.
The method and the device match specific command information in the Cache command with specific operation flows in the Cache operation modes of the references, and match the search result of the Cache search according to the input and output information with the search result corresponding to the Cache operation modes of the references so as to determine the Cache operation modes.
According to the method and the device for processing the Cache command, the Cache command can be matched with the configured Cache operation mode, the Cache command is classified into the corresponding Cache operation mode, the Cache command is responded according to the processing flow of the Cache operation mode, and the configured Cache operation mode and the Cache command can be compatible through the method and the device for processing the Cache command, so that more and more complex Cache operation modes can be supported.
In one embodiment, the performing the Cache lookup according to the Cache command to obtain the lookup result may include:
carrying out hash calculation according to the Cache command to obtain a hash value;
reading a target hash table item corresponding to a hash value in a hash table which is created in advance, wherein the target hash table item comprises state information of a Cache;
when the state information of the Cache indicates that the disk data is in the Cache, determining that the search result is that the data corresponding to the Cache command is hit in the Cache.
The Cache searching of the application refers to taking Disk information (such as dev_lba and Disk ID) in Cache command information as a Hash K value, obtaining a Hash table entry address P after Hash calculation, reading the Hash table entry according to the address P, and performing Cache searching operation. The Cache searching and recycling is only effective when the OpMode is write Cache-cycle, otherwise, the OpMode is Cache searching. The Cache search results comprise Cache hit, cache miss, hash conflict and cannot be locked. When the Hash conflicts, the Cache searching is carried out again by solving the Hash conflicts, retrying or waiting and the like. When the lock cannot be locked, the Cache searching is carried out again in a retry or waiting mode.
In the present application, the Hash table is a special data structure, which can obtain a position (P) according to a keyword (K) and a Hash algorithm, and then store the data in a Hash table entry corresponding to P. When the Cache data is required to be queried, inserted or deleted, a RAID Controller obtains the corresponding position according to the keyword and a Hash algorithm, and then reads or modifies the Hash table entry corresponding to P, so that operations such as the insertion, the query and the deletion of the Cache are realized.
Specifically, the hash table includes a plurality of entries, and each entry includes state information of the Cache. The state information of the Cache is used for indicating the state of the Cache, and specifically may include a locking state of the Cache, whether disk data is in the Cache, whether the disk data is available, and the like. The above-mentioned disk data in the Cache means that the disk data accessed by the Cache command hits in the Cache. The above-mentioned disk data in the Cache means that the disk data accessed by the Cache command hits in the Cache.
The above-mentioned execution Cache update may be implemented by updating the state information in the target entry in the hash table.
According to the method and the device, whether the data accessed by the Cache command hit in the Cache can be determined, the corresponding Cache operation mode is determined based on the search result, and the corresponding operation flow is executed according to the Cache operation mode.
In one embodiment, the above-mentioned state information of the Cache includes a plurality of state information bits and corresponding values, and the above-mentioned recovering the Cache resource according to the search result may include:
and updating the value of each state information bit to be invalid so as to recover the Cache resources.
The hash table comprises a plurality of table items, each table item comprises state information of the Cache, and the state information of the Cache comprises a plurality of state information bits and values corresponding to the state information bits. The state information bit and the corresponding value are used for indicating the operation state of the Cache or the state of the Cache. Here, the values may be 0 and 1, where 0 indicates invalid and 1 indicates valid.
In the application, the Cache recovery operation supports write Cache recovery. When the write Cache is recovered, the value of each state information bit is updated to be invalid, and the recovery of the Cache resource is completed after the update is completed. In one embodiment, the write Cache reclamation function is specifically: when the OpType is recovered by the Cache and the OpMode is written by the Cache, updating the Hash table entry and writing the Hash table entry to be all zero when the Cache hit. Writing the updated data into a Hash table, and recovering the Cache. When the Cache is in the miss, the Hash table item is not updated, and the recovery of the Cache is completed.
In one embodiment, the status information bits include a write lock status and a modification status, and before writing the data corresponding to the Cache command into the Cache, the method further includes:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and the search result is that the data corresponding to the Cache command is hit in the Cache, updating the writing locking state and the modification state in the target hash table to be effective;
when the Cache operation mode is a mode that the write Cache does not recycle the Cache resources and the search result is that the data corresponding to the Cache command is not hit in the Cache, the write locking state is updated to be effective.
In the present application, the status information bit may further include w_l: write Lock (Write Lock State), which indicates whether dev_lba data is locked while writing to Cache. When the status information bit is valid, the Hash table entry is locked during the write Cache operation. The above-mentioned status information bits further comprise a modification status M: modified indicates whether dev_lba data is Modified when writing to the Cache. The status information bit, when valid, indicates that dev_lba data is modified in the Cache. The mutual exclusion relationship between D_ L, RA _ L, rnA _L and W_L is described above.
When the search result is Cache hit and the OpMode (Cache operation mode) is write Cache-nricycle, updating the Hash table entry, setting W_L and M to be valid, writing the W_L and M into the Hash table after updating, and outputting the Cache search result: and (5) completing the Cache hit and the Cache lookup.
When the search result is Cache miss and the OpMode (Cache operation mode) is write Cache-nricycle, updating the Hash table entry, setting W_L to be valid, updating the values of the Disk ID (Disk address) and dev_lba fields in command information to the values of the Disk ID and dev_lba fields in the Hash table entry, writing the updated values into the Hash table, and outputting the Cache search result: cache miss, cache lookup is complete, where dev_lba refers to the disk's LBA (Logical Block Address ) starting address. The dev_lba data refers to disk data stored at the dev_lba address.
Specifically, the modes in which the Write Cache does not reclaim Cache resources may include a RAID Write Back mode and a RAID Write Through mode. The RAID Write Back mode refers to an operation mode of writing data of a Write command into the RAID Cache when the Cache hit is written. The RAID Write Through mode is an operation mode in which data of a write command is written into the RAID Cache and then written into the disk when the Cache hit is written.
Further, when the Cache operation mode is the RAID Write Back mode, before writing the data corresponding to the Cache command into the Cache, the following flow may be included:
s0: the Cache searching result is: cache hit. Executing S0.1;
s0.1: updating the Hash table item: reading the Hash table entry, updating W_L= '1', M= '1', and not updating other information; and writing the updated data into the Hash table. Executing S0.2;
s0.2: and outputting a Cache searching result. S1, executing;
s1: write Cache: and the RAID Controller writes the data of the write IO command to the Cache according to the search result.
Further, the modes in which the write Cache does not recycle the Cache resources may also include RAID Write Allocate mode. RAID Write Allocate is an operation mode in which an address storing write command data is allocated by the Raid Controller and data is written into the Raid Cache when writing the Cache miss.
Further, when the Cache operation mode is RAID Write Allocate mode, before writing the data corresponding to the Cache command into the Cache, the following procedure may be included:
s0: the Cache searching result is: cache miss. Executing S0.1;
s0.1: updating the Hash table item: reading a Hash table entry, updating W_L= '1', and updating a DISKID, NSID, dev _lba field in command information to a DISKID, NSID, dev _lba field of the Hash table entry; and writing the updated data into the Hash table. Executing S0.2;
S0.2: outputting a Cache searching result: and (5) writing the Cache miss into a result Cache.
In one embodiment, the status information bit further includes a status of whether the disk data is in the Cache, and when the status of the disk data is valid, the executing the Cache update includes:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and whether the disk data in the target hash table item are in the Cache state, the write locking state and the modification state are valid or not, updating the write locking state to be invalid so as to execute the Cache update;
when the Cache operation mode is a mode that the Cache is written and the Cache resources are not recycled, and whether the disk data is in the Cache state and the modification state are invalid, if the write locking state is valid, whether the disk data is updated in the Cache state is valid, and if the write locking update is invalid, the Cache update is executed.
Specifically, the status information bit may further include V, which indicates whether dev_lba data is in the Cache, and when the value of V is valid, it indicates that dev_lba data is in the Cache. Here, the dev_lba data refers to data stored at the dev_lba address in the disk, that is, data corresponding to the disk data.
In the application, after the data corresponding to the Cache command is written into the Cache, the method can further comprise Cache updating. Specifically, the Cache update includes:
when the OpType (Cache operation type) is Cache update, the OpMode is write Cache-nricycle, and both the Hash table entries V, W _L and M are valid, the Hash table entry is updated, W_L is set to be invalid, the Hash table is written after the update is completed, and the Cache update is completed.
When the Hash table item W_L is valid, V and M are invalid, updating the Hash table item, setting V to be valid, setting W_L to be invalid, updating the value of the pageIndex field in the command information to the value of the pageIndex field of the Hash table item, writing the value into the Hash table after updating, and finishing the updating of the Cache.
Specifically, when the above-mentioned Cache operation mode is RAID Write Back, after writing the data corresponding to the Cache command into the Cache, the above-mentioned method may further include:
s2: cache update, execution S2.1
S2.1: updating the Hash table item: reading the Hash table entry, and updating W_L= '0', wherein other information is unchanged; writing into the Hash table after updating is completed, and executing S2.2;
s2.2: outputting a result: and outputting a Cache update completion flag, and completing the operation of writing the Cache.
When the above-mentioned Cache operation mode is RAID Write Allocate mode, after the above-mentioned data corresponding to the Cache command is written into the Cache, the above-mentioned method may further include:
S3: cache update, execution S3.1
S3.1: updating the Hash table item: reading a Hash table entry, updating V=1 and W_L= '0', and updating a pageIndex field in command information to a pageIndex field of the Hash table entry; writing into the Hash table after updating is completed, and executing S3.2;
s3.2: outputting a result: and outputting a Cache update completion flag, and completing the operation of writing the Cache.
In one embodiment, the above state information bit further includes a Cache storage address, and when the Cache operation mode is a mode in which the write Cache does not recycle the Cache resource and the search result is that the data corresponding to the Cache command hits in the Cache, writing the data corresponding to the Cache command into the Cache may include:
writing data corresponding to the Cache command into a space corresponding to the Cache storage address;
the mode of writing the Cache and not recycling the Cache resources comprises a mode of writing the Cache and distributing, and when the Cache operation mode is the mode of writing the Cache and distributing and the search result is that the data corresponding to the Cache command is not hit in the Cache, the method further comprises the following steps:
distributing a new Cache storage address according to the search result;
the writing the data corresponding to the Cache command into the Cache may include:
and writing the data corresponding to the Cache command into a space corresponding to the new Cache storage address.
The status information bit may further include a pageIndex (corresponding to the Cache storage address described above), where the status information bit indicates a starting address of dev_lba data stored in the Cache. When the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, the Cache storage address is carried in the search result and output. Specifically, when the Cache searching result is output, the Cache hit and the pageIndex are output and written into the result Cache.
When the Cache operation mode is a mode of writing the Cache and distributing, and the search result is that the data corresponding to the Cache command is not hit in the Cache, and when the Cache search result is output, the Cache miss (which is equivalent to that the data corresponding to the Cache command is not hit in the Cache) is output, and the result is written into the Cache.
Specifically, the above-mentioned Cache operation modes may further include RAID Write Allocate mode, where when the Cache miss is written, the Raid Controller allocates an address storing the write command data, and writes the data into the Raid Cache. When the Cache operation mode is RAID Write Allocate mode, the method may further include:
s1: assign a new pageIndex: RAID Controller distributes new pageIndex according to the Cache searching result; s2, executing;
S2: write Cache: RAID Controller writes the data of the write IO command to the space specified by the new pageIndex.
According to the embodiment of the application, how to Write data into the Cache in a mode that the Write Cache does not recover the Cache resources is realized, and various complex Write Cache scenes, such as RAID Write Back, RAID Write Through, RAID Write Allocate and the like, can be supported.
Referring to FIG. 2, FIG. 2 is a schematic diagram illustrating an operation of a RAID Write Back mode in one embodiment. As shown in fig. 2, in the RAID Write Back mode, the data processing method of the Cache of the present application may include:
s0: the Cache searching result is: cache hit (Cache hit). Executing S0.1;
s0.1: updating the Hash table item: reading the Hash table entry, updating W_L= '1', M= '1', and not updating other information; and writing the updated data into the Hash table. Executing S0.2;
s0.2: outputting a Cache searching result: searching the Cache result: the Cache hit and pageIndex are written into the result Cache. S1, executing;
s1: write Cache: and the RAID Controller writes the data of the write IO command into the space specified by the pageIndex according to the search result. S2, executing;
s2: cache update, execution S2.1
S2.1: updating the Hash table item: reading the Hash table entry, and updating W_L= '0', wherein other information is unchanged; writing into the Hash table after updating is completed, and executing S2.2;
S2.2: outputting a result: and outputting a Cache update completion flag, and completing the operation of writing the Cache.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating an operation flow of RAID Write Through mode in one embodiment. As shown in fig. 3, in the RAID Write Through mode, the data processing method of the Cache of the present application may include:
s0: the Cache searching result is: cache hit. Executing S0.1;
s0.1: updating the Hash table item: reading the Hash table entry, updating W_L= '1', M= '1', and not updating other information; and writing the updated data into the Hash table. Executing S0.2;
s0.2: outputting a Cache searching result: searching the Cache result: the Cache hit and pageIndex are written into the result Cache. S1, executing;
s1: write Cache: and the RAID Controller writes the data of the write IO command into the space specified by the pageIndex according to the search result. S2, executing;
s2: writing a disc: and the RAID Controller writes the data of the write IO command to the disk according to the search result. S3, executing;
s3: cache update, execution S3.1
S3.1: updating the Hash table item: reading the Hash table entry, and updating W_L= '0', wherein other information is unchanged; writing into the Hash table after updating is completed, and executing S3.2;
s3.2: outputting a result: and outputting a Cache update completion flag, and completing the operation of writing the Cache.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating an operation flow of RAID Write Allocate mode in one embodiment. As shown in fig. 4, in the RAID Write Allocate mode, the data processing method of the Cache of the present application may include:
s0: the Cache searching result is: cache miss (Cache miss). Executing S0.1;
s0.1: updating the Hash table item: reading a Hash table entry, updating W_L= '1', and updating a DISKID, NSID, dev _lba field in command information to a DISKID, NSID, dev _lba field of the Hash table entry; and writing the updated data into the Hash table. Executing S0.2;
s0.2: outputting a Cache searching result: searching the Cache result: and writing the Cache miss into a result Cache. S1, executing;
s1: allocate a new pageIndex (Cache memory address corresponds to the memory address in the figure): RAID Controller distributes new pageIndex according to the Cache searching result; s2, executing;
s2: write Cache: RAID Controller writes the data of the write IO command to the space specified by the pageIndex. S3, executing;
s3: cache update, execution S3.1
S3.1: updating the Hash table item: reading a Hash table entry, updating V=1 and W_L= '0', and updating a pageIndex field in command information to a pageIndex field of the Hash table entry; writing into the Hash table after updating is completed, and executing S3.2;
S3.2: outputting a result: and outputting a Cache update completion flag, and completing the operation of writing the Cache.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating an operation flow of RAID No Write Allocate mode in one embodiment. As shown in fig. 5, in the RAID No Write Allocate mode, the data processing method of the Cache of the present application may include:
s0: the Cache searching result is: cache hit. Executing S0.1; the search result is: cache miss. Executing S0.2;
s0.1: updating the Hash table item: and writing all zeros in the Hash table entry, and writing the updated Hash table entry into the Hash table. Executing S0.2;
s0.2: outputting a search result: searching the Cache result: and writing the Cache hit and recycle into the result Cache. S1, executing;
s1: writing a disc: and the RAID Controller writes the data of the write IO command to the disk according to the search result. The write Cache operation is complete.
In one embodiment, the method may further include:
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address and the search result is that the data corresponding to the Cache command is hit in the Cache, the data in the designated space of the read Cache storage address is written back to the host, and the Cache update is executed;
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command in the read disk is returned to the host, and the Cache update is executed.
The application presets a plurality of read Cache modes, wherein the read Cache mode comprises a mode that the read Cache does not distribute Cache storage addresses, namely a read Cache-nAllocate mode.
Specifically, the above-described modes in which the Read Cache does not allocate a Cache storage address may include a RAID Read Back mode. The RAID Read Back mode refers to an operation mode of writing data in the RAID Cache into a host when the Cache hit is Read.
When the mode in which the Read Cache does not allocate a Cache storage address is a RAID Read Back mode, the method may include:
and the RAID Controller reads the data in the specified space of the pageIndex and writes the data back to the host according to the search result.
According to the embodiment of the application, multiple complex read Cache modes can be supported, and multiple read Cache application scenes can be supported.
Further, when the Cache operation mode is a mode that the read Cache does not allocate a Cache storage address, and the search result is that data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command in the read disk is returned to the host.
The mode in which the read Cache does not allocate a Cache storage address may further include a RAID Read Through mode. The RAID Read Through mode refers to an operation mode of writing data in a disk into a host when reading Cache miss.
The method and the device can realize the Cache reading flow under the RAID Read Through mode.
In one embodiment, the method may further include:
when the Cache operation mode is a mode of reading the Cache and distributing the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command is read from the disk and returned to the host, a new Cache storage address is distributed, the data corresponding to the Cache command is written into the new Cache storage address, and the Cache update is executed.
In the application, the Cache operation mode also comprises a mode of reading the Cache and distributing the storage address of the Cache, namely a read Cache-allocation mode. Specifically, the mode of reading the Cache and allocating the Cache storage address may be RAID Read Allocate mode, where RAID Read Allocate refers to an operation mode of writing data in the disk into the RAID Cache and then writing the data in the disk into the host, or an operation mode of writing data in the disk into the host and then writing the data in the disk into the RAID Cache.
In one embodiment, the state information further includes a read unassigned locking state, and before the data in the designated space of the read Cache memory address is written back to the host, the method further includes:
The read unassigned lock state is asserted.
When the Cache operation mode is a mode that the read Cache does not allocate a Cache storage address, and the search result is that data corresponding to a Cache command hits in the Cache, the executing the Cache update includes:
the read unassigned lock state is set to invalid.
The status information bits may further include a read unassigned lock status RnA _l: read nonAllocate Lock (read does not allocate a lock), which indicates whether dev_lba data is locked when executing a mode of reading the Cache and allocating the Cache memory address. The state information bit, when valid, indicates that the Hash table entry is locked.
When the search result is Cache hit and the OpMode (Cache operation mode) is read Cache-non-nAlllocat, updating the Hash table entry, setting RnA _L to be effective, and outputting the Cache search result: cache hit and pageIndex, the Cache lookup is complete.
And after the data of the designated space of the read Cache storage address is written back to the host, executing the Cache update. When the OpType (Cache operation type) is Cache update, and the OpMode is read Cache-NonAllocate, updating the Hash table entry, setting RnA _L as invalid, and writing the invalid into the Hash table after updating is completed, wherein the Cache update is completed.
According to the method and the device, the Cache update in the read Cache-non-nAllocate mode can be realized.
In one embodiment, the status information bit further includes a read allocation lock status, and before the data corresponding to the read Cache command from the disk is returned to the host, the method may further include:
setting the read allocation lock state to active;
when the Cache operation mode is a mode of reading the Cache and allocating a Cache storage address, and the search result is that data corresponding to a Cache command is missed in the Cache, the executing the Cache update includes:
the read allocation lock state is set to invalid.
The status information bits may further include a read allocation lock status ra_l: read Allocate Lock (read allocation lock), which indicates whether the dev_lba data is locked while the read Cache-Allocate mode is being executed. The state information bit, when valid, indicates that the Hash table entry is locked.
Specifically, when the search result is Cache hit and the op mode is read Cache-allocation, updating the Hash table entry, setting ra_l to be valid, and updating the values of the Disk ID (Disk ID) and dev_lba fields in the command information to the values of the Disk ID and dev_lba fields in the Hash table entry; writing into the Hash table after updating is completed, and outputting a Cache searching result: cache miss, cache lookup is completed.
When a new Cache storage address is allocated, after data corresponding to a Cache command is written into the new Cache storage address, executing Cache updating, when OpType is Cache updating and OpMode is Cache-allocation reading, updating a Hash table entry, setting V to be effective, setting RA_L to be invalid, updating the value of a pageIndex field in command information to the value of a pageIndex field in the Hash table entry, and writing the value into the Hash table after updating is completed, wherein the Cache updating is completed.
According to the method and the device, the Cache update in the read Cache-allocation mode can be realized.
Referring to FIG. 6, FIG. 6 is a flowchart illustrating an operation of a RAID Read Back mode in one embodiment. As shown in fig. 6, in the RAID Read Back mode, the data processing method of the Cache of the present application may include:
s0: the Cache searching result is: cache hit. Executing S0.1;
s0.1: updating the Hash table item: reading the Hash table entry, updating RnA _l= '1', and not updating other information; and writing the updated data into the Hash table. Executing S0.2;
s0.2: outputting a Cache searching result: searching the Cache result: the Cache hit and pageIndex are written into the result Cache. S1, executing;
s1: read Cache: and the RAID Controller reads the data in the specified space of the pageIndex and writes the data back to the host according to the search result. S2, executing;
S2: cache update, execution S2.1
S2.1: updating the Hash table item: reading the Hash table entry, updating RnA _L= '0', and keeping other information unchanged; writing into the Hash table after updating is completed, and executing S2.2;
s2.2: outputting a result: and outputting a Cache update completion mark, and completing the Cache reading operation.
Referring to fig. 7, fig. 7 is a schematic diagram illustrating an operation flow of RAID Read Through mode in an embodiment. As shown in fig. 7, in the RAID Read Through mode, the data processing method of the Cache of the present application may include:
s0: the Cache searching result is: cache miss. Executing S0.1;
s0.1: outputting a Cache searching result: searching the Cache result: the Cache hit and pageIndex are written into the result Cache. S1, executing;
s1: reading a disc: and the RAID Controller reads the disk data and writes the disk data back to the host according to the search result. The read Cache operation is completed.
Referring to fig. 8, fig. 8 is a schematic diagram illustrating an operation procedure of RAID Read Allocate mode in one embodiment. As shown in fig. 8, in the RAID Read Allocate mode, the data processing method of the Cache of the present application may include:
s0: the Cache searching result is: cache miss. Executing S0.1;
s0.1: updating the Hash table item: reading the Hash table entry, updating ra_l= '1', and updating a DISKID, NSID, dev _lba field in the command information to a DISKID, NSID, dev _lba field of the Hash table entry; and writing the updated data into the Hash table. Executing S0.2;
S0.2: outputting a Cache searching result: searching the Cache result: and writing the Cache miss into a result Cache. S1, executing;
s1: reading a disc: and the RAID Controller reads the disk data and writes the disk data back to the host according to the search result. S2, executing;
s2: assign a new pageIndex: RAID Controller distributes new pageIndex according to the Cache searching result; s2, executing;
s3: write Cache: RAID Controller writes disk data to the space specified by the pageIndex. S4, executing;
s4: cache update, execution S4.1
S4.1: updating the Hash table item: reading a Hash table entry, updating V= '1', RA_L= '0', and updating a pageIndex field in command information to a pageIndex field of the Hash table entry; writing into the Hash table after updating is completed, and executing S4.2;
s4.2: outputting a result: and outputting a Cache update completion mark, and completing the Cache reading operation.
In one embodiment, the method may further include:
when the Cache operation mode is the disk-dropping operation and the search result is that the data corresponding to the Cache command is not hit in the Cache, writing the data in the space corresponding to the Cache storage address into a disk, and updating the value of each state information bit to be invalid so as to recycle the Cache resources.
Specifically, when the OpType is Cache recovery and the OpMode is disk-drop Cache, updating the target hash table, and writing the value of each state information bit in the target hash table to be all zero. Writing the updated data into a Hash table, and recovering the Cache.
Referring to fig. 9, fig. 9 is a schematic flow chart of a tray-dropping operation in an embodiment. In fig. 9, the flow of the tray-drop operation includes:
s0: the Cache searching result is: cache hit. Executing S0.1; the search result is: cache miss, outputting query results: and the Cache miss, the tray-falling Cache operation is completed.
S0.1: updating the Hash table item: update d_l= '1', write Hash table after update is completed. Executing S0.2;
s0.2: outputting a result: searching the Cache result: the Cache hit and pageIndex are written into the result Cache. S1, executing;
s1: and (3) falling plate: and the RAID Controller writes the data in the space appointed by the pageIndex into the disk according to the search result. S2, executing;
s2: cache update: execution S2.1
S2.1: updating the Hash table item: and writing all zeros in the Hash table entry, and writing the updated Hash table entry into the Hash table. S2.2 is executed;
s2.2: outputting a result: and outputting a recovery completion mark of the Cache, and completing the operation of the tray-falling Cache.
In one embodiment, as shown in fig. 10, a data processing system of a disk array Cache is provided, which includes a disk array controller and a disk, where the disk array controller is connected with the disk, the disk array controller includes a Cache processing device and a read-write device, the Cache processing device is connected with the read-write device,
The Cache processing device is used for receiving the Cache command, executing Cache searching according to the Cache command to obtain a searching result, determining a Cache operation mode according to the Cache command and the searching result, and recovering the Cache resource according to the searching result when the Cache operation mode is a mode of writing the Cache and recovering the Cache resource and the searching result is that the data corresponding to the Cache command is hit in the Cache;
the read-write device is used for writing data corresponding to the Cache command into the disk;
the Cache processing device is also used for executing the Cache update.
In the application, the system also comprises a host, the host is connected with the disk array controller, the host sends IO command to the disk array controller, and the disk array controller analyzes the IO command to obtain the Cache command.
Specifically, the disk array controller matches each preconfigured Cache operation mode in the configuration data according to the command detail information in the Cache command, and when the target operation mode is matched, a processing flow corresponding to the target operation mode is obtained, wherein the processing flow comprises a Cache operation type, and the Cache command is determined according to the Cache operation type.
Specifically, the information carried in the Cache command includes, but is not limited to, the following information:
(1) Opttype: the method and the device represent the operation type of the Cache, and support the Cache searching, the Cache updating and the Cache recycling.
(2) Op mode: the method is used for representing the operation mode of the Cache and supporting write Cache-cycle, write Cache-nricycle, read Cache-allocation, read Cache-nAllocate and disk-drop Cache. The write Cache-cycle is only valid in RAID No Write Allocate mode, otherwise, the write Cache-nricycle is all written. The read Cache-allocateis only valid in RAID Read Allocate mode, otherwise, it is Cache-nAllocate.
(3) dev_lba: indicating the LBA start address of the disk.
(4) Disk ID: representing the disk ID number.
(5) pageIndex: representing the start address of the host IO command or disk data assigned by the RAID Controller.
In one embodiment, the Cache command includes a plurality of Cache processing devices, the Cache processing device includes a command queue, a Hash management unit, and a Cache processing unit, the command queue is connected to the Hash management unit, the Hash management unit is connected to the Cache processing unit, wherein,
the command queue is used for storing a plurality of Cache commands, determining the Cache operation mode of each Cache command and distributing each Cache command to the Hash management unit;
the Hash management unit is used for carrying out Hash calculation according to the Cache command and distributing the Cache command to the Cache processing unit according to the Hash value obtained by calculation;
The Cache processing unit is used for executing Cache searching according to each Cache command to obtain a searching result, and when the Cache operation mode of the target Cache command is a mode of writing the Cache and recovering the Cache resources and the searching result of the target Cache command is that the data corresponding to the Cache command hits in the Cache, the Cache resources are recovered according to the searching result.
In the application, the Cache structure is organized by taking the size of the logic block as a unit. Here, a logical block refers to the smallest unit of data accessible to the host, typically 512 bytes or 4096 bytes. When the Cache command is determined according to the Cache command, the determined Cache command comprises one or more than one Cache command.
Specifically, the command queue is used for storing commands processed by the RAID Cache issued by hardware or software, namely, cache commands. The hardware or software corresponds to the host command processing device described above. The Hash management unit is used for maintaining the RAID Cache organization structure, taking the Cache command from the command queue, processing the command and then dispatching the command to the Cache processing unit. The Cache processing unit is used for completing the functions of Cache searching, cache updating and Cache recycling.
According to the embodiment of the application, the searching, updating and recycling of the Cache can be realized.
Referring to fig. 11, in one embodiment, the above-mentioned Hash management unit includes a mutex lock, a plurality of buffers, and a Hash calculation unit corresponding to each buffer, and the Cache processing unit includes a Cache searching subunit, a Cache updating subunit, and a Cache recycling subunit, where,
The command queue is also used for determining the Cache operation type corresponding to each Cache command according to each Cache command, and distributing each Cache command to the corresponding buffer according to the Cache operation type corresponding to each Cache command and the association relation between each buffer and the Cache operation type, wherein the operation type comprises a Cache searching operation, a Cache updating operation and a Cache recycling operation;
the hash calculation unit is used for reading each Cache command from the corresponding buffer and calculating the hash value of each Cache command;
the mutual exclusion lock is used for locking according to hash values corresponding to all the Cache commands, and when the target Cache commands are locked, the target Cache commands are distributed to corresponding subunits in the Cache processing unit according to Cache operation types corresponding to the target Cache commands;
the Cache searching subunit is used for executing Cache searching according to each Cache command to obtain a searching result;
the operation type of the Cache updating subunit for processing is Cache updating operation;
the Cache recovery subunit is configured to, when the Cache operation mode of the target Cache command is a mode of writing the Cache and recovering the Cache resource, and the search result of the target Cache command is that the data corresponding to the Cache command hits in the Cache, recover the Cache resource according to the search result.
The Cache processing device can also comprise an arbitration unit, wherein the arbitration unit is connected with the Cache processing unit, and the arbitration unit is connected with external equipment through an external bus. The arbitration unit is used for arbitrating the bus interface which is generated by the Cache operation and accesses the external equipment.
In the application, the Buffer can be a command Buffer, and the Hash management unit internally comprises a mutual exclusion lock, D (D is more than or equal to 1) command buffers and a Hash calculation unit. And reading a command from the command Buffer, performing Hash calculation, and distributing the command to different Cache operation channels after the Cache mutual exclusion lock operation, wherein the Cache operation channels are equivalent to all the subunits in the Cache processing unit.
Specifically, the host command processing device determines a Cache searching command according to the Cache command, further determines a Cache operation mode according to a searching result and pre-established configuration data, and further determines a Cache updating command and a Cache recycling command according to the Cache operation mode. After the host command processing device determines a plurality of Cache commands, the Cache operation mode corresponding to each Cache command and the Cache operation type carried by each Cache command are distributed to a command queue. The command queue stores each Cache command.
Further, the command queue analyzes the Cache operation mode and the Cache operation type in each Cache command, and distributes each Cache command to a corresponding buffer according to the Cache operation type. The buffer here may be a command buffer. Each buffer has an association relationship with a subunit in the Cache processing unit. Specifically, each buffer has a corresponding relationship with the Cache operation type, and the subunit in each Cache processing unit also has a corresponding relationship with the Cache operation type, so that each buffer also has a corresponding relationship with the subunit in the Cache processing unit. Illustratively, the pre-configured command buffer1 fixedly stores the Cache lookup command, the command buffer2 fixedly stores the Cache update command, and the command buffer3 fixedly stores the Cache recycle command.
Specifically, the Hash management unit reads command queue information from the command Buffer, takes Disk information (such as dev_lba and Disk ID) as a K value, calculates a Hash table entry address P, and dispatches the P value calculated by each command Buffer to different Cache operation channels after performing mutual exclusion lock operation.
When the current Cache command mutex lock conflicts, or the Cache search result is Hash conflict, or locking cannot be achieved, the command is written back to the command Buffer. The Hash management unit also performs unlocking operation on the Cache mutual exclusion lock according to the Cache operation execution completion state. The Hash management unit also maintains a mapping relation between the command Buffer and the Cache operation channel.
Specifically, the Cache processing device may include the following modules outside:
(1) BUS0: and the external bus is used for receiving commands processed by the RAID Cache issued by hardware or software.
(2) BUS1: and the external bus is used for the RAID Cache processing device to access the Hash table and the result Cache.
(3) Hash table: and saving a Cache data structure maintained by the RAID Cache.
(4) Data Cache: disk data maintained by the RAID Cache is saved.
(5) And (3) caching results: and storing the result after the RAID Cache processing device finishes executing the Cache.
According to the embodiment of the application, the parallel operation of the host commands can be realized by setting a plurality of command buffers, a plurality of hash calculation units and a plurality of Cache processing subunits, so that the data processing efficiency is improved.
In one embodiment, the above-mentioned Cache processing apparatus further includes an arbitration unit, where the arbitration unit is connected to the Cache processing unit, and the arbitration unit is connected to an external device through an external bus, where,
the arbitration unit is used for arbitrating the bus interface which is generated by the Cache operation and accesses the external equipment.
In the present application, the external device connected to the arbitration unit through the external bus may include a Hash table, a Data Cache, and a result Cache.
In one embodiment, the number of at least one subunit in the Cache processing unit includes a plurality of subunits.
According to the application, the plurality of subunits are set in the Cache processing unit, and the number of each subunit is set to be a plurality of subunits, so that the concurrency of data processing is improved, and the data processing efficiency is improved.
In one application scenario, the data processing system of the disk array Cache supports write Cache operations. The write Cache operation supports a write Cache-nrencycloe mode, which may include the following modes:
RAID WriteBack, RAID Write Through or RAID Allocate modes
Referring to FIG. 12, in write Cache-nricycle mode, the disk array controller writes the data of the write Cache command to the RAID Cache (corresponding to the Cache described above). Wherein, the OpType corresponding to 21 is Cache searching, and the OpMode is write Cache-nRecycle.23 is the Cache update, and OpMode is the write Cache-nRecycle.21 and 23 are executed by a Cache processing unit, and 22 is executed by a disk array controller.
In one application scenario, the write Cache operation also supports a write Cache-cycle mode, which may include RAID No Write Allocate mode.
Referring to FIG. 13, in the write Cache-cycle mode, the disk array controller retrieves the Cache and then writes the data of the write command to the disk. Wherein, the OpType corresponding to 31 is Cache searching, and the OpMode is write Cache-cycle. 31 is a Cache processing unit and 32 is a disk array controller.
In one application scenario, the data processing system of the disk array Cache supports read Cache operations. The read Cache operation supports a read Cache-NonAllocate mode, and the read Cache-NonAllocate mode can comprise the following modes:
RAID Read Back mode and RAID Read Through mode
Referring to FIG. 14, in RAID Read Back mode, the disk array controller reads data from the RAID Cache and writes it Back to the host. Wherein, the OpType corresponding to 41 is Cache searching
The OpMode is read Cache-NonAllocate, and the search result is as follows: cache hit.43 is Cache update, and OpMode is read Cache-NonAllocate.41 and 43 are executed by the Cache processing unit, and 42 is executed by the disk array controller.
Referring to FIG. 15, in RAID Read Through mode, the disk array controller reads data from the disks and writes it back to the host. Wherein, the OpType corresponding to 51 is Cache searching, the OpMode is read Cache-NonAllocate, and the searching result is: cache miss.51 is a Cache processing unit and 52 is a disk array controller.
In one application scenario, read Cache operations also support a Read Cache-allocation mode, which may include a Read allocation mode.
Referring to fig. 16, in the Read allocation mode, the disk array controller reads data from the disk and writes the data to the Cache, and then reads data from the Cache and writes the data back to the host. Or reading data from the disk and writing the data back to the host, and then writing the data into the Cache. Wherein, the OpType corresponding to 61 is Cache searching, the OpMode is read Cache-allocation, and the searching result is: cache miss. The OpType corresponding to 63 is Cache update, and OpMode is read Cache-allocation. 61 and 63 are executed by the Cache processing unit and 62 is executed by the disk array controller.
In an application scenario, the data processing system of the disk array Cache supports a drop disk Cache operation. Referring to FIG. 17, in a drop disk Cache operation, the disk array controller writes data in the RAID Cache to the disk. Wherein, 71 corresponding OpType is the Cache and looks for, opMode is the disk-falling Cache, and the finding result is: cache hit.73 is the Cache recycle,
and OpMode is a disk-drop Cache.71 and 73 are executed by a Cache processing unit, and 72 is executed by a disk array controller. When the disk-falling Cache is processed, when the Cache searching result is Cache miss, the data to be dropped is not in the Cache. And the hardware or software reissues the new drop disk Cache command.
In one embodiment, as shown in fig. 18, there is provided a data processing apparatus of a disk array Cache, the apparatus including: a receiving module 11, a searching module 12, a determining module 13 and a reading and writing module 14, wherein,
a receiving module 11, configured to receive a Cache command;
the searching module 12 is configured to perform Cache searching according to the Cache command to obtain a searching result;
the determining module 13 is configured to determine a preconfigured Cache operation mode according to the Cache command and the search result;
and the read-write module 14 is configured to, when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources, and the search result is that the data corresponding to the Cache command hits in the Cache, recover the Cache resources according to the search result, write the data corresponding to the Cache command into the disk, and execute the Cache update.
In one embodiment, the determining module 13 may determine the Cache operation mode according to the Cache command, the search result, and the pre-created configuration data, where the configuration data includes a mapping relationship between each Cache operation mode and command information of each Cache command, and each search result.
In one embodiment, the above-mentioned searching module 12 may perform hash calculation according to the Cache command to obtain a hash value, read a target hash table entry corresponding to the hash value in the hash table created in advance, where the target hash table entry includes state information of the Cache, and determine that the searching result is that the data corresponding to the Cache command hits in the Cache when the state information of the Cache indicates that the disk data is in the Cache.
In one embodiment, the state information of the Cache includes a plurality of state information bits and corresponding values, and the read-write module 14 may update the values of the state information bits to be invalid to recover the Cache resource.
In one embodiment, the above-mentioned status information bits include a write lock status and a modify status, and the above-mentioned read-write module 14 may further update the write lock status and the modify status in the target hash table to be valid when the Cache operation mode is a mode in which the Cache is writing and the Cache is not recovering the Cache resource, and the search result is that the data corresponding to the Cache command is not hit in the Cache, and update the write lock status to be valid when the Cache operation mode is writing and the Cache is not recovering the Cache resource.
In one embodiment, the status information bit further includes a state of whether the disk data is in the Cache, when the state of the disk data is valid, the read/write module 14 may update the write lock status to be invalid to execute the Cache update when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resource, and when the write lock status is valid, the write lock status is updated to be invalid, and when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resource, and the disk data is invalid, and when the write lock status is valid, the disk data is updated to be valid.
In one embodiment, the state information bit further includes a Cache storage address, when the Cache operation mode is a mode in which the write Cache does not recycle Cache resources, and the search result is that data corresponding to the Cache command hits in the Cache, the read-write module 14 may write the data corresponding to the Cache command into a space corresponding to the Cache storage address, the write Cache does not recycle the Cache resources includes a mode in which the write Cache does not recycle the Cache resources, and when the Cache operation mode is a mode in which the write Cache does not recycle the Cache resources, and the search result is that the data corresponding to the Cache command does not hit in the Cache, the read-write module 14 may further allocate a new Cache storage address according to the search result, and write the data corresponding to the Cache command into the space corresponding to the new Cache storage address.
In one embodiment, the above-mentioned read-write module 14 may also write back the data in the specified space of the read Cache memory address to the host and execute the Cache update when the Cache operation mode is a mode in which the read Cache is not allocated with the Cache memory address and the search result is that the data corresponding to the Cache command is hit in the Cache, and when the Cache operation mode is a mode in which the read Cache is not allocated with the Cache memory address and the search result is that the data corresponding to the Cache command is missed in the Cache, the data corresponding to the Cache command in the read disk is returned to the host and the Cache update is executed.
In one embodiment, the above-mentioned read-write module 14 may also read data corresponding to the Cache command from the disk and return the data to the host when the Cache operation mode is a mode of reading the Cache and allocating a Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, and allocate a new Cache storage address, write the data corresponding to the Cache command into the new Cache storage address, and execute the Cache update.
In one embodiment, the state information further includes a read unassigned locking state, before the data in the specified space of the read Cache memory address is written back to the host, the lookup module 12 may further set the read unassigned locking state to be valid, and when the Cache operation mode is a mode in which the read Cache does not allocate the Cache memory address, and the lookup result is that the data corresponding to the Cache command hits in the Cache, the read-write module 14 may further set the read unassigned locking state to be invalid.
In one embodiment, the status information bit further includes a read allocation lock status, before the data corresponding to the read Cache command from the disk is returned to the host, the lookup module 12 may further set the read allocation lock status to be valid, and when the Cache operation mode is a mode of reading the Cache and allocating a Cache storage address, and the lookup result is that the data corresponding to the Cache command is missed in the Cache, the read/write module 14 may further set the read allocation lock status to be invalid.
In one embodiment, the above-mentioned read-write module 14 may further write the data in the space corresponding to the Cache storage address into the disk when the Cache operation mode is a disk-drop operation and the search result is that the data corresponding to the Cache command is not hit in the Cache, and update the value of each state information bit to be invalid, so as to recover the Cache resource.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 19. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as operation data of the intelligent household equipment. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by the processor, implements the data processing method of the Cache.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program: receiving a Cache command; performing Cache searching according to the Cache command to obtain a searching result; determining a pre-configured Cache operation mode according to a Cache command and a search result; when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into a disk, and executing Cache updating.
In one embodiment, when the processor executes the computer program to implement the above step of determining the Cache operation mode according to the Cache command and the search result, the following steps are specifically implemented:
according to the Cache commands, the search results and the pre-established configuration data, determining the Cache operation modes, wherein the configuration data comprises the command information of each Cache operation mode and each Cache command and the mapping relation of each search result.
In one embodiment, when the processor executes the computer program to implement the above-mentioned step of performing Cache lookup according to the Cache command to obtain a lookup result, the following steps are specifically implemented:
Carrying out hash calculation according to the Cache command to obtain a hash value;
reading a target hash table item corresponding to a hash value in a hash table which is created in advance, wherein the target hash table item comprises state information of a Cache;
when the state information of the Cache indicates that the disk data is in the Cache, determining that the search result is that the data corresponding to the Cache command is hit in the Cache.
In one embodiment, the state information of the Cache includes a plurality of state information bits and corresponding values, and when the processor executes the computer program to implement the step of recovering the Cache resource according to the search result, the following steps are specifically implemented:
and updating the value of each state information bit to be invalid so as to recover the Cache resources.
In one embodiment, the status information bits include a write lock status and a modify status, and before the processor executes the computer program to implement writing the data corresponding to the Cache command into the Cache, the following steps are specifically implemented:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and the search result is that the data corresponding to the Cache command is hit in the Cache, updating the writing locking state and the modification state in the target hash table to be effective;
When the Cache operation mode is a mode that the write Cache does not recycle the Cache resources and the search result is that the data corresponding to the Cache command is not hit in the Cache, the write locking state is updated to be effective.
In one embodiment, the status information bit further includes whether the disk data is in a Cache state, and when the disk data is in the Cache state, the processor executes the computer program to implement the above-mentioned Cache update, and specifically implement the following steps:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and whether the disk data in the target hash table item are in the Cache state, the write locking state and the modification state are valid or not, updating the write locking state to be invalid so as to execute the Cache update;
when the Cache operation mode is a mode that the Cache is written and the Cache resources are not recycled, and whether the disk data is in the Cache state and the modification state are invalid, if the write locking state is valid, whether the disk data is updated in the Cache state is valid, and if the write locking update is invalid, the Cache update is executed.
In one embodiment, the above state information bit further includes a Cache storage address, and when the Cache operation mode is a mode in which the write Cache does not recycle the Cache resource, and the search result is that the data corresponding to the Cache command hits in the Cache, the processor executes the computer program to implement the above step of writing the data corresponding to the Cache command into the Cache, specifically implementing the following steps:
Writing data corresponding to the Cache command into a space corresponding to the Cache storage address;
the mode of writing the Cache and not recycling the Cache resources comprises a mode of writing the Cache and distributing, and when the Cache operation mode is the mode of writing the Cache and distributing, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the processor executes the computer program, and specifically further realizes the following steps:
distributing a new Cache storage address according to the search result;
when the processor executes the computer program to realize the step of writing the data corresponding to the Cache command into the Cache, the following steps are specifically realized:
and writing the data corresponding to the Cache command into a space corresponding to the new Cache storage address.
In one embodiment, the processor, when executing the computer program, specifically further implements the steps of:
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address and the search result is that the data corresponding to the Cache command is hit in the Cache, the data in the designated space of the read Cache storage address is written back to the host, and the Cache update is executed;
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command in the read disk is returned to the host, and the Cache update is executed.
In one embodiment, the processor, when executing the computer program, specifically further implements the steps of:
when the Cache operation mode is a mode of reading the Cache and distributing the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command is read from the disk and returned to the host, a new Cache storage address is distributed, the data corresponding to the Cache command is written into the new Cache storage address, and the Cache update is executed.
In one embodiment, the above state information further includes a read unassigned locking state, and before the processor executes the computer program to implement writing back the data in the read Cache memory address specified space to the host, the following steps are specifically implemented:
the read unassigned lock state is asserted.
When the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address, and the search result is that the data corresponding to the Cache command is hit in the Cache, the processor executes the computer program to realize the step of executing the Cache update, and specifically realizes the following steps:
the read unassigned lock state is set to invalid.
In one embodiment, the status information bit further includes a read allocation lock status, and before the processor executes the computer program to implement the above-mentioned data corresponding to the read Cache command from the disk to return to the host, the following steps are specifically implemented:
Setting the read allocation lock state to active;
when the Cache operation mode is a mode of reading the Cache and distributing a Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the processor executes the computer program to realize the step of executing the Cache update, and the following steps are specifically realized:
the read allocation lock state is set to invalid.
In one embodiment, the processor, when executing the computer program, specifically further implements the steps of:
when the Cache operation mode is the disk-dropping operation and the search result is that the data corresponding to the Cache command is not hit in the Cache, writing the data in the space corresponding to the Cache storage address into a disk, and updating the value of each state information bit to be invalid so as to recover the Cache resources.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving a Cache command; performing Cache searching according to the Cache command to obtain a searching result; determining a pre-configured Cache operation mode according to a Cache command and a search result; when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into a disk, and executing Cache updating.
In one embodiment, when the computer program is executed by the processor to implement the above step of determining the Cache operation mode according to the Cache command and the search result, the following steps are specifically implemented:
according to the Cache commands, the search results and the pre-established configuration data, determining the Cache operation modes, wherein the configuration data comprises the command information of each Cache operation mode and each Cache command and the mapping relation of each search result.
In one embodiment, when the computer program is executed by the processor to perform the above-mentioned Cache search according to the Cache command to obtain the search result, the following steps are specifically implemented:
carrying out hash calculation according to the Cache command to obtain a hash value;
reading a target hash table item corresponding to a hash value in a hash table which is created in advance, wherein the target hash table item comprises state information of a Cache;
when the state information of the Cache indicates that the disk data is in the Cache, determining that the search result is that the data corresponding to the Cache command is hit in the Cache.
In one embodiment, the state information of the Cache includes a plurality of state information bits and corresponding values, and when the computer program is executed by the processor to implement the step of recovering the Cache resource according to the search result, the following steps are specifically implemented:
And updating the value of each state information bit to be invalid so as to recover the Cache resources.
In one embodiment, the status information bits include a write lock status and a modify status, and before the computer program is executed by the processor to implement writing the data corresponding to the Cache command into the Cache, the following steps are specifically implemented:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and the search result is that the data corresponding to the Cache command is hit in the Cache, updating the writing locking state and the modification state in the target hash table to be effective;
when the Cache operation mode is a mode that the write Cache does not recycle the Cache resources and the search result is that the data corresponding to the Cache command is not hit in the Cache, the write locking state is updated to be effective.
In one embodiment, the status information bit further includes a state of whether the disk data is in the Cache, and when the state of the disk data is valid, the computer program is executed by the processor to implement the following steps after the data corresponding to the Cache command is written into the Cache:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and whether the disk data in the target hash table item are in the Cache state, the write locking state and the modification state are valid or not, updating the write locking state to be invalid so as to execute the Cache update;
When the Cache operation mode is a mode that the Cache is written and the Cache resources are not recycled, and whether the disk data is in the Cache state and the modification state are invalid, if the write locking state is valid, whether the disk data is updated in the Cache state is valid, and if the write locking update is invalid, the Cache update is executed.
In one embodiment, the above state information bit further includes a Cache storage address, and when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resource, and the search result is that the data corresponding to the Cache command hits in the Cache, the computer program is executed by the processor to implement the above step of writing the data corresponding to the Cache command into the Cache, specifically implementing the following steps:
writing data corresponding to the Cache command into a space corresponding to the Cache storage address;
the mode of writing the Cache and not recycling the Cache resources comprises a mode of writing the Cache and distributing, and when the Cache operation mode is the mode of writing the Cache and distributing, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the computer program is executed by the processor, and the following steps are specifically realized:
distributing a new Cache storage address according to the search result;
when the computer program is executed by the processor to realize the step of writing the data corresponding to the Cache command into the Cache, the following steps are specifically realized:
And writing the data corresponding to the Cache command into a space corresponding to the new Cache storage address.
In one embodiment, the computer program when executed by the processor, specifically further performs the steps of:
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address and the search result is that the data corresponding to the Cache command is hit in the Cache, the data in the designated space of the read Cache storage address is written back to the host, and the Cache update is executed;
when the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command in the read disk is returned to the host, and the Cache update is executed.
In one embodiment, the computer program when executed by the processor, specifically further performs the steps of:
when the Cache operation mode is a mode of reading the Cache and distributing the Cache storage address, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command is read from the disk and returned to the host, a new Cache storage address is distributed, the data corresponding to the Cache command is written into the new Cache storage address, and the Cache update is executed.
In one embodiment, the above state information further includes a read unassigned locking state, and before the computer program is executed by the processor to implement writing back the data in the read Cache memory address specified space to the host, the following steps are specifically implemented:
the read unassigned lock state is asserted.
When the Cache operation mode is a mode that the read Cache does not allocate the Cache storage address and the search result is that the data corresponding to the Cache command is hit in the Cache, the computer program is executed by the processor to realize the step of executing the Cache update, and the following steps are specifically realized:
the read unassigned lock state is set to invalid.
In one embodiment, the status information bits further include a read allocation lock status, and before the computer program is executed by the processor to implement the above-mentioned data return corresponding to the read Cache command from the disk, the following steps are specifically implemented:
setting the read allocation lock state to active;
when the Cache operation mode is a mode of reading the Cache and distributing the storage address of the Cache, and the search result is that the data corresponding to the Cache command is not hit in the Cache, the computer program is executed by the processor to realize the step of executing the Cache update, and the following steps are specifically realized:
The read allocation lock state is set to invalid.
In one embodiment, the computer program when executed by the processor, specifically further performs the steps of:
when the Cache operation mode is the disk-dropping operation and the search result is that the data corresponding to the Cache command is not hit in the Cache, writing the data in the space corresponding to the Cache storage address into a disk, and updating the value of each state information bit to be invalid so as to recover the Cache resources.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (20)

1. The data processing method of the Cache is characterized by comprising the following steps of:
receiving a Cache command;
performing Cache searching according to the Cache command to obtain a searching result;
determining a pre-configured Cache operation mode according to the Cache command and the search result;
when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources, and the search result is that the data corresponding to the Cache command hits in the Cache, recovering the Cache resources according to the search result, writing the data corresponding to the Cache command into a disk, and executing Cache updating.
2. The method of claim 1, wherein the determining a Cache operation mode from the Cache command and the lookup result comprises:
and determining the Cache operation mode according to the Cache command, the search result and the pre-established configuration data, wherein the configuration data comprises command information of each Cache operation mode and each Cache command and mapping relation of each search result.
3. The method of claim 1, wherein the performing a Cache lookup according to the Cache command to obtain a lookup result comprises:
carrying out hash calculation according to the Cache command to obtain a hash value;
reading a target hash table item corresponding to the hash value in a pre-created hash table, wherein the target hash table item comprises state information of the Cache;
when the state information of the Cache indicates that the disk data is in the Cache, determining that the search result is that the data corresponding to the Cache command is hit in the Cache.
4. The method of claim 3, wherein the state information of the Cache includes a plurality of state information bits and corresponding values, and the recovering the Cache resource according to the search result includes:
And updating the value of each state information bit to be invalid so as to recover the Cache resource.
5. The method of claim 4, wherein the status information bits include a write lock status and a modify status, the method further comprising, prior to writing data corresponding to the Cache command into the Cache:
when the Cache operation mode is a mode of writing the Cache and not recovering the Cache resources, and the search result is that the data corresponding to the Cache command is hit in the Cache, updating the writing locking state and the modifying state in the target hash table item to be effective;
when the Cache operation mode is a mode that the write Cache does not recycle the Cache resources and the search result is that the data corresponding to the Cache command is not hit in the Cache, updating the write locking state to be effective.
6. The method of claim 5, wherein the status information bits further include whether disk data is in a Cache state, and wherein performing a Cache update when the disk data is valid in the Cache state comprises:
when the Cache operation mode is a mode that the Cache is written and the Cache resources are not recovered, and whether the disk data in the target hash table item are in the Cache state, the write locking state and the modification state are valid or not, updating the write locking state to be invalid so as to execute the Cache updating;
When the Cache operation mode is a mode that the Cache is written and the Cache resources are not recycled, and the state of the disk data in the Cache and the modification state are invalid, and the write locking state is valid, updating the state of the disk data in the Cache to be valid, and the write locking updating is invalid so as to execute the Cache updating.
7. The method of claim 5, wherein the status information bits further comprise a Cache storage address, and wherein writing the data corresponding to the Cache command into the Cache when the Cache operation mode is a mode in which write Cache does not recycle Cache resources and the lookup result is that the data corresponding to the Cache command hits in the Cache comprises:
writing data corresponding to the Cache command into a space corresponding to the Cache storage address;
the mode that the write Cache does not recycle the Cache resources comprises a mode of write Cache and allocation, and when the Cache operation mode is the mode of write Cache and allocation and the search result is that the data corresponding to the Cache command is not hit in the Cache, the method further comprises:
distributing a new Cache storage address according to the search result;
The writing the data corresponding to the Cache command into the Cache includes:
and writing the data corresponding to the Cache command into a space corresponding to the new Cache storage address.
8. The method of claim 7, wherein the method further comprises:
when the Cache operation mode is a mode that the read Cache does not allocate a Cache storage address and the search result is that data corresponding to the Cache command is hit in the Cache, the data in the Cache storage address designated space is read and written back to the host, and the Cache update is executed;
when the Cache operation mode is a mode that the read Cache does not allocate a Cache storage address, and the search result is that data corresponding to the Cache command is missed in the Cache, the data corresponding to the Cache command in the disk is read and returned to the host, and the Cache update is executed.
9. The method of claim 8, wherein the method further comprises:
when the Cache operation mode is a mode of reading the Cache and allocating a Cache storage address, and the search result is that data corresponding to the Cache command is not hit in the Cache, the data corresponding to the Cache command is read from the disk and returned to the host, a new Cache storage address is allocated, the data corresponding to the Cache command is written into the new Cache storage address, and the Cache update is executed.
10. The method of claim 8, wherein the state information is a read unassigned lock state, wherein the method further comprises, prior to writing back data that reads the Cache memory address designation space to the host:
setting the read unassigned locking state to valid;
when the Cache operation mode is a mode that the read Cache does not allocate a Cache storage address, and the search result is that data corresponding to the Cache command hits in the Cache, the executing the Cache update includes:
the read unassigned locking state is set to invalid.
11. The method of claim 9, wherein the status information bits further comprise a read allocation lock status, and wherein the method further comprises, before the data corresponding to the read Cache command from the disk is returned to the host:
setting the read allocation lock state to active;
when the Cache operation mode is a mode of reading the Cache and allocating a Cache storage address, and the search result is that data corresponding to the Cache command is not hit in the Cache, executing the Cache update includes:
and setting the read allocation locking state as invalid.
12. The method of claim 7, wherein the method further comprises:
when the Cache operation mode is a disk-dropping operation and the search result is that the data corresponding to the Cache command is not hit in the Cache, writing the data in the space corresponding to the Cache storage address into the disk, and updating the value of each state information bit to be invalid so as to recover the Cache resource.
13. A data processing system of a disk array Cache is characterized by comprising a disk array controller and a disk, wherein the disk array controller is connected with the disk and comprises a Cache processing device and a read-write device, the Cache processing device is connected with the read-write device, the read-write device is connected with the read-write device,
the Cache processing device is used for receiving a Cache command, executing Cache searching according to the Cache command to obtain a searching result, determining a Cache operation mode according to the Cache command and the searching result, and recovering the Cache resource according to the searching result when the Cache operation mode is a mode of writing the Cache and recovering the Cache resource and the searching result is that the data corresponding to the Cache command is hit in the Cache;
The read-write device is used for writing data corresponding to the Cache command into the disk;
the Cache processing device is also used for executing the Cache update.
14. The system of claim 13, wherein the Cache command comprises a plurality of Cache processing devices including a command queue, a Hash management unit, and a Cache processing unit, the command queue being coupled to the Hash management unit, the Hash management unit being coupled to the Cache processing unit, wherein,
the command queue is used for storing the plurality of Cache commands, determining a Cache operation mode of each Cache command, and distributing each Cache command to the Hash management unit;
the Hash management unit is used for carrying out Hash calculation according to the Cache command and distributing the Cache command to the Cache processing unit according to the Hash value obtained by calculation;
the Cache processing unit is used for executing Cache searching according to each Cache command to obtain a searching result, and when the Cache operation mode of the target Cache command is a mode of writing the Cache and recovering the Cache resources and the searching result of the target Cache command is that the data corresponding to the Cache command hits in the Cache, the Cache resources are recovered according to the searching result.
15. The system of claim 14, wherein the Hash management unit comprises a mutex lock, a plurality of buffers, and a Hash computation unit corresponding to each of the buffers, the Cache processing unit comprises a Cache lookup subunit, a Cache update subunit, and a Cache reclamation subunit, wherein,
the command queue is further configured to determine a Cache operation type corresponding to each Cache command according to each Cache command, and send each Cache command to a corresponding buffer according to the Cache operation type corresponding to each Cache command and an association relationship between each buffer and the Cache operation type, where the operation types include a Cache searching operation, a Cache updating operation and a Cache recycling operation;
the hash calculation unit is used for reading each Cache command from the corresponding buffer and calculating the hash value of each Cache command;
the mutual exclusion lock is used for locking according to hash values corresponding to the Cache commands, and when the target Cache commands are locked, the target Cache commands are distributed to corresponding subunits in the Cache processing unit according to Cache operation types corresponding to the target Cache commands;
The Cache searching subunit is used for executing Cache searching according to each Cache command to obtain a searching result;
the operation type of the Cache updating subunit for processing is the Cache updating operation;
and the Cache recovery subunit is used for recovering the Cache resources according to the search result when the Cache operation mode of the target Cache command is a mode of writing the Cache and recovering the Cache resources and the search result of the target Cache command is that the data corresponding to the Cache command hits in the Cache.
16. The system of claim 15, wherein the Cache processing apparatus further comprises an arbitration unit coupled to the Cache processing unit, the arbitration unit coupled to an external device via an external bus, wherein,
the arbitration unit is used for arbitrating the bus interface which is generated by the Cache operation and accesses the external equipment.
17. The system of claim 14, wherein the number of at least one subunit in the Cache processing unit comprises a plurality.
18. A data processing apparatus for a disk array Cache, the apparatus comprising:
the receiving module is used for receiving the Cache command;
The searching module is used for executing Cache searching according to the Cache command to obtain a searching result;
the determining module is used for determining a pre-configured Cache operation mode according to the Cache command and the search result;
and the read-write module is used for recovering the Cache resources according to the search result when the Cache operation mode is a mode of writing the Cache and recovering the Cache resources and the search result is that the data corresponding to the Cache command is hit in the Cache, writing the data corresponding to the Cache command into the disk and executing the Cache update.
19. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 12 when the computer program is executed.
20. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 12.
CN202311348634.1A 2023-10-18 2023-10-18 Data processing method and device of Cache, computer equipment and medium Active CN117093160B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311348634.1A CN117093160B (en) 2023-10-18 2023-10-18 Data processing method and device of Cache, computer equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311348634.1A CN117093160B (en) 2023-10-18 2023-10-18 Data processing method and device of Cache, computer equipment and medium

Publications (2)

Publication Number Publication Date
CN117093160A true CN117093160A (en) 2023-11-21
CN117093160B CN117093160B (en) 2024-02-02

Family

ID=88777206

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311348634.1A Active CN117093160B (en) 2023-10-18 2023-10-18 Data processing method and device of Cache, computer equipment and medium

Country Status (1)

Country Link
CN (1) CN117093160B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1804816A (en) * 2004-12-29 2006-07-19 英特尔公司 Method for programmer-controlled cache line eviction policy
CN104166601A (en) * 2014-08-14 2014-11-26 浙江宇视科技有限公司 Storage data backup method and device
US20150286438A1 (en) * 2014-04-03 2015-10-08 Lsi Corporation System, Method and Computer-Readable Medium for Dynamically Configuring an Operational Mode in a Storage Controller
CN115904231A (en) * 2022-11-09 2023-04-04 超聚变数字技术有限公司 RAID card power failure processing method and related device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1804816A (en) * 2004-12-29 2006-07-19 英特尔公司 Method for programmer-controlled cache line eviction policy
US20150286438A1 (en) * 2014-04-03 2015-10-08 Lsi Corporation System, Method and Computer-Readable Medium for Dynamically Configuring an Operational Mode in a Storage Controller
CN104166601A (en) * 2014-08-14 2014-11-26 浙江宇视科技有限公司 Storage data backup method and device
CN115904231A (en) * 2022-11-09 2023-04-04 超聚变数字技术有限公司 RAID card power failure processing method and related device

Also Published As

Publication number Publication date
CN117093160B (en) 2024-02-02

Similar Documents

Publication Publication Date Title
US8799601B1 (en) Techniques for managing deduplication based on recently written extents
CN108459826B (en) Method and device for processing IO (input/output) request
KR100772863B1 (en) Method and apparatus for shortening operating time of page replacement in demand paging applied system
JP2020046963A (en) Memory system and control method
US20220066693A1 (en) System and method of writing to nonvolatile memory using write buffers
US20140013025A1 (en) Hybrid memory with associative cache
CN111694770B (en) Method and device for processing IO (input/output) request
CN107193503B (en) Data deduplication method and storage device
CN108319430B (en) Method and device for processing IO (input/output) request
CN116431530B (en) CXL memory module, memory processing method and computer system
US20230359380A1 (en) Memory system and method for controlling nonvolatile memory
WO2024036985A1 (en) Storage system, computational storage processor and solid-state drive thereof, and data reading method and data writing method therefor
US9569113B2 (en) Data storage device and operating method thereof
CN117093160B (en) Data processing method and device of Cache, computer equipment and medium
CN107562654B (en) IO command processing method and device
US11474938B2 (en) Data storage system with multiple-size object allocator for disk cache
US11875152B2 (en) Methods and systems for optimizing file system usage
CN111625477B (en) Processing method and device for read request for accessing erase block
CN115756838A (en) Memory release method, memory recovery method, memory release device, memory recovery device, computer equipment and storage medium
US11874767B2 (en) Memory partitions for processing entities
CN113076056B (en) Data access method, hard disk and storage device
EP4287028A1 (en) Storage device providing high purge performance and memory block management method thereof
JP7337228B2 (en) Memory system and control method
WO2023236629A1 (en) Data access method and apparatus, and storage system and storage medium
KR101978515B1 (en) Data storage device and operating method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant