A method and device for constructing an SSD FTL mapping table by a host
By presetting the FTL mapping table in the faulty SSD and building the real table on the host side, the problem of FTL mapping table loss after the SSD is powered off is solved, and the FTL mapping relationship is quickly reconstructed and data recovery efficiency is improved.
Patent Information
- Application Number
- CN202210179230.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-25
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2042-02-25
AI Technical Summary
When the SSD is powered on again after the power is off, metadata such as the FTL mapping table may be lost, resulting in inefficient data recovery.
By presetting the FTL mapping table in the faulty SSD, the host constructs a real FTL mapping table based on the preset FTL mapping table and sends it back to the faulty SSD to quickly rebuild the FTL mapping relationship.
It realizes rapid and stable reconstruction of FTL mapping relationships in the failed SSD, improves data recovery efficiency, and provides preconditions for subsequent data recovery and backup.
Smart Images

Figure CN114546888B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of SSD FTL mapping table construction, and in particular to a method and device for a host to construct an SSD FTL mapping table. Background Art
[0002] The FTL mapping table is a linear table with FTL LBA as index and PBA as content. After receiving a write request from the host, the SSD converts the host LBA to obtain the FTL LBA, writes the logical data associated with the host LBA in the request command to the NAND space specified by the PBA, and then updates the mapping relationship between the FTL LBA and the PBA to the FTL mapping table. After receiving a read request from the host, the SSD converts the host LBA to the FTL LBA, searches the FTL mapping table according to the FTL LBA to obtain the PBA, and then reads the NAND data and returns it to the host. When the SSD is running, the FTL mapping table resides in the SSD DDR specified space. Before the SSD is powered off, it needs to be flushed to the NAND for permanent storage. After the SSD is powered on, it is read from the NAND and restored to the DDR specified space.
[0003] When the SSD fails to power off, metadata including the FTL mapping table is often lost when it is powered on again. In this case, deep recovery of the entire disk data and reconstruction of the FTL mapping table is a common way to effectively retrieve the lost data, but this method is not a necessary function of the SSD. The deep recovery of the entire disk data can be performed in the SSD or with the help of an external host.
[0004] Generally, due to the limited internal resources of SSD, deep data recovery is achieved with the help of the host. The host usually uses a dedicated reading method to read all the NAND data inside the failed SSD to the host, and then extracts and analyzes the data to recover the valid data. However, this recovery method is time-consuming and greatly affects the efficiency of data recovery. Summary of the invention
[0005] To solve the above problems, the present invention provides a method and device for a host to construct an SSD FTL mapping table. By presetting the FTL mapping table in the faulty SSD, the host constructs a real FTL mapping table according to the preset FTL mapping table, so as to quickly and stably reconstruct the FTL mapping relationship corresponding to all valid data in the faulty SSD NAND, thereby providing a prerequisite for the next step of data recovery and backup.
[0006] In a first aspect, the technical solution of the present invention provides a method for a host to construct an SSD FTL mapping table, comprising the following steps:
[0007] The host sends the FTL mapping table preset command to the faulty SSD N times; where N ≥ 2;
[0008] After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units in the corresponding partition space;
[0009] After the host completes the presetting of the FTL mapping table on the faulty SSD, it reads the NAND data of the faulty SSD and builds the real SSD FTL mapping table in the local memory;
[0010] After the host completes all the SSD FTL mapping table constructions, the host sends the finally reconstructed SSD FTL mapping table to the faulty SSD.
[0011] Furthermore, the value of N is determined by the granularity of the preset FTL mapping table. Specifically,
[0012] N = (number of storage units in the partition space + (number of FTL entries preset each time - 1)) / number of FTL entries preset each time;
[0013] The value range of the number of FTL entries preset each time is [1, namespace size / number of partition spaces]; after the faulty SSD is powered on, the entire disk is configured as a 4k namespace, and the entire namespace capacity is the user capacity. Namespace size = namespace capacity / namespace format size;
[0014] The number of logical block addresses of the FTL mapping table preset in each partition space for the first N-1 times is the number of FTLentries preset each time.
[0015] Further, after receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space, specifically including:
[0016] After receiving the current FTL mapping table preset command, the faulty SSD scans the storage units of the corresponding partition space according to the PBA format, and maps the physical block addresses of the storage units with the logical block addresses of the FTL mapping table in sequence.
[0017] Furthermore, the method specifically includes:
[0018] After the faulty SSD receives the current FTL mapping table preset command, it scans the remaining unscanned storage units of the corresponding partition space according to the PBA format, and maps the physical block addresses of the storage units with the logical block addresses of the FTL mapping table in sequence. It starts writing from the starting logical block address of the FTL mapping table, overwriting the physical block address written last time.
[0019] Furthermore, the method specifically includes:
[0020] If the number of storage units scanned by the faulty SSD after receiving the current FTL mapping table preset command is less than the number of storage units scanned last time, the physical block addresses that are not overwritten in the FTL mapping table are cleared.
[0021] Furthermore, after the host completes the presetting of the secondary FTL mapping table of the faulty SSD, it reads the NAND data of the faulty SSD and constructs a real SSD FTL mapping table in the local memory, specifically including:
[0022] The host calculates the current maximum host logical block address according to the number of accessible logical block addresses in the FTL mapping table preset by the faulty SSD;
[0023] Starting from the host logical block address 0 to the current maximum host logical block address, read the data of the faulty SSD through the NVME IO path;
[0024] Open up the same number of FTL mapping table spaces as the number of failed SSD partition spaces in the local memory, use the logical block address as the index, and use the physical block address and the corresponding data read from the failed SSD as the content to build a real SSD FTL mapping table.
[0025] Furthermore, the data of the failed SSD read by the host is the serial number of the corresponding storage unit data frame.
[0026] Furthermore, the method specifically includes:
[0027] If the logical block addresses in the data contents read by multiple physical block addresses are the same, then the serial number of the storage unit data frame with the largest serial number and the associated physical block address are selected as the table entry content of the associated logical block address index in the FTL mapping table.
[0028] Furthermore, the host calculates the current maximum host logical block address according to the number of accessible logical block addresses in the preset FTL mapping table of the current failed SSD, specifically:
[0029] The maximum host logical block address = the number of logical block addresses accessible by the preset FTL mapping table * the number of partition spaces - 1.
[0030] In a second aspect, the technical solution of the present invention provides a device for a host to construct an SSD FTL mapping table, comprising:
[0031] Preset command sending module: The host sends FTL mapping table preset commands to the faulty SSD N times; where N ≥ 2;
[0032] Preset FTL mapping table module: After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units in the corresponding partition space;
[0033] Real FTL mapping table construction module: After the host completes the presetting of the secondary FTL mapping table on the faulty SSD, it reads the faulty SSD NAND data and constructs the real SSD FTL mapping table in the local memory;
[0034] Real FTL mapping table sending module: After the host completes all SSD FTL mapping table constructions, the final reconstructed SSD FTL mapping table is sent to the faulty SSD.
[0035] In a third aspect, the technical solution of the present invention provides a terminal, including:
[0036] A memory, used for storing a program for a host to construct an SSD FTL mapping table;
[0037] The processor is used to implement the steps of any one of the above-mentioned methods for the host to construct an SSD FTL mapping table when executing the host to construct an SSD FTL mapping table program.
[0038] In a fourth aspect, the technical solution of the present invention provides a computer-readable storage medium, on which is stored a host SSD FTL mapping table construction program, and when the host SSD FTL mapping table construction program is executed by a processor, the steps of the host SSD FTL mapping table construction method as described in any of the above items are implemented.
[0039] Compared with the prior art, the present invention provides a method, device, terminal and storage medium for constructing an SSD FTL mapping table by a host, which has the following beneficial effects: an FTL mapping table is preset in a faulty SSD. After the FTL mapping table is preset, the host obtains target data, constructs a real FTL mapping table in a local memory, and then sends the final constructed real FTL mapping table to the faulty SSD, thereby quickly and stably reconstructing the FTL mapping relationship corresponding to all valid data in the NAND of the faulty SSD, and providing a prerequisite for the next step of data recovery and backup. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 A flowchart of a method for a host to construct an SSD FTL mapping table is provided in accordance with a first embodiment of the present invention.
[0042] Figure 2 This is a diagram of the Data Frame structure.
[0043] Figure 3 This is a structural diagram of the internal LBA and PBA mapping of a single partition of a faulty SSD according to an embodiment of the present invention.
[0044] Figure 4 This is a schematic diagram of the format of a real FTL mapping table constructed by a host according to an embodiment of the present invention.
[0045] Figure 5 A schematic block diagram of the structure of a device for constructing an SSD FTL mapping table by a host provided in Embodiment 2 of the present invention.
[0046] Figure 6 A schematic diagram of the structure of a terminal provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0047] Some English terms involved in the present invention are explained below.
[0048] SSD: Solid State Drives.
[0049] LBA: Logical Block Address logical block address.
[0050] PBA: Physical Block Address physical block address.
[0051] L2P: Logical To Physical Table, the mapping table from logical blocks to physical blocks, that is, the FTL mapping table.
[0052] NAND: Computer flash memory device.
[0053] DDR: A memory name that stands for double data rate synchronous dynamic random access memory.
[0054] The core of the present invention is to pre-set the FTL mapping table in the faulty SSD, and the host constructs a real FTL mapping table according to the preset FTL mapping table, so as to quickly and stably rebuild the FTL mapping relationship corresponding to all valid data in the faulty SSD NAND, and provide the prerequisite for the next step of data recovery and backup.
[0055] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0056] Embodiment 1
[0057] The first embodiment of the present invention provides a method for a host to construct an SSD FTL mapping table. The host notifies the faulty SSD to preset the FTL mapping table in the internal DDR for multiple times. After receiving the preset command, the faulty SSD presets the FTL mapping table in the DDR according to a specific preset method. After the host inquires that the preset of the current FTL mapping table is completed, it reads the faulty SSD NAND data through the NVME IO path method and rebuilds the real SSD FTL mapping table in the host-side memory. After the host side completes all the FTL mapping table reconstruction processes, the final reconstructed real SSD FTL mapping table is imported into the SSD DDR. In this way, the real FTL mapping table resides in the faulty SSD DDR, and the host can initiate a normal data reading process.
[0058] like Figure 1 The figure is a flow chart of a method for a host to construct an SSD FTL mapping table provided in the first embodiment, which includes the following steps.
[0059] S101, the host sends an FTL mapping table preset command to the faulty SSD N times; where N≥2.
[0060] S102, after receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units of the corresponding partition space.
[0061] Since the raw capacity of the SSD is larger than the user capacity, and the preset FTL mapping table is constructed based on the user capacity, a preset FTL mapping table cannot scan all storage units of the SSD once, and multiple preset FTL mapping table constructions are required to scan all storage units of the SSD.
[0062] S103, after the host completes the presetting of the current FTL mapping table of the faulty SSD, it reads the NAND data of the faulty SSD and builds a real SSD FTL mapping table in the local memory. After the host learns that the presetting of the faulty SSD is completed, it directly initiates a command to read the faulty SSD. The faulty SSD receives the command and queries the pre-set FTL mapping table according to the logical block address contained in the command to obtain the physical block address to read the NAND data of the faulty SSD.
[0063] S104, after the host completes all times of constructing the SSD FTL mapping table, the finally reconstructed SSD FTL mapping table is sent to the faulty SSD.
[0064] The first embodiment of the present invention provides a method for a host to construct an SSD FTL mapping table. The FTL mapping table is preset in a faulty SSD. After the FTL mapping table is preset, the host obtains target data, constructs a real FTL mapping table in a local memory, and then sends the final constructed real FTL mapping table to the faulty SSD, thereby quickly and stably reconstructing the FTL mapping relationship corresponding to all valid data in the NAND of the faulty SSD, providing a prerequisite for the next step of data recovery and backup.
[0065] In this embodiment, the SSD firmware architecture introduces a partition mechanism, which divides the entire SSD NAND space into several physical block areas, each of which is called a partition. Partitions are independent of each other, and are internally configured with a unique FTL firmware core, which runs the same firmware read and write mechanism and maintains a separate FTL mapping table. Inside a Partition, the FTL LBA is arranged starting from 0, and the NAND storage unit is generally managed at a 4K+ granularity. Each 4K+ granularity is associated with a unique PBA physical block address. In this way, each FTL entry is in the form of (FTL LBA, PBA), and the FTL LBA and PBA each occupy 4 bytes.
[0066] Assume that the SSD firmware uses a storage unit granularity of 4K+. This unit is called a Data Frame. The Data Frame structure is as follows: Figure 2 As shown. The Control meta contains fields such as 4-byte FTL LBA and 8-byte sequence number. During the operation of the SSD, before writing each DataFrame to NAND in a single partition, the FTL LBA will be recorded in the control meta and a sequence number will be assigned, which is similar to the timestamp mechanism, equivalent to recording the write time of each DataFrame. Other constraints are:
[0067] 1) The sequence number starts from 1. Each time a Data Frame is written, the sequence number increases by 1.
[0068] 2) The GC process only moves data and does not modify the sequence number;
[0069] 3) The sequence number is stored in the control meta of each Data Frame and cannot be reversed during the entire life of the SSD.
[0070] During the SSD power-on process, after detecting that the last power-off execution failed, a special read-only mode can be entered, and the read-only mode is reported to the host through an asynchronous event. In this read-only mode, the faulty SSD is identified as an NVME device. Since the FTL mapping table has been lost, all read requests received by the SSD will return virgin data. In this state, the host and the faulty SSD execute the method of constructing the SSD FTL mapping table of this embodiment, which mainly includes the following four processes: FTL mapping table preset command issuance, FTL mapping table preset, FTL mapping table construction, and FTL mapping table import.
[0071] 1. Sending FTL mapping table preset command
[0072] After the host recovery tool starts the recovery process, it first needs to notify the faulty SSD to preset the FTL mapping table.
[0073] Due to the existence of OP space (i.e. reserved space), the raw capacity of SSD is larger than the user capacity. For example, the raw capacity is 10 storage units, while the user capacity available to the user is only 6 storage units. Therefore, the entire L2P table (based on the user capacity, a total of 6 logical block addresses) is preset as a unit, and two preset command processing is required inside each partition. The first preset will fill the entire FTL mapping table, and the second preset is to continue setting the remaining physical space (referring to the physical space that was not scanned in the first preset, the first preset is 6 physical spaces, and the second preset is the remaining 4 physical spaces) from the head of the FTL mapping table. Two presets can also minimize the number of interactions between the host and the SSD, reducing development complexity.
[0074] Because it takes some time to preset the FTL mapping table of the faulty SSD, the host recovery tool can temporarily query the execution result of the preset command every 60 seconds.
[0075] (II) FTL mapping table preset
[0076] After the SSD receives the FTL mapping table preset command sent by the host, it starts to execute the FTL mapping table preset process. For simplicity and easy implementation, the FTL mapping table is preset in each partition by the firmware core responsible for PBA allocation during the write process.
[0077] Specifically, after receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units of the corresponding partition space.
[0078] Due to the existence of OP space, the raw capacity of SSD is larger than the user capacity. The faulty SSD is initialized to a single name space in 4k format in read-only mode, so its name space size, that is, the number of host LBAs that can be accessed in the name space, is fixed.
[0079] However, the SSD firmware uses a partition mechanism, and the name space size is not necessarily aligned with the partition, which means that the host LBAs allocated to each partition are not necessarily uniform.
[0080] It should be noted that the host sends FTL mapping table preset commands to the faulty SSD N times, and the value of N depends on the granularity of the preset FTL mapping table, that is, the number of FTL entries preset each time FTL_entry_preset_num_per_time.
[0081] Specifically, N = (PBA_num_per_partition+ (FTL_entry_preset_num_per_time-1)) / FTL_entry_preset_num_per_time.
[0082] Among them, PBA_num_per_partition is the number of storage units in each partition space.
[0083] For example, 1000 FTL entries are preset each time, that is, FTL_entry_preset_num_per_time = 1000. The number of logical block addresses of the FTL mapping table preset in each partition space for the first N-1 times is FTL_entry_preset_num_per_time = 1000.
[0084] In fact, the value range of FTL_entry_preset_num_per_time is [1, namespace size / number of partition spaces]. It can be understood that after the faulty SSD is powered on, the entire disk is configured as a 4k namespace, the entire namespace capacity is the user capacity, and the namespace size = namespace capacity / namespace format size.
[0085] Only when FTL_entry_preset_num_per_time = namespace size / number of partition spaces, when N=2, the first N-1 times can be this formula FTL_entry_preset_num_per_time = namespace size / number of partition spaces. This is the maximum FTL mapping table preset granularity.
[0086] The following takes two pre-setting of the FTL mapping table as an example to illustrate the constraints of the pre-setting of the FTL mapping table as follows.
[0087] After the SSD receives the first FTL mapping table preset command, the maximum number of pre-set processing firmware cores in each partition is the same and follows the following restrictions:
[0088] Max_cnt_per_partition=name_space_size / partition_num
[0089] That is, the number of logical block addresses of the preset FTL mapping table = the namespace size / the number of partition spaces.
[0090] In each partition, the core responsible for presetting the FTL mapping table only needs to scan Max_cnt_per_partition PBAs to complete the first round of FTL mapping table presetting commands.
[0091] For the second preset FTL mapping table, due to the influence of bad blocks and parity on blocks, in fact, the final number of readable FTL LBAs of the second preset FTL mapping table is random, but the last available PBA of the PBA format scan NAND and the number of PBAs set are known after the process is completed. Therefore, after the second round of scanning is completed, the number of FTL LBAs that can be processed in each partition, max_cnt_per_partition, needs to be fed back to the host.
[0092] The host calculates the maximum host logical block address according to the number of accessible logical block addresses of the FTL mapping table preset by the faulty SSD. Specifically, host LBA = max_cnt_per_partition * partition_num – 1, that is, the maximum host logical block address = the number of accessible logical block addresses of the preset FTL mapping table * the number of partition spaces - 1.
[0093] After the faulty SSD receives the current FTL mapping table preset command, it presets the mapping table of each partition space based on its partition space, specifically including: after the faulty SSD receives the current FTL mapping table preset command, it scans the storage unit of the corresponding partition space according to the PBA format, and maps the physical block address of the storage unit with the logical block address of the FTL mapping table in sequence.
[0094] like Figure 3 The figure shows a structural diagram of the internal LBA and PBA mapping of a single partition of a faulty SSD.
[0095] When the FTL mapping table preset command is processed for the second time, writing is also started from the beginning of the FTL mapping table, which is equivalent to overwriting the PBA written for the first time. Specifically, after the faulty SSD receives the current FTL mapping table preset command, it scans the remaining unscanned storage units of the corresponding partition space according to the PBA format, and maps the physical block addresses of the storage units with the logical block addresses of the FTL mapping table in sequence, and writes from the starting logical block address of the FTL mapping table, overwriting the physical block address written last time.
[0096] If the number of storage units scanned by the faulty SSD after receiving the current FTL mapping table preset command is less than the number of storage units scanned in the previous time, the physical block addresses that have not been overwritten in the preset FTL mapping table will be cleared. In specific implementation, in order to simplify the processing, the partitions can be synchronized to keep the number of FTL LBAs that can be processed consistent, that is, the maximum number of FTL LBAs that can be processed in all partitions is taken as max_cnt_per_partition. If the number of FTL LBAs that can be processed in a partition is less than the synchronized FTL LBA number value, then the PBA value of the alignment number needs to be cleared so that the host can return virgin data when reading the FTL LBA.
[0097] It should be noted that the bad block and parity positions need to be skipped during the PBA presetting process because the bad block table is currently maintained by the SSD firmware front end and stored in the superblock, and the faulty SSD can basically achieve super block recovery.
[0098] (III) FTL mapping table construction
[0099] The host query detects that the current SSD preset FTL mapping table is successfully executed, and obtains the max_cnt_per_partition that can be accessed at the time, so that the maximum host LBA that the host can access this time can be known. The host directly reads the faulty SSD through NVME IO starting from host LBA=0 until the maximum host LBA is read.
[0100] After receiving the read command, the SSD converts the host LBA in the read command into FTL LBA, queries the FTL mapping table, and then reads the NAND. It only feeds back the control meta data from the data frame data read from the NAND to the host.
[0101] like Figure 4 The figure shows the format of the real FTL mapping table constructed by the host. The host directly opens up the same number of FTL table spaces in the memory as the number of failed SSD partition spaces. Each FTL entry is in the form of (PBA, seq_num). The FTL mapping table uses FTL LBA as the index. If the FTL entry corresponding to the current FTL LBA has not been written, the current (PBA, seq_num) obtained is updated to the FTL table. Otherwise, the current seq_num and the seq_num stored in the FTL table need to be compared, and the FTL entry with the larger seq_num is the final result of the current FTL LBA.
[0102] Specifically, the process performs the following steps.
[0103] Step 1: The host calculates the current maximum host logical block address according to the number of accessible logical block addresses in the FTL mapping table preset by the faulty SSD.
[0104] The maximum host logical block address = the number of logical block addresses accessible by the current preset FTL mapping table * the number of partition spaces - 1.
[0105] Step 2: starting from the host logical block address 0 to the current maximum host logical block address, read the data of the failed SSD through the NVME IO path.
[0106] The data read by the host from the failed SSD is the serial number of the corresponding storage unit data frame of the storage single data frame.
[0107] If the logical block addresses in the data contents read by multiple physical block addresses are the same, then the serial number of the storage unit data frame with the largest serial number and the associated physical block address are selected as the table entry content of the associated logical block address index in the FTL mapping table.
[0108] Step three, open up the same number of FTL mapping table spaces as the number of failed SSD partition spaces in the local memory, use the logical block address as the index, and build a real SSDFTL mapping table with the physical block address and the corresponding data read from the failed SSD as the content.
[0109] (IV) Importing the FTL mapping table
[0110] After N times of presetting the FTL mapping table and the corresponding host FTL mapping table construction, the host builds a real FTL mapping table in the memory. In order to further read all valid data, the host needs to import the FTL mapping table in the host memory into the SSD DDR. Because the host memory builds FTL mapping tables with equal partition scores, the FTL mapping tables of all partitions need to be imported into the SSD DDR in sequence. When importing, start importing from the starting FTL LBA of each FTL mapping table. You only need to import the PBA corresponding to the FTL LBA into the corresponding position in the SSD DDR until all FTL LBAs are imported.
[0111] Embodiment 2
[0112] The second embodiment provides a device for a host to construct an SSD FTL mapping table, which is used to implement the aforementioned method for a host to construct an SSD FTL mapping table.
[0113] like Figure 5 The figure is a schematic block diagram of the structure of a device for a host to construct an SSD FTL mapping table provided in the second embodiment, which includes the following functional modules.
[0114] Preset command sending module 101: The host sends FTL mapping table preset commands to the faulty SSD in N times; where N≥2.
[0115] Presetting FTL mapping table module 102: After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units of the corresponding partition space.
[0116] The real FTL mapping table construction module 103: after the host completes presetting of the secondary FTL mapping table on the faulty SSD, the host reads the faulty SSD NAND data and constructs a real SSD FTL mapping table in the local memory.
[0117] The real FTL mapping table sending module 104 sends the finally reconstructed SSD FTL mapping table to the faulty SSD after the host completes all the SSD FTL mapping table constructions.
[0118] The host constructing SSD FTL mapping table device of this embodiment is used to implement the aforementioned host constructing SSD FTL mapping table method. Therefore, the specific implementation method of the device can be seen in the embodiment part of the host constructing SSD FTL mapping table method in the previous text. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part, which will not be elaborated here.
[0119] In addition, since the host-constructed SSD FTL mapping table device of this embodiment is used to implement the aforementioned host-constructed SSDFTL mapping table method, its function corresponds to that of the aforementioned method and will not be repeated here.
[0120] Embodiment 3
[0121] Figure 6 A schematic diagram of the structure of a terminal device 600 provided in an embodiment of the present invention includes: a processor 610, a memory 620 and a communication unit 630. The processor 610 is used to implement the following steps when the host saves in the memory 620 constructs the SSD FTL mapping table program:
[0122] The host sends the FTL mapping table preset command to the faulty SSD N times; where N ≥ 2;
[0123] After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units of the corresponding partition space;
[0124] After the host completes the presetting of the FTL mapping table on the faulty SSD, it reads the NAND data of the faulty SSD and builds the real SSD FTL mapping table in the local memory;
[0125] After the host completes all the SSD FTL mapping table constructions, the host sends the finally reconstructed SSD FTL mapping table to the faulty SSD.
[0126] The present invention presets an FTL mapping table in a faulty SSD. After the FTL mapping table is preset, the host obtains the target data, constructs a real FTL mapping table in the local memory, and then sends the final constructed real FTL mapping table to the faulty SSD, thereby quickly and stably reconstructing the FTL mapping relationship corresponding to all valid data in the NAND of the faulty SSD, providing a prerequisite for the next step of data recovery and backup.
[0127] The terminal device 600 includes a processor 610, a memory 620 and a communication unit 630. These components communicate via one or more buses. It can be understood by those skilled in the art that the structure of the server shown in the figure does not constitute a limitation of the present invention, and it can be a bus structure or a star structure, and can also include more or less components than shown in the figure, or combine some components, or arrange the components differently.
[0128] The memory 620 can be used to store the execution instructions of the processor 610. The memory 620 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 620 are executed by the processor 610, the terminal 600 can execute some or all of the steps in the following method embodiments.
[0129] The processor 610 is the control center of the storage terminal, and uses various interfaces and lines to connect various parts of the entire electronic terminal. It runs or executes software programs and / or modules stored in the memory 620, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor 610 can only include a central processing unit (CPU). In the embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0130] The communication unit 630 is used to establish a communication channel so that the storage terminal can communicate with other terminals, receive user data sent by other terminals or send user data to other terminals.
[0131] Embodiment 4
[0132] The present invention also provides a computer storage medium, wherein the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0133] The computer storage medium stores a host-built SSD FTL mapping table program, and when the host-built SSD FTL mapping table program is executed by the processor, the following steps are implemented:
[0134] The host sends the FTL mapping table preset command to the faulty SSD N times; where N ≥ 2;
[0135] After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units of the corresponding partition space;
[0136] After the host completes the presetting of the FTL mapping table on the faulty SSD, it reads the NAND data of the faulty SSD and builds the real SSD FTL mapping table in the local memory;
[0137] After the host completes all the SSD FTL mapping table constructions, the host sends the finally reconstructed SSD FTL mapping table to the faulty SSD.
[0138] The present invention presets an FTL mapping table in a faulty SSD. After the FTL mapping table is preset, the host obtains the target data, constructs a real FTL mapping table in the local memory, and then sends the final constructed real FTL mapping table to the faulty SSD, thereby quickly and stably reconstructing the FTL mapping relationship corresponding to all valid data in the NAND of the faulty SSD, providing a prerequisite for the next step of data recovery and backup.
[0139] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, including several instructions for enabling a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention.
[0140] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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 through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0141] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0142] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0143] The above disclosure is only a preferred embodiment of the present invention, but the present invention is not limited thereto. Any non-creative changes that can be thought of by a person skilled in the art, as well as several improvements and modifications made without departing from the principle of the present invention, should fall within the protection scope of the present invention.
Claims
1. A method for a host to construct an SSD FTL mapping table, characterized in that: The following steps are involved: The host sends the FTL mapping table preset command to the faulty SSD N times; The value of N is determined by the granularity of the preset FTL mapping table, specifically: N = (number of storage units in the partition space + (number of FTL entries preset each time - 1)) / number of FTL entries preset each time; The value range of the number of FTL entries preset each time is [1, namespace size / number of partition spaces]; after the faulty SSD is powered on, the entire disk is configured as a 4k namespace, and the entire namespace capacity is the user capacity. Namespace size = namespace capacity / namespace format size; The number of logical block addresses of the FTL mapping table preset in each partition space for the first N-1 times is the number of FTLentries preset each time; After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units in the corresponding partition space; After the host completes the presetting of the FTL mapping table on the faulty SSD, it reads the NAND data of the faulty SSD and builds the real SSD FTL mapping table in the local memory; After the host completes all the SSD FTL mapping table constructions, the host sends the finally reconstructed SSD FTL mapping table to the faulty SSD.
2. The method for constructing an SSD FTL mapping table by a host according to claim 1, characterized in that: After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space, specifically including: After receiving the current FTL mapping table preset command, the faulty SSD scans the storage units of the corresponding partition space according to the PBA format, and maps the physical block addresses of the storage units with the logical block addresses of the FTL mapping table in sequence.
3. The method for constructing an SSD FTL mapping table by a host according to claim 2, characterized in that: The method specifically also includes: After the faulty SSD receives the current FTL mapping table preset command, it scans the remaining unscanned storage units of the corresponding partition space according to the PBA format, and maps the physical block addresses of the storage units with the logical block addresses of the FTL mapping table in sequence. It starts writing from the starting logical block address of the FTL mapping table, overwriting the physical block address written last time.
4. The method for constructing an SSD FTL mapping table by a host according to claim 3, characterized in that: The method specifically also includes: If the number of storage units scanned by the faulty SSD after receiving the current FTL mapping table preset command is less than the number of storage units scanned last time, the physical block addresses that are not overwritten in the FTL mapping table are cleared.
5. The method for constructing an SSD FTL mapping table by a host according to any one of claims 1 to 4, characterized in that: After the host completes the presetting of the secondary FTL mapping table on the faulty SSD, it reads the NAND data of the faulty SSD and builds the real SSDFTL mapping table in the local memory, including: The host calculates the current maximum host logical block address according to the number of accessible logical block addresses in the FTL mapping table preset by the faulty SSD; Starting from the host logical block address 0 to the current maximum host logical block address, read the data of the faulty SSD through the NVME IO path; Open up the same number of FTL mapping table spaces as the number of failed SSD partition spaces in the local memory, use the logical block address as the index, and use the physical block address and the corresponding data read from the failed SSD as the content to build a real SSD FTL mapping table.
6. The method for constructing an SSD FTL mapping table by a host according to claim 5, characterized in that: The data of the failed SSD read by the host is the serial number of the corresponding storage unit data frame.
7. The method for constructing an SSD FTL mapping table by a host according to claim 6, characterized in that: The method specifically also includes: If the logical block addresses in the data contents read by multiple physical block addresses are the same, then the serial number of the storage unit data frame with the largest serial number and the associated physical block address are selected as the table entry content of the associated logical block address index in the FTL mapping table.
8. The method for constructing an SSD FTL mapping table by a host according to claim 7, characterized in that: The host calculates the current maximum host logical block address according to the number of accessible logical block addresses in the preset FTL mapping table of the faulty SSD, specifically: The maximum host logical block address = the number of logical block addresses accessible by the preset FTL mapping table * the number of partition spaces - 1.
9. A device for a host to construct an SSD FTL mapping table, characterized in that: include, Preset command sending module: The host sends FTL mapping table preset commands to the faulty SSD N times; The value of N is determined by the granularity of the preset FTL mapping table, specifically: N = (number of storage units in the partition space + (number of FTL entries preset each time - 1)) / number of FTL entries preset each time; The value range of the number of FTL entries preset each time is [1, namespace size / number of partition spaces]; after the faulty SSD is powered on, the entire disk is configured as a 4k namespace, and the entire namespace capacity is the user capacity. Namespace size = namespace capacity / namespace format size; The number of logical block addresses of the FTL mapping table preset in each partition space for the first N-1 times is the number of FTLentries preset each time; Preset FTL mapping table module: After receiving the current FTL mapping table preset command, the faulty SSD presets the FTL mapping table of each partition space based on its partition space; wherein the number of logical block addresses in the preset FTL mapping table is less than the number of storage units in the corresponding partition space; Real FTL mapping table construction module: After the host completes the presetting of the secondary FTL mapping table on the faulty SSD, it reads the faulty SSDNAND data and constructs the real SSD FTL mapping table in the local memory; Real FTL mapping table sending module: After the host completes all SSD FTL mapping table constructions, the final reconstructed SSD FTL mapping table is sent to the faulty SSD.
Citation Information
Patent Citations
Method for deleting the data and device thereof
CN102511044A
Method and device for enhancing starting speeds of flash memory equipment
CN108415851A