Metadata storage method and storage system
Through the combination of an off-band storage solution and on-chip cache memory, the read-after-write traffic problem caused by metadata storage methods in CXL devices is solved, and independent access and efficient storage of metadata and related data are achieved.
Patent Information
- Application Number
- CN202410134309.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-30
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the metadata storage method of CXL devices leads to excessive read and write traffic and the inability to utilize the inherent spatial locality of the access mode, increasing the overhead of CXL metadata.
The out-of-band storage scheme is used to decouple the access of related data and metadata, store the metadata independently from the related data, and set up a special cache memory on the chip to cache metadata, realize independent access of metadata and related data, and avoid frequent access to the main memory.
It realizes independent access between metadata and related data, reduces DRAM overhead, makes full use of the spatial locality of metadata, and improves access efficiency.
Smart Images

Figure CN120406811A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a method and a storage system for storing metadata. Background Art
[0002] CXL (Compute Express Link) technology is a new high-speed interconnection technology developed based on PCIe (Peripheral Component Interconnect Express). It is a dynamic multi-protocol technology designed to provide higher data throughput and lower latency to meet the requirements of modern computing and storage systems. For some CXL devices (such as Type 3 devices), the CXL specification defines metadata for recording the ownership of each cache line. Currently, in-band storage is usually adopted to store metadata, that is, storing metadata in the main memory (such as DRAM). For example, error correction codes (ECC) and metadata are concatenated for in-band storage. Or, according to the value of the metadata, "modulation operation" is performed on the originally calculated ECC, and then the modulated ECC is sent to the DRAM. Through the additional "modulation operation" step, the metadata information has been "embedded" into the modulated ECC. However, both of these two schemes will result in excessive write-after-read traffic and cannot utilize the inherent spatial locality of the access pattern, thus increasing the overhead of CXL metadata.
[0003] This section aims to provide background or context for the embodiments of the present application described in the claims. The description herein is not admitted to be prior art that has been publicly disclosed merely because it is included in this section. Summary of the Invention
[0004] The purpose of this application is to provide a method and a storage system for storing metadata, decouple the access of related data and metadata, store the metadata independently of the related data, and achieve independent access between the metadata and the related data, thus eliminating any write-after-read DRAM overhead.
[0005] This application discloses a storage system for metadata, including:
[0006] A main memory, the main memory includes a data storage area and a metadata storage area, the data storage area is used to store related data and its corresponding first error correction code, and the metadata storage area is used to store metadata and its corresponding second error correction code; and
[0007] A cache memory, the cache memory includes a cache control state machine and at least one storage unit, wherein the storage unit is used to cache metadata from the main memory and its corresponding second error correction code, and the cache control state machine is used to receive an access request corresponding to the metadata and perform corresponding operations on the target metadata cached in the storage unit according to the access request.
[0008] In a preferred example, the cache control state machine performing corresponding operations on the target metadata cached in the storage unit according to the access request includes:
[0009] Determining whether the target metadata corresponding to the access request is cached in the storage unit, and when it is determined that the target metadata is cached in the storage unit, performing corresponding operations on the target metadata; when it is determined that the target metadata is not cached in the storage unit, obtaining the target cache line where the target metadata is located from the main memory and caching the target cache line in the storage unit.
[0010] In a preferred example, the cache control state machine caching the target cache line in the storage unit includes:
[0011] Selecting one cache line from multiple cache lines of the storage unit as a replacement cache line and overwriting the replacement cache line with the obtained target cache line.
[0012] In a preferred example, before the cache control state machine overwrites the replacement cache line with the obtained target cache line, it is also used to:
[0013] Judging whether the replacement cache line has been modified according to the status field of the replacement cache line, and when it is determined that the replacement cache line has not been modified, overwriting the replacement cache line with the obtained target cache line; when it is determined that the replacement cache line has been modified, storing the replacement cache line into the main memory and overwriting the replacement cache line in the storage unit with the obtained target cache line.
[0014] In a preferred example, when the access request is a read request, after the cache control state machine caches the target cache line in the storage unit, it is also used to mark the status field of the target cache line as unmodified to indicate that the target cache line has not been modified.
[0015] In a preferred example, when the access request is a write request, after the cache control state machine performs corresponding operations on the target metadata cached in the storage unit according to the access request, it is further configured to mark the status field of the target cache line where the target metadata is located as modified, so as to indicate that the target cache line has been modified.
[0016] In a preferred example, the cache memory further includes a tag array memory, and the tag array memory is used to store a tag field, the status field, and a count field corresponding to each cache line in the storage unit;
[0017] Wherein, the tag field is used to indicate the storage address of the cache line in the main memory, the count field is used to indicate the historical access times of the cache line, and the status field is used to indicate the status of the cache line.
[0018] In a preferred example, determining whether the target metadata corresponding to the access request is cached in the storage unit includes:
[0019] The cache control state machine compares the tag field in the target address corresponding to the access request with the tag fields of the cache lines in at least one storage unit pointed to by the index field in the target address corresponding to the access request;
[0020] When the tag field in the target address matches the tag field of any one of the cache lines in the at least one storage unit, it is determined that the target metadata corresponding to the access request is cached in the storage unit; and
[0021] When the tag field in the target address does not match the tag fields of all the cache lines in the at least one storage unit, it is determined that the target metadata corresponding to the access request is not cached in the storage unit.
[0022] The present application also discloses a method for storing metadata, which is applied to a metadata storage system. The system includes a main memory and a cache memory. The main memory includes a data storage area and a metadata storage area. The data storage area is used to store related data and its corresponding first error correction code. The metadata storage area is used to store metadata and its corresponding second error correction code. The cache memory includes a cache control state machine and at least one storage unit. The storage unit is used to cache metadata from the main memory and its corresponding second error correction code. The method includes:
[0023] The cache control state machine receives an access request corresponding to metadata, and performs corresponding operations on the target metadata cached in the storage unit according to the access request.
[0024] In a preferred example, the cache control state machine performing corresponding operations on the target metadata cached in the storage unit according to the access request includes:
[0025] Determining whether the target metadata corresponding to the access request is cached in the storage unit;
[0026] When it is determined that the target metadata is cached in the storage unit, the cache control state machine performs corresponding operations on the target metadata; and
[0027] When it is determined that the target metadata is not cached in the storage unit, the cache control state machine obtains the target cache line where the target metadata is located from the main memory, and caches the target cache line in the storage unit.
[0028] In a preferred example, the cache control state machine caching the target cache line in the storage unit includes:
[0029] Selecting one cache line from multiple cache lines in the storage unit as the replacement cache line, and overwriting the replacement cache line with the obtained target cache line.
[0030] In a preferred example, before overwriting the replacement cache line with the obtained target cache line, it further includes:
[0031] Judging whether the replacement cache line has been modified according to the status field of the replacement cache line;
[0032] When it is determined that the replacement cache line has not been modified, overwriting the replacement cache line with the obtained target cache line; and
[0033] When it is determined that the replacement cache line has been modified, storing the replacement cache line in the main memory, and overwriting the replacement cache line in the storage unit with the obtained target cache line.
[0034] In a preferred example, when the access request is a read request, after the cache control state machine caches the target cache line in the storage unit, the method further includes:
[0035] Marking the status field of the target cache line as not modified to indicate that the target cache line has not been modified.
[0036] In a preferred example, when the access request is a write request, after the cache control state machine performs corresponding operations on the target metadata cached in the storage unit according to the access request, the method further includes:
[0037] Mark the status field of the target cache line where the target metadata is located as modified to indicate that the target cache line has been modified.
[0038] In the embodiments of the present application, an out-of-band storage scheme is adopted to decouple the access of related data and metadata, and the metadata is stored independently of the related data. This storage method can achieve independent access between the metadata and the related data, without any read-after-write DRAM overhead, and this scheme can make full use of the inherent spatial locality of the metadata. In addition, a cache for caching metadata is provided on the chip in this scheme, which can make the access of the metadata have a certain continuity and avoid frequent access to the main memory (such as DRAM).
[0039] A large number of technical features are recorded in the specification of the present application, which are distributed in various technical solutions. If all possible combinations of technical features (i.e., technical solutions) of the present application are listed, the specification will be too long. To avoid this problem, each technical feature disclosed in the above-mentioned invention content of the present application, each technical feature disclosed in the following embodiments and examples, and each technical feature disclosed in the drawings can be freely combined with each other to form various new technical solutions (these technical solutions should all be regarded as having been recorded in this specification), unless the combination of such technical features is technically infeasible. For example, in one example, features A+B+C are disclosed, and in another example, features A+B+D+E are disclosed, and features C and D are equivalent technical means that play the same role. Technically, only one of them can be used and it is impossible to use both at the same time. Feature E can be combined with feature C technically. Then, the scheme of A+B+C+D should not be regarded as having been recorded because it is technically infeasible, and the scheme of A+B+C+E should be regarded as having been recorded. Brief Description of the Drawings
[0040] Figure 1 is a block diagram of a storage system for metadata according to an embodiment of the present application.
[0041] Figure 2 is a flowchart of a method for storing metadata according to an embodiment of the present application.
[0042] Figure 3 is a detailed flowchart of a storage operation for metadata according to an embodiment of the present application. Detailed Embodiments [[ID=2,6]]
[0043] In the following description, many technical details are presented to enable readers to better understand the present application. However, those of ordinary skill in the art can understand that even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can still be implemented.
[0044] Explanation of some concepts:
[0045] Cache memory: A cache memory is a high-speed, small-capacity memory between the processor and the main memory, usually composed of SRAM (Static Random Access Memory). The cache is a bridge between the CPU and the main memory, used to balance the speed difference between high-speed devices (CPU) and low-speed devices (main memory).
[0046] Cache line: It is the unit in the cache memory used to store instruction data.
[0047] Metadata, also known as intermediate data or relay data, is data that describes data (also referred to as "related data" in this article), mainly information that describes the properties of data, used to support functions such as indicating storage locations, historical data, resource searches, file records, etc. Metadata is a kind of electronic directory. To achieve the purpose of compiling a directory, it is necessary to describe and collect the content or characteristics of the data, thereby assisting in data retrieval.
[0048] Error Correcting Code (ECC) is a technology that can achieve "error checking and correction".
[0049] To make the purpose, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0050] The metadata defined by CXL has an asymmetric access mode with its related data. Therefore, when the in-band storage method is adopted for the metadata defined by CXL, most read commands will result in write-after-read operations of the DRAM. Based on this, the embodiments of the present application adopt an out-of-band storage scheme to decouple the access of related data and metadata, such as Figure 1As shown in the figure, in the embodiment of the present application, the metadata is stored independently of the related data, and both the metadata and the related data have corresponding ECC protection. This storage method can achieve independent access between the metadata and the related data, without any read-after-write DRAM overhead, and this solution can make full use of the inherent spatial locality of the metadata. In addition, in this solution, a cache memory dedicated to caching metadata is provided on the chip, which can make the access to the metadata have a certain continuity and avoid frequent access to the main memory (such as DRAM).
[0051] Specific embodiments of the present application will be described in detail below.
[0052] An embodiment of the present application discloses a storage system for metadata, as Figure 1 shown. The storage system includes a main memory 101 and a cache memory 104 on the chip. The main memory 101 includes a data storage area 102 and a metadata storage area 103. The data storage area 102 is used to store related data and its corresponding first error correction code, and the metadata storage area 103 is used to store metadata and its corresponding second error correction code. In one embodiment, the main memory 101 may be a dynamic random access memory (DRAM). The cache memory 104 may include a cache control state machine 106, a tag array memory 105, and at least one storage unit for caching metadata, such as Figure 1 the storage units 107.1, 107.2,..., 107.n shown in the figure. Each storage unit can be implemented by a static random access memory (SRAM). In some embodiments, the storage unit can be implemented by the SRAM inside the chip. Generally, the processor chip will pre-read a number of metadata and their corresponding second error correction codes from the metadata storage area 103 in the main memory 101 and cache them in the cache memory 104, and then the metadata and the second error correction code can be directly obtained from the cache memory 104.
[0053] Each storage unit can store multiple cache lines (such as cacheline), and the data access between the main memory 101 and the cache memory 104 takes a cache line as the minimum access granularity. Each cache line includes a tag field, a state field, a count field, a data field, etc. The tag array memory 105 is used to store the tag field, the state field, and the count field corresponding to each cache line in the storage unit. Among them, each row of the tag array memory 105 corresponds to a cache line. The tag field indicates the storage address of the metadata cached in this cache line in the main memory 101, and the tag field is a part of the storage address of the metadata cached in this cache line in the main memory 101 (the tag part in this storage address). The count field is used to store the historical access times of this cache line. The state field is used to indicate the state of this cache line. For example, the exclusive state and the modified state. Among them, the exclusive state means that the metadata stored in this cache line is the same as the metadata stored at the corresponding address in the main memory 101, that is, the metadata stored in this cache line has not been modified. For example, it can be represented by "Exclusive". The modified state means that the metadata stored in this cache line is different from the metadata stored at the corresponding address in the main memory 101, that is, the metadata stored in this cache line has been modified. For example, it can be represented by "Modified".
[0054] The cache control state machine 106 receives an access request from the host. The target address corresponding to the access request may include a tag field, an index field, and an offset field. Among them, the index field is used to indicate the cache line corresponding to the access request. It can be understood that when the cache memory 104 includes multiple storage units, the index field can simultaneously serve as the index of the cache lines of multiple storage units. The tag field is used to indicate the address in the main memory 101 corresponding to the access request. The offset field is used to indicate the offset position of the target metadata corresponding to the access request in the target address. The access request may include a read request for metadata and a write request for metadata.
[0055] Specifically, when the cache control state machine 106 receives the access request, it can determine whether the metadata (i.e., the target metadata) in the target address corresponding to the access request is cached in the cache memory according to the access request.
[0056] In one embodiment, the cache control state machine 106 may first determine the cache line in the cache memory corresponding to the target address according to the index field in the target address. When there are multiple storage units in the cache memory, the index field may index to the cache lines in the multiple storage units. After that, the cache control state machine may compare the tag field in the target address with the tag fields of the cache lines in each of the storage units pointed to by the index field. When the tag field in the target address matches the tag field of the cache line in one of the storage units, it indicates that the metadata in the target address is cached in the cache memory, and the matching cache line is the target cache line where the metadata in the target address is stored; when the tag field in the access request does not match the tag fields of the cache lines in each of the storage units, it indicates that the metadata in the target address is not cached in the cache memory.
[0057] When it is determined that the metadata in the target address is cached in the cache memory 104, the cache control state machine 106 may directly execute the access request on the target cache line. Corresponding to a read request, the cache control state machine 106 may determine the position of the target metadata to be read in the target cache line according to the offset field in the access request, read the target metadata from the determined position, and return it to the host. Corresponding to a write request, the cache control state machine 106 may determine the write position of the target metadata to be written in the target cache line according to the offset field in the access request, and write the target metadata to the determined write position.
[0058] When it is determined that the metadata in the target address is not cached in the cache memory 104, the cache control state machine 106 may select a cache line as the replacement cache line from the cache lines of the multiple storage units in the cache memory 104, and determine whether it is necessary to store the replacement cache line to the main memory 101 according to the status field of the replacement cache line. When the status field of the replacement cache line indicates that the replacement cache line is modified, the cache control state machine 106 stores the replacement cache line to the main memory 101. When the status field of the replacement cache line indicates that the replacement cache line is not modified, there is no need to store the replacement cache line to the main memory, and the replacement operation can be directly performed subsequently.
[0059] In one embodiment, the cache control state machine 106 selects a cache line as the replacement cache line according to a preset rule. For example, the cache control state machine 106 may select a cache line according to the count field of the cache line, for example, select the cache line with the smallest count value as the replacement cache line. It should be noted that this application is not limited thereto, and any suitable rule or random selection can be used to select the replacement cache line.
[0060] After determining the replacement cache line, the cache control state machine 106 can obtain the target cache line corresponding to the access request from the main memory 101 and overwrite the replacement cache line in the cache memory with the target cache line. After that, the cache control state machine 106 can perform corresponding operations on the target cache line in the cache memory 104 according to the access request.
[0061] The embodiment of the present application also provides a method for storing metadata, and its flowchart is as Figure 2 shown. The caching method can be applied to the cache control state machine 106 described above, and the method includes:
[0062] Step 201, when receiving an access request, determine whether the metadata in the target address corresponding to the access request is cached in the cache memory. If not, go to step 202; if so, directly go to step 206.
[0063] The cache control state machine 106 can determine whether the metadata in the target address is cached in the cache memory according to the index field and the tag field in the target address. Specifically, the cache control state machine 106 can first determine the cache line of the cache memory corresponding to the target address according to the index field, and then compare the tag field in the target address with the tag field of the determined cache line. If the tag field in the target address matches the tag field of the determined cache line, it means that the metadata in the target address is cached in the cache memory, and the matching cache line is the target cache line where the metadata in the target address is stored; if not, it means that the metadata in the target address is not cached in the cache memory. When the cache memory includes multiple storage units, the index field can point to the cache line in the multiple storage units. At this time, the cache control state machine can compare the tag field in the target address with the tag fields of all the cache lines pointed to by the index field. If the tag field in the target address matches the tag field of one of the cache lines, it means that the metadata in the target address is cached in the cache memory; if the tag field in the target address does not match the tag fields of all the cache lines, it means that the metadata in the target address is not cached in the cache memory.
[0064] Step 202, select a cache line from the cache memory as the replacement cache line.
[0065] As described above, the cache control state machine can randomly select a cache line as the replacement cache line, or select it according to the count fields corresponding to the respective cache lines in the cache memory. For example, select the cache line with the smallest count value as the replacement cache line.
[0066] Step 203: Determine whether the replacement cache line has been modified. If it has been modified, proceed to step 204; if it has not been modified, directly proceed to step 205.
[0067] If it has been modified, it means that the metadata stored in the replacement cache line is different from the metadata stored at the corresponding address in the main memory. Therefore, it is necessary to write the replacement cache line into the main memory; if it has not been modified, it means that the metadata stored in the replacement cache line is the same as the metadata stored at the corresponding address in the main memory, and deleting the metadata stored in the replacement cache line will not cause metadata loss.
[0068] The cache control state machine can determine whether the replacement cache line has been modified according to the status field corresponding to the replacement cache line. For example, if the status field corresponding to the replacement cache line indicates the exclusive state, it means that the replacement cache line has not been modified; when the status field corresponding to the replacement cache line indicates the modified state, it means that the replacement cache line has been modified.
[0069] Step 204: Write the replacement cache line into the main memory.
[0070] Step 205: Obtain the target cache line corresponding to the target address from the main memory, and overwrite the replacement cache line in the cache memory with the target cache line.
[0071] It can be understood that when the access request is a metadata read request, after overwriting the replacement cache line in the cache memory with the target cache line, the cache control state machine can mark the status of the target cache line as the unmodified state, such as marking "Exclusive".
[0072] Step 206: Perform corresponding operations on the target cache line in the cache memory according to the access request.
[0073] It can be understood that in step 201, when the tag field in the target address matches the tag field of the cache line pointed to by the index field, the matching cache line is the target cache line; when the tag field in the target address does not match the tag field of the cache line pointed to by the index field, the cache line corresponding to the target address obtained from the main memory in step 205 is the target cache line.
[0074] If the access request is a read request for metadata, the corresponding target metadata can be read from the target cache line and returned to the host. Among them, the cache control state machine can determine the position of the target metadata to be read in the target cache line according to the offset field in the target address.
[0075] If the access request is a write request for metadata, the target cache line can be written with the target metadata to be written. Among them, the cache control state machine can determine the write position according to the offset field in the target address. It can be understood that after the target metadata is written into the target cache line, the cache control state machine can mark the state of the target cache line as the modified state, such as marking "Modified".
[0076] In practical applications, when the cache state control machine receives an access request, it can also first determine the type of the access request (read request or write request), and then execute different steps according to the type of the access request, such as Figure 3 shown
[0077] Step 301, when receiving an access request, determine whether the access request is a read request for metadata or a write request for metadata. If it is a read request, the cache control state machine executes steps 302-308. If it is a write request, the cache control state machine executes steps 309-315.
[0078] In one embodiment, if the access request is a read request for metadata, the cache control state machine performs the following operations:
[0079] Step 30), determine whether the metadata in the target address corresponding to the read request is cached in the cache memory.
[0080] If the metadata in the target address corresponding to the read request is not cached in the cache memory (i.e., cache miss), go to step 303, select a cache line in the cache lines of the cache memory as the replacement cache line, and then go to step 304. If the metadata in the target address corresponding to the read request is cached in the cache memory (i.e., cache hit), go to step 307.
[0081] Step 304, determine whether the replacement cache line has been modified according to the state of the replacement cache line.
[0082] If the replacement cache line has not been modified, proceed to step 305, read the target cache line corresponding to the target address from the main memory, and overwrite the replacement cache line with the target cache line, then proceed to step 306. If the replacement cache line has been modified, proceed to step 308 and write the replacement cache line to the main memory.
[0083] Step 306, mark the target cache line as the exclusive state.
[0084] Step 307, return the target metadata.
[0085] In one embodiment, if the access request is a write request for metadata, the cache control state machine performs the following operations:
[0086] Step 309, determine whether the metadata in the target address corresponding to the write request is cached in the cache memory.
[0087] If the metadata in the target address corresponding to the write request is not cached in the cache memory (i.e., cache miss), proceed to step 310, select a cache line from the cache lines of the cache memory as the replacement cache line, then proceed to step 311. If the metadata in the target address corresponding to the write request is cached in the cache memory (i.e., cache hit), proceed to step 313.
[0088] Step 311, determine whether the replacement cache line has been modified according to the state of the replacement cache line.
[0089] If the replacement cache line has not been modified, proceed to step 312, read the target cache line corresponding to the target address from the main memory, and overwrite the replacement cache line with the target cache line, then proceed to step 313. If the replacement cache line has been modified, proceed to step 315 and write the replacement cache line to the main memory.
[0090] Step 313, write the corresponding metadata to the target cache line.
[0091] Step 314, mark the target cache line as the modified state.
[0092] In the embodiments of the present application, metadata and related data are stored separately, and both the metadata and the related data are protected by ECC. Due to the decoupling of the metadata and the related data, the complete DRAM burst RMW (read-modify-write) for dynamic update and readout of the metadata will be avoided. The metadata uses a dedicated cache to utilize the spatial locality inherent in the access pattern. According to the metadata access attributes defined in the CXL specification, read allocation and write allocation set-associativity write-back caches are adopted to minimize the overhead of the DRAM. And the metadata cache is located upstream of the DRAM controller, and its implementation is not affected by the version updates of the CXL controller and the DRAM controller IP modules.
[0093] Correspondingly, the embodiments of the present application also provide a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the various method embodiments of the present application are implemented. The computer-readable storage medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, computer-readable storage media do not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0094] It should be noted that in the application documents of this patent, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one" does not exclude the existence of additional identical elements in the process, method, article or device comprising said element. In the application documents of this patent, if it is mentioned that an act is performed according to a certain element, it means that the act is performed at least according to that element, including two cases: performing the act only according to that element and performing the act according to that element and other elements. Expressions such as multiple, many times, various, etc. include 2, 2 times, 2 kinds, as well as more than 2, more than 2 times, more than 2 kinds.
[0095] All documents mentioned in this specification are considered to be integrally included in the disclosure of this application so that they can be used as a basis for modification if necessary. In addition, it should be understood that the above is only a preferred embodiment of this specification and is not used to limit the protection scope of this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included within the protection scope of one or more embodiments of this specification.
[0096] In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A storage system for metadata, characterized in that, Including: A main memory, the main memory including a data storage area and a metadata storage area, the data storage area being used for storing relevant data and its corresponding first error correction code, the metadata storage area being used for storing metadata and its corresponding second error correction code; And A cache memory, the cache memory including a cache control state machine and at least one storage unit, wherein, the storage unit is used for caching metadata from the main memory and its corresponding second error correction code, and the cache control state machine is used for receiving an access request corresponding to the metadata and performing corresponding operations on the target metadata cached in the storage unit according to the access request.
2. The system according to claim 1, wherein The cache control state machine performing corresponding operations on the target metadata cached in the storage unit according to the access request includes: Determining whether the target metadata corresponding to the access request is cached in the storage unit, and when it is determined that the target metadata is cached in the storage unit, performing corresponding operations on the target metadata; when it is determined that the target metadata is not cached in the storage unit, obtaining the target cache line where the target metadata is located from the main memory and caching the target cache line in the storage unit.
3. The system according to claim 2, wherein The cache control state machine caching the target cache line in the storage unit includes: Selecting one cache line from multiple cache lines of the storage unit as a replacement cache line and overwriting the replacement cache line with the obtained target cache line.
4. The system according to claim 3, wherein Before the cache control state machine overwrites the replacement cache line with the obtained target cache line, it is also used for: Judging whether the replacement cache line has been modified according to the status field of the replacement cache line, and when it is determined that the replacement cache line has not been modified, overwriting the replacement cache line with the obtained target cache line; when it is determined that the replacement cache line has been modified, storing the replacement cache line into the main memory and overwriting the replacement cache line in the storage unit with the obtained target cache line.
5. The system according to claim 2, wherein When the access request is a read request, after the cache control state machine caches the target cache line in the storage unit, it is also used for marking the status field of the target cache line as unmodified to indicate that the target cache line has not been modified.
6. The system according to claim 1, wherein When the access request is a write request, after the cache control state machine performs corresponding operations on the target metadata cached in the storage unit according to the access request, it is also used for marking the status field of the target cache line where the target metadata is located as modified to indicate that the target cache line has been modified.
7. The system according to claim 4, wherein The cache memory further includes a tag array memory, and the tag array memory is used for storing a tag field, the status field and a count field corresponding to each cache line in the storage unit; Among them, the tag field is used to indicate the storage address of the cache line in the main memory, the count field is used to indicate the historical access times of the cache line, and the status field is used to indicate the status of the cache line.
8. The system according to claim 7, wherein Determining whether the target metadata corresponding to the access request is cached in the storage unit includes: The cache control state machine compares the tag field in the target address corresponding to the access request with the tag field of the cache line in at least one storage unit pointed to by the index field in the target address corresponding to the access request; When the tag field in the target address matches the tag field of any cache line in the at least one storage unit, it is determined that the target metadata corresponding to the access request is cached in the storage unit; and When the tag field in the target address does not match the tag fields of all cache lines in the at least one storage unit, it is determined that the target metadata corresponding to the access request is not cached in the storage unit.
9. A method for storing metadata, characterized in that, Applied to a metadata storage system, the system includes a main memory and a cache memory. The main memory includes a data storage area and a metadata storage area. The data storage area is used to store relevant data and its corresponding first error correction code, and the metadata storage area is used to store metadata and its corresponding second error correction code; the cache memory includes a cache control state machine and at least one storage unit, and the storage unit is used to cache metadata from the main memory and its corresponding second error correction code; the method includes: The cache control state machine receives an access request corresponding to metadata and performs corresponding operations on the target metadata cached in the storage unit according to the access request.
10. The method according to claim 9, characterized in that, The cache control state machine performing corresponding operations on the target metadata cached in the storage unit according to the access request includes: Determining whether the target metadata corresponding to the access request is cached in the storage unit; When it is determined that the target metadata is cached in the storage unit, the cache control state machine performs corresponding operations on the target metadata; and When it is determined that the target metadata is not cached in the storage unit, the cache control state machine obtains the target cache line where the target metadata is located from the main memory and caches the target cache line in the storage unit.
11. The method according to claim 10, wherein The cache control state machine caching the target cache line in the storage unit includes: Selecting a cache line from multiple cache lines in the storage unit as a replacement cache line and overwriting the replacement cache line with the obtained target cache line.
12. The method according to claim 11, wherein Before overwriting the replacement cache line with the obtained target cache line, it further includes: Judging whether the replacement cache line has been modified according to the status field of the replacement cache line; When it is determined that the replacement cache line has not been modified, overwriting the replacement cache line with the obtained target cache line; and When it is determined that the replacement cache line is modified and stale, the replacement cache line is stored in the main memory, and the replacement cache line in the storage unit is overwritten with the obtained target cache line.
13. The method according to claim 10, wherein When the access request is a read request, after the cache control state machine caches the target cache line in the storage unit, the method further includes: Marking the status field of the target cache line as unmodified to indicate that the target cache line has not been modified.
14. The method according to claim 9, wherein When the access request is a write request, after the cache control state machine performs corresponding operations on the target metadata cached in the storage unit according to the access request, the method further includes: Marking the status field of the target cache line where the target metadata is located as modified to indicate that the target cache line has been modified.