Method for updating vc table, solid state disk and electronic device

By using a hardware acceleration module to scan secondary entries in the SSD, the problem of excessively long power-on recovery time in DRAM-less SSDs is solved, achieving faster SSD recovery speeds.

CN115469805BActive Publication Date: 2025-11-04SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211073602.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-02
Publication Date
2025-11-04
Estimated Expiration
2042-09-02

AI Technical Summary

Technical Problem

In DRAM-less SSD architecture, the limited random access memory space necessitates a step-by-step scanning of secondary entries during power-on recovery. Existing software scanning methods are too time-consuming, impacting SSD recovery speed.

Method used

A hardware acceleration module is used to scan the current and target second-level table entries. The hardware acceleration module scans the current updated second-level table and the target second-level table, generates scan results, and updates the VC Table, thereby reducing scan time.

Benefits of technology

By using a hardware acceleration module for scanning, the scanning time of the secondary table is reduced, thereby accelerating the power-on recovery process of the SSD.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115469805B_ABST
    Figure CN115469805B_ABST
Patent Text Reader

Abstract

The application provides a VC Table updating method, a solid state disk and an electronic device. The method comprises the following steps: acquiring at least one updated secondary table saved after an updating time based on the updating time of a primary table saved in the solid state disk; reading, for each updated secondary table, a current updated secondary table and index information corresponding to the current updated secondary table; reading a target secondary table corresponding to the same index information from a plurality of previously saved secondary tables corresponding to the primary table; and scanning the current updated secondary table and the target secondary table by using a hardware acceleration module arranged in the solid state disk to obtain a scanning result, and updating the VC Table based on the scanning result. In this way, the current updated secondary table and the target secondary table are scanned by using the hardware acceleration module, and the VC Table is updated, so that the scanning time of all secondary tables can be reduced, and the power recovery time of the SSD is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of solid state disks, in particular to a VC Table updating method, a solid state disk and an electronic device. BACKGROUND

[0002] In a Dram-less SSD (Solid State Disk) architecture, due to the limited space of the random memory, the table entries all adopt multi-level mapping, and in the power-on table recovery process, the table entries need to be recovered level by level upwards, and when the primary table is recovered through the logical-physical mapping table (i.e. the secondary table), all the secondary tables flushed by the SSD in the period from the last time the primary table is flushed to the power-off time need to be scanned, and currently, software is often used to scan each table entry, and this method needs to spend a lot of time, assuming that each table is 32K and a user data address occupies 4Bytes, then each table needs to scan 8K user data addresses, and the more the table entries to be scanned, the longer the time needed. SUMMARY

[0003] The present application aims to provide a VC Table updating method, a solid state disk and an electronic device to reduce the scanning time of all the secondary tables and accelerate the power-on recovery time of the SSD.

[0004] The present application provides a VC Table updating method applied to a solid state disk, the solid state disk storing a primary table, at least one secondary table, a VC Table and at least one user data; each secondary table is used to store the address information of at least part of the user data; the primary table is used to store the address information of each secondary table; wherein the updating time of the secondary table is earlier than that of the primary table; the method comprises:

[0005] Based on the updating time in the primary table stored in the solid state disk, at least one updated secondary table stored after the updating time is obtained; wherein the address information of each updated secondary table is not stored in the primary table;

[0006] For each updated secondary table, the current updated secondary table and the index information corresponding to the current updated secondary table are read;

[0007] From the multiple secondary tables previously stored corresponding to the primary table, a target secondary table corresponding to the index information same as the index information is read;

[0008] Through a hardware acceleration module set in the solid state disk, the current updated secondary table and the target secondary table are scanned to obtain a scanning result, and the VC Table is updated based on the scanning result; wherein the VC Table stores the valid quantity information of the user data.

[0009] Further, the step of reading, from the plurality of previously saved secondary tables corresponding to the primary table, a target secondary table corresponding to the same index information as the index information of the index information comprises:

[0010] Based on the index information corresponding to the currently updated secondary table, obtaining address information of a target secondary table corresponding to the same index information as the index information from the primary table;

[0011] Based on the address information of the target secondary table, reading the target secondary table corresponding to the address information of the target secondary table.

[0012] Further, the method further comprises:

[0013] Based on each updated secondary table, saving address information of each updated secondary table in the primary table to obtain an updated primary table.

[0014] Further, the step of updating the VC Table based on the scanning result by scanning the currently updated secondary table and the target secondary table through the hardware acceleration module arranged in the solid state disk comprises:

[0015] Based on the read currently updated secondary table and the target secondary table, respectively obtaining an address space of the currently updated secondary table and an address space of the target secondary table;

[0016] Based on the address space of the currently updated secondary table and the address space of the target secondary table, respectively determining a current update starting address of the address space of the currently updated secondary table and a target starting address of the address space of the target secondary table;

[0017] According to the preset address information size, the address information of the user data in the address space of the currently updated secondary table and the address space of the target secondary table is compared in turn from the current update starting address and the target starting address to obtain a comparison result; wherein, the preset address information size is the same as the address information size of each user data;

[0018] According to the comparison result, a scanning result is generated, and the VC Table is updated based on the scanning result.

[0019] Further, the step of comparing, according to the preset address information size, the address information of the user data in the address space of the currently updated secondary table and the address space of the target secondary table in turn from the current update starting address and the target starting address to obtain a comparison result comprises:

[0020] According to the preset address information size, the number of user data addresses in the address space of the currently updated secondary table and the address space of the target secondary table is determined respectively, wherein, the number of user data addresses in the address space of the currently updated secondary table and the number of user data addresses in the address space of the target secondary table are the same, and the preset address information size is the same as the address information size of each user data.

[0021] Based on the number of user data, the address information of each user data in the current updating secondary table address space and the target secondary table address space is compared in turn to obtain at least one comparison result.

[0022] Further, the comparison result has multiple; according to the comparison result, the scanning result is generated, and based on the scanning result, the step of updating the VC Table includes:

[0023] For each comparison result, the following operations are performed:

[0024] If the address information of the user data in the current updating secondary table address space and the target secondary table address space is equal, the address information of the next user data in the current updating secondary table address space and the target secondary table address space is compared;

[0025] If the address information of the user data in the current updating secondary table address space and the target secondary table address space is not equal, the preset special information in the address information of the user data in the current updating secondary table address space and the target secondary table address space is extracted respectively;

[0026] Read the pre-stored VC Table, and based on the read VC Table, obtain the address space of the VC Table;

[0027] Based on the special information extracted respectively, determine the data block corresponding to the address information of the user data in the current updating secondary table address space and the address information of the user data in the target secondary table address space in the address space of the VC Table;

[0028] If the address information of the user data in the current updating secondary table address space and the target secondary table address space is not equal, the VC value of the data block corresponding to the address information of the user data in the current updating secondary table address space is reduced by 1, and the VC value of the data block corresponding to the address information of the user data in the target secondary table address space is increased by 1, wherein the size of the VC value represents the number of valid user data.

[0029] Further, by setting the hardware acceleration module in the solid state disk, the current updating secondary table and the target secondary table are scanned to obtain the scanning result, and the step of updating the VC Table based on the scanning result includes:

[0030] By setting the hardware acceleration module in the solid state disk, the current updating secondary table and the target secondary table are scanned;

[0031] determining whether there is still an update secondary table to be scanned, and if so, reading the next update secondary table and target secondary table to be scanned while scanning the current update secondary table and the target secondary table;

[0032] determining whether the current update secondary table and the target secondary table are complete, and if not, continuing to scan, and if so, obtaining a scan result;

[0033] updating the VC Table based on the scan result, and repeating the step of scanning the current update secondary table and the target secondary table through the hardware acceleration module provided in the solid state disk.

[0034] Further, the method further comprises:

[0035] if there is no update secondary table to be scanned in the update secondary table saved after the update time, then continuing to determine whether the current update secondary table and the target secondary table are complete, and if not, continuing to scan, and if so, obtaining a scan result;

[0036] updating the VC Table based on the scan result, and closing the hardware acceleration module.

[0037] The application provides a solid state disk, which stores a primary table, at least one secondary table, a VC Table, and at least one user data; each secondary table is used for storing address information of at least part of the user data; the primary table is used for storing address information of each secondary table; wherein the update time of the secondary table is earlier than the update time of the primary table; the solid state disk comprises a flash memory, a hardware acceleration module, and a central processing unit;

[0038] the flash memory is used for obtaining at least one update secondary table saved after the update time based on the update time in the primary table stored in the solid state disk; wherein the address information of each update secondary table is not stored in the primary table;

[0039] the central processing unit is used for reading, for each update secondary table, a current update secondary table and index information corresponding to the current update secondary table; and reading, from a plurality of secondary tables saved before the primary table, a target secondary table corresponding to the same index information as the index information;

[0040] the hardware acceleration module is used for scanning the current update secondary table and the target secondary table to obtain a scan result, and updating the VC Table based on the scan result; wherein the VC Table stores valid quantity information of the user data.

[0041] The electronic device provided by the application comprises a processor and a memory, the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the method of any one of the above.

[0042] The computer readable storage medium provided by the application stores computer executable instructions, and the computer executable instructions, when called and executed by a processor, cause the processor to implement the method of any one of the above.

[0043] The VC Table updating method, the solid state disk and the electronic device provided by the application, the method comprises: based on the update time of the primary table saved in the solid state disk, obtaining at least one updated secondary table saved after the update time; for each updated secondary table, reading the current updated secondary table and the index information corresponding to the current updated secondary table; from the multiple secondary tables saved before corresponding to the primary table, reading the target secondary table corresponding to the same index information; through the hardware acceleration module set in the solid state disk, scanning the current updated secondary table and the target secondary table to obtain a scanning result, and updating the VC Table based on the scanning result. In this way, by using the hardware acceleration module to scan the current updated secondary table and the target secondary table and update the VC Table, the scanning time of all secondary tables can be reduced, thereby accelerating the power recovery time of the SSD. BRIEF DESCRIPTION OF DRAWINGS

[0044] In order to more clearly illustrate the specific embodiments of the application or the technical solutions in the prior art, the drawings needed in the specific embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.

[0045] Figure 1 A flowchart for recovering a primary table is provided for the embodiments of the application.

[0046] Figure 2 A software scanning secondary table updating VC Table schematic diagram is provided for the embodiments of the application.

[0047] Figure 3 A flowchart of a VC Table updating method is provided for the embodiments of the application.

[0048] Figure 4 A solid state disk state schematic diagram before and after power failure is provided for the embodiments of the application.

[0049] Figure 5 Another solid state disk state schematic diagram before and after power failure is provided for the embodiments of the application.

[0050] Figure 6 A flow chart of another method for updating a VC Table according to an embodiment of the present application is provided;

[0051] Figure 7 A schematic diagram of a hardware acceleration module scanning a secondary table to update a VC Table according to an embodiment of the present application is provided;

[0052] Figure 8 A flow chart of another method for updating a VC Table according to an embodiment of the present application is provided;

[0053] Figure 9 A flow chart of a hardware acceleration module according to an embodiment of the present application is provided;

[0054] Figure 10 A comparison chart of a software scanning flow and a hardware acceleration scanning flow according to an embodiment of the present application is provided;

[0055] Figure 11 A structural schematic diagram of a solid state disk according to an embodiment of the present application is provided;

[0056] Figure 12 A structural schematic diagram of an electronic device according to an embodiment of the present application is provided. DETAILED DESCRIPTION

[0057] The technical solutions of the present application are described in detail in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0058] In a Dram-less SSD (Solid State Disk) architecture, due to limited ram (random access memory) space, table entries are all mapped in multiple levels, and in the power-on table entry recovery process, they need to be recovered level by level upwards. Specifically, refer to Figure 1A recovery flow chart of a primary table is shown. When the primary table is recovered through a logical-physical mapping table (i.e., a secondary table), a recovery starting point needs to be determined according to running information, and an ending point is a position where the last data is written. Then, secondary table entries and metadata are read from the starting point. Metadata of the secondary table entries records an idx (index information) of a current entry. The idx is used to find a corresponding old entry address in the primary table. Then, a mapping relationship of a current idx and related information are updated. The old entry is read to the ram. Finally, new and old entries are scanned and compared. If the mapping relationship points to the same user data, no processing is performed, and the comparison is continued. Otherwise, a VC (Valid Count) value of the old data block is reduced by 1, and a VC value of the new data block is increased by 1. After a secondary table is scanned, the above operation is repeated to read a next secondary table, until all entries are scanned.

[0059] According to the introduction in the previous section, when the primary table is recovered on the SSD, all secondary tables (new secondary tables) and corresponding old secondary tables that are written in a period from the last time the primary table is written to power-off need to be scanned. If the scanning is performed by using software, refer to Figure 2 A software scanning secondary table update VC Table diagram is shown. A large amount of time is required for each table entry. Assuming that each table is 32K, and an entry (user data address) occupies 4 bytes, 8K entries need to be scanned for each table. The more table entries that need to be scanned, the longer the time required. Based on this, the present application provides a VC Table update method, a solid state disk, and an electronic device. The main purpose is to reduce the time for scanning each table entry to update the VC Table by using a hardware acceleration scanning method, and to concurrently read and scan the table entries, thereby reducing the time for scanning all table entries of the system and accelerating the recovery time of the SSD.

[0060] To facilitate the understanding of the present embodiment, first, a VC Table update method disclosed in the present embodiment is introduced in detail. The method is applied to a solid state disk, as shown in Figure 3 The method includes the following steps:

[0061] In step S102, at least one updated secondary table saved after an update time is obtained based on the update time in the primary table saved in the solid state disk. Address information of each updated secondary table is not saved in the primary table.

[0062] In the implementation process, the solid state disk generally stores a primary table, at least one secondary table, a VCTable and at least one user data; each secondary table is used to store address information of at least a part of user data; the primary table is used to store address information of each secondary table; wherein the update time of the secondary table is earlier than the update time of the primary table; when the solid state disk is powered off, the address information of the secondary table saved in the solid state disk after updating the primary table cannot be saved in the primary table, at this time, the primary table only stores the address information of the secondary table saved in the solid state disk before updating the primary table.

[0063] Specifically, referring to a solid state disk state diagram before and after power failure shown in Figure 4 ; wherein T1 represents the last update time of the primary table saved in the solid state disk, L2P3 and L2P4 represent updated secondary tables saved after the update time, T2 represents the power-off time of the solid state disk, because L2P3 and L2P4 are saved later than the primary table saved before T1, the address information of L2P3 and L2P4 is not saved in the primary table at the time of power failure, and the primary table is not updated again.

[0064] Step S104, for each updated secondary table, read the current updated secondary table and the index information corresponding to the current updated secondary table.

[0065] Step S106, from the plurality of secondary tables saved before corresponding to the primary table, read the target secondary table corresponding to the index information same as the index information.

[0066] In actual implementation, each updated secondary table and the plurality of secondary tables saved before corresponding to the primary table have corresponding index information (which can be Arabic numerals such as 1, 2, 3, etc.), and specifically referring to another solid state disk state diagram before and after power failure shown in Figure 5 ; in the figure, L2P2 represents an updated secondary table saved after the update time of the primary table, idx:0 represents that the index information corresponding to the updated secondary table is 0, L2P2 and idx:0 are read, and then from the plurality of secondary tables saved before the update time corresponding to the primary table, the target secondary table (corresponding to L2P1 in Figure 5 ) with index information also being 0 is read.

[0067] Step S108, by the hardware acceleration module set in the solid state disk, scan the current updated secondary table and the target secondary table to obtain a scanning result, and update the VC Table based on the scanning result; wherein the VC Table stores valid quantity information of user data.

[0068] The solid state disk generally further stores a VC Table for recording quantity information of valid user data, and in actual implementation, the solid state disk is provided with a hardware acceleration module, the current update secondary table and the target secondary table corresponding thereto can be scanned through the acceleration module to obtain a scanning result (whether each user data address in the current update secondary table and the target secondary table corresponding thereto is the same), and the VC Table is updated according to the scanning result; wherein the VC Table stores the valid quantity information of the user data.

[0069] The method for updating the VC Table provided by the application comprises the following steps: obtaining at least one update secondary table saved after an update time of a primary table in a solid state disk based on the update time; reading the current update secondary table and index information corresponding to the current update secondary table for each update secondary table; reading a target secondary table corresponding to the same index information from a plurality of secondary tables saved before the primary table; and scanning the current update secondary table and the target secondary table through a hardware acceleration module arranged in the solid state disk to obtain a scanning result, and updating the VC Table based on the scanning result. In this way, the scanning time of all secondary tables can be reduced by scanning the current update secondary table and the target secondary table through the hardware acceleration module and updating the VC Table, thereby accelerating the power recovery time of the SSD.

[0070] The application further provides another method for updating the VC Table, which is implemented based on the method of the above embodiment; as shown in Figure 6 The method comprises the following steps:

[0071] In step S202, at least one update secondary table saved after an update time of a primary table in a solid state disk is obtained based on the update time; wherein the address information of each update secondary table is not saved in the primary table.

[0072] In step S204, the current update secondary table and index information corresponding to the current update secondary table are read for each update secondary table.

[0073] In step S206, the address information of a target secondary table corresponding to the same index information is obtained from the primary table based on the index information corresponding to the current update secondary table.

[0074] In step S208, the target secondary table corresponding to the address information of the target secondary table is read based on the address information of the target secondary table.

[0075] Still referring to Figure 5Another power-on / off solid state disk state diagram shown; in the figure, PBAX in the first level table represents the address information of the target second level table corresponding to the index information 0, and L2P1 is the target second level table corresponding to the address information of the target second level table. In actual implementation, based on the index information 0 corresponding to the current updated second level table L2P2, the address information of the target second level table with the index information 0 is obtained from the first level table, and then the target second level table L2P1 corresponding to the address information of the target second level table is read.

[0076] Step S210, based on each updated second level table, saving the address information of each updated second level table in the first level table to obtain an updated first level table.

[0077] In actual implementation, the mapping relationship PBAX (address information of the target second level table L2P1) in the original first level table is updated to PBAY (address information of the current updated second level table L2P2) to obtain an updated first level table.

[0078] Step S212, based on the read current updated second level table and the target second level table, respectively obtaining the address space of the current updated second level table and the address space of the target second level table.

[0079] Step S214, based on the address space of the current updated second level table and the address space of the target second level table, respectively determining the current updated starting address of the current updated second level table address space and the target starting address of the target second level table address space.

[0080] Step S216, according to the preset address information size, starting from the current updated starting address and the target starting address, comparing the address information of the user data in the current updated second level table address space and the target second level table address space in turn to obtain a comparison result; wherein the preset address information size is the same as the address information size of each user data.

[0081] Specifically, step S216 can be implemented through steps one to two:

[0082] Step one: according to the preset address information size, respectively determining the number of user data addresses in the current updated second level table address space and the target second level table address space.

[0083] In actual implementation, the preset address information size is the same as the address information size of each user data; the size of the address information of each user data can be set in advance, and then it is determined how many user data addresses with the address information size in the current updated second level table address space and the target second level table address space, wherein the total number of user data addresses in the current updated second level table address space is the same as the total number of user data addresses in the target second level table address space.

[0084] Step two: based on the number of user data addresses, compare the address information of each user data in the current updating secondary table address space and the target secondary table address space in turn, and obtain at least one comparison result.

[0085] In actual implementation, the user data addresses in the current updating secondary table address space correspond to the user data addresses in the target secondary table address space one by one, so the address information of each one-to-one corresponding user data can be compared in turn to obtain the comparison result of each comparison.

[0086] Step S218: generating a scanning result according to the comparison result, and updating the VC Table based on the scanning result.

[0087] Specifically, step S218 can be implemented through steps three to seven:

[0088] After step S216 is executed, multiple comparison results can be obtained, and for each comparison result, the following operations are performed:

[0089] Step three: if the address information of the user data in the current updating secondary table address space and the target secondary table address space is equal, continue to compare the address information of the user data in the next current updating secondary table address space and the target secondary table address space.

[0090] Step four: if the address information of the user data in the current updating secondary table address space and the target secondary table address space is not equal, extract the preset special information in the address information of the user data in the current updating secondary table address space and the target secondary table address space, respectively.

[0091] Step five: read the pre-stored VC Table, and based on the read VC Table, obtain the address space of the VC Table.

[0092] Step six: based on the special information extracted respectively, determine the data block corresponding to the address information of the user data in the current updating secondary table address space and the data block corresponding to the address information of the user data in the target secondary table address space in the address space of the VC Table.

[0093] Step seven: if the address information of the user data in the current updating secondary table address space and the target secondary table address space is not equal, the VC value of the data block corresponding to the address information of the user data in the current updating secondary table address space is reduced by 1, and the VC value of the data block corresponding to the address information of the user data in the target secondary table address space is increased by 1, wherein the size of the VC value represents the number of valid user data.

[0094] The embodiment provides a hardware acceleration module, which mainly scans a secondary table and updates a VC table, instead of a software scanning function, and details are shown in the following Figure 7 A hardware acceleration module for scanning a secondary table and updating a VC table is shown in a schematic diagram. First, the address space of a current updating secondary table (Memory A) and the address space of a target secondary table (Memory B) are obtained, the VC Table stored in the solid state disk is read, the address space of the VC Table (Memory C) and the start address (start address 3) are obtained; then, the current updating start address (start address 1) of the address space of the current updating secondary table and the target start address (start address 2) of the address space of the target secondary table are determined; finally, the address information of the user data in Memory A and Memory B is compared in turn (that is, the space stored in each entry of the new and old table items (the current updating secondary table and the target secondary table) is compared in turn) starting from start address 1 and start address 2, if equal, the comparison is continued (if the two entries being compared in the two table items are equal, the next two entries are compared); if not equal, the info (preset special information) of the two entries is extracted, it should be noted that the size of the address information to be compared each time needs to be set in advance (in the embodiment, the size of each entry is set to 4 bytes), which Byte bits in each entry are used as the info, the extracted entry is used as the index information (result idx) of Memory C (that is, the storage space of the VC Table), the info of the two entries corresponds to two result idx, wherein the result idx pointed to by the current entry info in Memory A points to the VC minus 1 of the data block, the result idx pointed to by the current entry info in Memory B points to the VC plus 1 of the data block, and the VC value of the data block represents how many valid user data the data block saves.

[0095] The updating method of the VC Table provided in the foregoing embodiment can replace the software scanning logic physical mapping table with a hardware acceleration module. The hardware itself is faster than software in operation because the hardware does not need to execute excessive program codes. The hardware acceleration module obtains the address space of the current updating secondary table and the address space of the target secondary table based on the read current updating secondary table and the target secondary table, respectively, determines the current updating start address of the current updating secondary table address space and the target start address of the target secondary table address space based on the current updating secondary table address space and the target secondary table address space, respectively, compares the address information of the user data in the current updating secondary table address space and the target secondary table address space from the current updating start address and the target start address according to a preset address information size, and obtains a comparison result. The method generates a scanning result according to the comparison result and updates the VC Table based on the scanning result, thereby reducing the time for scanning each table item to update the VC Table, reducing the time for scanning all table items of the system, and accelerating the power recovery time of the SSD.

[0096] The embodiment of the present application also provides another updating method of the VC Table, which is implemented on the basis of the method of the foregoing embodiment. Figure 8 As shown in the method, the method comprises the following steps:

[0097] In step S302, at least one updating secondary table saved after an updating time is obtained based on the updating time in the primary table saved in the solid state disk. The address information of each updating secondary table is not saved in the primary table.

[0098] In step S304, the current updating secondary table and the index information corresponding to the current updating secondary table are read for each updating secondary table.

[0099] In step S306, the target secondary table corresponding to the index information is read from the multiple secondary tables saved before the primary table.

[0100] In step S308, the current updating secondary table and the target secondary table are scanned by the hardware acceleration module arranged in the solid state disk.

[0101] In step S310, it is determined whether there is still an updating secondary table to be scanned. If there is, the next updating secondary table to be scanned and the target secondary table are read while the current updating secondary table and the target secondary table are scanned.

[0102] In step S312, it is determined whether the current updating secondary table and the target secondary table are scanned. If not, the scanning is continued. If yes, a scanning result is obtained.

[0103] Step S314, based on the scanning result, updating the VC Table, and repeating the step of scanning the current update secondary table and the target secondary table through the hardware acceleration module arranged in the solid state disk.

[0104] Step S316, if there is no update secondary table to be scanned in the update secondary table saved after the update time, continuing to determine whether the current update secondary table and the target secondary table are completed scanning, if not, continuing to scan, if yes, obtaining the scanning result.

[0105] Step S318, based on the scanning result, updating the VC Table, and closing the hardware acceleration module.

[0106] Since the hardware acceleration module does not occupy CPU resources, after starting the hardware acceleration module, the CPU can do other things, specifically, referring to Figure 9 the hardware acceleration module scanning flowchart shown in FIG. 5, after reading the first new and old logical-physical mapping table (the current update secondary table and the target secondary table) to be scanned to a storage space on the ram, starting the hardware acceleration module to scan, determining whether all table items have been scanned, if not, reading the next new and old logical-physical mapping table to be scanned to another storage space while scanning the current new and old logical-physical mapping table, then, determining whether the hardware acceleration module is busy (whether the current new and old logical-physical mapping table is completed scanning), if yes, continuing to scan and determining whether the acceleration module is busy, if not, obtaining the scanning result of the current new and old logical-physical mapping table and updating the VC Table, then continuing to scan the new and old logical-physical mapping table read in the previous scanning process (starting the hardware acceleration module to scan the current read table item after the previous table item is scanned), and sequentially repeating the operation until all table items are scanned, if starting the hardware acceleration module to scan the current new and old logical-physical mapping table, determining that all table items have been scanned, then continuing to determine whether the current update secondary table and the target secondary table are completed scanning, if not, continuing to scan, if yes, obtaining the scanning result and updating the VC Table, then closing the hardware acceleration module, and ending the whole process.

[0107] In order to better understand the above embodiment, referring to Figure 10 the software scanning flow and the hardware acceleration scanning flow comparison diagram shown in FIG. 6; in the original flow (the software scanning flow), the reading table item and the scanning table item are processed in series, in the present flow (the hardware acceleration scanning flow), the reading table item and the scanning table item are processed in parallel, further accelerating the whole power recovery time.

[0108] The updating method of the VC Table provided in the above, by replacing the software scanning logical-physical mapping table with the hardware acceleration module, the single table entry scanning time is saved, the more entries of a table, the more obvious the hardware scanning advantage, and because the hardware scanning does not occupy the CPU resource, therefore, when the hardware scanning, the system can do other tasks, such as reading the next logical-physical mapping table which needs to be scanned in the application, so that the reading and scanning table entries are pipelined, thereby reducing the scanning time of all logical-physical mapping tables, and finally accelerating the power recovery time of the SSD.

[0109] The application provides a solid state disk, which stores a primary table, at least one secondary table, a VC Table and at least one user data; each secondary table is used for storing address information of at least part of the user data; the primary table is used for storing address information of each secondary table; wherein the updating time of the secondary table is earlier than the updating time of the primary table; as shown in the figure, the solid state disk 10 comprises a flash memory 11, a hardware acceleration module 12 and a central processing unit 13. Figure 11

[0110] The flash memory is used for acquiring at least one updated secondary table stored after the updating time based on the updating time in the primary table stored in the solid state disk; wherein the address information of each updated secondary table is not stored in the primary table.

[0111] The central processing unit is used for reading, for each updated secondary table, the current updated secondary table and index information corresponding to the current updated secondary table; and reading, from the multiple secondary tables stored before the primary table, a target secondary table corresponding to the same index information.

[0112] The hardware acceleration module is used for scanning the current updated secondary table and the target secondary table to obtain a scanning result, and updating the VC Table based on the scanning result; wherein the VC Table stores valid quantity information of the user data.

[0113] The solid state disk provided by the application acquires at least one updated secondary table stored after the updating time based on the updating time of the primary table stored in the solid state disk; reads, for each updated secondary table, the current updated secondary table and index information corresponding to the current updated secondary table; reads, from the multiple secondary tables stored before the primary table, a target secondary table corresponding to the same index information; and scans, through the hardware acceleration module arranged in the solid state disk, the current updated secondary table and the target secondary table to obtain a scanning result, and updates the VC Table based on the scanning result. The solid state disk scans the current updated secondary table and the target secondary table through the hardware acceleration module, and updates the VC Table, which can reduce the scanning time of all secondary tables, thereby accelerating the power recovery time of the SSD.

[0114] ​Further, the central processor is further configured to obtain address information of a target secondary table corresponding to the same index information as the index information from the primary table based on the index information corresponding to the current updated secondary table, and read the target secondary table corresponding to the address information of the target secondary table based on the address information of the target secondary table.

[0115] Further, the solid state disk further comprises saving address information of each updated secondary table in the primary table based on each updated secondary table to obtain an updated primary table.

[0116] Further, the hardware acceleration module is further configured to obtain an address space of the current updated secondary table and an address space of the target secondary table based on the read current updated secondary table and the target secondary table respectively, determine a current updated starting address of the address space of the current updated secondary table and a target starting address of the address space of the target secondary table based on the address space of the current updated secondary table and the address space of the target secondary table respectively, compare address information of user data in the address space of the current updated secondary table and the address space of the target secondary table in sequence starting from the current updated starting address and the target starting address according to a preset address information size to obtain a comparison result, and generate a scanning result according to the comparison result and update the VC Table based on the scanning result.

[0117] Further, the hardware acceleration module is further configured to determine a number of user data addresses in the address space of the current updated secondary table and the address space of the target secondary table according to the preset address information size, wherein the number of user data addresses in the address space of the current updated secondary table and the number of user data addresses in the address space of the target secondary table are the same, and the preset address information size is the same as a size of address information of each user data, and compare address information of each user data in the address space of the current updated secondary table and the address space of the target secondary table in sequence based on the number of user data to obtain at least one comparison result.

[0118] Further, the comparison result has multiple; the hardware acceleration module is further used for, if the address information of the user data in the current update secondary table address space and the target secondary table address space of current comparison is equal, then continue to compare the address information of the user data in the next current update secondary table address space and the target secondary table address space; if the address information of the user data in the current update secondary table address space and the target secondary table address space of current comparison is not equal, then extract the preset special information in the address information of the user data in the current update secondary table address space and the target secondary table address space respectively; read the VC Table stored in advance, and based on the read VC Table, obtain the address space of the VC Table; based on the special information extracted respectively, determine the data block corresponding to the address information of the user data in the current update secondary table address space and the address information of the user data in the target secondary table address space in the address space of the VC Table; if the address information of the user data in the current update secondary table address space and the target secondary table address space of current comparison is not equal, then the VC value of the data block corresponding to the address information of the user data in the current update secondary table address space is reduced by 1, and the VC value of the data block corresponding to the address information of the user data in the target secondary table address space is increased by 1, wherein the size of the VC value represents the number of valid user data.

[0119] Further, the hardware acceleration module is further used for scanning the current update secondary table and the target secondary table; judging whether there is still an update secondary table to be scanned, if there is, then read the next update secondary table and the target secondary table to be scanned while scanning the current update secondary table and the target secondary table; judging whether the current update secondary table and the target secondary table are completed scanning, if not, then continue to scan, if completed, then obtain the scanning result; based on the scanning result, updating the VC Table, and repeating the step of scanning the current update secondary table and the target secondary table.

[0120] Further, the hardware acceleration module is further used for, if there is no update secondary table to be scanned in the update secondary table saved after the update time, then continue to judge whether the current update secondary table and the target secondary table are completed scanning, if not, then continue to scan, if completed, then obtain the scanning result; based on the scanning result, updating the VC Table, and closing the hardware acceleration module.

[0121] The solid state disk provided by the embodiment of the application has the same implementation principle and technical effects as the aforementioned VC Table updating method embodiment, and the solid state disk embodiment part can refer to the corresponding content in the aforementioned VC Table updating method embodiment.

[0122] The embodiment of the application further provides an electronic device, as shown inFigure 12 As shown, the electronic device includes a processor 130 and a memory 131 storing machine executable instructions executable by the processor 130 to implement the above-mentioned method for updating the VC Table.

[0123] Further, Figure 12 As shown, the electronic device further includes a bus 132 and a communication interface 133, and the processor 130, the communication interface 133 and the memory 131 are connected through the bus 132.

[0124] The memory 131 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used. The bus 132 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 12 Only one bidirectional arrow is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0125] The processor 130 can be an integrated circuit chip having a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 130 or the instruction in the form of software. The processor 130 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block disclosed in the embodiment of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiment of the present application can be directly embodied as a hardware decoding processor for execution, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and combines the hardware to complete the steps of the method of the above embodiment.

[0126] The embodiment of the present application further provides a computer readable storage medium, which stores computer executable instructions, when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to implement the above-mentioned air pump driving method. For specific implementation, refer to the method embodiment, which will not be described here.

[0127] The VC Table updating method, the solid state disk and the electronic equipment provided by the embodiment of the present application include a computer readable storage medium storing program codes, instructions included in the program codes can be used to execute the method described in the foregoing method embodiment, for specific implementation, refer to the method embodiment, which will not be described here.

[0128] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0129] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for updating a VC Table, characterized in that, The method is applied to a solid-state drive (SSD), which stores a primary table, at least one secondary table, a VC table, and at least one set of user data. Each secondary table stores address information of at least a portion of the user data. The primary table stores address information of each secondary table. Updates to the secondary tables occur earlier than updates to the primary tables. The method includes: Based on the update time in the first-level table stored in the solid-state drive, at least one updated second-level table saved after the update time is obtained; wherein, the address information of each updated second-level table is not stored in the first-level table; For each of the updated second-level tables, read the currently updated second-level table and its corresponding index information; From the multiple previously saved second-level tables corresponding to the first-level table, read the target second-level table corresponding to the index information that is the same as the index information; The hardware acceleration module installed in the solid-state drive scans the current updated secondary table and the target secondary table to obtain scan results, and updates the VC Table based on the scan results; wherein, the VC Table stores the valid quantity information of the user data.

2. The method according to claim 1, characterized in that, The step of reading the target secondary table corresponding to the same index information as the index information from the multiple previously saved secondary tables corresponding to the primary table includes: Based on the index information corresponding to the currently updated second-level table, obtain the address information of the target second-level table corresponding to the same index information from the first-level table; Based on the address information of the target secondary table, read the target secondary table corresponding to the address information of the target secondary table.

3. The method according to claim 1, characterized in that, The method further includes: Based on each of the updated secondary tables, the address information of each of the updated secondary tables is stored in the primary table to obtain the updated primary table.

4. The method according to claim 1, characterized in that, The step of scanning the current updated secondary table and the target secondary table using a hardware acceleration module installed in the solid-state drive, obtaining scan results, and updating the VC Table based on the scan results includes: Based on the currently updated second-level table and the target second-level table read, the address space of the currently updated second-level table and the address space of the target second-level table are obtained respectively; Based on the address space of the currently updated second-level table and the address space of the target second-level table, the current update start address of the address space of the currently updated second-level table and the target start address of the address space of the target second-level table are determined respectively. According to the preset address information size, starting from the current update start address and the target start address, the address information of user data in the current update secondary table address space and the target secondary table address space are compared sequentially to obtain the comparison result; wherein, the preset address information size is the same as the address information size of each user data; Based on the comparison results, a scan result is generated, and the VC Table is updated based on the scan result.

5. The method according to claim 4, characterized in that, The step of comparing the address information of user data in the current updated secondary table address space and the target secondary table address space sequentially, starting from the current update start address and the target start address, according to a preset address information size, to obtain the comparison result includes: According to the preset address information size, the number of user data addresses in the current updated second-level table address space and the target second-level table address space are determined respectively, wherein the number of user data addresses in the current updated second-level table address space and the number of user data addresses in the target second-level table address space are the same, and the preset address information size is the same as the address information size of each user data; Based on the quantity of user data, the address information of each user data in the currently updated second-level table address space and the target second-level table address space is compared sequentially to obtain at least one comparison result.

6. The method according to claim 4, characterized in that, There are multiple comparison results; the step of generating scan results based on the comparison results and updating the VC Table based on the scan results includes: For each comparison result, perform the following operations: If the address information of the user data in the currently updated second-level table address space and the target second-level table address space are equal, then continue to compare the address information of the user data in the next currently updated second-level table address space and the next target second-level table address space. If the address information of the user data in the currently updated second-level table address space and the target second-level table address space are not equal, then preset special information is extracted from the address information of the user data in the currently updated second-level table address space and the target second-level table address space, respectively. Read the pre-stored VC Table, and obtain the address space of the VC Table based on the read VC Table; Based on the extracted special information, the data blocks corresponding to the user data address information in the current updated second-level table address space and the data blocks corresponding to the user data address information in the target second-level table address space are determined in the address space of the VC Table. If the address information of user data in the currently updated second-level table address space and the target second-level table address space are not equal, then the VC value of the data block corresponding to the address information of user data in the currently updated second-level table address space is decreased by 1, and the VC value of the data block corresponding to the address information of user data in the target second-level table address space is increased by 1, wherein the VC value represents the number of valid user data.

7. The method according to claim 1, characterized in that, The step of scanning the current updated secondary table and the target secondary table using a hardware acceleration module installed in the solid-state drive, obtaining scan results, and updating the VC Table based on the scan results includes: The current updated secondary table and the target secondary table are scanned using a hardware acceleration module installed in the solid-state drive. Determine whether there are still updated second-level tables that need to be scanned. If so, while scanning the current updated second-level table and the target second-level table, read the next updated second-level table and the target second-level table that need to be scanned. Determine whether the current updated second-level table and the target second-level table have been scanned. If not, continue scanning; if completed, obtain the scan result. Based on the scan results, the VC Table is updated, and the steps of scanning the currently updated secondary table and the target secondary table by means of the hardware acceleration module set in the solid-state drive are repeated.

8. The method according to claim 7, characterized in that, The method further includes: If there are no more updated second-level tables that need to be scanned in the updated second-level tables saved after the update time, then it is determined whether the current updated second-level table and the target second-level table have been scanned. If not, the scan continues. If it is completed, the scan result is obtained. Based on the scan results, update the VC Table and disable the hardware acceleration module.

9. A solid-state drive, characterized in that, The solid-state drive (SSD) stores a primary table, at least one secondary table, a VCTable, and at least one set of user data. Each secondary table stores address information of at least a portion of the user data. The primary table stores address information of each secondary table. Updates to the secondary tables occur earlier than updates to the primary tables. The SSD includes a flash memory, a hardware acceleration module, and a central processing unit. The flash memory is used to obtain at least one updated secondary table saved after the update time based on the update time of the primary table stored in the solid-state drive; wherein the address information of each updated secondary table is not stored in the primary table; The central processing unit is configured to, for each of the updated secondary tables, read the currently updated secondary table and the index information corresponding to the currently updated secondary table; and read the target secondary table corresponding to the same index information from the multiple previously saved secondary tables corresponding to the primary table. The hardware acceleration module is used to scan the currently updated secondary table and the target secondary table to obtain the scan results, and update the VC Table based on the scan results; wherein, the VC Table stores the valid quantity information of the user data.

10. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the steps of the method described in any one of claims 1-8.

Citation Information

Patent Citations

  • Solid state disk data table management method and device, storage medium and electronic equipment

    CN110688070A

  • Effective data bitmap creation method and device, storage medium and electric equipment

    CN112379830A