Command processing method, log processing method, and storage device
By constructing the ILBT table and optimizing processing process, the assignment commands in the SSD to allocate commands to process long, storage space remains unable to indicate and log in logging, and achieve more efficient command processing and performance improvement.
Patent Information
- Application Number
- PCT/CN2024/106544
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-21
- Filing Date
- 2024-07-19
- Publication Date
- 2025-01-30
AI Technical Summary
The de-allocation command processing time in SSD is long, and the de-allocation table cannot represent the remaining amount of storage space. Logging increases bandwidth consumption, resulting in a de-study of SSD write performance.
Build an ineffective logic block table (ILBT) to mark the effectiveness of the logic block in the FTL table, optimize the processing command processing process, reduce the log redundant, and improve the log format to reduce the bandwidth consumption.
The execution speed of allocating commands can be improved, which can represent the remaining amount of storage space, reduce the bandwidth consumption of log records, and improve the writing performance and user experience of SSD.
Smart Images

Figure CN2024106544_30012025_PF_FP_ABST
Abstract
Description
Command processing method, log processing method and storage device
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on July 21, 2023, with application number 2023109066094 and invention name “Command processing method, log processing method and storage device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a command processing method, a log processing method, and a storage device. Background Art
[0003] With the development of hard disk technology, solid-state drives (SSDs) are gradually replacing hard disk drives (HDDs) to improve data storage stability and data reading efficiency.
[0004] Currently, SSDs use the FTL (Flash Translation Layer) table to record the address mapping relationship between logical blocks and physical blocks, while the de-allocation table records whether the address mapping relationship between logical blocks and physical blocks has been removed. To improve SSD reliability, the SSD logs any updates to the FTL and de-allocation tables. For example, the FTL table logs the physical address of saved data, and the de-allocation table logs the length of the physical address that was de-allocated or restored.
[0005] However, as the storage capacity of SSDs increases, the size of the FTL table also increases, resulting in a large number of memory access operations required during the execution of de-allocation commands, which prolongs the processing time of de-allocation commands, affects the performance of the SSD, and further affects the execution of read and write commands. In addition, the de-allocation table cannot represent the remaining amount of storage space, which is not conducive to the implementation of the NUSE (Namespace Utilization) function in the NVMe protocol. In addition, the current FTL table log cannot express the status of the de-allocation table (including de-allocation status and restore allocation status), and is redundant with the de-allocation table log. For example, when writing data requires saving the restore allocation status log, the SSD will record the physical block update log and the corresponding restore allocation status log, resulting in the recording of redundant information. Therefore, the current logging method increases bandwidth consumption and reduces the bandwidth of the SSD for processing IO (Input Output) tasks, resulting in a decrease in the write performance of the SSD, thereby reducing the user experience.
[0006] Summary of the Invention
[0007] At least one embodiment of the present disclosure provides a command processing method, a log processing method, a storage device, and a storage medium to solve at least one of the problems of long processing time for de-allocation commands, the problem of the inability to represent the remaining amount of storage space in the de-allocation table, and the problem of increased bandwidth consumption due to logging.
[0008] In a first aspect, embodiments of the present disclosure provide a command processing method, wherein an FTL table and an ILBT table are pre-built. The FTL table is used to record the address mapping relationship between logical blocks and physical blocks; the ILBT table is used to mark whether each logical block recorded in the FTL table is valid. The method includes:
[0009] After receiving the de-allocation command, obtain the logical block address indicated by the de-allocation command, and mark the table entry corresponding to the logical block address as invalid in the ILBT table;
[0010] After processing the de-allocation command, if no read command and / or write command is received, the ILBT table is scanned. If a logic block marked as invalid is found, the corresponding entry of the invalid logic block in the FTL table is marked as de-allocated.
[0011] In some embodiments, the command processing method further includes:
[0012] After scanning the ILBT table, if a read command is received, the logical block address indicated by the read command is obtained; the physical block address mapped by the logical block address is directly obtained from the FTL table, and the data stored in the physical block address is used as the response to the read command;
[0013] or,
[0014] During the scanning of the ILBT table, if a read command is received, the logical block address indicated by the read command is obtained; the tag of the logical block address is obtained in the ILBT table, and the response to the read command is determined based on the tag of the logical block address.
[0015] In some embodiments, the command processing method further includes:
[0016] When starting to scan the ILBT table, set the running flag of the ILBT scanning task;
[0017] After completing the ILBT table scan, delete the running flag or set the stop flag of the ILBT scan task;
[0018] After receiving the read command, obtain the logical block address indicated by the read command and detect whether there is a running flag;
[0019] If there is no run identifier, the physical block address mapped by the logical block address is directly obtained in the FTL table, and the data stored in the physical block address is used as the response to the read command; or, if there is a run identifier, the tag of the logical block address is obtained in the ILBT table, and the response to the read command is determined based on the tag of the logical block address.
[0020] In some embodiments, determining a response to a read command based on a tag of a logical block address includes:
[0021] If the mark of the logical block address is invalid, the preset data is used as a response to the read command;
[0022] If the mark of the logical block address is valid, the physical block address mapped by the logical block address is obtained in the FTL table, and the data stored in the physical block address is used as a response to the read command.
[0023] In some embodiments, the command processing method further includes:
[0024] After receiving the write command, obtain the logical block address indicated by the write command and allocate a physical block address for the write command;
[0025] Update the allocated physical block address to the target entry in the FTL table, where the target entry in the FTL table is the entry in the FTL table corresponding to the logical block address indicated by the write command;
[0026] The data indicated by the write command is written to the allocated physical block address.
[0027] In some embodiments, the command processing method further includes:
[0028] After scanning the ILBT table, if a write command is received and the entry corresponding to the logical block address indicated by the write command in the FTL table is marked as de-allocated, the target entry in the ILBT table is marked as valid. The target entry in the ILBT table is the entry corresponding to the logical block address indicated by the write command in the ILBT table.
[0029] or,
[0030] During the scanning of the ILBT table, if a write command is received, an attempt is made to directly mark a target entry in the ILBT table as valid. The target entry in the ILBT table is an entry in the ILBT table corresponding to the logical block address indicated by the write command.
[0031] In a second aspect, the present disclosure also provides a log processing method, including:
[0032] In response to the de-allocation command, after marking an entry corresponding to the logical block address indicated by the de-allocation command as invalid in the ILBT table, generating an invalidation log of the ILBT table based on a preset log format;
[0033] In response to scanning the ILBT table, after successfully marking the table entry corresponding to the scanned logic block marked as invalid in the FTL table as deallocated, a deallocation log of the FTL table is generated based on a preset log format.
[0034] In a third aspect, an embodiment of the present disclosure further proposes a storage device, which includes: a control component and an NVM chip, and the control component executes the steps of any command processing method according to the first aspect or the steps of any log processing method according to the second aspect.
[0035] It can be seen that in at least one embodiment of the present disclosure, an ILBT table is constructed to mark whether each logical block recorded in the FTL table is valid. If the mark is invalid, it indicates that the logical block has not been allocated a physical block. For a logical block that has been allocated a physical block before, the logical block is marked as invalid, indicating that a de-allocation command has been executed on the logical block. Therefore, when the de-allocation command is received, the logical block address indicated by the de-allocation command is obtained, and the table entry corresponding to the logical block address is marked as invalid in the ILBT table to update the ILBT table. After the ILBT table is updated, the host can be instructed that the de-allocation command has been executed, thereby improving the execution speed of the de-allocation command. In addition, after processing the de-allocation command, the ILBT table is scanned at a time when no read or write command is received to avoid affecting the processing of the read and write commands and reducing the user experience. The table entry corresponding to the logical block scanned and marked as invalid (including the LBA indicated by the de-allocation command) in the FTL table is marked as de-allocated, so as to update the FTL table and facilitate subsequent processing of read and write commands. There is no need to clear the logical block marked as invalid in the ILBT table (for example, the logical block marked as 1). In the related art, after attempting to mark the table entry corresponding to the invalid logical block in the FTL table as de-allocated (for example, marked as 0), it is also necessary to clear the table entry corresponding to the invalid logical block in the de-allocation table to 0 to indicate that the invalid logical block has been de-allocated. Therefore, this embodiment can reduce the clearing processing and improve the efficiency of the ILBT table scanning.
[0036] In addition, in at least one embodiment of the present disclosure, an ILBT table is constructed. After marking the entry corresponding to the logical block address indicated by the de-allocation command as invalid in the ILBT table, an invalidation log for the ILBT table is generated based on a preset log format, indicating that the state of the logical block address has changed from allocated to unallocated. Furthermore, after scanning the ILBT table and successfully marking the entry corresponding to the logical block marked as invalid in the FTL table as de-allocated, an FTL de-allocation log is generated based on a preset log format, indicating that the de-allocation instruction has been executed on the logical block address, thereby unmapping the logical block from the physical block. This reduces the amount of logs generated during command processing, and since both the invalidation log for the ILBT table and the de-allocation log for the FTL table are generated based on the same preset log format, redundant information between logs is reduced, thereby reducing bandwidth consumption for log recording, increasing the bandwidth for SSDs processing I / O tasks, and improving SSD write performance, thereby enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0038] FIG1 is a flow chart of a command processing method provided by an embodiment of the present disclosure;
[0039] FIG2 is a flow chart of a log processing method provided by an embodiment of the present disclosure;
[0040] FIG3 is a schematic diagram of a scenario including command processing and log processing provided by an embodiment of the present disclosure;
[0041] FIG4 is a schematic diagram of a scenario of a concurrent processing flow provided by an embodiment of the present disclosure;
[0042] FIG5 is an exemplary block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0043] 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 making creative efforts are within the scope of protection of this application.
[0044] In the SSD, the FTL (Flash Translation Layer) is used to maintain the address mapping relationship between the logical block address (LBA) and the physical block address (PBA), where the logical block address constitutes the SSD storage space perceived by upper-layer applications such as the operating system, and the physical block address is the address used to access the physical storage unit of the SSD. The table structure that stores the address mapping relationship between the logical block and the physical block is called the FTL table. In the FTL table, LBA is used as an index, and the table entry content includes the PBA mapped by the LBA. The index and the table entry are collectively referred to as an entry in the FTL table, that is, one LBA corresponds to an entry in the FTL table. It can be seen that the storage capacity of the SSD determines the size of the FTL table. As the storage capacity of the SSD increases, the size of the FTL table increases accordingly. In the related art, the FTL table before executing the de-allocation command is shown in Table 1 below.
[0045] Table 1 FTL table before executing the deallocation command
[0046] As can be seen, the FTL table shown in Table 1 records the PBAs (denoted as PBAa-b) mapped to each of the eight LBAs (numbered 0 to 7). a indicates a physical block, and b indicates a page within the physical block. For example, LBA 0 maps to PBAs 1-4, indicating that logical block 0 maps to page 4 of physical block 1. In other words, the data at logical address "LBA 0" is stored in the physical page with physical address "PBA 1-4." It should be noted that a physical block includes multiple pages, and data is typically stored and read on a storage medium by page, while data is erased by block.
[0047] In the SSD, the de-allocation command is used to release the address mapping relationship to inform the SSD which logical block address spaces no longer store valid data, so that the SSD can erase invalid data to release physical storage space during garbage collection (GC). Among them, the de-allocation command includes: the Trim command defined in ATA8-ACS2, the UNMAP command defined in the SCSI (Small Computer System Interface) specification, the Deallocate command defined in the NVMe (Non-Volatile Memory express) specification, and other dataset management commands with the same or similar functions, as well as commands with the same or similar functions that appear in other or future protocols, specifications or technologies. In the related art, the de-allocation table before executing the de-allocation command is shown in Table 2 below.
[0048] Table 2 De-allocation table before executing the de-allocation command
[0049] The deallocation table stores a flag (value 0 or 1) corresponding to whether each LBA in the FTL table is deallocated. 0 represents the LBA as "allocated" (i.e., the LBA is mapped to a PBA in the FTL table), and 1 represents the LBA as unallocated or "deallocated" (i.e., the LBA is not mapped to a PBA in the FTL table). Since LBAs 0 to 7 are all mapped to PBAs in the FTL table shown in Table 1, the flags corresponding to LBAs 0 to 7 in the deallocation table shown in Table 2 are all 0, representing "allocated."
[0050] It can be seen that the de-allocation table cannot represent the remaining amount of the SSD storage space, which is not conducive to implementing the NUSE (Namespace Utilization) function in the NVMe protocol.
[0051] The de-allocation command specifies a logical address range, indicating that the LBAs corresponding to that logical address range are de-allocated. As SSD storage capacity increases, the size of the FTL table also increases. This results in a large number of memory access operations required to execute de-allocation commands, which increases the processing time of the de-allocation command, affects SSD performance, and further affects the execution of read and write commands.
[0052] After executing the de-allocation command, different effects can occur. For example, (1) after executing the de-allocation command, when the logical address range indicated by the de-allocation command is read again (before executing other write operations on the logical address range), the result obtained is a certain value; (2) after executing the de-allocation command, when the logical address range indicated by the de-allocation command is read again (before executing other write operations on the logical address range), the result obtained is all 0s; (3) after executing the de-allocation command, when the logical address range indicated by the de-allocation command is read again (before executing other write operations 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.
[0053] If a de-allocation command is executed on any LBA, the entry corresponding to that LBA in the FTL table is specially marked. The special mark, for example, is 0 or another value, indicating that the LBA is "de-allocated," and the address mapping relationship between the LBA and the PBA is released. For example, the logical address range indicated in the de-allocation command includes LBA 0 to LBA 3. That is, if a de-allocation command is executed on LBA 0 to LBA 3 in the FTL table shown in Table 1, the entry corresponding to LBA 0 to LBA 3 is specially marked, for example, with 0, indicating that LBA 0 to LBA 3 are "de-allocated." This results in the FTL table shown in Table 3 after the de-allocation command is executed.
[0054] Table 3. FTL table after executing the deallocation command
[0055] After executing the de-allocation command and before performing other write operations on the logical address range indicated by the de-allocation command (for example, LBA 0 to LBA 3), if the logical address range indicated by the de-allocation command (for example, LBA 0 to LBA 3) is read again, the physical address corresponding to the logical address range is found to be 0 (meaning a special mark, indicating de-allocation) in the FTL table shown in Table 3, and thus the result that conforms to the execution effect of the de-allocation command (for example, all 0s) is used as a response to the read command to indicate that the read logical address range is de-allocated.
[0056] Since the de-allocation command is executed on LBA 0 to LBA 3, in the de-allocation table shown in Table 2, the table entries corresponding to LBA 0 to LBA 3 are marked as 1, representing "de-allocation" (that is, the LBA has no mapped PBA in the FTL table), while the de-allocation command is not executed for LBA4 to LBA7, and they are still marked as 0, representing that LBA4 to LBA7 are "allocated", resulting in the de-allocation table after executing the de-allocation command shown in Table 4.
[0057] Table 4 De-allocation table after executing the de-allocation command
[0058] To improve the reliability of the SSD, the SSD logs any updates to the FTL table and de-allocation table. In related art, the format of the FTL table log is shown in Table 5 below.
[0059] Table 5. Format of the FTL table log
[0060] In the related art, the format of the de-allocation table log is shown in Table 6 below.
[0061] Table 6 Format of de-allocation table log
[0062] It can be seen that the current FTL table log cannot express the status of the deallocation table (including the deallocation status and the restore allocation status), and is redundant with the deallocation table log. For example, when writing data requires saving the restore allocation status log, the SSD will record the physical block update log (using the FTL table log format) and the corresponding restore allocation status log (using the deallocation table log format). Therefore, the current logging method increases bandwidth consumption and reduces the bandwidth of the SSD for processing IO (Input Output) tasks, resulting in a decrease in the SSD's write performance, thereby reducing the user experience.
[0063] In order to reduce the bandwidth consumption of logging, the embodiment of the present disclosure provides an invalid logical block table (ILBT) to replace the de-allocation table in the related art. The ILBT table is shown in Table 7 below.
[0064] Table 7 ILBT table
[0065] The ILBT table stores a flag indicating whether each LBA in the FTL table is valid. In other words, the ILBT table is used to mark each LBA recorded in the FTL table as valid. A flag value of 0 indicates valid (i.e., the LBA is mapped to a PBA and the LBA status is allocated), while a flag value of 1 indicates invalid (i.e., the LBA is not mapped to a PBA and the LBA status is unallocated).
[0066] In the embodiment of the present disclosure, when the SSD is powered on for the first time after leaving the factory (i.e., after production), all entries in the ILBT table are initialized to 1 (indicating that the LBA is invalid, i.e., the LBA is unallocated). When user data is written (and the LBA indicated by the write operation has not executed the de-allocation command), the LBA entry indicated by the write operation is marked as 0 in the ILBT table, indicating that the LBA is valid (i.e., allocated). When the de-allocation command is executed, the LBA entry indicated by the de-allocation command is marked as 1 in the ILBT table, indicating that the LBA is invalid (i.e., unallocated). When user data is written (and the LBA indicated by the write operation has executed the de-allocation command), the LBA entry indicated by the write operation is marked as 0 in the ILBT table, indicating that the LBA is valid (i.e., allocated). After the de-allocation command is executed, when the restore allocation is executed, the LBA entry indicated by the restore allocation in the ILBT table does not change (still 1), indicating that the LBA is invalid (i.e., unallocated), and the corresponding LBA entry in the FTL table is marked as 0, indicating that the LBA is unallocated.
[0067] The difference between the ILBT table and the de-allocation table in the related art is shown in Table 8 below.
[0068] Table 8 Comparison of differences between ILBT table and de-allocation table
[0069] It can be seen that compared with the de-allocation table in the related art, the ILBT table can not only indicate the allocation status of the LBA (that is, it can indicate the de-allocation attribute of the LBA), but also determine the number of LBAs not used by user data (by calculating the number of LBAs marked as 1 (that is, invalid) in the ILBT table), that is, it can indicate the remaining amount of storage space of the SSD, which is conducive to the implementation of the NUSE (Namespace Utilization) function in the NVMe protocol.
[0070] The embodiment of the present disclosure proposes a new log format based on the ILBT table. The new log format is shown in Table 9 below, which realizes the merging of the FTL table log and the de-allocation table log in the related technology, and merges the FTL table log of the restored allocation and the de-allocation table log of the restored allocation.
[0071] Table 9 A new log format
[0072] In the embodiment of the present disclosure, the FTL is divided into several streams. When recording the log of a certain FTL stream in Table 9, only the offset of the logical block involved in the log relative to the starting logical block address of the FTL stream is recorded.
[0073] The organization of the log is the same as that of the related art. The log includes multiple log entries (table items). Each log entry is generated based on the log format shown in Table 9, and each log entry corresponds to one or multiple consecutive LBAs. That is, each log entry corresponds to one or more table items in the FTL table. The log has two states: (1) generated but not written to the NAND flash memory, and (2) written to the NAND flash memory. Log entries are continuously generated during the operation of the SSD and continuously written to the SSD's NAND flash memory. The log entries written to the SSD can be read out in the order in which they were written or in reverse order.
[0074] The basic information of the log entry includes the LBA and the modification of the FTL table or ILBT table associated with the LBA; the value of the modification to the FTL table is the physical block address recorded in the FTL table, and the value of the modification to the ILBT table is a valid flag (for example, 0) or an invalid flag (for example, 1).
[0075] It can be seen that compared with the log entry generated in the related art, the log entry is improved in the embodiment of the present disclosure. The improvements include: (1) adding a new log type:
[0076] When the log type value is 0, it means that only the physical block address of the corresponding entry in the FTL table is updated;
[0077] When the value of the log type is 1, it means that the physical block address of the corresponding entry in the FTL table is updated and the corresponding entry in the ILBT table is marked as valid (for example, marked as 0);
[0078] When the log type value is 2, it means that only the corresponding entry in the ILBT table is marked as invalid (for example, marked as 1);
[0079] When the log type value is 3, it means that only the corresponding entry in the ILBT table is marked as valid (for example, marked as 0);
[0080] When the value of the log type is 4, it means that the corresponding entry in the FTL table is marked as deallocation (for example, marked as 0).
[0081] (2) The storage space for storing LBA is reduced from 32 bits to 29 bits (the reduced 3 bits are obtained from the organization of the log according to the storage location of the log on the SSD).
[0082] (3) Each entry corresponds to one or multiple consecutive LBAs, that is, to one or more entries in the FTL table.
[0083] In order to solve the problem of long processing time for de-allocation commands, based on the ILBT table proposed above, Figure 1 is a flow chart of a command processing method provided in an embodiment of the present disclosure. The executor of the command processing method is an electronic device, and the electronic device includes but is not limited to storage devices (such as solid-state drives, flash memory devices, etc.), smart phones, PDAs, tablet computers, wearable devices with displays, desktops, laptops, all-in-ones, smart home devices, servers, etc., wherein the server can be an independent server or a cluster of multiple servers, including servers built locally and servers set up in the cloud.
[0084] In the command processing method shown in Figure 1, an FTL table and an ILBT table are pre-built. The FTL table is used to record the address mapping relationship between logical blocks and physical blocks; the ILBT table is used to mark whether each logical block recorded in the FTL table is valid. As shown in Figure 1, the command processing method includes the following steps 101 and 102:
[0085] In step 101, after receiving the de-allocation command, the logical block address indicated by the de-allocation command is obtained, and the entry corresponding to the logical block address is marked as invalid in the ILBT table.
[0086] In this embodiment, since the de-allocation command indicates the logical block address (LBA), it means that the LBA is de-allocated to release the address mapping relationship between the LBA and the PBA (physical block address). Therefore, the LBA is extracted from the de-allocation command, and then the table entry corresponding to the extracted LBA is marked as invalid in the ILBT table, for example, marked as 1, indicating that the LBA indicated by the de-allocation command has no mapped PBA, and the status of the LBA is unallocated.
[0087] In step 102, after processing the de-allocation command, if no read and / or write commands are received, the ILBT table is scanned. If a logic block marked as invalid is found, the corresponding entry in the FTL table is marked as de-allocated. The de-allocation command is processed using the existing method and will not be further described.
[0088] In this embodiment, since the ILBT table is processed first after receiving the de-allocation command, the FTL table is not directly processed after processing the de-allocation command, but is adaptively adjusted based on the ILBT table. Specifically, after processing the de-allocation command, the ILBT table is scanned, and the scanning timing is when the SSD is in an idle state (i.e., no read command and / or write command is received) to avoid affecting the processing of read and write commands and reducing the user experience. If a logical block address marked as invalid is scanned (including the LBA indicated by the de-allocation command), indicating that the status of the LBA is unallocated, the PBA corresponding to the LBA indicated by the de-allocation command in the FTL table is marked as de-allocated, for example, marked as 0, indicating that the LBA indicated by the de-allocation command has no mapped PBA and the status of the LBA is unallocated.
[0089] It can be seen that in the embodiment of the present disclosure, an ILBT table is constructed to mark whether each logical block recorded in the FTL table is valid. If the mark is invalid, it indicates that the logical block has not been allocated a physical block. For a logical block that has been allocated a physical block before, the logical block is marked as invalid, indicating that a de-allocation command has been executed on the logical block. Therefore, when the de-allocation command is received, the logical block address indicated by the de-allocation command is obtained, and the table entry corresponding to the logical block address is marked as invalid in the ILBT table to update the ILBT table. After the ILBT table is updated, the host can be instructed that the de-allocation command has been executed, thereby improving the execution speed of the de-allocation command. In addition, after processing the de-allocation command, the ILBT table is scanned at a time when no read or write command is received to avoid affecting the processing of the read and write commands and reducing the user experience. The table entry corresponding to the logical block scanned and marked as invalid (including the LBA indicated by the de-allocation command) in the FTL table is marked as de-allocated, so as to update the FTL table and facilitate subsequent processing of read and write commands. There is no need to clear the logical block marked as invalid in the ILBT table (for example, the logical block marked as 1). In the related art, after attempting to mark the table entry corresponding to the invalid logical block in the FTL table as de-allocated (for example, marked as 0), it is also necessary to clear the table entry corresponding to the invalid logical block in the de-allocation table to 0 to indicate that the invalid logical block has been de-allocated. Therefore, this embodiment can reduce the clearing processing and improve the efficiency of the ILBT table scanning.
[0090] In some embodiments, considering that a read command may be received at any time, different methods are used to process the read command at different times when the read command is received:
[0091] Method 1: After scanning the ILBT table, if a read command is received, the logical block address indicated by the read command is obtained; the physical block address mapped by the logical block address is directly obtained in the FTL table, and the data stored in the physical block address is used as the response to the read command.
[0092] Method 2: When a read command is received during scanning of the ILBT table, the logical block address indicated by the read command is obtained; the tag of the logical block address is obtained in the ILBT table, and a response to the read command is determined based on the tag of the logical block address.
[0093] In method 2, the logical block address indicated by the read command has two marks in the ILBT table: a valid mark (for example, marked as 0) and an invalid mark (for example, marked as 1). Different methods are used to determine the response to the read command for different marks: if the mark of the logical block address is invalid, it means that the logical block address is not mapped to the physical block address, so the actual data cannot be read, so the preset data is used as the response to the read command, where the preset data is, for example, 0, or other values, to indicate that there is no actual data at the logical block address indicated by the read command; if the mark of the logical block address is valid, the physical block address mapped by the logical block address is obtained in the FTL table, and the data stored in the physical block address is used as the response to the read command.
[0094] In some embodiments, to facilitate distinguishing different times when a read command is received, a running flag (ILBT Scan running) of the ILBT table scan task is set when the ILBT table scan begins; after the ILBT table scan is completed, the running flag is deleted or a stop flag (ILBT Scan stop) of the ILBT table scan task is set. Thus, by setting the running flag of the ILBT table scan task, it is easy to distinguish different times when a read command is received, and then use different methods to process the read command:
[0095] After receiving the read command, the command processing method also includes:
[0096] Obtain the logical block address indicated by the read command, and detect whether there is a running identifier for the ILBT scanning task; if there is no running identifier, it means that the ILBT scan has been completed, then directly obtain the physical block address mapped by the logical block address in the FTL table, and use the data stored in the physical block address as a response to the read command; or, if there is a running identifier, it means that the ILBT scan is not completed and is currently in the process of scanning the ILBT table, then obtain the mark of the logical block address in the ILBT table, and determine the response to the read command based on the mark of the logical block address. Specifically, if the mark of the logical block address is invalid, use the preset data as a response to the read command, where the preset data is, for example, 0, or other values; if the mark of the logical block address is valid, obtain the physical block address mapped by the logical block address in the FTL table, and use the data stored in the physical block address as a response to the read command.
[0097] In some embodiments, if a write command is received, the logical block address indicated by the write command is obtained, and a physical block address is allocated for the write command; the allocated physical block address is updated to the target table entry in the FTL table, wherein the target table entry in the FTL table is the table entry corresponding to the logical block address indicated by the write command in the FTL table; and then the data indicated by the write command is written into the allocated physical block address.
[0098] Considering that a write command may be received at any time, different methods are used to process the ILBT table according to the different timings of receiving the write command:
[0099] Method 1: After scanning the ILBT table, if a write command is received and the logical block address indicated by the write command has a de-allocation mark (for example, 0) in the FTL table, the target entry in the ILBT table is marked as valid (for example, marked as 0), indicating that the logical block address corresponding to the target entry is allocated a physical block address, wherein the target entry in the ILBT table is the entry in the ILBT table corresponding to the logical block address indicated by the write command.
[0100] Method 2: During the scanning process of the ILBT table, if a write command is received, an attempt is made to directly mark the target entry in the ILBT table as valid (for example, marked as 0), indicating that the logical block address corresponding to the target entry is assigned a physical block address, wherein the target entry in the ILBT table is the entry in the ILBT table corresponding to the logical block address indicated by the write command.
[0101] To address the issue of current logging methods increasing bandwidth consumption, reducing the bandwidth available for SSDs to process IO tasks, and thus degrading SSD write performance, a log processing method based on the aforementioned ILBT table is provided in Figure 2, which is a flow chart of a log processing method provided by an embodiment of the present disclosure. The method pre-builds an FTL table and an ILBT table. The FTL table is used to record the address mapping relationship between logical blocks and physical blocks; the ILBT table is used to mark each logical block recorded in the FTL table as valid. The log processing method includes the following steps 201 and 202:
[0102] In step 201 , in response to a de-allocation command, after marking an entry corresponding to a logical block address indicated by the de-allocation command as invalid in the ILBT table, an invalidation log of the ILBT table is generated based on a preset log format.
[0103] In this embodiment, after receiving the de-allocation command, the logical block address (LBA) indicated by the de-allocation command is obtained, which represents the de-allocation of the LBA to release the address mapping relationship between the LBA and the PBA (physical block address). Then, after the table entry corresponding to the LBA indicated by the de-allocation command is marked as invalid in the ILBT table (indicating that the LBA indicated by the de-allocation command has no mapped PBA, and the status of the LBA is unallocated), for example, after being marked as 1, an invalid mark log of the ILBT table is generated based on the preset log format.
[0104] In step 202 , in response to scanning the ILBT table, after successfully marking the table entry corresponding to the scanned logic block marked as invalid in the FTL table as deallocated, a deallocation log of the FTL table is generated based on a preset log format.
[0105] In this embodiment, after processing the de-allocation command, the ILBT table is scanned, and the timing of the scan is when the SSD is in an idle state (that is, no read command and / or write command is received) to avoid affecting the processing of the read and write commands and reducing the user experience. Then, the logical block address marked as invalid (including the LBA indicated by the de-allocation command, indicating that the status of the LBA is unallocated) is scanned and the corresponding PBA in the FTL table is marked as de-allocated (indicating that the LBA indicated by the de-allocation command has no mapped PBA, and the status of the LBA is unallocated), for example, after being marked as 0, a de-allocation log of the FTL table is generated based on the preset log format.
[0106] It can be seen that in the embodiments of the present disclosure, by constructing an ILBT table, after marking the table entry corresponding to the logical block address indicated by the de-allocation command as invalid in the ILBT table, a mark-invalid log of the ILBT table is generated based on a preset log format, which can indicate that the state of the logical block address has changed from an allocated state to an unallocated state; and by scanning the ILBT table, after successfully marking the table entry corresponding to the scanned logical block marked as invalid in the FTL table as de-allocated, a de-allocation log of the FTL table is generated based on a preset log format, which can indicate that a de-allocation instruction has been executed on the logical block address, thereby de-mapping the logical block from the physical block. Moreover, both the mark-invalid log of the ILBT table and the de-allocation log of the FTL table are generated based on the same preset log format, which can reduce redundant information between logs and the amount of logs generated during command processing, thereby reducing bandwidth consumption for log recording, increasing the bandwidth of the SSD for processing IO tasks, and improving the write performance of the SSD, thereby improving the user experience.
[0107] In some embodiments, considering that a write command may be received at any time, different logs are generated after the FTL table is updated for different times when a write command is received:
[0108] If a write command is received after scanning the ILBT table, and the logical block address (LBA) indicated by the write command has a de-allocation mark in the FTL table corresponding to the table entry (for example, marked as 0), it means that the LBA indicated by the write command has not been allocated a physical block address (PBA), that is, the table entry corresponding to the LBA indicated by the write command in the ILBT table is invalid (that is, the LBA has not been allocated a PBA), but since a new PBA is allocated for the LBA indicated by the write command, after completing the update of the FTL table, a log is generated based on the preset log format, and the log includes the update of the FTL table and the valid mark of the ILBT table, wherein the update of the FTL table is to update the physical block address (PBA) allocated for the write command to the target table entry in the FTL table, and the target table entry in the FTL table is the table entry corresponding to the logical block address (LBA) indicated by the write command in the FTL table.
[0109] Alternatively, if a write command is received after scanning the ILBT table, and the logical block address (LBA) indicated by the write command corresponds to an entry in the FTL table that is an arbitrary physical block address, it means that the LBA indicated by the write command has been assigned a physical block address (PBA), that is, the entry corresponding to the LBA indicated by the write command in the ILBT table is marked as valid. It can be seen that even if the PBA corresponding to the LBA indicated by the write command is updated, the mark of the entry corresponding to the LBA indicated by the write command in the ILBT table does not need to be changed and is still valid. Therefore, after completing the update of the FTL table, an update log of the FTL table is generated based on the preset log format.
[0110] It can be seen that in this embodiment, the logs generated, including the update of the FTL table and the valid marking of the ILBT table, as well as the update log of the FTL table, are all generated based on the same preset log format, which can reduce the redundant information between logs, reduce the storage space of the LBA for storing log table entries, and thus reduce the bandwidth consumption of log records, increase the bandwidth of the SSD for processing IO tasks, improve the write performance of the SSD, and thus improve the user experience.
[0111] In some embodiments, if a write command is received during the scanning of the ILBT table, since a physical block address (PBA) will be assigned to the logical block address (LBA) indicated by the write command, the entry corresponding to the LBA indicated by the write command in the ILBT table will be marked as valid (indicating that the LBA is assigned a PBA). Therefore, regardless of whether the entry corresponding to the LBA indicated by the write command in the current ILBT table is marked as valid, an attempt is made to directly mark the target entry in the ILBT table as valid. The target entry in the ILBT table is the entry corresponding to the logical block address (LBA) indicated by the write command in the ILBT table. Different logs are generated based on whether the ILBT table is successfully marked valid:
[0112] For the logical blocks corresponding to the entries that are successfully marked as valid, a log is generated based on the preset log format. The log includes the update of the FTL table and the valid marking of the ILBT table.
[0113] For the logical blocks corresponding to the entries that are not successfully marked as valid or do not need to be marked as valid, an update log of the FTL table is generated based on a preset log format.
[0114] It can be seen that in this embodiment, the logs generated, including the update of the FTL table and the valid marking of the ILBT table, as well as the update log of the FTL table, are all generated based on the same preset log format, which can reduce the redundant information between logs, reduce the storage space of the LBA for storing log table entries, and thus reduce the bandwidth consumption of log records, increase the bandwidth of the SSD for processing IO tasks, improve the write performance of the SSD, and thus improve the user experience.
[0115] Based on the various embodiments disclosed above, different logs are generated based on a preset log format. Compared to the current log format, the preset log format is a new log format. It is reflected in the following aspects: the preset log format includes log items, and the log items include log types, and then the corresponding logs are generated according to the log types. Among them, the log types include at least the following five types:
[0116] The value of the log type is the first value, and the corresponding log generated is the update log of the FTL table;
[0117] The value of the log type is the second value, and the corresponding generated log includes the update of the FTL table and the valid mark of the ILBT table;
[0118] The value of the log type is the third value, and the corresponding generated log is the invalid log of the ILBT table;
[0119] The value of the log type is the fourth value, and the corresponding generated log is a marked valid log of the ILBT table;
[0120] The value of the log type is the fifth value, and the corresponding generated log is the de-allocation log of the FTL table.
[0121] For example:
[0122] When the log type value is 0, the corresponding log generated is the update log of the FTL table, which means that only the physical block address of the corresponding entry in the FTL table is updated;
[0123] When the value of the log type is 1, the corresponding log generated includes the update of the FTL table and the valid mark of the ILBT table, which means that the physical block address of the corresponding table entry in the FTL table is updated and the corresponding table entry in the ILBT table is marked as valid (for example, marked as 0);
[0124] When the log type value is 2, the corresponding log generated is the invalidation log of the ILBT table, which means that only the corresponding table entry in the ILBT table is marked as invalid (for example, marked as 1);
[0125] When the log type value is 3, the corresponding log generated is the valid log of the ILBT table, which means that only the corresponding table entry in the ILBT table is marked as valid (for example, marked as 0);
[0126] When the value of the log type is 4, the corresponding log generated is a deallocation log of the FTL table, which means that the corresponding table entry of the FTL table is marked as deallocation (for example, marked as 0).
[0127] Accordingly, the default log format is shown in Table 10 below.
[0128] Table 10 Default log format
[0129] As can be seen, the log includes multiple log entries (table entries), each of which is generated based on the preset log format shown in Table 10, and each log entry corresponds to one or multiple consecutive LBAs, that is, each log entry corresponds to one or more table entries in the FTL table. The log has two states: (1) generated but not written to the NAND flash memory, and (2) written to the NAND flash memory. Log entries are continuously generated during the operation of the SSD and continuously written to the SSD's NAND flash memory. The log entries written to the SSD can be read out in the order in which they were written or in reverse order.
[0130] The basic information of the log entry includes the LBA and the modification of the FTL table or ILBT table associated with the LBA; the value of the modification to the FTL table is the physical block address recorded in the FTL table, and the value of the modification to the ILBT table is a valid flag (for example, 0) or an invalid flag (for example, 1).
[0131] In some embodiments, different log processing methods are used for logs of different log types:
[0132] (1) If the log type value of the generated log is the third value (i.e., the mark invalid log of the ILBT table), the fourth value (i.e., the mark valid log of the ILBT table), or the fifth value (i.e., the de-allocation log of the FTL table), the log is written to the NAND flash memory.
[0133] For example, based on Table 10, if the log type value of the generated log is 2 (i.e., the mark invalid log of the ILBT table), 3 (i.e., the mark valid log of the ILBT table), or 4 (i.e., the de-allocated log of the FTL table), the log is directly written to the NAND flash memory.
[0134] (2) If the log type value of the generated log is the first value (i.e., the update log of the FTL table), the first physical block address updated in the log is obtained, and the second physical block address updated in the FTL table is queried; if the first physical block address is the same as the second physical block address, the log is written to the NAND flash memory; if the first physical block address is different from the second physical block address, the log is discarded, which can reduce the amount of log processing. Because if the log is not discarded, then during the log processing process, the log needs to be written to the NAND flash memory, or a certain number of logs need to be cached and then cached to the NAND flash memory, which requires processing a large number of logs.
[0135] For example, based on Table 10, if the log type value of the generated log is 0 (i.e., the update log of the FTL table), the first physical block address P1 updated in the log is obtained, and the logical block address corresponding to the first physical block address P1 is L1, and the second physical block address P2 corresponding to the logical block address L1 in the FTL table is queried. If P1=P2, it means that the updated P1 in the log is consistent with the actual updated P2, and the log is directly written to the NAND flash memory. If P1≠P2, it means that the updated P1 in the log is inconsistent with the actual updated P2, and the log is discarded and no longer processed, which can reduce the log processing volume.
[0136] (3) If the log type value of the generated log is the second value (ie, a log including updates of the FTL table and valid marks of the ILBT table), it is detected whether there is a running identifier of the ILBT scanning task.
[0137] If there is or it indicates that the ILBT scanning task has been completed, the first physical block address P1 updated in the log is obtained, and the second physical block address P2 updated in the FTL table is queried; if the first physical block address P1 is the same as the second physical block address P2, it means that the updated P1 in the log is consistent with the actual updated P2, and the log is written to the NAND flash memory; if the first physical block address P1 is different from the second physical block address P2, it means that the updated P1 in the log is inconsistent with the actual updated P2, and the log type value of the log is modified to the fourth value to obtain the marked valid log of the ILBT table, that is, only the mark of the ILBT table is retained valid without retaining the update of the FTL table, and then the marked valid log of the ILBT table is written to the NAND flash memory.
[0138] If it does not exist or indicates that the ILBT scan task has been paused, the first physical block address P1 updated in the log is obtained, and the second physical block address P2 updated in the FTL table is queried.
[0139] If the first physical block address P1 is the same as the second physical block address P2, it means that the updated P1 in the log is consistent with the actual updated P2, then the logical block address L1 corresponding to the first physical block address P1 in the ILBT table is queried, if the logical block address L1 is marked as invalid, since the ILBT table has completed the scan, it means that the logical block address L1 is not actually assigned a physical block address, that is, the valid mark of the ILBT table in the log is inconsistent with the actual situation, then the log type value of the log is modified to the first value, and the update log of the FTL table is obtained, that is, only the update of the FTL table is retained but the valid mark of the ILBT table is not retained; if the logical block address L1 is marked as valid, it means that the logical block address L1 is actually assigned a physical block address, that is, the valid mark of the ILBT table in the log is consistent with the actual situation, then the log is written to the NAND flash memory.
[0140] If the first physical block address P1 is different from the second physical block address P2, it means that the updated P1 in the log does not match the actual updated P2, then the logical block address L2 corresponding to the first physical block address P1 in the ILBT table is queried. If the logical block address L2 is marked as invalid, it means that the logical block address L2 is not actually assigned a physical block address, then the log is discarded (because the update of the FTL table and the valid mark of the ILBT table in the log are both inconsistent with the actual situation); if the logical block address L2 is marked as valid, it means that the logical block address L2 is actually assigned a physical block address, and the valid mark of the ILBT table in the log is consistent with the actual situation. Therefore, the log type value of the log is modified to the fourth value to obtain the valid mark log of the ILBT table, that is, only the valid mark of the ILBT table is retained without retaining the update of the FTL table and the valid mark log of the ILBT table is written to the NAND flash memory.
[0141] For example, based on Table 10, if the log type value of the generated log is 1 (i.e., a log including updates of the FTL table and valid marks of the ILBT table), then detect whether there is a running identifier for the ILBT scanning task; if it exists or indicates that the ILBT scanning task has been completed, obtain the first physical block address P1 updated in the log, and query the second physical block address P2 updated in the FTL table; if P1=P2, write the log to the NAND flash memory; if P1≠P2, modify the log type value of the log to 3, obtain the valid mark log of the ILBT table, and write the valid mark log of the ILBT table to the NAND flash memory.
[0142] If it does not exist or indicates that the ILBT scanning task has been paused, obtain the first physical block address P1 updated in the log and query the second physical block address P2 updated in the FTL table; if P1=P2, query the logical block address L1 corresponding to the first physical block address P1 in the ILBT table. If the logical block address L1 is marked as invalid, modify the log type value of the log to 0 and obtain the updated log of the FTL table; if the logical block address L1 is marked as valid, write the log to the NAND flash memory; if P1≠P2, query the logical block address L2 corresponding to the first physical block address P1 in the ILBT table. If the logical block address L2 is marked as invalid, discard the log; if the logical block address L2 is marked as valid, modify the log type value of the log to 3, obtain the marked valid log of the ILBT table, and write the marked valid log of the ILBT table to the NAND flash memory.
[0143] In some embodiments, if the SSD is powered on again after an abnormal power outage, the FTL table and / or ILBT table are restored based on the value of the log type in response to the power-on signal. Different methods are used to restore the FTL table and / or ILBT table for different values of the log type:
[0144] (1) If the value of the log type is the first value, the physical block address recorded in the log is written into the corresponding entry in the FTL table;
[0145] (2) If the value of the log type is the second value, the physical block address recorded in the log is written into the corresponding entry in the FTL table, and the corresponding entry in the ILBT table is marked as valid;
[0146] (3) If the value of the log type is the third value, the entry in the ILBT table corresponding to the logical block address recorded in the log is marked as invalid;
[0147] (4) If the value of the log type is the fourth value, the entry in the ILBT table corresponding to the logical block address recorded in the log is marked as valid;
[0148] (5) If the value of the log type is the fifth value, the entry in the FTL table corresponding to the logical block address recorded in the log is marked as de-allocated.
[0149] For example, based on the preset log format shown in Table 10, the ILBT table shown in Table 7, and the FTL table shown in Table 3:
[0150] (1) If the value of the log type is 0, that is, the log is an update log of the FTL table, then the physical block address recorded in the log is written into the corresponding table entry in the FTL table;
[0151] (2) If the value of the log type is 1, that is, the log includes the update of the FTL table and the mark of the ILBT table is valid, then the physical block address recorded in the log is written into the corresponding table entry in the FTL table, and the corresponding table entry in the ILBT table is marked as valid, for example, marked as 0;
[0152] (3) If the value of the log type is 2, that is, the log is an invalid log of the ILBT table, then the entry in the ILBT table corresponding to the logical block address recorded in the log is marked as invalid, for example, marked as 1;
[0153] (4) If the value of the log type is 3, that is, the log is a valid log of the ILBT table, then the entry in the ILBT table corresponding to the logical block address recorded in the log is marked as valid, for example, marked as 0;
[0154] (5) If the value of the log type is 4, that is, the log is a deallocation log of the FTL table, then the entry in the FTL table corresponding to the logical block address recorded in the log is marked as deallocation, for example, marked as 0.
[0155] Based on the various embodiments disclosed above, FIG3 is a schematic diagram of a scenario including command processing and log processing provided by an embodiment of the present disclosure, which is applied to an SSD. In FIG3 , multiple tasks (Tasks) are concurrently executed in the SSD, including at least one of the following tasks: a task for processing a read command: Task (Read CMD), a task for processing a write command: Task (Write CMD), a task for processing a de-allocation command: Task (Trim CMD), an ILBT scanning task: Task (ILBT Scan), and a task for processing a log: Task (Log), and multiple of each task can exist at the same time. The SSD includes multiple processors (CPUs) for executing different tasks. For example, CPU1 executes a task for processing a read command, CPU2 executes a task for processing a write command, and CPU3 executes a task for processing a de-allocation command, an ILBT scanning task, and a task for processing a log. The pre-created FTL table and ILBT table are stored in the DRAM (dynamic random access memory) of the SSD, and the log is stored in the NAND flash memory of the SSD.
[0156] In FIG3 , the task of processing a read command, processing a write command, or processing a de-allocation command is started after receiving the corresponding command, and the ILBT scanning task can be started at a suitable time (eg, when the SSD is idle).
[0157] In Figure 3, after receiving a de-allocation command (e.g., Trim CMD), the logical block address indicated by the de-allocation command is obtained, and the entry corresponding to the logical block address is marked as invalid in the ILBT table, for example, marked as 1, generating a marked invalid log for the ILBT table, i.e., a log of log type 2, as shown in Table 10. This log is generated by the Generate Log command (i.e., CMD(Log) in Figure 3), and a log processing task (i.e., Task(Log) in Figure 3) is initiated to process the marked invalid log in the ILBT table. Task(Log) is executed by CPU3. Since the log type of the processed log is 2, the log is directly written to the NAND flash memory. As can be seen, the meaning of "generating a log" is not to write the log to the NAND flash memory, but rather to generate the log by the Generate Log command (i.e., CMD(Log)) and to initiate the log processing task (i.e., Task(Log)).
[0158] In Figure 3, after processing the de-allocation command (for example, Trim CMD), that is, after CPU3 executes the de-allocation command processing task (Task(Trim CMD)), if no IO command (that is, read command and write command) is received, the ILBT scanning task (Task(ILBT Scan)) is started, and CPU3 performs a background scan of the ILBT table. If a logic block marked as invalid (i.e., the entry in the ILBT table is "1") is scanned, an attempt is made to mark the corresponding entry of the invalid logic block in the FTL table as de-allocated (i.e., the corresponding entry in the FTL table is marked as "0"); if de-allocation is successfully marked in the FTL table, a log of log type 4 (i.e., the de-allocation log of the FTL table) is generated based on the preset log format shown in Table 10. The log is generated by a generate log command (i.e., CMD(Log) in Figure 3), and a log processing task (i.e., Task(Log) in Figure 3) is started to process the de-allocation log of the FTL table. Task(Log) is executed by CPU3. Since the log type of the processed log is 4, the log is directly written to the NAND flash memory.
[0159] In Figure 3, different methods are used to process read commands according to the different timings of receiving the read command:
[0160] (1) After scanning the ILBT table, that is, after CPU3 completes the background scan of the ILBT table, if a read command is received, the logical block address (LBA) indicated by the read command is obtained; the physical block address (PBA) mapped by the logical block address is directly obtained from the FTL table, and the task of processing the read command (Task (Read CMD)) is started. CPU1 executes the read command task: the data stored in the obtained physical block address (PBA) is used as the response to the read command.
[0161] (2) During the scanning of the ILBT table, that is, CPU3 is performing background scanning of the ILBT table, indicating that the ILBT table and the FTL table are not fully synchronized (for example, a logical block address in the ILBT table is marked as invalid, that is, the logical block address is not mapped to a physical block address, but the corresponding table entry of the logical block address in the FTL table entry records a physical block address, that is, the logical block address is mapped to a physical block address). If a read command is received, the logical block address (LBA) indicated by the read command is obtained; the mark of the logical block address (LBA) is obtained in the ILBT table, and based on the mark of the logical block address, the response to the read command is determined. For example, if the mark of the logical block address is invalid (for example, marked as 1), preset data (for example, all-zero data) is used as the response to the read command; if the mark of the logical block address is valid (for example, marked as 0), the physical block address (PBA) mapped by the logical block address is obtained in the FTL table, and the task of processing the read command (Task (Read CMD)), CPU1 executes the read command task: the data stored in the obtained physical block address (PBA) is used as a response to the read command.
[0162] In Figure 3, the process of processing a write command is as follows:
[0163] After receiving the write command, the logical block address indicated by the write command is obtained, and a physical block address is allocated for the write command; the allocated physical block address is updated to the target table entry in the FTL table, where the target table entry in the FTL table is the table entry corresponding to the logical block address indicated by the write command in the FTL table; after completing the FTL table update, the write command processing task (Task (Write CMD)) is started, and CPU2 executes the write command processing task: the data indicated by the write command is written to the allocated physical block address.
[0164] Different logs are generated for different times when a write command is received:
[0165] (1) After scanning the ILBT table, that is, after CPU3 completes the background scanning of the ILBT table, if a write command is received, then after completing the update of the FTL table, an update log of the FTL table is generated. The log is generated by the log generation command (CMD(Log)), and the log processing task (Task(Log)) is started, and Task(Log) is executed by CPU3; in addition, it is determined whether the table entry corresponding to the logical block address (LBA) indicated by the write command in the FTL table is a de-allocation mark (the de-allocation mark is, for example, 0). If it is not "0" (indicating that the logical block address (LBA) indicated by the write command is mapped to a physical block address, that is, data has been written to the LBA, and that the table entry corresponding to the LBA in the ILBT table is marked as valid), then the write command processing task (Task(Write)) is started. CMD)), CPU2 executes the write command processing task: writes the data indicated by the write command into the allocated physical block address, and realizes the overwrite write process of the logical block address (LBA) indicated by the write command; if it is "0" (indicating that the logical block address (LBA) indicated by the write command is marked as invalid in the ILBT table, for example, marked as 1), then the entry of the LBA in the ILBT table is marked as valid, for example, marked as 0, to indicate that the LBA is mapped with a PBA, and after completing the update of the FTL table, generates a log including the update of the FTL table and the valid mark of the ILBT table. The log is generated by the generate log command (CMD(Log)), and the log processing task (Task(Log)) is started. CPU3 executes Task(Log), and then starts the write command processing task (Task(Write CMD)). CPU2 executes the write command processing task: writes the data indicated by the write command into the allocated physical block address.
[0166] (2) During the scanning of the ILBT table, that is, when CPU3 is performing background scanning of the ILBT table, if a write command is received, it directly attempts to mark the target entry in the ILBT table as valid (for example, marked as 0), wherein the target entry in the ILBT table is the entry in the ILBT table corresponding to the logical block address indicated by the write command; for the logical block corresponding to the entry successfully marked as valid, a log including the update of the FTL table and the valid marking of the ILBT table is generated. The log is generated by the generate log command (CMD(Log)), and the log processing task (Task(Log)) is started, and Task(Log) is executed by CPU3. For the logical block corresponding to the entry that is not successfully marked as valid or does not need to be marked as valid, an update log of the FTL table is generated. The log is generated by the generate log command (CMD(Log)), and the log processing task (Task(Log)) is started, and Task(Log) is executed by CPU3.
[0167] Based on the above embodiments, the present disclosure provides a process for processing an ILBT scanning task, including the following steps (1) to (4):
[0168] (1) When starting to scan the ILBT table, set the running flag of the ILBT scan task (ILBT Scan running), which is visible to all tasks;
[0169] (2) Scan the ILBT table. If a logical block marked as invalid is found, for example, marked as 1, indicating that the logical block has no mapped physical block, then try to mark the table entry corresponding to the invalid logical block in the FTL table as de-allocated to indicate that the logical block has no allocated physical block; where "try" means that if the table entry corresponding to the invalid logical block in the FTL table has been marked as de-allocated, for example, marked as 0, there is no need to write 0 again, or the table entry corresponding to the invalid logical block in the FTL table is occupied by other tasks and cannot be written to 0.
[0170] (3) If the entry corresponding to the scanned logic block marked as invalid in the FTL table is successfully marked as de-allocated, a de-allocation log of the FTL table is generated, that is, a log of log type 4 (see Table 10) is generated.
[0171] Repeat steps (2) and (3) to cyclically scan the ILBT table.
[0172] (4) After completing the scanning of the ILBT table, the running flag of the ILBT scanning task is deleted or the stop flag of the ILBT scanning task is set.
[0173] It can be seen that in this embodiment, after step (2) is executed, there is no need to clear the logic blocks marked as invalid in the ILBT table (for example, the logic blocks marked as 1). In the related art, after attempting to mark the corresponding table entry of the invalid logic block in the FTL table as de-allocated (for example, marked as 0), it is also necessary to clear the table entry corresponding to the invalid logic block in the de-allocation table to 0 to indicate that the invalid logic block has been de-allocated. Therefore, this embodiment can reduce the clearing processing and improve the ILBT table scanning efficiency.
[0174] Based on the above embodiments, the present disclosure provides a processing flow of a read command:
[0175] After receiving the read command from the host, obtain the logical block address indicated by the read command and detect whether there is an ILBT scan task running flag (ILBT Scan running);
[0176] If there is no ILBT Scan running, go to steps A1 and A2; if there is an ILBT Scan running, go to step B;
[0177] (A1) directly obtain the physical block address mapped by the logical block address in the FTL table;
[0178] (A2) The data stored in the physical block address is sent to the host as a response to the read command.
[0179] (B) Obtain the tag of the logical block address indicated by the read command from the ILBT table and determine the response to the read command based on the tag of the logical block address. For example, if the tag of the logical block address is invalid, preset data (e.g., all zeros) is sent to the host as the response to the read command. If the tag of the logical block address is valid, obtain the physical block address mapped to the logical block address from the FTL table and send the data stored in the physical block address as the response to the read command to the host.
[0180] Based on the above embodiments, the present disclosure provides a process for processing a write command, including the following steps (1) and (2):
[0181] (1) After receiving the write command from the host, obtain the logical block address indicated by the write command and allocate a physical block address for the write command;
[0182] (2) Detect whether there is an ILBT Scan task running flag (ILBT Scan running); if there is no ILBT Scan running, execute steps A1 and A2; if there is ILBT Scan running, execute steps B1 to B3;
[0183] (A1) reading the physical block address corresponding to the logical block address indicated by the write command in the FTL table, and updating the physical block address corresponding to the logical block address indicated by the write command in the FTL table to the allocated physical block address;
[0184] (A2) If, upon receiving a write command, the entry corresponding to the logical block address indicated by the write command in the FTL table is not 0, this indicates that the logical block address indicated by the write command has been assigned a physical block address before the write. Therefore, the data indicated by the write command is written to the assigned physical block address, implementing the overwrite process of the logical block address (LBA) indicated by the write command; and an update log for the FTL table is generated, i.e., a log of log type 0 (see Table 10);
[0185] If, when a write command is received, the entry corresponding to the logical block address indicated by the write command in the FTL table is marked as de-allocated, for example, marked as 0, indicating that before writing, the entry corresponding to the logical block address indicated by the write command in the ILBT table is marked as invalid, for example, marked as 1, indicating that the corresponding logical block address has not been allocated a physical block address, then the entry corresponding to the logical block address indicated by the write command in the ILBT table is marked as valid, for example, marked as 0, and the data indicated by the write command is written to the allocated physical block address, thereby implementing the write process of the logical block address (LBA) indicated by the write command; and generating a log including the update of the FTL table and the valid mark of the ILBT table, that is, generating a log of log type 1 (refer to Table 10);
[0186] (B1) updating the physical block address corresponding to the logical block address indicated by the write command in the FTL table to the allocated physical block address;
[0187] (B2) writing the data indicated by the write command into the allocated physical block address, thereby implementing a write process of the logical block address (LBA) indicated by the write command;
[0188] (B3) Directly attempt to mark the target table entry in the ILBT table as valid, for example, mark it as 0, where the target table entry is the table entry in the ILBT table corresponding to the logical block address indicated by the write command; for the logical block corresponding to the table entry that is successfully marked valid, generate a log including the update of the FTL table and the valid marking of the ILBT table, that is, generate a log with a log type of 1 (refer to Table 10); for the logical block corresponding to the table entry that is not successfully marked valid or does not need to be marked valid, generate an update log of the FTL table, that is, generate a log with a log type of 0 (refer to Table 10).
[0189] Based on the above disclosed embodiments, the present disclosure provides a log processing process, including the following steps (A) to (C):
[0190] (A) If the log type is 0, that is, the log is an update log of the FTL table, then the first updated physical block address P1 in the log is obtained, and the second updated physical block address P2 in the FTL table is queried; if P1 = P2, then the log is written to the NAND flash memory, and the writing method continues to use the existing method. During the log processing process, multiple logs can be cached and written to the NAND flash memory at once; if P1 ≠ P2, then the log is discarded and no longer processed, which can reduce the log processing volume.
[0191] (B) If the log type is 1, that is, the log includes the update of the FTL table and the mark of the ILBT table is valid, check whether there is a running mark of the ILBT scan task;
[0192] If the ILBT scan task exists or indicates that it has been completed, obtain the first physical block address P1 updated in the log and query the second physical block address P2 updated in the FTL table; if P1 = P2, write the log to the NAND flash memory; if P1 ≠ P2, change the log type value of the log to 3, obtain the valid log of the ILBT table, and write the valid log of the ILBT table to the NAND flash memory;
[0193] If it does not exist or indicates that the ILBT scan task has been paused, obtain the first physical block address P1 updated in the log and query the second physical block address P2 updated in the FTL table;
[0194] If P1 = P2, query the logical block address L1 corresponding to P1 in the ILBT table. If L1 is marked as invalid, change the log type value of the log to 0, obtain the update log of the FTL table, and process the log according to step (A); if L1 is marked as valid, write the log to the NAND flash memory;
[0195] If P1≠P2, query the logical block address L2 corresponding to P1 in the ILBT table. If L2 is marked as invalid, discard the log and no longer process it, reducing the log processing volume. If the logical block address is marked as valid, change the log type value of the log to 3, obtain the marked valid log of the ILBT table, and write the marked valid log of the ILBT table into the NAND flash memory.
[0196] (C) If the log type is 2, 3, or 4, the log is written directly to the NAND flash memory.
[0197] Based on the embodiments disclosed above, FIG4 is a scenario diagram of a concurrent processing flow provided by an embodiment of the present disclosure. In FIG4 , at time 1 (Time 1), write command 1 (Write CMD 1) is obtained, and the logical block address indicated by Write CMD 1 is 100, recorded as LBA 100; at time 2 (Time 2), write command 2 (Write CMD 2) is obtained, and the logical block address indicated by Write CMD 2 is also 100, recorded as LBA 100, that is, Write CMD 1 and Write CMD 2 access the same logical block address at different times. Therefore, concurrent processing includes two aspects: one is the concurrency of processing the write command task (Task (Write CMD)) and processing the log task (Task (Log)), and the other is the concurrency of two Write CMDs.
[0198] In Figure 4, after receiving Write CMD 1 or Write CMD 2, the write command processing task is started: Task (Write CMD). Task (Write CMD) updates the FTL table entry corresponding to LBA 100 to PPA1 (Physical Page Address) at time Time 1A, recorded as: update LBA (100) = PPA1; Task (Write CMD) updates the FTL table entry corresponding to LBA 100 to PPA2 at time Time 2A, recorded as: update LBA (100) = PPA2. Accordingly, at time Time 1A, the physical block address corresponding to LBA 100 in the FTL table is updated to PPA1, recorded as Time 1A:<LBA 100,PPA1> At time 2A, the physical block address corresponding to LBA 100 is updated to PPA2, recorded as Time2A:<LBA 100,PPA2> .
[0199] In Figure 4, for Write CMD 1, at time Time 1B, log command 1 (CMD(Log1)) is generated to generate a log with log type 0, that is, the update log of the FTL table, recorded as: Time 1B: CMD(Log1)(type==0, LBA=100, PPA1); for Write CMD 2, at time Time 2B, log command 2 (CMD(Log2)) is generated to generate a log with log type 0, that is, the update log of the FTL table, recorded as: Time 2B: CMD(Log2)(type==0, LBA=100, PPA2).
[0200] Correspondingly, the log processing task (Task(Log)) processes CMD(Log1) at Time 1B. If Tim1B is after Time 2A, when Task(Log) processes the log generated by CMD(Log1), the physical address obtained from the log generated by CMD(Log1) is PPA1, and the physical address obtained by querying the table entry corresponding to LBA 100 in the FTL table is PPA2. Since the two are different, the log generated by CMD(Log1) does not match the actual address and becomes meaningless when the SSD is powered on and restored. Therefore, the log generated by CMD(Log1) is discarded and not written to the NAND flash memory, thereby reducing the amount of log writes.
[0201] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art will understand that the embodiments of the present disclosure are not limited by the order of the actions described, because according to the embodiments of the present disclosure, certain steps can be performed in other orders or simultaneously. In addition, those skilled in the art will understand that the embodiments described in the specification are all optional embodiments.
[0202] In an embodiment of the present application, a storage device (or solid-state storage device, etc.) is provided, including: a memory and a controller, the controller executes a command processing method or a log processing method in any of the above method embodiments, wherein the memory can be an NVM (Non-Volatile Memory) chip.
[0203] Figure 5 is an exemplary block diagram of an electronic device provided in accordance with an embodiment of the present disclosure. As shown in Figure 5 , the electronic device includes a memory 51, a processor 52, and a computer program stored in the memory 51. It will be appreciated that the memory 51 in this embodiment may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
[0204] In some embodiments, the memory 51 stores the following elements, executable modules or data structures, or a subset or an extended set thereof: an operating system and application programs.
[0205] The operating system includes various system programs, such as the framework layer, core library layer, and driver layer, which are used to implement various basic tasks and process hardware-based tasks. The application program includes various application programs, such as a media player and a browser, which are used to implement various application tasks. The program that implements the command processing method or log processing method provided in the embodiments of the present disclosure can be included in the application program.
[0206] In an embodiment of the present disclosure, at least one processor 52 calls a program or instruction stored in at least one memory 51, specifically, a program or instruction stored in an application, and at least one processor 52 is used to execute the steps of each embodiment of the command processing method or log processing method provided in an embodiment of the present disclosure.
[0207] The command processing method or log processing method provided in the embodiment of the present disclosure can be applied to the processor 52, or implemented by the processor 52. The processor 52 can be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 52 or the instructions in the form of software. The above-mentioned processor 52 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0208] The steps of the command processing method or log processing method provided in the embodiments of the present disclosure can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other storage media that are well-known in the art. The storage medium is located in memory 51, and processor 52 reads the information in memory 51 and combines it with hardware to complete the steps of the method.
[0209] The present disclosure also provides a computer-readable storage medium that stores a program or instruction that causes a computer to execute the steps of the command processing method or log processing method. To avoid repeated description, the computer-readable storage medium may be a non-transitory computer-readable storage medium.
[0210] The present disclosure also provides a computer program product, comprising a computer program stored in a computer-readable storage medium, which may be a non-transitory computer-readable storage medium. At least one processor of a computer reads and executes the computer program from the computer-readable storage medium, causing the computer to perform the steps of the command processing method or log processing method embodiments. To avoid repetition, these steps are not described here.
[0211] The above-described device or apparatus embodiments are merely illustrative. The unit modules described as separate components may or may not be physically separate, and the components shown as module units may or may not be physical units, that is, they may be located in one place or distributed across multiple network module units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment.
[0212] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the relevant technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or certain parts of the embodiment.
[0213] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Based on the idea of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the present application as above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application. Industrial Applicability
[0214] In the disclosed embodiment, an ILBT table is constructed to mark the validity of each logical block recorded in the FTL table. For a logical block that has previously been allocated a physical block, the logical block is marked as invalid, indicating that a de-allocation command has been executed on the logical block. Therefore, upon receiving a de-allocation command, the entry corresponding to the logical block address indicated by the de-allocation command in the ILBT table is marked as invalid, thereby updating the ILBT table. After the ILBT table is updated, the completion of the de-allocation command can be indicated to the host, thereby improving the execution speed of the de-allocation command. In addition, after processing the de-allocation command, the ILBT table is scanned at a time when no read or write command is received to avoid affecting the processing of the read or write command. The entry corresponding to the logical block marked as invalid in the FTL table is marked as de-allocated, thereby updating the FTL table and facilitating subsequent processing of read and write commands. This embodiment has industrial practicality.
Claims
1. A command processing method, wherein: Pre-building an FTL table and an ILBT table, wherein the FTL table is used to record the address mapping relationship between the logical block and the physical block; The ILBT table is used to mark whether each logic block recorded in the FTL table is valid. The method includes: After receiving the de-allocation command, obtaining the logical block address indicated by the de-allocation command, and marking the table entry corresponding to the logical block address as invalid in the ILBT table; After processing the de-allocation command, if no read command and / or write command is received, the ILBT table is scanned, and if a logic block marked as invalid is scanned, the corresponding table entry of the invalid logic block in the FTL table is marked as de-allocated.
2. The method according to claim 1, wherein: The method further comprises: After scanning the ILBT table, if a read command is received, the logical block address indicated by the read command is obtained; the physical block address mapped by the logical block address is directly obtained in the FTL table, and the data stored in the physical block address is used as a response to the read command; or, During the scanning of the ILBT table, if a read command is received, the logical block address indicated by the read command is obtained; the mark of the logical block address is obtained in the ILBT table, and the response to the read command is determined based on the mark of the logical block address.
3. The method according to claim 1, wherein: The method further comprises: When starting to scan the ILBT table, setting the running flag of the ILBT scanning task; After completing scanning the ILBT table, deleting the running flag or setting a stop flag for the ILBT scanning task; After receiving the read command, it also includes: Obtaining the logical block address indicated by the read command, and detecting whether the operation identifier exists; If the operation identifier does not exist, directly obtain the physical block address mapped by the logical block address in the FTL table, and use the data stored in the physical block address as a response to the read command; or, If the operation flag exists, the tag of the logical block address is obtained in the ILBT table, and the response of the read command is determined based on the tag of the logical block address.
4. The method according to claim 2 or 3, wherein: The step of determining a response to the read command based on the tag of the logical block address comprises: If the mark of the logic block address is invalid, using preset data as a response to the read command; If the mark of the logical block address is valid, the physical block address mapped by the logical block address is obtained in the FTL table, and the data stored in the physical block address is used as a response to the read command.
5. The method according to claim 1, wherein: The method further comprises: After receiving the write command, obtaining the logical block address indicated by the write command and allocating a physical block address to the write command; Update the allocated physical block address into a target entry in the FTL table, where the target entry in the FTL table is a table entry in the FTL table corresponding to the logical block address indicated by the write command; The data indicated by the write command is written into the allocated physical block address.
6. The method according to claim 5, wherein: The method further comprises: After scanning the ILBT table, if a write command is received and the logical block address indicated by the write command corresponds to a de-allocation mark in the FTL table, the target entry in the ILBT table is marked as valid, and the target entry in the ILBT table is the table entry corresponding to the logical block address indicated by the write command in the ILBT table; or, During the scanning of the ILBT table, if a write command is received, an attempt is directly made to mark a target entry in the ILBT table as valid, where the target entry in the ILBT table is an entry in the ILBT table corresponding to the logical block address indicated by the write command.
7. A log processing method, the method comprising: In response to the de-allocation command, after marking the table entry corresponding to the logical block address indicated by the de-allocation command as invalid in the ILBT table, generating a mark invalidation log of the ILBT table based on a preset log format; In response to scanning the ILBT table, after successfully marking the table entry corresponding to the scanned logic block marked as invalid in the FTL table as de-allocated, a de-allocation log of the FTL table is generated based on the preset log format.
8. The method according to claim 7, wherein: The method further comprises: If a write command is received after scanning the ILBT table, and the table entry corresponding to the logical block address indicated by the write command in the FTL table is a de-allocation mark, then after completing the update of the FTL table, a log is generated based on the preset log format, and the log includes the update of the FTL table and the mark of the ILBT table is valid, wherein the update of the FTL table is to update the physical block address allocated for the write command to the target table entry in the FTL table, and the target table entry in the FTL table is the table entry corresponding to the logical block address indicated by the write command in the FTL table; or, If a write command is received after scanning the ILBT table, and the logical block address indicated by the write command corresponds to an entry in the FTL table that is an arbitrary physical block address, then after completing the update of the FTL table, an update log of the FTL table is generated based on a preset log format.
9. The method according to claim 7, wherein: The method further comprises: If a write command is received during the scanning of the ILBT table, directly try to mark the target entry in the ILBT table as valid, where the target entry in the ILBT table is the entry in the ILBT table corresponding to the logical block address indicated by the write command; For a logic block corresponding to a table entry successfully marked as valid, generating a log based on the preset log format, the log including an update of the FTL table and a valid mark of the ILBT table; For the logic blocks corresponding to the entries that are not successfully marked as valid or do not need to be marked as valid, an update log of the FTL table is generated based on the preset log format.
10. The method according to any one of claims 7 to 9, wherein: The preset log format includes a log item, and the log item includes a log type; the method further includes: Generate corresponding logs according to the log type; The value of the log type is the first value, and the corresponding generated log is the update log of the FTL table; The value of the log type is a second value, and the corresponding generated log includes the update of the FTL table and the mark of the ILBT table as valid; The value of the log type is a third value, and the corresponding generated log is an invalid log marked in the ILBT table; The value of the log type is a fourth value, and the corresponding generated log is a marked valid log of the ILBT table; The value of the log type is the fifth value, and the corresponding generated log is the de-allocation log of the FTL table.
11. The method according to claim 10, wherein: The method further comprises: If the value of the log type of the generated log is the third value, the fourth value or the fifth value, writing the log into the NAND flash memory; or, If the value of the log type of the generated log is the first value, the first physical block address updated in the log is obtained, and the second physical block address updated in the FTL table is queried; if the first physical block address is the same as the second physical block address, the first physical block address is updated. The log is written into the NAND flash memory; if the first physical block address is different from the second physical block address, the log is discarded.
12. The method according to claim 10, wherein: The method further comprises: If the value of the log type of the generated log is the second value, detecting whether there is a running identifier of the ILBT table scan task; If there is or it indicates that the ILBT table scanning task has been completed, the first physical block address updated in the log is obtained, and the second physical block address updated in the FTL table is queried; if the first physical block address is the same as the second physical block address, the log is written into the NAND flash memory; if the first physical block address is different from the second physical block address, the value of the log type of the log is modified to the fourth value, the marked valid log of the ILBT table is obtained, and the marked valid log of the ILBT table is written into the NAND flash memory; If it does not exist or indicates that the ILBT table scanning task has been suspended, then obtaining the first physical block address updated in the log, and querying the second physical block address updated in the FTL table; If the first physical block address is the same as the second physical block address, query the logical block address corresponding to the first physical block address in the ILBT table; if the logical block address is marked as invalid, modify the value of the log type of the log to the first value to obtain the update log of the FTL table; if the logical block address is marked as valid, write the log into the NAND flash memory; If the first physical block address is different from the second physical block address, the logical block address corresponding to the first physical block address in the ILBT table is queried, and if the logical block address is marked as invalid, the log is discarded; if the logical block address is marked as valid, the value of the log type of the log is modified to the fourth value, the marked valid log of the ILBT table is obtained, and the marked valid log of the ILBT table is written into the NAND flash memory.
13. The method according to claim 10, wherein: The method further comprises: In response to a power-on signal, the FTL table and / or the ILBT table is restored based on the value of the log type.
14. The method according to claim 13, wherein: The restoring the FTL table and / or the ILBT table based on the value of the log type includes: If the value of the log type is the first value, writing the physical block address recorded in the log into the corresponding entry in the FTL table; and / or, if the value of the log type is a second value, writing the physical block address recorded in the log into a corresponding entry in the FTL table, and marking the corresponding entry in the ILBT table as valid; and / or, if the value of the log type is a third value, marking the entry in the ILBT table corresponding to the logical block address recorded in the log as invalid; and / or, if the value of the log type is a fourth value, marking the entry in the ILBT table corresponding to the logical block address recorded in the log as valid; And / or, if the value of the log type is a fifth value, marking the entry in the FTL table corresponding to the logical block address recorded in the log as de-allocated.
15. A storage device, wherein: include: A control component and an NVM chip, wherein the control component executes the steps of the command processing method according to any one of claims 1 to 6 or the steps of the log processing method according to any one of claims 7 to 14.
Citation Information
Patent Citations
De-allocation command processing method and storage equipment thereof
CN112148645A
Storage device and operation method of storage system
CN112306900A
Electronic system and operating method thereof
CN114579475A
Storage device management method and device and storage system
CN114691014A
Command processing method, log processing method and storage device
CN117093505A