Metadata management methods, apparatus, devices and readable storage media
By storing metadata uniformly in a metadata storage block and recording valid addresses, the problem of slow startup speed of storage devices caused by scattered metadata storage in existing technologies is solved, and fast power-on startup is achieved.
Patent Information
- Application Number
- CN202611313915.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, metadata is stored in different NAND physical blocks, which causes the storage device to spend a lot of time reading the header information of each type of metadata when it powers on and starts up, thus slowing down the startup speed.
Metadata is stored uniformly in a metadata storage block, and its valid address is recorded. When a power-on boot request is detected, the metadata of the valid address is read directly from the metadata storage block to control the power-on boot of the storage device.
By reducing repeated readings of metadata header information, the power-on startup speed of storage devices is significantly improved, the amount of scanning is reduced, and the startup efficiency of storage devices is optimized.
Smart Images

Figure CN123114367A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technology, and in particular to a metadata management method, apparatus, device, and readable storage medium. Background Technology
[0002] Storage devices generate a large amount of metadata during operation, mainly including link tables, write-protected blocks (WPRO), operation logs, and mapinfo information. In existing solutions, various types of metadata are scattered across different NAND physical blocks, with each type of metadata occupying its own independent physical block.
[0003] Based on existing metadata storage, when a storage device powers on, it needs to read the header information (including the current sequence number, CRC checksum, etc.) of each type of metadata in different NAND physical blocks. Only by determining the valid metadata in each type of metadata based on the header information can power-on be achieved based on the valid metadata. However, since various types of metadata are stored in different NAND physical blocks, it takes a lot of time to read the header information of each type of metadata, which slows down the power-on speed of the storage device. Summary of the Invention
[0004] In view of this, the purpose of this application is to overcome the shortcomings of the prior art, avoid the need for various types of metadata to be scattered in different NAND physical blocks, and avoid the need to spend a lot of time reading the header information of each type of metadata, thereby improving the power-on speed of the storage device.
[0005] This application provides a metadata management method, which is applied to a storage device, the storage device including a metadata storage block, the method comprising: Obtain the metadata generated by the operation of the storage device, store the metadata in the metadata storage block, and record the valid address of the metadata in the metadata storage block; When a power-on request is detected, the metadata corresponding to the valid address is read from the metadata storage block, and the storage device is powered on and started based on the metadata.
[0006] In one embodiment, the step of obtaining the metadata generated by the operation of the storage device, storing the metadata uniformly in the metadata storage block, and recording the valid address of the metadata in the metadata storage block includes: Obtain the metadata generated by the operation of the storage device, and determine the dedicated storage area of the metadata in the metadata storage block according to the metadata type of the metadata; According to a preset allocation strategy, a target storage page is determined from the free storage pages in the dedicated storage area, and the metadata is stored in the target storage page; Based on the target storage page, a valid address is determined, and the valid address is recorded in the status record table corresponding to the dedicated storage area.
[0007] In one embodiment, the step of determining the target storage page from the free storage pages in the dedicated storage area according to a preset allocation strategy includes: Obtain the address sequence of non-free storage pages in the dedicated storage area, and determine the storage page with the current largest address based on the address sequence; Among the free storage pages in the dedicated storage area, the storage page adjacent to the storage page with the current maximum address is selected as the target storage page.
[0008] In one embodiment, the step of reading the metadata corresponding to the valid address from the metadata storage block when a power-on boot request is detected, and controlling the power-on boot of the storage device based on the metadata, includes: Upon detecting a power-on boot request, determine all metadata types required for power-on boot; For each of the aforementioned metadata types, a dedicated storage area for that metadata type is determined, and a valid address is read from the status record table corresponding to the dedicated storage area, and the metadata corresponding to the valid address is read from the dedicated storage area; Based on all the read metadata, control the storage device to power on and start.
[0009] In one embodiment, the method further includes: Detect whether the free space of the dedicated storage area has reached a preset first space threshold; If the free space reaches a preset first space threshold, then read the metadata corresponding to the valid address in the dedicated storage area; Allocate a free storage area in the metadata storage block as a new dedicated storage area, and store the metadata corresponding to the valid address in the new dedicated storage area.
[0010] In one embodiment, the method further includes: Detect whether the free space of the metadata storage block has reached a preset second space threshold; If the free space reaches a preset second space threshold, then read the metadata corresponding to the valid addresses of all metadata types from the metadata storage block; Allocate a free storage block in the storage device as a new metadata storage block, and store the metadata corresponding to the valid addresses of all the metadata types in the new metadata storage block.
[0011] In one embodiment, the method further includes: For each of the aforementioned metadata types, a dedicated backup storage area is allocated within the metadata storage block; The metadata in the dedicated storage area corresponding to each metadata type is backed up and stored in the corresponding dedicated backup storage area.
[0012] This application also provides a metadata management device, the metadata management device comprising: The storage module is used to acquire the metadata generated by the operation of the storage device, store the metadata in the metadata storage block, and record the valid address of the metadata in the metadata storage block; The startup module is used to read the metadata corresponding to the valid address from the metadata storage block when a power-on startup request is detected, and to control the storage device to power on and start based on the metadata.
[0013] This application also provides a storage device, which includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the above-described metadata management method.
[0014] This application also provides a computer-readable storage medium storing a computer program that executes the above-described metadata management method when run on a processor.
[0015] The embodiments of this application have the following beneficial effects: This application applies to a storage device, which includes a metadata storage block. The method includes: acquiring metadata generated during the operation of the storage device, storing the metadata in the metadata storage block, and recording the valid address of the metadata in the metadata storage block; upon detecting a power-on boot request, reading the metadata corresponding to the valid address in the metadata storage block, and controlling the power-on boot of the storage device based on the metadata. By storing the metadata in the metadata storage block, only the metadata at the valid address in the metadata storage block needs to be read during power-on boot, avoiding the need for various types of metadata to be scattered across different NAND physical blocks, which would require a significant amount of time to read the header information of each type of metadata, thus improving the power-on boot speed of the storage device. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and therefore should not be considered as a limitation on the scope of protection of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating the first embodiment of the metadata management method provided in this application; Figure 2 A flowchart illustrating a second embodiment of the metadata management method provided in this application; Figure 3 A flowchart illustrating a third embodiment of the metadata management method provided in this application; Figure 4 A flowchart illustrating the fourth embodiment of the metadata management method provided in this application; Figure 5 A flowchart illustrating the fifth embodiment of the metadata management method provided in this application; Figure 6 A flowchart illustrating the sixth embodiment of the metadata management method provided in this application; Figure 7 A schematic diagram illustrating the process of storing metadata provided in this application; Figure 8 A schematic diagram of the metadata management device provided in this application. Detailed Implementation
[0018] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0019] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0020] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0021] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0022] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0023] It is understood that the method of this application is applied to a metadata management system, which is installed in storage devices such as SSD (Solid-State Drive) or UFS (Universal Flash Storage) commonly used in consumer smart terminals. For ease of explanation, the following embodiments use a metadata management system as an example for detailed description.
[0024] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0025] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a first embodiment of the metadata management method provided in this application. The method is applied to a storage device, which includes a metadata storage block. The method includes: Step S101: Obtain the metadata generated by the operation of the storage device, store the metadata in the metadata storage block, and record the valid address of the metadata in the metadata storage block.
[0026] In this embodiment, the metadata management system acquires the generated metadata during the operation of the storage device, stores this metadata uniformly in the metadata storage block, and records the valid address of the metadata in the metadata storage block. It should be noted that the metadata of the storage device can generally be divided into the following categories: tables (Linktable) for storing information about each block, write protection information snapshots (WPRO information), operation logs (log) generated during firmware operation, and snapshots of various management information during runtime (Mapinfo), etc. The metadata storage block allocates a corresponding storage area for each type of metadata, using Link IDs (e.g., LinkID_WPRO, LinkID_Linktable, LinkID_log, LinkID_Mapinfo) as unique identifiers for each type of metadata storage area. The storage areas storing each type of metadata have contiguous storage addresses. Metadata is written from the lowest address to the highest address in the storage area according to the generation time sequence. The storage address of the most recently generated metadata in the storage area is the valid address, and the metadata storage block has matching positions to record the valid address of each type of metadata.
[0027] Step S102: When a power-on startup request is detected, the metadata corresponding to the valid address is read from the metadata storage block, and the storage device is powered on and started based on the metadata.
[0028] In this embodiment, when the metadata management system detects a power-on request, it directly reads the metadata corresponding to the valid address from the metadata storage block and controls the power-on of the storage device based on the metadata. It is understood that the metadata storage block has matching locations for recording the valid addresses of each type of metadata. The metadata management system reads the valid addresses of each type of metadata, then reads the metadata from the storage area of each type of metadata at the valid addresses, and then controls the power-on of the storage device based on this metadata.
[0029] It's important to note that in existing storage devices, metadata is not static; it's dynamically updated continuously through background operations such as host writes, garbage collection (GC), and wear leveling (WL). However, flash memory has a fundamental limitation: it cannot be modified in-place. Any data update requires erasing the entire block (typically 128–512 pages) before writing the new data to free pages. This leads to a critical issue: the same metadata might be scattered across multiple physical pages, or even multiple blocks, at different times. To accurately identify the latest, valid, and reliable version from these fragmented metadata at power-on, a control information segment must be appended to each page's metadata—this is the header information. It typically includes fields such as version number, generation counter, checksum (CRC), and valid flag. Thus, when the storage device powers on, it must traverse all blocks containing metadata, read the header information, compare the sequence number and CRC, and ultimately select the metadata with the largest sequence number and successful verification as the valid metadata. Only based on this valid metadata can the storage device be powered on and started. This application stores metadata in a metadata storage block. Upon power-on startup, it only needs to read the metadata of the valid address in the metadata storage block to quickly determine the valid metadata. This significantly reduces the parsing time and eliminates the need for comparison header information, greatly reducing the amount of scanning and thus significantly improving the power-on startup speed of the storage device.
[0030] The metadata management system in this embodiment acquires metadata generated during the operation of the storage device, stores the metadata in a metadata storage block, and records the valid addresses of the metadata in the metadata storage block. When a power-on boot request is detected, the system reads the metadata corresponding to the valid address from the metadata storage block and controls the power-on boot of the storage device based on the metadata. By storing the metadata in a metadata storage block, only the metadata at the valid address in the metadata storage block needs to be read during power-on boot, avoiding the need for various types of metadata to be scattered across different NAND physical blocks, which would require a lot of time to read the header information of each type of metadata, thus improving the power-on boot speed of the storage device.
[0031] Please refer to Figure 2 , Figure 2 The flowchart illustrates a second embodiment of the metadata management method provided in this application. The difference between the second and first embodiments lies in the step of acquiring the metadata generated during the operation of the storage device, uniformly storing the metadata in the metadata storage block, and recording the valid address of the metadata in the metadata storage block, which includes: Step S201: Obtain the metadata generated by the operation of the storage device, and determine the dedicated storage area of the metadata in the metadata storage block according to the metadata type of the metadata.
[0032] In this embodiment, the metadata management system acquires metadata generated by the storage device during operation and determines a dedicated storage area for the metadata within the metadata storage block based on the metadata type. It is understood that the metadata storage block allocates a corresponding storage area for each type of metadata, using Link ID (e.g., LinkID_WPRO, LinkID_Linktable, LinkID_log, LinkID_Mapinfo) as a unique identifier for each type of metadata storage area. When the metadata management system acquires metadata of type Link table, it determines the storage area identified as LinkID_Linktable as the dedicated storage area for Link table metadata. When the metadata management system acquires metadata of type WPRO information, it determines the storage area identified as LinkID_WPRO as the dedicated storage area for WPRO information metadata. When the metadata management system acquires metadata of type log, it determines the storage area identified as LinkID_log as the dedicated storage area for log metadata. When the metadata management system acquires metadata of type Mapinfo, it determines the storage area identified as LinkID_Mapinfo as the dedicated storage area for Mapinfo metadata.
[0033] Step S202: According to the preset allocation strategy, determine the target storage page from the free storage pages in the dedicated storage area, and store the metadata in the target storage page.
[0034] In this embodiment, after determining the dedicated storage area for the metadata, the metadata management system identifies a target storage page from the free storage pages in the dedicated storage area according to a preset allocation strategy, and stores the metadata in the target storage page. Optionally, the preset allocation strategy may be to randomly select the target storage page from the free storage pages in the dedicated storage area, or to randomly select the target storage page from the free storage pages according to the address sequence of the non-free storage pages. It is understood that the number of target storage pages needs to be determined based on the size of the metadata.
[0035] In one embodiment, the step of determining the target storage page from the free storage pages in the dedicated storage area according to a preset allocation strategy includes: Step S2021: Obtain the address sequence of non-free storage pages in the dedicated storage area, and determine the storage page with the current largest address based on the address sequence.
[0036] Step S2022: Among the free storage pages in the dedicated storage area, select the storage page adjacent to the storage page with the current maximum address and determine it as the target storage page.
[0037] In this embodiment, metadata is stored in the dedicated storage area in order from the lowest address to the highest address; that is, newly generated metadata is stored immediately following the address of the old metadata. The metadata management system obtains the address sequence of non-free storage pages in the dedicated storage area, determines the storage page with the current highest address based on the address sequence, and selects the storage page adjacent to the storage page with the current highest address from the free storage pages in the dedicated storage area as the target storage page. Since it is stored in order from the lowest address to the highest address, directly finding the storage page adjacent to the storage page with the current highest address and determining it as the target storage page ensures that newly generated metadata is stored immediately following the address of the old metadata.
[0038] For example, based on the address sequence of non-free storage pages in the dedicated storage area, the current highest address valid page is found to be Page 225. If the metadata requires three storage pages to be stored, then Page 226, Page 227, and Page 228, which follow Page 225, are the target storage pages.
[0039] Step S203: Determine the valid address based on the target storage page, and record the valid address in the status record table corresponding to the dedicated storage area.
[0040] In this embodiment, the metadata management system stores metadata in the target storage page, determines the valid address based on the target storage page, and records the valid address in the status record table corresponding to the dedicated storage area. For example, the status record table can be a pre-defined record table in the OOB (Out-Of-Band) area of the dedicated storage area, specifically used to record the valid addresses of the dedicated storage area.
[0041] The metadata management system in this embodiment acquires metadata generated by the storage device during operation and determines a dedicated storage area for the metadata within the metadata storage block based on the metadata type. According to a preset allocation strategy, it identifies a target storage page from the free storage pages within the dedicated storage area and stores the metadata in that target page. Based on the target storage page, it determines a valid address and records it in the status log table corresponding to the dedicated storage area. By sharing a metadata storage block with multiple types of metadata, instead of allocating separate storage blocks for each type, the system significantly reduces the physical blocks occupied by metadata, eliminates storage fragmentation, and frees up more OP (operational operations) redundancy space. Sufficient OP can optimize GC (Garbage Collection) and WL (Workload) scheduling logic, reduce background tasks from preempting host I / O bandwidth, and stabilize the continuous read / write bandwidth performance of the SSD. Simultaneously, allocating a dedicated storage area for each type of metadata and recording the latest valid address of the metadata in the status log table corresponding to the dedicated storage area helps the storage device quickly read the metadata at a valid address in the metadata storage block during power-on, improving the power-on speed of the storage device.
[0042] Please refer to Figure 3 , Figure 3 The flowchart illustrates a third embodiment of the metadata management method provided in this application. The difference between this third embodiment and the first to second embodiments lies in the step of reading the metadata corresponding to the valid address from the metadata storage block upon detecting a power-on request, and controlling the power-on startup of the storage device based on the metadata. This step includes: Step S301: When a power-on startup request is detected, determine all metadata types required for power-on startup.
[0043] Step S302: For each metadata type, determine the dedicated storage area for the metadata type, read the valid address from the status record table corresponding to the dedicated storage area, and read the metadata corresponding to the valid address from the dedicated storage area.
[0044] Step S303: Based on all the read metadata, control the storage device to power on and start.
[0045] In this embodiment, when the metadata management system detects a power-on startup request, it determines all metadata types required for power-on startup. In the dedicated storage area of each metadata type in the metadata storage block, it reads the valid address from the status record table corresponding to the dedicated storage area, reads the corresponding metadata in the dedicated storage area based on the valid address, and then controls the storage device to power on and start based on all the read metadata.
[0046] It is understandable that the metadata corresponding to a valid address is the latest metadata. The metadata management system can quickly obtain the latest metadata based on the valid address. This not only improves the speed of metadata reading, but also avoids misreading old and invalid metadata, which could lead to failure to power on and start up.
[0047] The metadata management system in this embodiment reads the valid address of the latest metadata from the status record table corresponding to the dedicated storage area of each type of metadata when the storage device is powered on and started. Then, it reads the latest metadata to control the power-on and startup of the storage device. This not only improves the speed of metadata reading, but also avoids misreading old invalid metadata, which would prevent the storage device from being powered on and started, thus improving the efficiency of the power-on and startup of the storage device.
[0048] Please refer to Figure 4 , Figure 4 A flowchart illustrating a fourth embodiment of the metadata management method provided in this application. The difference between the fourth embodiment and the first to third embodiments is that the method further includes: Step S401: Detect whether the free space of the dedicated storage area has reached a preset first space threshold.
[0049] Step S402: If the free space reaches a preset first space threshold, then read the metadata corresponding to the valid address in the dedicated storage area.
[0050] Step S403: Allocate a free storage area in the metadata storage block as a new dedicated storage area, and store the metadata corresponding to the valid address in the new dedicated storage area.
[0051] In this embodiment, during operation, the metadata management system will detect in real time whether the free space of the dedicated storage area of metadata has reached a preset first space threshold. If the free space reaches the preset first space threshold, the metadata corresponding to the valid address will be read from the dedicated storage area, and a free storage area will be allocated in the metadata storage block as a new dedicated storage area. The metadata corresponding to the valid address will be stored in the new dedicated storage area.
[0052] In one embodiment, the preset first space threshold is 0. That is, if the metadata management system determines that the dedicated storage area for metadata is full, it reads the metadata corresponding to the valid address from the dedicated storage area, allocates a free storage area in the metadata storage block as a new dedicated storage area, and stores the metadata corresponding to the valid address in the new dedicated storage area. It is understood that transferring only the valid metadata can further reduce the amount of data transferred and avoid consuming too much computing power.
[0053] In this embodiment, if the metadata management system determines that the dedicated storage area for metadata is full, it reads the metadata corresponding to the valid address from the dedicated storage area, allocates a free storage area in the metadata storage block as a new dedicated storage area, and stores the metadata corresponding to the valid address in the new dedicated storage area. This avoids the possibility of metadata loss if metadata continues to be stored when the dedicated storage area is full, thus improving the reliability and security of metadata storage.
[0054] Please refer to Figure 5 , Figure 5 A flowchart illustrating the fifth embodiment of the metadata management method provided in this application. The difference between the fifth embodiment and the first to fourth embodiments is that the method further includes: Step S501: Detect whether the free space of the metadata storage block has reached a preset second space threshold.
[0055] Step S502: If the free space reaches a preset second space threshold, then read the metadata corresponding to the valid addresses of all metadata types in the metadata storage block.
[0056] Step S503: Allocate a free storage block in the storage device as a new metadata storage block, and store the metadata corresponding to the valid addresses of all the metadata types in the new metadata storage block.
[0057] In this embodiment, during operation, the metadata management system continuously monitors whether the free space of the metadata storage block reaches a preset second space threshold. If the free space reaches the preset second space threshold, it reads the metadata corresponding to the valid addresses of all metadata types from the metadata storage block, allocates a free storage block in the storage device as a new metadata storage block, and stores the metadata corresponding to the valid addresses of all metadata types in the new metadata storage block. It is understood that when storing metadata of various types in the new metadata storage block, a dedicated storage area is allocated for each type of metadata, and each type of metadata is stored separately in its corresponding dedicated storage area.
[0058] In one embodiment, the preset second space threshold is also 0. That is, if the metadata management system determines that the metadata storage block is full, it reads the metadata corresponding to the valid addresses of all metadata types from the metadata storage block, allocates a free storage block in the storage device as a new metadata storage block, and stores the metadata corresponding to the valid addresses of all metadata types in the new metadata storage block. It is understood that transferring only the valid metadata can further reduce the amount of data transferred and avoid consuming too much computing power.
[0059] In one embodiment, after the metadata management system stores the metadata corresponding to the valid addresses of all metadata types in a new metadata storage block, it erases all the metadata stored in the new metadata storage block, so that the storage block can be used to store new data, thus avoiding the old invalid metadata occupying the storage space of the storage device.
[0060] In this embodiment, the metadata management system determines that the metadata storage block is full. If so, it reads the metadata corresponding to the valid addresses of all metadata types from the metadata storage block, allocates a free storage block in the storage device as a new metadata storage block, and stores the metadata corresponding to the valid addresses of all metadata types in the new metadata storage block. This avoids the possibility of metadata loss that might occur if metadata is stored when the metadata storage block is full, thus improving the reliability and security of metadata storage.
[0061] Please refer to Figure 6 , Figure 6 A flowchart illustrating a sixth embodiment of the metadata management method provided in this application. The difference between the sixth embodiment and the first to fifth embodiments is that the method further includes: Step S601: For each of the metadata types, allocate a dedicated backup storage area in the metadata storage block.
[0062] Step S602: Backup and store the metadata in the dedicated storage area corresponding to each metadata type into the corresponding dedicated backup storage area.
[0063] In this embodiment, the metadata management system allocates a dedicated backup storage area within the metadata storage block for each metadata type. The metadata in the dedicated storage area corresponding to each metadata type is backed up and stored in the corresponding dedicated backup storage area. Simultaneously, each dedicated backup storage area is identified by its own identifier. For example: if the identifier of the dedicated storage area is LinkID_WPRO, the identifier of the dedicated backup storage area is LinkID_WPRO_backup; if the identifier of the dedicated storage area is LinkID_Linktable, the identifier of the dedicated backup storage area is LinkID_Linktable_backup; if the identifier of the dedicated storage area is LinkID_log, the identifier of the dedicated backup storage area is LinkID_log_backup; if the identifier of the dedicated storage area is LinkID_Mapinfo, the identifier of the dedicated backup storage area is LinkID_Mapinfo_backup.
[0064] In this embodiment, the metadata management system allocates a dedicated backup storage area in the metadata storage block for each metadata type. The metadata in the dedicated storage area corresponding to each metadata type is backed up and stored in the corresponding dedicated backup storage area, which further avoids metadata loss and further improves the reliability and security of metadata storage.
[0065] Please refer to the following during the specific implementation process. Figure 7 , Figure 7 This is a flowchart illustrating the metadata storage process provided in this application. The metadata management system allocates metadata storage blocks in the storage device. Within each metadata storage block, a dedicated storage area is allocated for each type of metadata. Upon detecting new metadata, the system checks if the corresponding dedicated storage area is full. If not, the metadata is written to that dedicated storage area. If full, the system checks if the metadata storage block is full. If not, a new dedicated storage area is allocated within the metadata storage block for that type of metadata, and the metadata is written to the new dedicated storage area. If the metadata storage block is full, a free storage block is allocated in the storage device as a new metadata storage block. Metadata corresponding to the valid addresses of all metadata types is stored in this new metadata storage block. When storing metadata of each type in the new metadata storage block, a dedicated storage area is allocated for each type of metadata, and each type of metadata is stored separately in its corresponding dedicated storage area. After completing the metadata storage, the metadata management system backs up the metadata.
[0066] refer to Figure 8 , Figure 8 This is a schematic diagram of the metadata management device provided in this application. The metadata management device includes: Storage module 10 is used to acquire metadata generated by the operation of the storage device, store the metadata in the metadata storage block, and record the valid address of the metadata in the metadata storage block.
[0067] The startup module 20 is used to read the metadata corresponding to the valid address from the metadata storage block when a power-on startup request is detected, and to control the storage device to power on and start based on the metadata.
[0068] It is understood that the metadata management device in this embodiment corresponds to the metadata management method in the above embodiments, and the options in the above embodiments are also applicable to this embodiment, so they will not be described again here.
[0069] This application also provides a storage device, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to enable the storage device to perform the metadata management method described above.
[0070] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0071] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.
[0072] This application also provides a computer storage medium for storing the computer program used in the aforementioned storage device. The computer storage medium can be a readable storage medium, a non-volatile storage medium, or a volatile storage medium. For example, the computer storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0073] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0074] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0075] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a storage device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0076] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A metadata management method, characterized in that, The method is applied to a storage device, the storage device including a metadata storage block, and the method includes: Obtain the metadata generated by the operation of the storage device, store the metadata in the metadata storage block, and record the valid address of the metadata in the metadata storage block; When a power-on request is detected, the metadata corresponding to the valid address is read from the metadata storage block, and the storage device is powered on and started based on the metadata.
2. The metadata management method according to claim 1, characterized in that, The step of acquiring the metadata generated by the operation of the storage device, storing the metadata uniformly in the metadata storage block, and recording the valid address of the metadata in the metadata storage block includes: Obtain the metadata generated by the operation of the storage device, and determine the dedicated storage area of the metadata in the metadata storage block according to the metadata type of the metadata; According to a preset allocation strategy, a target storage page is determined from the free storage pages in the dedicated storage area, and the metadata is stored in the target storage page; Based on the target storage page, a valid address is determined, and the valid address is recorded in the status record table corresponding to the dedicated storage area.
3. The metadata management method according to claim 2, characterized in that, The step of determining the target storage page from the free storage pages in the dedicated storage area according to a preset allocation strategy includes: Obtain the address sequence of non-free storage pages in the dedicated storage area, and determine the storage page with the current largest address based on the address sequence; Among the free storage pages in the dedicated storage area, the storage page adjacent to the storage page with the current maximum address is selected as the target storage page.
4. The metadata management method according to claim 2, characterized in that, The step of reading the metadata corresponding to the valid address from the metadata storage block when a power-on startup request is detected, and controlling the power-on startup of the storage device based on the metadata, includes: Upon detecting a power-on boot request, determine all metadata types required for power-on boot; For each of the aforementioned metadata types, a dedicated storage area for that metadata type is determined, and a valid address is read from the status record table corresponding to the dedicated storage area, and the metadata corresponding to the valid address is read from the dedicated storage area; Based on all the read metadata, control the storage device to power on and start.
5. The metadata management method according to claim 2, characterized in that, The method further includes: Detect whether the free space of the dedicated storage area has reached a preset first space threshold; If the free space reaches a preset first space threshold, then read the metadata corresponding to the valid address in the dedicated storage area; Allocate a free storage area in the metadata storage block as a new dedicated storage area, and store the metadata corresponding to the valid address in the new dedicated storage area.
6. The metadata management method according to claim 2, characterized in that, The method further includes: Detect whether the free space of the metadata storage block has reached a preset second space threshold; If the free space reaches a preset second space threshold, then read the metadata corresponding to the valid addresses of all metadata types from the metadata storage block; Allocate a free storage block in the storage device as a new metadata storage block, and store the metadata corresponding to the valid addresses of all the metadata types in the new metadata storage block.
7. The metadata management method according to claim 2, characterized in that, The method further includes: For each of the aforementioned metadata types, a dedicated backup storage area is allocated within the metadata storage block; The metadata in the dedicated storage area corresponding to each metadata type is backed up and stored in the corresponding dedicated backup storage area.
8. A metadata management device, characterized in that, The metadata management device includes: The storage module is used to acquire metadata generated by the operation of the storage device, store the metadata in a unified metadata storage block, and record the valid address of the metadata in the metadata storage block; The startup module is used to read the metadata corresponding to the valid address from the metadata storage block when a power-on startup request is detected, and to control the storage device to power on and start based on the metadata.
9. A storage device, characterized in that, The storage device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the metadata management method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a processor, executes the metadata management method according to any one of claims 1-7.
