De-allocation command processing method and storage device thereof
By generating de-allocation logs in solid-state storage devices and reconstructing the FTL table when power-on, the storage problem of FTL table when the storage device capacity increases is solved, ensuring the integrity of the FTL table and the processing efficiency of de-allocation commands.
Patent Information
- Application Number
- CN201910576181.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-28
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2039-06-28
AI Technical Summary
In solid-state storage devices, as the storage capacity increases, the size of the FTL table increases, resulting in the inability to fully save in a short time during power failure, affecting the processing efficiency of de-allocation commands and the integrity of the FTL table.
By generating and recording de-allocation logs when receiving de-allocation commands, and scanning the storage unit after powering on the storage device to reconstruct the FTL table, and updating the de-allocation logical address range, ensuring the integrity and rapid recovery of the FTL table.
It effectively solves the problem of saving the FTL table when the power is out, ensures the integrity of the FTL table when the storage device fails unexpectedly, and improves the processing efficiency of de-allocation commands and the responsiveness of the storage device.
Smart Images

Figure CN112148645B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a de-allocation command processing method and a storage device thereof. Background Art
[0002] Figure 1 The block diagram of the solid-state storage device is shown. The solid-state storage device 102 is coupled to the host to provide storage capacity for the host. The host and the solid-state storage device 102 can be coupled in a variety of ways, including but not limited to connecting the host and the solid-state storage device 102 through, for example, SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express, PCIe), NVMe (NVM Express), Ethernet, Fiber Channel, wireless communication network, etc. The host can be an information processing device that can communicate with the storage device in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103 , a control component 104 , one or more NVM chips 105 , and a DRAM (Dynamic Random Access Memory) 110 .
[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), etc. are common NVMs.
[0004] The interface 103 may be adapted to exchange data with the host via, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.
[0005] The control component 104 is used to control data transmission between the interface 103, the NVM chip 105 and the DRAM 110, and is also used for storage management, mapping of host logical addresses to flash physical addresses, erase leveling, bad block management, etc. The control component 104 can be implemented in a variety of ways, such as software, hardware, firmware, or a combination thereof. For example, the control component 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 can also include a processor or a controller, in which software is executed to manipulate the hardware of the control component 104 to process IO (Input / Output) commands. The control component 104 can also be coupled to the DRAM 110 and can access the data of the DRAM 110. The data of the FTL table and / or cached IO commands can be stored in the DRAM.
[0006] The control component 104 includes a flash memory interface controller (or medium interface controller, flash memory channel controller), which is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that complies with the interface protocol of the NVM chip 105 to operate the NVM chip 105, and receives command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI" and the like.
[0007] A memory target is one or more logic units (LUNs) within a NAND flash package that share a CE (Chip Enable) signal. A NAND flash package may include one or more dies. Typically, a logic unit corresponds to a single die. A logic unit may include multiple planes. Multiple planes within a logic unit can be accessed in parallel, and multiple logic units within a NAND flash chip can execute commands and report status independently of each other.
[0008] Data is usually stored and read on a storage medium in pages. Data is erased in blocks. A block (also called a physical block) contains multiple pages. A block contains multiple pages. A page on a storage medium (called a physical page) has a fixed size, such as 17664 bytes. A physical page can also have other sizes.
[0009] In the storage device, the FTL (Flash Translation Layer) is used to maintain the mapping information from the logical address to the physical address. The logical address constitutes the storage space of the solid-state storage device perceived by the upper-layer software such as the operating system. The physical address is the address used to access the physical storage unit of the solid-state storage device. In the related art, the address mapping can also be implemented using the intermediate address form. For example, the logical address is mapped to the intermediate address, and then the intermediate address is further mapped to the physical address.
[0010] The table structure that stores the mapping information from logical addresses to physical addresses is called an FTL table. The FTL table is an important metadata in a solid-state storage device. The data items in the FTL table record the address mapping relationship in units of data units in the solid-state storage device. In one example, the logical page in the FTL table corresponds to 4KB of storage space, and the storage space of the physical page is also 4KB (also including additional out-of-band storage space). The FTL table provides a record for each 4KB data unit to record the mapping of its logical address to the physical address. In another example, the storage space size corresponding to the data unit is different from the storage space size of the physical page. For example, the physical page can accommodate multiple data units, and the data unit corresponds to 4KB of storage space, while the storage space of the physical page can accommodate multiple data units (for example, 4).
[0011] The FTL table includes multiple FTL table entries (or table items). In one case, each FTL table entry records the correspondence between a logical page address and a physical page. In another case, each FTL table entry records the correspondence between multiple consecutive logical page addresses and multiple consecutive physical pages. In another case, each FTL table entry records the correspondence between a logical block address and a physical block address. In still another case, the FTL table records the mapping relationship between the logical block address and the physical block address, and / or the mapping relationship between the logical page address and the physical page address.
[0012] When processing a read command from the host, the solid-state storage device uses the logical address carried in the read command to obtain the corresponding physical address from the FTL table, and sends a read request to the NVM chip based on the physical address, and receives the data output by the NVM chip in response to the read request. When processing a write command from the host, the solid-state storage device assigns a physical address to the write command, records the correspondence between the logical address of the write command and the assigned physical address in the FTL table, and sends a write request to the NVM chip based on the assigned physical address.
[0013] The Trim command is defined in ATA8-ACS2, and commands with the same or similar meanings are called UNMAP in the SCSI (Small Computer System Interface) specification and Deallocate in the NVMe specification. Hereinafter, "deallocate" is used to indicate data set management commands with the same or similar functions as "Trim" of ATA8-ACS2, "Unmap" of SCSI, and "Deallocate" of NVMe, and also indicates commands with the same or similar functions that appear in other or future protocols, specifications, or technologies.
[0014] In the de-allocation command, the logical address range is described. After the de-allocation command is executed, different effects may occur. For example, (1) after the de-allocation command is executed, when the logical address range indicated by the de-allocation command is read again (before other write operations are performed on the logical address range), the result obtained is certain; (2) after the de-allocation command is executed, when the logical address range indicated by the de-allocation command is read again (before other write operations are performed on the logical address range), the result obtained is all 0; (3) after the de-allocation command is executed, when the logical address range indicated by the de-allocation command is read again (before other write operations are performed on the logical address range), the result obtained can be any value. The execution effect of the de-allocation command can be set or selected in the de-allocation command or other commands. Summary of the invention
[0015] By using the de-allocation command, the host can inform the solid-state drive which logical address spaces no longer store valid data, so that the storage device does not have to move the invalid data when reclaiming the storage space. However, in order to respond to the de-allocation command faster, the FTL table is usually updated according to the received de-allocation command. However, the FTL is stored in the memory, and when the storage device loses power, the FTL table needs to be recorded in the NVM. As the storage capacity of the solid-state storage device increases, the size of the FTL table increases accordingly, and the complete FTL table cannot be saved in the NVM in a short time when the power is lost. In addition, when processing the de-allocation command, no data corresponding to the de-allocated logical address is written to the NVM, so that this part of the logical address has no chance to be written to the NVM together with the data. Therefore, it is necessary to effectively store the update of the FTL table by the de-allocation command in the NVM, which does not extend the time when the storage device needs the FTL table when the power is lost, and can also ensure the integrity of the FTL table in the event of an unexpected power outage.
[0016] According to the first aspect of the present application, a method for processing a first de-allocation command according to the first aspect of the present application is provided, which includes the following steps: obtaining a command; in response to receiving the de-allocation command, allocating a storage unit for the de-allocation command; recording a de-allocation log generated according to the de-allocation command in the allocated storage unit; and updating the FTL table according to the de-allocation command.
[0017] According to the processing method of the first de-allocation command of the first aspect of the present application, a processing method of the second de-allocation command of the first aspect of the present application is provided, wherein, if the de-allocation command indicates that one or more logical addresses are to be de-allocated, then one or more logical addresses are recorded in the FTL table as being de-allocated.
[0018] According to the processing method of the second de-allocation command of the first aspect of the present application, a processing method of the third de-allocation command of the first aspect of the present application is provided, wherein the de-allocation of the logical address is recorded in each table entry of the FTL table corresponding to one or more logical addresses accessed by the de-allocation command.
[0019] According to the method for processing the de-allocation command of any one of the first to third items of the first aspect of the present application, a method for processing the fourth de-allocation command of the first aspect of the present application is provided, wherein one or more logical address ranges indicated by the de-allocation command are recorded in one or more entries of the allocation log.
[0020] According to the first de-allocation command processing method of the first aspect of the present application, a fifth de-allocation command processing method of the first aspect of the present application is provided, wherein the allocated storage unit comes from a storage area for recording data corresponding to the write command.
[0021] According to the method for processing the de-allocation command of any one of the first to fifth items of the first aspect of the present application, a method for processing the sixth de-allocation command of the first aspect of the present application is provided, wherein the physical address of the storage unit where the de-allocation log is located is not recorded in the FTL table.
[0022] According to the method for processing the de-allocation command of any one of the first to sixth items of the first aspect of the present application, a method for processing the seventh de-allocation command of the first aspect of the present application is provided, wherein, in response to receiving a write command, an unused storage unit is allocated to the write command, and the correspondence between the logical address of the write command and the physical address of the storage unit allocated to the write command is recorded in the FTL table.
[0023] According to the second aspect of the present application, a first method for reconstructing an FTL table according to the second aspect of the present application is provided, which includes the following steps: in response to power-on of a storage device, scanning a storage unit to which data is written; reading data from the scanned storage unit, and if the read data records a de-allocation log, updating the FTL table according to one or more de-allocated logical address ranges indicated by the de-allocation log.
[0024] According to the first method for reconstructing the FTL table of the second aspect of the present application, a second method for reconstructing the FTL table of the second aspect of the present application is provided, wherein the scanned storage unit is the storage unit with the smallest physical address, or the physical address of the specified storage unit is recorded.
[0025] According to the first or second method for reconstructing the FTL table of the second aspect of the present application, a third method for reconstructing the FTL table of the second aspect of the present application is provided, wherein, if the data read from the scanned storage unit is data corresponding to the write command and the logical address associated with the data, the FTL table is updated according to the physical address of the storage unit and the logical address recorded in the storage unit.
[0026] According to the third method for reconstructing the FTL table of the second aspect of the present application, a fourth method for reconstructing the FTL table of the second aspect of the present application is provided, wherein, if the logical address corresponding to the scanned storage unit coincides with the logical address corresponding to the scanned physical address, the physical address corresponding to the logical address is updated in the FTL table.
[0027] According to the fourth method for reconstructing the FTL table of the second aspect of the present application, a fifth method for reconstructing the FTL table of the second aspect of the present application is provided, wherein, in a table entry of the FTL table corresponding to one or more de-allocated logical address ranges, it is recorded that the logical address corresponding to the table entry is de-allocated.
[0028] According to the method for reconstructing the FTL table according to any one of the first to fifth items of the second aspect of the present application, a sixth method for reconstructing the FTL table according to the second aspect of the present application is provided, wherein a next storage unit of the designated storage unit is scanned, and if the data read from the next storage unit records a de-allocation log, the FTL table is updated according to one or more de-allocated logical address ranges indicated by the de-allocation log;
[0029] According to the method for reconstructing the FTL table according to any one of the first to sixth items of the second aspect of the present application, a seventh method for reconstructing the FTL table according to the second aspect of the present application is provided, wherein, in response to completing the scanning of all storage units of the storage device to which data is written, the FTL table obtained is the reconstructed FTL table.
[0030] According to the seventh method for reconstructing the FTL table of the second aspect of the present application, an eighth method for reconstructing the FTL table of the second aspect of the present application is provided, wherein it is determined that all storage cells with written data have been scanned by identifying that physical addresses have not been written with data.
[0031] According to the method for reconstructing the FTL table of any one of the first to eighth items of the second aspect of the present application, a ninth method for reconstructing the FTL table of the second aspect of the present application is provided, wherein the physical address of the storage unit last updated is recorded.
[0032] According to the ninth method for reconstructing the FTL table of the second aspect of the present application, a tenth method for reconstructing the FTL table of the second aspect of the present application is provided, wherein the storage units are scanned in descending order of physical addresses to reconstruct the FTL table.
[0033] According to the tenth method for reconstructing the FTL table of the second aspect of the present application, an eleventh method for reconstructing the FTL table of the second aspect of the present application is provided, wherein when updating table entries of the FTL table, each table entry is updated only once.
[0034] According to the eleventh method for reconstructing the FTL table of the second aspect of the present application, a twelfth method for reconstructing the FTL table of the second aspect of the present application is provided, wherein, if an allocation log is recorded in the accessed storage unit, and the corresponding table entry in the FTL table of the de-allocated logical address recorded in the allocation log has been updated, the table entry will no longer be updated.
[0035] According to the method of reconstructing the FTL table according to any one of the tenth to twelfth items of the second aspect of the present application, a thirteenth method of reconstructing the FTL table according to the second aspect of the present application is provided, wherein all storage units into which data are written have been scanned, and the FTL table obtained at this time is the reconstructed FTL table.
[0036] According to a third aspect of the present application, a first storage device according to the third aspect of the present application is provided, which includes a control component and a non-volatile storage medium, and the control component executes the methods of the first aspect to the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in 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 recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0038] Figure 1 is a block diagram of a solid-state storage device of the prior art;
[0039] Figure 2 It is a schematic diagram of de-allocating logs according to an embodiment of the present application;
[0040] Figures 3A-3D A schematic diagram of processing IO commands and de-allocation commands provided according to an embodiment of the present application is shown;
[0041] Figure 4 is a flowchart of processing a de-allocation command provided according to an embodiment of the present application;
[0042] Figure 5Ais a schematic diagram of data recording of a non-volatile memory provided according to an embodiment of the present application;
[0043] Figure 5B-5E is a schematic diagram of an FTL table provided according to an embodiment of the present application;
[0044] Figure 6 It is a flowchart of rebuilding the FTL table provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0045] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0046] According to an embodiment of the present application, in response to receiving a de-allocation command, in addition to marking the logical address indicated by the de-allocation command as de-allocated in the FTL table according to the de-allocation command, a de-allocation log is recorded in the NVM of the storage device for storing user data. The de-allocation log records the de-allocation command, or one or more de-allocated logical addresses generated according to the de-allocation command.
[0047] Figure 2 A schematic diagram of de-allocating logs according to an embodiment of the present application is shown.
[0048] As an example, Figure 2 The de-allocation log includes multiple entries, each of which records a "TRIM range" (TRIM range 0, TRIM range 1, ... TRIM range 4). "TRIM range" represents a continuous logical address range indicated by the de-allocation command, consisting of a starting logical address and an ending logical address, or a starting logical address and a length. Each entry of the de-allocation log has, for example, a specified size.
[0049] Figures 3A-3D A schematic diagram of processing IO commands and de-allocation commands according to the present application is shown.
[0050] The command queue shows the commands received by the storage device in order. The commands further down the command queue are received earlier, while the commands further up the command queue are received later. Figure 3A In the example, command W1 (LBA1) in the command queue indicates that the storage device has received a write command W1 for updating the logical address LBA1.
[0051] The storage device also includes an FTL table and an NVM. Each table entry of the FTL table is indexed by a logical address (LBA1, LBA2, ...), and the content of the table entry is a physical address (PBA) corresponding to the logical address. The NVM includes a plurality of data storage units, indexed by physical addresses (PBA1, PBA2, ...), and the data storage units of the NVM store data and also store logical addresses associated with the stored data. For example, see Figure 3A The unit storing data indexed by the physical address PBA1 records data (indicated by "Data"), and also records the logical address "LBA1", which indicates that the logical address of the data stored at the physical address "PBA1" is "LBA1", and the FTL table indicates that the data with the logical address "LBA1" is stored in the unit storing data with the physical address "PBA1" (hereinafter referred to as "storage unit").
[0052] Continue to view Figure 3A In response to receiving the command W1(LBA1), where "W" indicates that the command is a write command, and "(LBA1)" indicates the logical address of the data to be written. The storage device allocates an unused storage unit from the NVM for the write command, and the physical address of the allocated storage unit is "PBA1". In the FTL table, the physical unit corresponding to the logical address "LBA1" is recorded as "PBA1", and the data corresponding to the command W1(LBA1) and the logical address "LBA1" are written to the storage unit with the allocated physical address "PBA1". The processing of the command W1(LBA1) is now completed.
[0053] See also Figure 3B After receiving the command W1 (LBA1), the command W2 (LBA2) and the command W3 (LBA3) are received in sequence, respectively instructing to write data to the logical address LBA2 and to write data to the logical address LBA3. The storage device allocates unused storage units from the NVM for these two write commands, and the physical addresses of the allocated storage units are "PBA2" and "PBA3" respectively. In the FTL table, the physical unit corresponding to the logical address "LBA2" is recorded as "PBA2", and the physical unit corresponding to the logical address "LBA3" is recorded as "PBA3". The data corresponding to the command W2 (LBA2) and the logical address "LBA2" are written to the storage unit with the allocated physical address "PBA2", and the data corresponding to the command W3 (LBA3) and the logical address "LBA3" are written to the storage unit with the allocated physical address "PBA3".
[0054] See also Figure 3C, then receives a deallocation command "TRIM (LBA1, LBA2)", which indicates that the logical address LBA1 and the logical address LBA2 are to be de-allocated. In response, the storage device records in the FTL table that the logical address LBA1 and the logical address LBA2 are de-allocated. For example, a special value recorded in the FTL table entry indicates that the logical address corresponding to the table entry is de-allocated.
[0055] And allocate an unused storage unit for the de-allocation command, the physical address of the allocated storage unit is "PBA 4", and the de-allocation log generated according to the de-allocation command "TRIM (LBA1, LBA2)" is recorded in the allocated storage unit. The de-allocation log records the de-allocation of the logical address LBA1 and the logical address LBA2. It can be understood that Figure 3C The de-allocation command "TRIM(LBA1, LBA2)" implements de-allocation of logical address LBA1 / LBA2, while other de-allocation commands can describe more or fewer other logical addresses. Accordingly, the generated de-allocation log also records the de-allocation of one or more logical address ranges indicated by the de-allocation command.
[0056] Continue to view Figure 3D After receiving the de-allocation command "TRIM (LBA1, LBA2)", a write command W4 (LBA1') is received, which instructs to write data to the logical address LBA1. Since the storage unit of the physical address PBA1 in the NVM has already recorded the data written to the logical address LBA1, "LBA1'" is used in the write command W4 (LBA1') to distinguish it from the previous logical address LBA1. In response, the storage device allocates an unused storage unit from the NVM for the write command, and the physical address of the allocated storage unit is "PBA5". In the FTL table, the physical unit corresponding to the logical address "LBA1'" (whose value is the same as the logical address LBA1, using the table entry for the logical address LBA1 of the FTL table) is recorded as "PBA5", and the data corresponding to the command W5 (LBA1') and the logical address "LBA1'" are written to the storage unit with the allocated physical address "PBA5".
[0057] It can be understood that at this time, the storage unit with the physical address "PBA1" and the storage unit with the physical address "PBA5" in the NVM both record the logical address (LBA1 / LBA1'). Since the storage unit with the physical address "PBA5" is written later in time, relative to the storage unit with the physical address "PBA1", the correspondence between the logical address LBA1' and the physical address "PBA 5" recorded by the storage unit with the physical address "PBA5" covers the correspondence between the logical address LBA1 and the physical address "PBA 1".
[0058] Figure 4 It is a flowchart of processing de-allocation commands according to an embodiment of the present application.
[0059] In response to receiving a de-allocation command, a de-allocation log is generated according to the de-allocation command (410), and one or more entries of the generated de-allocation log record one or more logical address ranges to be accessed by the de-allocation command. An available storage unit is allocated from a storage area of the NVM of the storage device for recording data corresponding to the write command, and the generated de-allocation log is written to the allocated storage unit (420). Optionally, the physical address of the storage unit where the de-allocation log is located is not recorded in the FTL table.
[0060] The FTL table is updated according to the de-allocation command (430), and the de-allocation of the logical address is recorded in each table entry of the FTL table corresponding to the one or more logical addresses accessed by the de-allocation command. For example, a special value recorded in the FTL table entry indicates that the logical address corresponding to the table entry is de-allocated. At this point, the de-allocation command is processed (440).
[0061] According to the embodiment of the present application, the de-allocation command is processed so that the FTL table can be rebuilt after the storage is powered on. Figures 5A-5E A schematic diagram of rebuilding an FTL table according to an embodiment of the present application is shown.
[0062] The NVM of the storage device records the data, the logical address corresponding to the data, and the de-allocation log. When the storage device is powered on, the FTL table is empty. In order for the storage device to work properly, the FTL table needs to be rebuilt.
[0063] Figure 5A Shows the data recorded in NVM. Figure 5A , the storage unit with the physical address PBA1 of the NVM records data (DATA) and the corresponding logical address (LBA1), the storage unit with the physical address PBA2 records data (DATA) and the corresponding logical address (LBA2), the storage unit with the physical address PBA3 records data (DATA) and the corresponding logical address (LBA3), the storage unit with the physical address PBA4 records a de-allocation log indicating that the logical addresses LBA1 and LBA2 are de-allocated, and the storage unit with the physical address PBA5 records data (DATA) and the corresponding logical address (LBA1'). No data is recorded in other storage units of the storage device.
[0064] Figures 5B-5D A schematic diagram of an FTL table is shown.
[0065] To rebuild the FTL table, the storage device starts rebuilding the FTL table from a specified storage unit (e.g., a storage unit with a physical address of PBA1). The storage device accesses the storage unit with a physical address of PBA1, obtains the logical address LBA1 therefrom, and accordingly records the physical address corresponding to the logical address LBA1 as PBA1 in the FTL table ( Figure 5B ).
[0066] It can be understood that the physical addresses PBA1, PBA2, PBA3, ... PBA5 are successively increasing and adjacent physical addresses, so that all subsequent physical addresses can be obtained according to the physical address PBA1. Optionally, the storage units corresponding to some physical addresses are damaged, and the damaged storage units are not used.
[0067] It is still understandable that the designated storage unit (eg, the storage unit with the physical address PBA1) is the storage unit with, for example, the smallest physical address, or the storage device records the physical address of the designated storage unit.
[0068] See also Figure 5C Next, the storage device increments the accessed physical address PBA1 to obtain the physical address PBA2, and accesses the storage unit with the physical address PBA2 to obtain the logical address LBA2, thereby recording the physical address corresponding to the logical address LBA2 as PBA2 in the FTL table. Similarly, the storage unit with the physical address PBA3 is accessed to obtain the logical address LBA3, and the physical address corresponding to the logical address LBA3 is recorded as PBA3 in the FTL table.
[0069] See also Figure 5D Next, the storage device increments the accessed physical address PBA3 to obtain the physical address PBA4, and identifies that the storage unit of the physical address PBA4 stores the de-allocation log. According to the de-allocation log, it is known that the logical address LBA1 and the logical address LBA2 are de-allocated. Therefore, in the FTL table, the entries corresponding to the logical addresses LBA1 and LBA2 are marked as being de-allocated.
[0070] See also Figure 5E Next, the storage device increments the accessed physical address PBA4 to obtain the physical address PBA5, and accesses the storage unit with the physical address PBA5 to obtain the logical address LBA1', thereby recording the physical address corresponding to the logical address LBA1' (whose value is LBA1) in the FTL table as PBA5.
[0071] At this point, the storage device has completed the reconstruction of the FTL table and can work normally to respond to commands. Figure 5E Shows the same FTL table as 3D.
[0072] It can be understood that the storage device determines that all storage units with written data have been accessed by recognizing that physical address PBA6 has no data written, thereby recognizing that the reconstruction of the FTL table is completed. Optionally, the storage device records which storage units should be accessed when rebuilding the FTL table.
[0073] Figure 6 A flowchart for rebuilding an FTL table according to an embodiment of the present application is shown.
[0074] In response to the storage device being powered on, the FTL table is rebuilt (610). The storage units to which data is written in the NVM of the storage device are scanned in order of, for example, increasing physical addresses. Optionally, a timestamp is recorded when data is written to the storage unit, and the FTL table is rebuilt, and the storage units to which data is written are accessed in order of the timestamp from old to new.
[0075] According to the data read out from the storage unit (620), if the read out data is data corresponding to the write command and the corresponding associated logical address, the FTL table (630) is updated according to the physical address of the storage unit and the logical address recorded in the storage unit, and the physical address of the storage unit is recorded in the table entry of the FTL table with the logical address recorded in the storage unit as the index. If the data read out from the storage unit records the de-allocation log, the FTL table (640) is updated according to one or more de-allocated logical address ranges indicated by the de-allocation log, and the logical address corresponding to the table entry corresponding to the one or more de-allocated logical address ranges is recorded in the table entry of the FTL table corresponding to the one or more de-allocated logical address ranges.
[0076] Then, the next storage device of the storage device is scanned, and the above process is repeated until all storage units of the storage device to which data is written are scanned (650). The FTL table obtained at this time is the reconstructed FTL table.
[0077] According to another embodiment of the present application, the storage device records the physical address of the storage unit that was last updated, and when rebuilding the FTL table, the storage units of the NVM of the storage device to which data is written are scanned in the order of increasing physical addresses. Still optionally, the FTL table is rebuilt, and each storage unit to which data is written is scanned in the order of timestamps from new to old. When updating the table entries of the FTL table, each table entry is updated only once. See also Figure 5A, scan the storage units in the order of physical addresses PBA5 to PBA1, and first record the physical address corresponding to the logical address LBA1' as PBA5 in the FTL table. Next, read the de-allocation log from the storage unit of physical address PBA4, which records that the logical addresses LBA1 and LBA2 are de-allocated. Since the table entry corresponding to the logical address LBA1 (whose value is the same as LBA1') in the FTL table has been updated once, the table entry is no longer updated, and the de-allocation of the logical address LBA2 is recorded in the FTL table. Next, read the logical address LBA3 from the storage unit of physical address PBA3, and record the physical address corresponding to the logical address LBA3 as PBA3 in the FTL table. Next, read the logical address LBA2 from the storage unit of physical address PBA2, and since the table entry corresponding to the logical address LBA2 in the FTL table has been updated once (recording that the logical address is de-allocated), the table entry is no longer updated. Next, the logical address LBA1 is read from the storage unit of the physical address PBA1. Since the entry corresponding to the logical address LBA1 in the FTL table has been updated once (the recorded physical address is PBA 5), the entry is no longer updated. Since the storage units of the storage device where data is written have all been scanned, the FTL table obtained at this time is the reconstructed FTL table.
[0078] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for processing a de-allocation command, characterized in that: The following steps are involved: Get command; In response to receiving a de-allocation command, allocating an available storage unit from a storage area of the NVM chip for recording data corresponding to the write command for the de-allocation command, wherein the storage unit is a unit of the NVM chip for storing data; Generate a de-allocation log according to the de-allocation command, and write the generated de-allocation log to the allocated storage device; wherein the de-allocation log includes a plurality of entries, each entry records a continuous logical address range indicated by the de-allocation command, and the logical address range is represented by a starting logical address and an ending logical address, or the logical address range is represented by a starting logical address and a length; The FTL table is updated according to the de-allocation command, and the de-allocation command is now processed.
2. The method for processing a de-allocation command according to claim 1, characterized in that: If the deallocation command indicates that one or more logical addresses are to be deallocated, then it is recorded in the FTL table that the one or more logical addresses are deallocated.
3. The method for processing a de-allocation command according to claim 1 or 2, characterized in that: In response to receiving a write command, an unused storage unit is allocated for the write command, and a correspondence between a logical address of the write command and a physical address of the storage unit allocated for the write command is recorded in the FTL table.
4. A method for reconstructing an FTL table, characterized in that: The steps include: In response to the storage device being powered on, scanning the storage unit where the data is written; Data is read out from the scanned storage unit, and if the read data records a de-allocation log, the FTL table is updated according to one or more de-allocated logical address ranges indicated by the de-allocation log; wherein the de-allocation log is generated in response to receiving a de-allocation command and executing the processing method of the de-allocation command according to one of claims 1-3.
5. The method for reconstructing the FTL table according to claim 4, characterized in that: If the data read from the scanned storage unit is data corresponding to the write command and the logical address associated with the data, the FTL table is updated according to the physical address of the storage unit and the logical address recorded in the storage unit.
6. The method for reconstructing the FTL table according to claim 5, characterized in that: If the logical address corresponding to the scanned storage unit coincides with the logical address corresponding to the scanned physical address, the physical address corresponding to the logical address is updated in the FTL table.
7. The method for rebuilding an FTL table according to any one of claims 4 to 6, characterized in that: In response to completing the scanning of all storage units of the storage device to which data is written, the obtained FTL table is the reconstructed FTL table.
8. A storage device, characterized in that: The device comprises a control component and a non-volatile storage medium, wherein the control component executes the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Built-in mapping message of memory device
CN101676882A
Deallocation command processing method and storage device thereof
CN109086219A
A storage command processing method and storage equipment thereof
CN109840048A