UFS metadata reconstruction method, device, readable storage medium and electronic device
By judging power outage in UFS storage and using version number information and P2L table to restore the L2P table, the problem of low efficiency and consistency of metadata reconstruction in UFS storage without external DRAM is solved, and fast and efficient metadata recovery is achieved.
Patent Information
- Application Number
- CN202410985587.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-07-23
AI Technical Summary
In UFS storage products without external DRAM, power failure is prone to occur during writing, resulting in low and inconsistent metadata recovery efficiency. Traditional methods require rescanning the L2P table to calculate the number of valid data, which takes a long time and may lead to repair errors.
By determining whether the power has occurred, obtain the version number information of the last disk, restore the L2P table in the super block, and use the P2L table to restore the remaining L2P table, update the number of valid data and version number information, and write to the preset partition , avoid rescanning the L2P table.
It improves the efficiency and consistency of metadata reconstruction, saves reconstruction time, ensures the reliability of metadata, and avoids data loss and inconsistency problems.
Smart Images

Figure CN118519667B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular to a UFS metadata reconstruction method, device, readable storage medium and electronic device. Background Art
[0002] In DRAM-less (no external dynamic random access memory) UFS (Universal Flash Storage) embedded storage products, power outages during the writing process are usually unavoidable. When power outages occur, the firmware may be operating some key metadata or writing data, and the data needs to be rebuilt after powering on again.
[0003] The traditional method for recovering the valid-count (number of valid data) of the L2P table (recording the mapping relationship between the host logical address LBA and the physical address PBA) and SPB (superblock) is to scan the actual content in the L2P table and reset the valid-count to make the two consistent during power-on reconstruction. This method causes the L2P table to be loaded repeatedly, which is time-consuming. At the same time, if there is a problem with the L2P table itself, the repaired valid-count will also have problems. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a UFS metadata reconstruction method, device, readable storage medium and electronic device, which can improve the efficiency of metadata reconstruction and effectively ensure the consistency of metadata.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A UFS metadata reconstruction method comprises the following steps:
[0007] In the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, determining whether a power failure occurs, and if so, powering on again;
[0008] Obtaining version number information of the last disk download from a preset partition of the memory, and restoring part of the L2P table in the super block based on the version number information of the last disk download;
[0009] Acquire a P2L table corresponding to the latest L2P table, and restore the remaining L2P tables in the super block based on the P2L table;
[0010] The valid data quantity information and the version number information of the super block corresponding to all the restored L2P tables are updated, and the valid data quantity information and the version number information are written into the preset partition.
[0011] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0012] A UFS metadata reconstruction device, comprising:
[0013] A power-on module, used to determine whether a power failure occurs during the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, and if so, re-power on;
[0014] A first recovery module, configured to obtain the version number information of the last disk download from the preset partition of the memory, and to recover part of the L2P table in the super block based on the version number information of the last disk download;
[0015] a second recovery module, configured to obtain a P2L table corresponding to the latest L2P table, and recover the remaining L2P tables in the super block based on the P2L table;
[0016] The update module is used to update the valid data number information and the version number information of the super block corresponding to all the restored L2P tables, and write the valid data number information and the version number information into the preset partition.
[0017] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0018] A computer-readable storage medium stores a computer program, which implements each step of the above-mentioned UFS metadata reconstruction method when executed by a processor.
[0019] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0020] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements each step of the above-mentioned UFS metadata reconstruction method when executing the computer program.
[0021] The beneficial effect of the present invention is that: in the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, power failure occurs. After power is restored, the version number information of the last disk download is obtained from the preset partition of the memory, and part of the L2P table in the super block is restored based on the version number information of the last disk download, and the remaining L2P table is restored based on the obtained P2L table, and the valid data number information and version number information of the super block corresponding to all the restored L2P tables are updated and written into the preset partition, so that the metadata after power failure and restart is rebuilt using the version number information and the P2L table, without rescanning the L2P table to calculate the valid data number information, saving a lot of reconstruction time, and ensuring the consistency between the restored L2P table and the valid data number information, thereby improving the efficiency of metadata reconstruction, and effectively ensuring the consistency of metadata, thereby improving the reliability of metadata. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A flowchart of a method for reconstructing UFS metadata according to an embodiment of the present invention;
[0023] Figure 2 A schematic diagram of the structure of a UFS metadata reconstruction device according to an embodiment of the present invention;
[0024] Figure 3 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention;
[0025] Figure 4 A schematic diagram of metadata writing to a disk in a UFS metadata reconstruction method according to an embodiment of the present invention;
[0026] Figure 5 This is a schematic diagram of L2P in the UFS metadata reconstruction method according to an embodiment of the present invention;
[0027] Figure 6 A schematic diagram of L2PP2 recovery in a UFS metadata reconstruction method according to an embodiment of the present invention;
[0028] Figure 7 The figure is a schematic diagram of L2PP3 disk writing in the UFS metadata reconstruction method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0030] Please refer to Figure 1 , a UFS metadata reconstruction method, comprising the steps of:
[0031] In the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, determining whether a power failure occurs, and if so, powering on again;
[0032] Obtaining version number information of the last disk download from a preset partition of the memory, and restoring part of the L2P table in the super block based on the version number information of the last disk download;
[0033] Acquire a P2L table corresponding to the latest L2P table, and restore the remaining L2P tables in the super block based on the P2L table;
[0034] The valid data quantity information and the version number information of the super block corresponding to all the restored L2P tables are updated, and the valid data quantity information and the version number information are written into the preset partition.
[0035] From the above description, it can be seen that the beneficial effect of the present invention is that: in the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, power failure occurs. After power is restored, the version number information of the last disk download is obtained from the preset partition of the memory, and part of the L2P table in the super block is restored based on the version number information of the last disk download, and the remaining L2P table is restored based on the obtained P2L table, and the valid data number information and version number information of the super block corresponding to all the restored L2P tables are updated and written into the preset partition, so that the metadata after power failure and restart is rebuilt using the version number information and the P2L table, without the need to rescan the L2P table to calculate the valid data number information, saving a lot of reconstruction time, and being able to ensure the consistency between the restored L2P table and the valid data number information, thereby improving the efficiency of metadata reconstruction, and effectively ensuring the consistency of metadata, thereby improving the reliability of metadata.
[0036] Furthermore, in the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, before determining whether power failure occurs, the method further includes:
[0037] After the user data is written into the memory, the latest L2P table and the version number information corresponding to the L2P table are updated and written into the super block in the memory, and a P2L table corresponding to the latest L2P table is generated;
[0038] The valid data number information of the super block is updated, and the valid data number information and the version number information are written into a preset partition of the memory.
[0039] From the above description, it can be seen that after the user data is written into the memory, the latest L2P table and the corresponding version number information are updated and written into the super block, and a P2L table corresponding to the latest L2P table is generated, and the number of valid data and the version number information are written into the preset partition of the memory. The version number information and the P2L table can help rebuild the metadata after a power outage, thereby ensuring the reliability of the metadata.
[0040] Further, the restoring of part of the L2P table in the super block based on the version number information of the last download includes:
[0041] The L2P table in the super block whose version number information is less than or equal to the version number information of the last download is restored.
[0042] From the above description, it can be seen that since the version number information of the last disk download and the corresponding L2P table have been successfully written to the disk, the two are consistent, so the L2P table whose version number information in the super block is less than or equal to the version number information of the last disk download is first restored to achieve rapid reconstruction of metadata.
[0043] Further, the restoring the remaining L2P table in the super block based on the P2L table includes:
[0044] Determining a remaining L2P table to be restored from the P2L table according to the restored partial L2P table;
[0045] The remaining L2P tables to be restored are restored.
[0046] It can be seen from the above description that the remaining L2P tables to be restored are determined from the P2L table according to the restored partial L2P tables, and restored, thereby quickly completing the reconstruction of the L2P tables.
[0047] Further, the updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory includes:
[0048] The sub-table of the latest L2P table and the version number information corresponding to the L2P table are updated and written into the super block of the NAND.
[0049] From the above description, it can be seen that the DRAM-less UFS memory cannot store all the L2P tables, and the sub-table of the L2P table contains a part of the L2P table, so the sub-table of the latest L2P table and the version number information corresponding to the L2P table are updated and written to the NAND super block to implement the update and writing of the L2P table.
[0050] Furthermore, the preset partition is a ROOT partition.
[0051] From the above description, it can be seen that the valid data number information and version number information are stored in a special NAND location, which is different from the storage location of the L2P table. After power-on reconstruction, data loss is avoided and it is ensured that the version number information can be used for data recovery.
[0052] Furthermore, it also includes:
[0053] Determine whether new user data is written into the memory, if so, increment the version number information by one, and then return to execute the step of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory.
[0054] From the above description, it can be seen that when it is determined that new user data is written to the memory, it means that the next round of IO process is required. At this time, the version number information is first increased by one, and then the L2P table is updated and written to the disk to ensure that the version number information is updated in time.
[0055] Please refer to Figure 2 Another embodiment of the present invention provides a UFS metadata reconstruction device, including:
[0056] A power-on module, used to determine whether a power failure occurs during the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, and if so, re-power on;
[0057] A first recovery module, configured to obtain the version number information of the last disk download from the preset partition of the memory, and to recover part of the L2P table in the super block based on the version number information of the last disk download;
[0058] a second recovery module, configured to obtain a P2L table corresponding to the latest L2P table, and recover the remaining L2P tables in the super block based on the P2L table;
[0059] The update module is used to update the valid data number information and the version number information of the super block corresponding to all the restored L2P tables, and write the valid data number information and the version number information into the preset partition.
[0060] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the steps in the above-mentioned UFS metadata reconstruction method.
[0061] Please refer to Figure 3 Another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements each step in the above-mentioned UFS metadata reconstruction method when executing the computer program.
[0062] The UFS metadata reconstruction method, device, readable storage medium and electronic device of the present invention can be applied to a UFS memory without an external DRAM, and are described below through specific implementation methods:
[0063] Glossary:
[0064] L2P table: records the mapping relationship between the host logical address (LBA) and the physical address (PBA);
[0065] valid-count: information about the number of valid data. A SPB (super block) contains multiple PBAs. This information is used to record the number of valid PBAs in the currently used super block.
[0066] Please refer to Figure 1 , Figure 4-Figure 7 , Embodiment 1 of the present invention is:
[0067] A UFS metadata reconstruction method comprises the following steps:
[0068] S1. After user data is written into the memory, the latest L2P table and the version number (SN) information corresponding to the L2P table are updated and written into the super block in the memory, and a P2L table corresponding to the latest L2P table is generated.
[0069] The updating and writing of the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory includes:
[0070] The sub-table (L2P-partial, L2PP) of the latest L2P table and the version number information corresponding to the L2P table are updated and written into the super block of the NAND.
[0071] Specifically, Figure 4 As shown, when writing SPB in meta-space, it is written in the form of data+sparedata (NAND itself provides space for sparedata). Data is placed in the L2PP data itself, and sparedata stores SN information.
[0072] The version number information is a serial number of an integer type.
[0073] S2. Update the valid data number information of the super block, and write the valid data number information and the version number information into a preset partition of the memory.
[0074] Wherein, the preset partition is the ROOT partition.
[0075] S3. In the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, determine whether power failure occurs, and if so, power on again.
[0076] Among them, since the L2P table is relatively large, it is usually necessary to store the L2P table on NAND. In order to distinguish between user data writing and internally generated metadata writing, FW (Firmware) usually divides the NAND space into data-space and meta-space. User data is written to data-space and L2P table is written to meta-space. Similarly, after the data is written to NAND, the valid-count of the currently used super block needs to be updated and saved, and it needs to be consistent with the number of PBAs belonging to the super block in the current L2P table.
[0077] like Figure 5 As shown, there are multiple LBA to PBA mappings in the L2P table. Assume that PBA0->PBA2 belongs to SPB0, and the valid-count of SPB0 is 3; PBA3->PBA5 belongs to SPB1, and its valid-count is 3.
[0078] When the L2P table is being written to the meta-space, the system loses power. The following three situations may occur:
[0079] a. All L2P table writes failed, and valid-count is not updated;
[0080] b. The L2P table is partially or completely written successfully, and the valid-count is not updated;
[0081] c. The L2P table is written successfully and the valid-count is updated successfully.
[0082] Then when the power is turned on again after a power outage, the L2P table may not correspond to the valid-count of SPB, which will cause problems in the subsequent use of SPB. For example, SPB can only be released when the valid-count of SPB is reduced to 0. If the valid-count count does not match, then a series of problems will occur, such as the SPB cannot be released after use.
[0083] To avoid the above problems, perform the following operations after powering on again.
[0084] S4. Obtain the version number information of the last disk download from the preset partition of the memory, and restore part of the L2P table in the super block based on the version number information of the last disk download.
[0085] Specifically, the version number information of the last disk download is obtained from the preset partition of the memory, and the L2P table in the super block whose version number information is less than or equal to the version number information of the last disk download is restored. The restoration is to restore the mapping item corresponding to the corresponding data at the current LBA position, so that the business can read this block of data. If the mapping item is not restored, the old data at the current LBA position will be read.
[0086] S5, obtaining a P2L table corresponding to the latest L2P table, and restoring the remaining L2P tables in the super block based on the P2L table, specifically including S51-S53:
[0087] S51 . Obtain a P2L (PBA TO LBA) table corresponding to the latest L2P table.
[0088] S52: Determine the remaining L2P tables to be restored from the P2L table according to the restored partial L2P tables.
[0089] S53: Restore the remaining L2P tables to be restored.
[0090] S6. Update the valid data number information and version number information of the super block corresponding to all the restored L2P tables, and write the valid data number information and the version number information into the preset partition.
[0091] In an optional implementation, it also includes:
[0092] It is determined whether new user data is written into the memory. If so, the version number information is incremented by one and the execution returns to S1.
[0093] The following is a specific example:
[0094] (1) Update the L2P tables L2PP0 and L2PP1 and write them to disk, along with the corresponding SN information SN0, with the write location being SPB, such as Figure 4 shown.
[0095] (2) After writing is completed, the valid-count information at this time is updated and written into the ROOT partition together with the current SN information SN0.
[0096] (3) Add 1 to the SN information SN0 to change it to SN1.
[0097] (4) Update the L2P table L2PP2 and write it to the disk, and write the corresponding SN information SN1, such as Figure 4 As shown, if power is lost after writing, power is turned on again.
[0098] (5) After power-on, the SN information of the last download is obtained from the ROOT partition, which is SN0 (that is, the one written in step (2)).
[0099] (6) Then scan SPB and recover the data whose SN information is less than or equal to SN0, namely L2PP0 and L2PP1, while the data whose SN information is greater than SN0, namely L2PP2, is not recovered yet. Since the data of L2PP2 is not recovered, the latest status of the current L2P table is still maintained at the status of L2PP0, L2PP1 and valid-count & SN0. In this status, the L2P table and valid-count are consistent.
[0100] (7) Since L2PP2 is also generated after the host IO writes, directly discarding it will result in the loss of the latest data. Therefore, it is restored to the L2P table through the corresponding P2L table, and merged from the P2L table to L2P to restore the L2PP2 data. Then, the valid-count information at this time is updated and written into the ROOT partition together with the current SN information SN1.
[0101] like Figure 6 As shown, assuming that PBA0~PBA3 belong to SPB0, PBA4~PBA7 belong to SPB1, then with the merge action of P2Ltable, the change of valid-count is valid-count-4 of SPB0, valid-count+4 of SPB1, and the information of L2PP2 is restored at the same time.
[0102] (8) After valid-count & SN1 is written to the disk, if the power is cut off again, the maximum SN information that needs to be restored becomes SN1, so L2PP0, L2PP1 and L2PP2 can all be directly restored. Then the SN information is changed to SN2, and the new L2PP data (L2PP3) will be written with SN2, such as Figure 7 shown.
[0103] Please refer to Figure 2 , Embodiment 2 of the present invention is:
[0104] A UFS metadata reconstruction device, comprising:
[0105] A power-on module, used to determine whether a power failure occurs during the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, and if so, re-power on;
[0106] A first recovery module, configured to obtain the version number information of the last disk download from the preset partition of the memory, and to recover part of the L2P table in the super block based on the version number information of the last disk download;
[0107] a second recovery module, configured to obtain a P2L table corresponding to the latest L2P table, and recover the remaining L2P tables in the super block based on the P2L table;
[0108] The update module is used to update the valid data number information and the version number information of the super block corresponding to all the restored L2P tables, and write the valid data number information and the version number information into the preset partition.
[0109] Embodiment 3
[0110] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, each step of the UFS metadata reconstruction method in the first embodiment can be implemented.
[0111] Embodiment 4
[0112] Please refer to Figure 3 An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the UFS metadata reconstruction method in the first embodiment is implemented.
[0113] In summary, the present invention provides a UFS metadata reconstruction method, device, readable storage medium and electronic device. In the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table to the super block in the memory, a power failure occurs. After power is restored, the version number information of the last download is obtained from the preset partition of the memory, and part of the L2P table in the super block is restored based on the version number information of the last download, and the remaining L2P table is restored based on the obtained P2L table, and the valid data number information and version number information of the super block corresponding to all the restored L2P tables are updated, and the super block is written. The preset partition is entered, so that the metadata after power failure and restart can be rebuilt by using the version number information and the P2L table. There is no need to rescan the L2P table to calculate the number of valid data, which saves a lot of reconstruction time and can ensure the consistency between the restored L2P table and the number of valid data, thereby improving the efficiency of metadata reconstruction and effectively ensuring the consistency of metadata, thereby improving the reliability of metadata; in addition, the number of valid data information and the version number information are stored in a special NAND location, which is different from the storage location of the L2P table. After power-on reconstruction, data loss is avoided and it is ensured that the version number information can be used for data recovery.
[0114] In the above embodiments provided in the present application, it should be understood that the disclosed methods, devices, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or components or modules, which can be electrical, mechanical or other forms.
[0115] The components described as separate components may or may not be physically separated, and the components shown as components may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the components may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0116] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each component may exist physically separately, or two or more modules may be integrated into one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0117] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0118] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0119] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0120] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A UFS metadata reconstruction method, characterized in that: Includes steps: In the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, determining whether a power failure occurs, and if so, powering on again; Obtaining version number information of the last disk download from a preset partition of the memory, and restoring part of the L2P table in the super block based on the version number information of the last disk download; Acquire a P2L table corresponding to the latest L2P table, and restore the remaining L2P tables in the super block based on the P2L table; Update the valid data number information and version number information of the super block corresponding to all the restored L2P tables, and write the valid data number information and the version number information into the preset partition; The restoring of part of the L2P table in the super block based on the version number information of the last download includes: Restoring the L2P table in the super block whose version number information is less than or equal to the version number information of the last download; The restoring the remaining L2P table in the super block based on the P2L table includes: Determining a remaining L2P table to be restored from the P2L table according to the restored partial L2P table; Restoring the remaining L2P tables to be restored; In the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, before determining whether power failure occurs, the method further includes: After the user data is written into the memory, the latest L2P table and the version number information corresponding to the L2P table are updated and written into the super block in the memory, and a P2L table corresponding to the latest L2P table is generated; Updating the valid data number information of the super block, and writing the valid data number information and the version number information into a preset partition of the memory; Also includes: Determine whether new user data is written into the memory, if so, increment the version number information by one, and then return to execute the step of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory.
2. A UFS metadata reconstruction method according to claim 1, characterized in that: The updating and writing of the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory comprises: The sub-table of the latest L2P table and the version number information corresponding to the L2P table are updated and written into the super block of the NAND.
3. A UFS metadata reconstruction method according to claim 1, characterized in that: The preset partition is the ROOT partition.
4. A UFS metadata reconstruction device, characterized in that: include: A power-on module, used to determine whether a power failure occurs during the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, and if so, re-power on; A first recovery module, configured to obtain the version number information of the last disk download from the preset partition of the memory, and to recover part of the L2P table in the super block based on the version number information of the last disk download; a second recovery module, configured to obtain a P2L table corresponding to the latest L2P table, and recover the remaining L2P tables in the super block based on the P2L table; An update module, used for updating the valid data number information and the version number information of the super block corresponding to all the restored L2P tables, and writing the valid data number information and the version number information into the preset partition; The restoring of part of the L2P table in the super block based on the version number information of the last download includes: Restoring the L2P table in the super block whose version number information is less than or equal to the version number information of the last download; The restoring the remaining L2P table in the super block based on the P2L table includes: Determining a remaining L2P table to be restored from the P2L table according to the restored partial L2P table; Restoring the remaining L2P tables to be restored; In the process of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory, before determining whether power failure occurs, the method further includes: After the user data is written into the memory, the latest L2P table and the version number information corresponding to the L2P table are updated and written into the super block in the memory, and a P2L table corresponding to the latest L2P table is generated; Updating the valid data number information of the super block, and writing the valid data number information and the version number information into a preset partition of the memory; Also includes: Determine whether new user data is written into the memory, if so, increment the version number information by one, and then return to execute the step of updating and writing the latest L2P table and the version number information corresponding to the L2P table into the super block in the memory.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step in a UFS metadata reconstruction method as described in any one of claims 1 to 3 is implemented.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, each step in the UFS metadata reconstruction method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Self-journaling and hierarchical consistency for non-volatile storage
CN103392207A
Metadata restoration method and related device
CN112307022A
Memory power-off recovery method and system and memory
CN115221566A
Data recovery method, device and equipment for solid state disk
CN116225776A
Fine granularity translation layer for data storage devices
US20200104252A1
