SSD to store log frames and log entries
By splitting the FTL table into FTL blocks and log frames to form a linked list, and adjusting the storage ratio and update sequence when abnormal events occur, the problem of long startup of solid-state storage devices is solved and the recovery speed and efficiency are improved.
Patent Information
- Application Number
- CN202110926537.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2016-06-29
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2036-06-29
AI Technical Summary
Existing solid-state storage devices need to access all physical pages to rebuild the FTL table during startup, which causes the startup process to take a long time and affects device performance.
Split the FTL table into multiple FTL blocks. Each FTL block corresponds to an FTL frame and a log frame to form a linked list. When an abnormal event occurs, the storage ratio of log frames is adjusted and the FTL blocks are updated in reverse order to improve recovery speed.
It reduces the amount of data written, improves the recovery speed of FTL tables, and shortens the recovery time of solid-state drives when abnormal events occur.
Smart Images

Figure CN113590504B
Abstract
Description
Technical Field
[0001] The present application relates to solid state drives, and in particular to the generation and use of solid state drive logs. Background Art
[0002] With the advancement of technology, higher and higher requirements are placed on the storage capacity and response speed of electronic devices. Figure 1 A block diagram of a solid state storage device (SSD) in the prior art is shown. The storage device 102 is coupled to the host through an interface 103. The host may be an information processing device that can communicate with the storage device 102 in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103, a control component 104, one or more NVM (non-volatile memory) storage chips 105, and a firmware memory 110. The interface 103 may be adapted to exchange data with the host through, for example, SATA, IDE, USB, PCIE, NVMe, SCSI, Ethernet, Fiber Channel, etc. The control component 104 is used to control data transmission between the interface 103, the NVM storage chip 105, and the firmware memory 110, and is also used for storage management, host logical address to flash physical address mapping, erase leveling, bad block management, etc. The control component 104 loads firmware from the firmware memory 110 at runtime.
[0003] In the prior art solid-state storage device, for example Figure 1 In the storage device 102 shown, FTL (Flash Translation Layer) is used to maintain the mapping information from the logical address to the physical address. The logical address constitutes the storage space of the solid-state storage device perceived by the upper-layer software such as the operating system. The physical address is the address used to access the physical storage unit of the solid-state storage device. In the prior art, the address mapping can also be implemented using the intermediate address form. For example, the logical address is mapped to the intermediate address, and then the intermediate address is further mapped to the physical address.
[0004] The table structure that stores the mapping information from logical addresses to physical addresses is called the FTL table. The FTL table is an important metadata in solid-state storage devices. Usually, the data items of the FTL table record the address mapping relationship in units of data pages in the solid-state storage device. The FTL table of the solid-state storage device has a large size, such as several GB. When the solid-state storage device is turned off, the FTL table needs to be completely saved, and when the solid-state storage device is started, the FTL needs to be fully loaded.
[0005] In the prior art, the logical address corresponding to each physical page of the solid-state storage device is additionally stored. When the solid-state storage device is started, all physical pages need to be accessed to obtain the logical address corresponding to each physical page and rebuild the FTL table. However, such an operation will take a lot of time and cause the solid-state storage device startup process to take a long time.
[0006] In the Chinese patent application (201510430174.6), a log-based FTL table storage and loading method is provided. In this log-based FTL table storage and loading method, the FTL frame adopts a round-robin writing method, and the FTL frame and the log frame are written into the log at a fixed ratio. When an abnormal event occurs, the FTL frame is still written. Summary of the invention
[0007] In view of this, the present application provides a log recording method, a loading method and a device thereof.
[0008] According to a first aspect of the present invention, a first log generation method based on an FTL table according to the first aspect of the present invention is provided, comprising: recording a logical address and a physical address corresponding to an operation request as a log entry; generating a log frame using the log entry; generating an FTL frame using part of an FTL block, wherein the FTL table comprises a plurality of FTL blocks; and storing the generated FTL frame and the first log frame on an NVM.
[0009] According to the first FTL table-based log generation method of the first aspect of the present invention, a second FTL table-based log generation method according to the first aspect of the present invention is provided, wherein the size of the combination of the FTL frame and the log frame corresponds to the size of the NVM physical page.
[0010] According to the first or second FTL table-based log generation method of the first aspect of the present invention, a third FTL table-based log generation method according to the first aspect of the present invention is provided, wherein the portion of the FTL block comes from a portion of the FTL block that has not yet been written to a non-volatile storage medium.
[0011] According to the first, second or third FTL table-based log generation method of the first aspect of the present invention, a fourth FTL table-based log generation method according to the first aspect of the present invention is provided, wherein one or more FTL frames are combined with one or more log frames and written to (one) physical page of the NVM.
[0012] According to one of the first to fourth log generation methods based on the FTL table of the first aspect of the present invention, a fifth log generation method based on the FTL table according to the first aspect of the present invention is provided, which also includes, in response to the occurrence of an abnormal event, writing multiple log frames to the physical page of the NVM, so that the physical page does not include the FTL frame.
[0013] According to one of the first to fourth FTL table-based log generation methods of the first aspect of the present invention, a sixth FTL table-based log generation method according to the first aspect of the present invention is provided, further comprising, in response to the occurrence of an abnormal event, changing the ratio of FTL frames and log frames stored on the NVM according to priority.
[0014] According to one of the first to fourth FTL table-based log generation methods of the first aspect of the present invention, a seventh FTL table-based log generation method according to the first aspect of the present invention is provided, wherein, in response to the occurrence of an abnormal event, it also includes: storing the address of the last FTL frame of each FTL block in the NVM and the address of the last log frame in the NVM in the startup page of the NVM.
[0015] According to one of the first to fourth FTL table-based log generation methods of the first aspect of the present invention, an eighth FTL table-based log generation method according to the first aspect of the present invention is provided, wherein, in response to the occurrence of an abnormal event, it also includes: storing the physical page address of the last FTL frame group in the NVM and the physical page address of the last log frame group in the NVM of each FTL block in the startup page of the NVM, wherein the FTL frame group is a plurality of FTL frames stored on the same NVM physical page, and the log frame group is a plurality of log frames stored on the same NVM physical page.
[0016] According to one of the first to eighth log generation methods based on the FTL table according to the first aspect of the present invention, a ninth log generation method based on the FTL table according to the first aspect of the present invention is provided, wherein the FTL table is divided into multiple FTL blocks according to the memory address of the FTL table.
[0017] According to one of the first to ninth log generation methods based on the FTL table according to the first aspect of the present invention, there is provided a tenth log generation method based on the FTL table according to the first aspect of the present invention, wherein the multiple FTL blocks come from different parts of the FTL table.
[0018] According to the first to eleventh FTL table-based log generation methods of the first aspect of the present invention, an eleventh FTL table-based log generation method according to the first aspect of the present invention is provided, wherein the FTL frames are written into the NVM in the order of addresses of the FTL blocks.
[0019] According to the first to eleventh log generation method based on the FTL table of the first aspect of the present invention, a twelfth log generation method based on the FTL table according to the first aspect of the present invention is provided, wherein the FTL frame includes metadata recording the storage location on the NVM of a previous FTL frame belonging to the same FTL block as the FTL frame.
[0020] According to one of the first to twelfth log generation methods based on the FTL table of the first aspect of the present invention, a thirteenth log generation method based on the FTL table according to the first aspect of the present invention is provided, which also includes generating a second FTL frame using part of the second FTL block; storing the generated second FTL frame and second log frame on the NVM; wherein the second FTL frame includes a second pointer, which records the storage location of a previous FTL frame belonging to the second FTL block on the NVM.
[0021] According to one of the first to thirteenth log generation methods based on the FTL table of the first aspect of the present invention, a fourteenth log generation method based on the FTL table according to the first aspect of the present invention is provided, wherein the second log frame includes a pointer that records the storage location of the first log frame in the NVM, and the logical addresses of the first log frame and the second log frame belong to the same FTL block.
[0022] According to one of the first to fourteenth log generation methods based on the FTL table of the first aspect of the present invention, a fifteenth log generation method based on the FTL table according to the first aspect of the present invention is provided, wherein the log frame includes metadata recording the storage location of a previous log frame belonging to the same FTL block as the log frame.
[0023] According to one of the first to fourteenth log generation methods based on the FTL table of the first aspect of the present invention, a sixteenth log generation method based on the FTL table according to the first aspect of the present invention is provided, wherein the first log frame includes a pointer, the pointer records the address of the third log frame stored on the NVM, and the logical addresses of the first log frame and the third log frame belong to the same FTL block.
[0024] According to one of the first to sixteenth log generation methods based on the FTL table of the first aspect of the present invention, a seventeenth log generation method based on the FTL table according to the first aspect of the present invention is provided, wherein generating a log frame using log entries includes: judging the number of log entries, and generating a log frame if the number of log entries reaches a standard for generating a log frame.
[0025] According to the seventeenth log generation method based on the FTL table according to the first aspect of the present invention, there is provided an eighteenth log generation method based on the FTL table according to the first aspect of the present invention, wherein padding data is generated while generating log entries, and when judging the number of log entries, after adding the padding data, it is judged whether the standard for generating log frames is met.
[0026] According to the seventeenth or eighteenth FTL table-based log generation method of the first aspect of the present invention, a nineteenth FTL table-based log generation method according to the first aspect of the present invention is provided, wherein the size of the log frame corresponds to the size of the physical page of the NVM.
[0027] According to one of the seventeenth to nineteenth log generation methods based on the FTL table according to the first aspect of the present invention, there is provided a twentieth log generation method based on the FTL table according to the first aspect of the present invention, wherein the size of the physical page of the NVM is an integer multiple of the size of the log frame.
[0028] According to the seventeenth to twentieth log generation method based on the FTL table according to the first aspect of the present invention, there is provided a twenty-first log generation method based on the FTL table according to the first aspect of the present invention, wherein the log frame also includes metadata; the metadata indicates the FTL block to which the log frame belongs.
[0029] According to the twenty-first FTL table-based log generation method of the first aspect of the present invention, a twenty-second FTL table-based log generation method according to the first aspect of the present invention is provided, wherein the metadata also records a previous log frame belonging to the same FTL block.
[0030] According to the first to twenty-second log generation method based on the FTL table of the first aspect of the present invention, a twenty-third log generation method based on the FTL table of the first aspect of the present invention is provided, wherein each log frame includes logical addresses and physical addresses corresponding to multiple write requests issued to the solid state drive after the previous log frame is generated or the updates to the FTL table.
[0031] According to a second aspect of the present invention, a first method for reconstructing an FTL table using a log according to the second aspect of the present invention is provided, comprising: obtaining storage locations of FTL frames and log frames of an FTL block; reading multiple FTL frames and multiple log frames belonging to the FTL block; reconstructing the FTL block using the multiple FTL frames; and updating the FTL block using the log frame; wherein the FTL block is part of the FTL table.
[0032] According to the first method of rebuilding an FTL table using logs according to the second aspect of the present invention, a second method of rebuilding an FTL table using logs according to the second aspect of the present invention is provided, wherein the FTL block to be rebuilt is determined to be rebuilt starting from the first FTL block.
[0033] According to the first or second method of reconstructing an FTL table using a log according to the second aspect of the present invention, a third method of reconstructing an FTL table using a log according to the second aspect of the present invention is provided, wherein obtaining the storage location of the FTL frame and the log frame of the FTL block includes: obtaining the storage location of the last FTL frame of the first FTL block and the storage location of the last log frame of the first FTL block from a non-volatile storage medium.
[0034] According to one of the first to third methods of reconstructing an FTL table using logs according to the second aspect of the present invention, there is provided a fourth method of reconstructing an FTL table using logs according to the second aspect of the present invention, wherein updating the FTL block using log frames comprises updating the FTL block in the order in which log entries in the log frames are generated or updating the FTL block in the reverse order of the order in which log entries in the log frames are generated.
[0035] According to the fourth method of reconstructing an FTL table using a log according to the second aspect of the present invention, there is provided a fifth method of reconstructing an FTL table using a log according to the second aspect of the present invention, wherein the FTL block is updated in the reverse order of the order in which the log entries in the log frame are generated, comprising: obtaining a first log frame belonging to a first FTL block; updating multiple log entries in the first log frame to the FTL block in a back-to-front order; setting a mark for the updated FTL entry; if a mark exists on the FTL entry to be updated by the log entry, ignoring the log entry; after all log frames belonging to the first FTL block are updated to the first FTL block, or after all FTL entries of the first FTL block have a mark, clearing the mark of the FTL entry of the current FTL block.
[0036] According to the fifth method of reconstructing an FTL table using a log according to the second aspect of the present invention, there is provided a sixth method of reconstructing an FTL table using a log according to the second aspect of the present invention, further comprising: obtaining an address of a second log frame from the first log frame and obtaining the second log frame, and updating the first FTL block in the reverse order of the order in which log entries in the second log frame are generated, wherein the first log frame and the second log frame belong to the same FTL block.
[0037] According to the sixth method of reconstructing an FTL table using logs according to the second aspect of the present invention, there is provided a seventh method of reconstructing an FTL table using logs according to the second aspect of the present invention, wherein the first log frame is the last log frame of the first FTL block; and the second log frame is the immediately preceding log frame of the first log frame in the order of generation.
[0038] According to the fourth method of reconstructing an FTL table using logs according to the second aspect of the present invention, there is provided an eighth method of reconstructing an FTL table using logs according to the second aspect of the present invention, wherein the FTL block is updated in the order in which log entries in the log frame are generated, comprising: obtaining a first log frame belonging to a first FTL block; updating multiple log entries in the first log frame to the FTL block in order from front to back; repeating the above steps to update all log frames belonging to the first FTL block to the first FTL block.
[0039] According to the eighth method of reconstructing an FTL table using a log according to the second aspect of the present invention, there is provided a ninth method of reconstructing an FTL table using a log according to the second aspect of the present invention, further comprising: obtaining an address of a second log frame from the first log frame and obtaining the second log frame, and updating the first FTL block in the order in which log entries in the second log frame are generated, wherein the first log frame and the second log frame belong to the same FTL block.
[0040] According to the ninth method of the second aspect of the present invention, there is provided a tenth method of the second aspect of the present invention, wherein the first log frame is the earliest log frame of the first FTL block; and the second log frame is the log frame immediately following the first log frame in the order of generation.
[0041] According to the first to tenth methods of reconstructing an FTL table using a log according to the second aspect of the present invention, there is provided an eleventh method of reconstructing an FTL table using a log according to the second aspect of the present invention, wherein the FTL frame includes metadata recording the storage location of a previous FTL frame belonging to the same FTL block as the FTL frame.
[0042] According to the first to eleventh methods of reconstructing an FTL table using a log according to the second aspect of the present invention, a twelfth method of reconstructing an FTL table using a log according to the second aspect of the present invention is provided, wherein the log frame includes metadata recording the storage location of a previous log frame belonging to the same FTL block as the log frame.
[0043] According to a third aspect of the present invention, a first solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention is provided, comprising: a non-volatile storage medium comprising multiple physical pages; wherein each physical page comprises one or more FTL frames and / or one or more log frames; wherein each FTL frame comprises multiple FTL table entries and metadata recording the storage location of a previous FTL frame belonging to the same FTL block as the FTL frame, each log frame comprises multiple operation log entries and metadata recording the storage location of a previous log frame belonging to the same FTL block as the log frame, each operation log entry comprises a logical address and a corresponding physical address, and the FTL block is part of the FTL table.
[0044] According to the first solid-state hard disk for storing log frames and log entries of the third aspect of the present invention, there is provided a second solid-state hard disk for storing log frames and log entries of the third aspect of the present invention, and further includes: storing the address of the last FTL frame of each FTL block in the NVM and the address of the last log frame in the NVM in the startup page of the NVM.
[0045] According to the first solid state drive for storing log frames and log entries of the third aspect of the present invention, a third solid state drive for storing log frames and log entries of the third aspect of the present invention is provided, which also includes: storing the physical page address of the last FTL frame group in the NVM and the physical page address of the last log frame group in the NVM of each FTL block in the boot page of the NVM, wherein the FTL frame group is a plurality of FTL frames stored on the same NVM physical page, and the log frame group is a plurality of log frames stored on the same NVM physical page.
[0046] According to the first solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, there is provided a fourth solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, wherein the log frame includes metadata indicating the FTL block to which the log frame belongs.
[0047] According to the first solid state drive for storing log frames and log entries according to the third aspect of the present invention, there is provided a fifth solid state drive for storing log frames and log entries according to the third aspect of the present invention, wherein multiple FTL frames belonging to the same FTL block occupy continuous physical address space in the solid state drive.
[0048] According to the fifth solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, there is provided a sixth solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, wherein the multiple FTL frames occupy a continuous physical address space in the solid-state hard disk excluding bad block space.
[0049] According to the first solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, there is provided a seventh solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, wherein the non-volatile storage medium is an MLC (Multi Level Cell) or TLC (Triple Level Cell) non-volatile storage medium.
[0050] According to the first solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, there is provided an eighth solid-state hard disk for storing log frames and log entries according to the third aspect of the present invention, wherein the multiple physical pages are accessed using pSLC (pseudo-SLC) mode or SLC (Single Level Cell) mode.
[0051] According to a fourth aspect of the present invention, a first solid-state hard disk according to the fourth aspect of the present invention is provided, characterized in that it includes a controller, an NVM, and a random access memory; the controller is coupled to the NVM and the random access memory respectively; the NVM includes a log area and a user data area; the solid-state hard disk log is stored in the log area; the user data is stored in the user data area; wherein an FTL table is stored in the memory, and the FTL table includes multiple FTL blocks; wherein the controller is used to execute the log generation method based on the FTL table according to one of the first to twenty-third of the first aspect of the present invention.
[0052] According to the first solid-state hard disk according to the fourth aspect of the present invention, a second solid-state hard disk according to the fourth aspect of the present invention is provided, wherein an FTL table is stored in DRAM, and log frames stored in the log area record updates of the FTL table; the log frames also store the address of a previous log frame belonging to the same FTL block as the log frame.
[0053] According to the first solid state drive of the fourth aspect of the present invention, a third solid state drive according to the fourth aspect of the present invention is provided, wherein the addresses of the FTL frames and log frames of each FTL block in the log area are stored in the startup page of the NVM.
[0054] According to the first solid-state hard disk according to the fourth aspect of the present invention, a fourth solid-state hard disk according to the fourth aspect of the present invention is provided, wherein FTL frames belonging to the same FTL block are organized into a linked list, and log frames belonging to the same FTL block are also organized into a linked list; the FTL frame linked list and the log frame linked list of each FTL block are stored in the startup page at the starting address and the ending address of the log area.
[0055] According to the first solid-state hard disk according to the fourth aspect of the present invention, a fifth solid-state hard disk according to the fourth aspect of the present invention is provided, wherein the storage positions of the head node and tail node of the FTL frame linked list of each FTL block in the log area, and the storage positions of the head node and tail node of the log frame linked list in the log area are stored in the startup page.
[0056] According to the first solid-state drive of the fourth aspect of the present invention, a sixth solid-state drive according to the fourth aspect of the present invention is provided, which also includes a NOR flash memory, and multiple startup pages are stored in the NAND flash memory for providing a backup of the startup page or different versions of the startup page; the storage location of the valid startup page is stored in the NOR flash memory.
[0057] According to a fifth aspect of the present invention, a first solid-state hard disk according to the fifth aspect of the present invention is provided, comprising a controller, an NVM, and a random access memory; the controller is coupled to the NVM and the random access memory respectively; the NVM comprises a log area and a user data area; the solid-state hard disk log is stored in the log area; the user data is stored in the user data area; wherein an FTL table is stored in the memory, the FTL table comprising a plurality of FTL blocks; when the solid-state hard disk is started, the controller executes the first to twelfth methods of using the log to reconstruct the FTL table according to the second aspect of the present invention.
[0058] According to a sixth aspect of the present invention, a first log generation device based on an FTL table according to the sixth aspect of the present invention is provided, comprising: a log entry generation module, used to record a logical address and a physical address corresponding to an operation request as a log entry; a log frame generation module, used to generate a log frame through the log entry generated by the log entry generation module; an FTL frame generation module, used to generate an FTL frame using part of an FTL block, wherein the FTL table comprises a plurality of FTL blocks; and a storage module, used to store the generated FTL frame and the first log frame on an NVM.
[0059] According to a seventh aspect of the present invention, there is provided a first device for reconstructing an FTL table using a log according to the seventh aspect of the present invention, comprising: a storage position acquisition module, used to acquire the storage positions of FTL frames and log frames of an FTL block; a frame reading module, used to read a plurality of FTL frames and a plurality of log frames belonging to the FTL block; an FTL block reconstruction module, used to reconstruct an FTL block using the plurality of FTL frames, wherein the FTL block is part of the FTL table; and an FTL block update module, used to update the FTL block using the log frame, wherein the FTL block is part of the FTL table.
[0060] According to an eighth aspect of the present invention, there is provided a program comprising program code, which, when loaded into a storage device and executed on the storage device, causes the storage device to execute the FTL table-based log generation method according to the first aspect of the present invention.
[0061] According to a ninth aspect of the present invention, there is provided a program comprising program code, which, when loaded into a storage device and executed on the storage device, causes the storage device to execute the method of reconstructing an FTL table using a log according to the second aspect of the present invention.
[0062] In an embodiment of the present invention, the FTL table is split into multiple FTL blocks, each FTL block corresponds to a corresponding FTL frame and log frame, and the FTL frames and log frames belonging to the same FTL block respectively form a linked list, so that when the FTL table is rebuilt, the amount of data written can be reduced and the recovery speed can be improved. When an abnormal event occurs, the storage ratio of the log frame in the log is changed to minimize data loss. During reconstruction and recovery, the data of the FTL table can be quickly restored through the setting of the linked list. At the same time, during reconstruction and recovery, the FTL table is updated in reverse order, which can make the solid-state hard disk recover faster when an abnormal event occurs. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0064] Figure 1 It is a structural schematic diagram of a solid-state storage device in the prior art;
[0065] Figure 2 is a structural block diagram of a solid state drive log according to an embodiment of the present invention;
[0066] Figure 3 is a structural block diagram of an FTL table according to an embodiment of the present invention;
[0067] Figure 4 is a structural block diagram of a "write" log according to an embodiment of the present invention
[0068] Figure 5 is a flow chart of a method for generating a solid state drive log according to an embodiment of the present invention;
[0069] Figure 6 is a structural block diagram of a solid state drive log according to another embodiment of the present invention;
[0070] Figure 7 is a flow chart of a method for generating a solid state drive log according to another embodiment of the present invention;
[0071] Figure 8 is a flowchart of a method for rebuilding an FTL table using a log according to an embodiment of the present invention;
[0072] Fig. 9 is a block diagram of a solid state drive according to an embodiment of the present invention; and
[0073] Fig.104 is a schematic diagram of generating a solid state drive log in response to a power failure event according to an embodiment of the present invention. DETAILED DESCRIPTION
[0074] The present application proposes a log recording method, a loading method and a device thereof, which splits the FTL table into multiple FTL blocks, each FTL block corresponds to a corresponding FTL frame and a log frame, and the FTL frames and log frames belonging to the same FTL block respectively form a linked list, so that when rebuilding the FTL table, the amount of data written can be reduced and the recovery speed can be improved. When an abnormal event occurs, the log usage efficiency can be improved as much as possible by changing the storage ratio of the log frame in the log, and when rebuilding the FTL table, the data of the FTL table can be quickly restored through the setting of the linked list. At the same time, when rebuilding the FTL table, the FTL table is updated in reverse order, which can make the recovery speed of the FTL table faster when an abnormal event occurs.
[0075] Of course, implementing any technical solution of the present application does not necessarily require achieving all of the above advantages at the same time.
[0076] In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 ordinary technicians in the field should fall within the scope of protection of this application.
[0077] The specific implementation methods of the present application are further described below in conjunction with the accompanying drawings of the present application.
[0078] Figure 2 2 is a block diagram of a solid state drive log according to an embodiment of the present invention. In order to quickly rebuild the FTL table when the solid state drive is started and reduce unnecessary FTL block write operations, a solid state drive log 210 is provided according to an embodiment of the present invention. The solid state drive log 210 is stored in a non-volatile storage medium. Figure 2 The solid state disk log 210 includes FTL frame 1-1 (220), FTL frame 1-2 (221) ... FTL frame 2-3 (225), and the solid state disk log 210 also includes log frame 230 ... log frame 235. The FTL frame is a component of the FTL block. Figure 2 In the example of , FTL block 1 includes 3 FTL frames, which are composed of FTL frame 1-1, FTL frame 1-2 and FTL frame 1-1. Log frame 0-1 (230) is used for FTL block 0 ( Figure 2(not shown in the figure), log frame 1-1 (231) is the first log frame for FTL block 1, log frame 1-3 (232) is the second log frame for FTL block 1, log frame 1-3 (235) is the third log frame for FTL block 1, log frame 2-1 (233) is the first log frame for FTL block 2, and log frame 4-1 (234) is the first log frame for FTL block 4. Information is recorded in the metadata of the log frame to indicate the FTL block to which the log frame belongs. And optionally, the metadata of the log frame (for example, log frame 1-3 (232)) also records the previous log frame in the log frames belonging to the same FTL block (for example, log frame 1-3 (232) and log frame 1-1 (231) both belong to FTL block 1, and the previous log frame of log frame 1-3 (232) is log frame 1-1 (231)). Figure 2 In an embodiment, the FTL block occupies a continuous physical address space in the solid state drive (optionally, skipping bad blocks). Optionally, a log storage area is provided in the solid state drive with a non-volatile storage medium, and the FTL block is stored in a continuous address space of the log storage area. The FTL frame and the log frame occupy a physical page of the non-volatile storage medium, so that the combination of the FTL frame and the log frame can be written to the non-volatile storage medium in one write operation.
[0079] In one embodiment of the present invention, the non-volatile storage medium is an MLC (Multi Level Cell) or TLC (Triple Level Cell) non-volatile storage medium. When the solid-state drive log is stored in the data page of the non-volatile storage medium, the non-volatile storage medium is accessed using the pSLC (pseudo-SLC) mode or the SLC (Single Level Cell) mode to speed up the solid-state drive log storage process and obtain higher data reliability. As another implementation, the solid-state drive log is stored in the SLC non-volatile storage medium. In still another embodiment, the solid-state drive log is stored in the LSB page of the MLC non-volatile storage medium.
[0080] The number of log frames corresponding to each FTL block can be different. Figure 2 , there is no update to FTL block 3 for a period of time, so there is no log frame corresponding to FTL block 3 in the solid state drive log 210. However, there are multiple updates to FTL block 1, so three log frames (231, 232, 235) are used to record all update operations on FTL block 1.
[0081] exist Figure 2In the embodiment of the present invention, the SSD log 210 stores FTL blocks in the order of their memory addresses in the FTL table (for example, FTL block 2 is stored after FTL block 1), and log frames are recorded in the order in which log frames are generated. Each log frame belongs to and only belongs to one FTL block. In one example, the "write" log entries belonging to each FTL block are cached in the memory. When the "write" log entries belonging to a certain FTL block fill a log frame, the log frame is written to the SSD log.
[0082] In this way, the FTL table only needs to save a complete record in the SSD log, and record each update of the FTL table entry in the SSD log. When the FTL table entry is not updated, there is no need to record the FTL table in the SSD log, thereby saving system resources. When the FTL table entry is updated, only the modification of the FTL table entry is recorded in the log frame, reducing the amount of data written to the SSD log.
[0083] The FTL table can be rebuilt using the solid state drive log 210. Due to power failure of the storage device and other reasons, the FTL table in the memory disappears, and it is necessary to read the solid state drive log 210 and rebuild the FTL table. To rebuild the FTL table, the storage address (physical address) of each FTL block in the solid state drive and the physical address of the last log frame belonging to each FTL block are also stored in the non-volatile storage medium of the solid state drive (optionally, the physical address of the earliest log frame belonging to each FTL block is also stored).
[0084] When rebuilding the FTL table, as an example, the physical address of the FTL frame of FTL block 1 stored in the non-volatile storage medium in the solid state disk log 210 is obtained, and the FTL block 1 (including FTL frame 1-1, FTL frame 1-2 and FTL frame 1-3) in the solid state disk log 210 is read. Next, the last log frame belonging to FTL block 1 is obtained (see Figure 2, log frame 1-3 (235)), and in the reverse order of the log entries arranged by address in log frame 1-3 (235), the corresponding FTL entry in FTL block 1 in the memory is updated with the log entry recorded in log frame 1-3 (235). As an example, the meaning of updating the corresponding entry of the FTL block with the log entry includes accessing the FTL block with the logical address of the log entry as the index, and replacing the physical address of the indexed FTL entry in the FTL block with the physical address of the log entry. Since FTL block 1 is updated in the reverse order of log frame 1-3 (235), and the log entry at the later position in log frame 1-3 (235) includes the later update of the FTL entry, each FTL entry only needs to be updated once in the process of rebuilding the FTL table. For this purpose, further, the updated FTL entry is also marked so that the updated FTL entry is no longer updated in the process of rebuilding the FTL table. After updating FTL block 1 with log frame 1-3 (235), the previous log frame belonging to FTL block 1 as log frame 1-3 (235) is obtained (see Figure 2 , log frame 1-2 (232)); until all log frames of FTL block 1 (FTL frame 1-1 (231), FTL frame 1-2 (232) and FTL frame 1-3 (235)) are updated to FTL block 1, or all entries of FTL block 1 are updated. For example, the address of the previous FTL frame 1-2 (232) belonging to FTL block 1 is recorded in log frame 1-3 (235).
[0085] As another example of the present invention, to rebuild the FTL table, the physical address of the FTL frame of FTL block 1 stored in the non-volatile storage medium in the solid state disk log 210 is obtained, and the FTL block 1 (including FTL frame 1-1, FTL frame 1-2 and FTL frame 1-3) in the solid state disk log 210 is read. Next, the first log frame belonging to FTL block 1 is obtained (see Figure 2 , log frame 1-1(231)), and in the order of log entries arranged by address in log frame 1-1(231), the corresponding FTL entry in FTL block 1 in memory is updated with the log entry recorded in log frame 1-1(231). As another example, updating the corresponding entry of the FTL block with a log entry means accessing the FTL block with the logical address of the log entry as an index, and replacing the physical address of the indexed FTL entry in the FTL block with the physical address of the log entry. Since FTL block 1 is updated in the order of log frames 1-1(231), the FTL block needs to be updated with each log entry during the process of rebuilding the FTL table. After updating FTL block 1 with log frame 1-1(231), the next log frame (see Figure 2, log frame 1-2 (232)); until all log frames of FTL block 1 (FTL frame 1-1 (231), FTL frame 1-2 (232) and FTL frame 1-3 (235)) are updated to FTL block 1. For example, the address of the next FTL frame 1-2 (232) belonging to FTL block 1 is recorded in log frame 1-1 (231).
[0086] Figure 3 is a structural block diagram of an FTL table according to an embodiment of the present invention. The FTL table includes multiple FTL table entries (or table items). In one embodiment, each FTL table entry records the correspondence between a logical page address and a physical page. In another embodiment, each FTL table entry records the correspondence between a logical block address and a physical block address. In still another embodiment, the FTL table records the mapping relationship between the logical block address and the physical block address, and / or the mapping relationship between the logical page address and the physical page address. In still another embodiment, the FTL table is organized into a tree structure.
[0087] In still another embodiment, the FTL table is stored in a continuous memory address space, each FTL table entry records a physical address, and the memory address of each FTL table entry itself represents a logical address corresponding to the physical address. The number of FTL table entries corresponds to the size of the solid-state storage device logical address space.
[0088] For the purpose of storing the FTL table in a non-volatile storage medium, the FTL table is organized into data frames. Figure 3 , the FTL table (310) includes FTL frame 1, FTL frame 2, FTL frame 3 ... FTL frame 600. Each FTL frame includes multiple FTL table entries. The size of each FTL frame corresponds to the minimum write unit of the non-volatile storage medium (for example, a page). The data page size of the non-volatile storage medium is usually 2KB, 4KB, 8KB or 16KB. In one embodiment, the data page size of the non-volatile storage medium is 16KB, and the FTL frame size is 2KB, 4KB or 8KB. In another embodiment, the data page size of the non-volatile storage medium is 4KB, and the FTL frame size is 512B, 1KB or 2KB. Generally, the FTL frame size is selected so that the data page size of the non-volatile storage medium is an integer multiple of the FTL frame size, so as to store multiple FTL frames in the data page of the non-volatile storage medium. In one example, the FTL frame 1, FTL frame 2, FTL frame 3 ... FTL frame 600 contained in the FTL table are stored continuously in the memory according to the memory address.
[0089] In an embodiment according to the present invention, the FTL table (310) is further organized into an FTL block. The FTL block includes a plurality of FTL frames, preferably, a plurality of FTL frames with consecutive memory addresses. Figure 3 In the example, FTL block 1 (320) includes 100 FTL frames (FTL frame 1 to FTL frame 100), FTL block 2 (321) includes FTL frame 101 to FTL frame 200, and FTL block 6 (325) includes FTL frame 501 to FTL frame 600. As an example, the FTL frame size is 4KB, including 1K (1024) FTL entries, and each FTL entry corresponds to a 4KB logical / physical address space, so each FTL frame corresponds to a 4MB logical / physical address space, and each FTL block includes 100 FTL frames, corresponding to a 400MB logical / physical address space.
[0090] When the solid-state storage device processes a write request, a physical address is allocated to the write request, and the correspondence between the logical address and the physical address of the write request is recorded in the FTL table. In another embodiment, the host accessing the solid-state storage device maintains the FTL table, and when a write request needs to be issued to the solid-state storage, the physical address of the solid-state storage device is allocated to the write request, and the correspondence between the logical address and the physical address of the write request is recorded in the FTL table.
[0091] Figure 4 1 is a structural block diagram of a "write" log according to an embodiment of the present invention. When a solid-state storage device processes a write request, a "write" log is also generated. The "write" log records the logical address and physical address corresponding to the write operation. For each FTL table entry update request, a corresponding "write" log entry is generated.
[0092] For the purpose of storing the "write" log in the non-volatile storage medium, the "write" log is organized into log frames 410 (see Figure 4 ). Each log frame 410 includes a plurality of "write" log entries (422, 424, 42n) (or "table entries"). Each "write" log entry (422, 424 or 42n) includes a logical address and a corresponding physical address. The "write" log entries are generated and organized in the log frame in the order in which the receiving FTL table is updated. Therefore, in the "write" log, there may be "write" log entries with the same logical address and / or physical address.
[0093] The size of each log frame 410 corresponds to the minimum write unit of the non-volatile storage medium (e.g., page). The data page size of the non-volatile storage medium is generally 2KB, 4KB, 8KB, or 16KB. In one embodiment, the data page size of the non-volatile storage medium is 16KB, and the log frame size is 2KB, 4KB, 8KB, or 16KB. In another embodiment, the data page size of the non-volatile storage medium is 4KB, and the log frame size is 512B, 1KB, 2KB, or 4KB. Generally, the log frame size is selected so that the data page size of the non-volatile storage medium is an integer multiple of the log frame size, so as to store one or more log frames in the data page of the non-volatile storage medium. In yet another embodiment, one or more FTL frames and one or more "write" log data frames constitute a data page of the non-volatile storage medium.
[0094] The log frame 410 according to the embodiment of the present invention also includes metadata 440, which indicates that the log frame 410 belongs to FTL block 1. The log frame 410 belongs to FTL block 1, which means that the entries in the log frame 410 record the updates to the entries of FTL block 1. In other words, the logical addresses of the entries in the log frame 410 are all within the logical address range of FTL block 1.
[0095] In one example, a queue is provided to accommodate "write" log entries. When a "write" log is generated, the log entry is inserted into the queue (end of the queue). Optionally, multiple entries are combined and inserted into the queue in one memory access operation, and the size of the multiple entries combined can be equal to the bus width or the memory interface width. In taking out the log entries from the head of the queue, a specified number of log entries are taken out according to the log frame size. The queue is first-in-first-out, so that the order in which the log entries are generated can be easily identified in the solid-state drive log. The depth of the queue is appropriately selected so that in the event of a power outage, the log entries in the queue can be written to the solid-state drive log within the limited time of the backup power supply.
[0096] In another example, a log frame buffer is provided to accommodate "write" log entries. The log frame buffer has a size corresponding to one or more log frames. The size of the buffer is appropriately selected so that when a power outage occurs, the log entries in the log frame buffer can be written to the solid-state drive log within a limited time when the backup power supply is powered. When the log frame buffer accumulates data of the log frame size, its content is written to the solid-state drive log.
[0097] In a further example, when adding a "write" log entry to a queue or log frame buffer, it is also checked whether an entry with the same logical address already exists in the queue or buffer. If an entry with the same logical address has already been recorded in the queue or buffer, the existing entry in the queue or buffer is updated with the log entry to be written, thereby reducing the amount of data to be written to the SSD log.
[0098] like Figure 5 As shown, it is a flow chart of a solid state drive log generation method based on an FTL table according to an embodiment of the present invention. When updating the FTL table, the correspondence between the logical address and the physical address of the updated FTL table entry is recorded (510). Optionally, the FTL table is updated accordingly. The correspondence between the logical address and the physical address recorded in the cache, each correspondence between the logical address and the physical address, constitutes a "write" log entry. A certain number of "write" log entries constitute a log frame. The "write" log entries in the same log frame record the update of the FTL entry of the same FTL block. When the correspondence between the cached multiple logical addresses and the physical addresses can constitute a log frame, the correspondence between the cached multiple logical addresses and the physical addresses is used to generate a log frame (520). A portion of one of the multiple FTL blocks of the FTL table in the memory is also selected to generate an FTL frame (530). For example, the selected portion of the FTL block is a portion of FTL block 1 that has not yet been written to the non-volatile storage medium. In a preferred embodiment, the size of the combination of the FTL frame 1-1 (220) and the log frame (230) corresponds to the data page size of the non-volatile storage medium of the solid state drive, so that the combination of the FTL frame 1-1 (220) and the log frame (230) can be written to the non-volatile storage medium (540) of the solid state drive through a single non-volatile storage medium write operation.
[0099] According to another embodiment of the present invention, each time a predetermined number of write requests are received, a log frame is generated, wherein a mapping relationship between logical addresses and physical addresses corresponding to the predetermined number of write requests can be accommodated in one log frame. And each time a log frame is generated, a portion of the FTL table is selected to generate the FTL frame. According to still another embodiment of the present invention, the log frame is periodically generated using the cached "write" log entries. And each time a log frame is generated, a portion of the FTL table is selected to generate the FTL frame. According to still another embodiment of the present invention, the size of the log frame corresponds to the data page size of the non-volatile storage medium, and the size of the FTL frame also corresponds to the data page size of the non-volatile storage medium.
[0100] According to still another embodiment of the present invention, when generating an FTL frame of an FTL table, a portion of an FTL block is selected according to the memory address of the FTL block itself to generate the FTL frame.
[0101] For example, a portion of an FTL block of length L starting from address 0 in FTL block 1 is selected to form FTL frame 1-1. A portion of an FTL block of length L starting from address L in FTL block 1 is selected to form FTL frame 1-2. A portion of an FTL block of length L starting from address (N-1)*L in FTL block 1 is selected to form FTL frame 1-N. Each FTL block and FTL frame of the FTL table is sequentially written to the non-volatile storage medium, so that the complete FTL table can be recorded in the solid state drive log.
[0102] In this way, one physical page is stored in the SSD each time. Even if the SSD loses power, the storage of the FTL table can be completed within the limited working time of the backup power supply.
[0103] Those skilled in the art will appreciate that in some cases, the SSD log does not include a complete FTL table. For example, for a new or blank SSD, as the SSD is used, a power outage occurs after selecting portions of the FTL table three times to generate FTL frames. At this time, only FTL block 1 in the FTL table is valid, and only FTL block 1 is recorded in the SSD log. By marking used data blocks and / or unused data blocks in the SSD log, valid data frames in the SSD log are identified, thereby reconstructing the FTL table when the SSD is powered off.
[0104] Figure 6 610 is a structural block diagram of a solid state disk log according to another embodiment of the present invention. The solid state disk log 610 is stored in a non-volatile storage medium. Figure 6 , the solid state drive log 410 includes multiple physical pages (physical pages 620, 621, 622...628, 629). Physical page 620 includes FTL frame 1-1, FTL frame 1-2, FTL frame 1-3 and log frame 0-1. The FTL frame and the log frame have the same size. FTL frame 1-1, FTL frame 1-2...FTL frame 1-100 accommodates all FTL entries of FTL block 1, and log frame 1-1, log frame 1-2 and log frame 1-3 are log frames belonging to FTL block 1. The solid state drive log 610 also includes other types of frames (other frame 1, other frame 2 and other frame 3).
[0105] Each FTL frame also includes metadata, which records the FTL block to which the FTL frame belongs and the storage location (physical address) of the previous FTL frame belonging to the same FTL block. Thus, multiple FTL frames belonging to the same FTL block are organized into a linked list. Each log frame also includes metadata, which records the FTL block to which the log frame belongs and the storage location (physical address) of the previous log frame belonging to the same FTL block. Thus, multiple log frames belonging to the same FTL block are organized into a linked list.
[0106] exist Figure 6 In the example, FTL frame 1-1 is the first FTL frame of FTL block 1, FTL frame 1-2 is the second FTL frame of FTL block 1, and so on, FTL frame 1-100 is the last FTL frame of FTL block 1. Multiple FTL frames belonging to the same FTL block can be stored discontinuously in the SSD log 610. When other types of frames with high priority appear, they can be stored in the SSD log in a timely manner. Log frame 0-1 is for FTL block 0 ( Figure 6 1-1 is the first log frame for FTL block 1, log frame 1-2 is the second log frame for FTL block 1, and log frame 1-3 is the third log frame for FTL block 1. The entries in the log frames are arranged in the order in which they are generated.
[0107] Figure 7 FIG. 1 is a flow chart of a method for generating a solid state drive log according to another embodiment of the present invention. Figure 7 , generating Figure 6 SSD log 610 is shown.
[0108] When updating the FTL table, the correspondence between the logical address and the physical address of the updated FTL table entry is recorded (710). Optionally, the FTL table is updated accordingly. The correspondence between the logical address and the physical address recorded in the cache, each correspondence between the logical address and the physical address, constitutes a "write" log entry. A certain number of "write" log entries constitute a log frame. The "write" log entries in the same log frame record the update of the FTL entries of the same FTL block. When the correspondence between multiple cached logical addresses and physical addresses can constitute a log frame, the multiple cached "write" log entries are used to generate a log frame, and the FTL block to which it belongs is marked in the log frame (720) (see Figure 6 and Figure 7 , for example, log frame 0-1). Optionally, the storage location of the previous log frame belonging to the same FTL block as the log frame is also marked in the log frame. Figure 6 , log frames 0-1 are FTL block 0 ( Figure 6 The first log frame (not shown) is marked in log frame 0-1 that its previous log frame does not exist.
[0109] One of the FTL blocks (e.g., FTL block 1) of the FTL table in the memory is also selected to generate an FTL frame (730). The generated one or more FTL frames are written to a non-volatile storage medium together with the log frame (740). Figure 6 In the example of , a combination of 3 FTL frames and 1 log frame occupies one physical page of the non-volatile storage medium. Steps 710-740 are repeatedly executed to write the log frame and the FTL frame into the SSD log at any time.
[0110] In one example, one of the FTL blocks (e.g., FTL block 1) is selected to generate an FTL frame, and before FTL block 1 is completely written to the SSD log 610, other FTL blocks are avoided from being written to the SSD log as much as possible, so that the FTL blocks are distributed as concentratedly as possible in the SSD log. However, since the FTL frame includes metadata indicating the previous FTL frame, the FTL frames belonging to the same FTL block do not have to be stored continuously in the SSD log. Other types of frames (e.g., Figure 6 other frames 1) or other FTL frames of other FTL blocks (e.g., Figure 6 FTL frame 2-1) is stored between multiple FTL frames of FTL block 1.
[0111] When the storage device is powered on, the FTL frame and the log frame can be read from the solid state drive log 610 to rebuild the FTL table. In one example, by reading the complete solid state drive log 610, each FTL block recorded in the solid state drive log 610 and the log frame corresponding thereto are found, and the state of the FTL table before the storage device is powered off is determined. In another example, in order to speed up the FTL table reconstruction process, the storage position of the first FTL frame and / or the last FTL frame of multiple FTL frames of each FTL block is also recorded in the non-volatile storage medium, and the storage position of the first log frame and / or the last log frame of multiple log frames of each FTL block is recorded. Thus, when the storage device is powered on, the storage position of the FTL frame and the log frame of each FTL block can be quickly located, and each FTL block can be restored without reading the complete solid state drive log 610.
[0112] In one embodiment, in response to a power failure of the storage device, even if the number of cached log entries is insufficient to form a log frame, the cached log entries are filled to form a log frame and written to the solid state drive log. The storage location of the first FTL frame and / or the last FTL frame of the multiple FTL frames of each FTL block is recorded in the non-volatile storage medium, and the storage location of the first log frame and / or the last log frame of the multiple log frames of each FTL block is recorded. Return to see Figure 6, in the SSD log, 100 FTL frames of FTL block 1 are completely recorded; therefore, in response to power failure of the storage device, the storage location of FTL frame 1-1 and / or FTL frame 1-100 and the storage location of log frame 1-1 and / or log frame 1-3 are recorded in the non-volatile storage medium, so as to restore FTL block 1 from the SSD log. As an example, when power is lost, 100 FTL frames of FTL block 2 have not been completely recorded, but the update of FTL block 2 is completely recorded in the log frame. In this case, FTL frame 2-1, FTL frame 2-2, FTL frame 2-3, FTL frame 2-7, FTL frame 2-8, FTL frame 2-9 recorded in the SSD log 610 are not used to reconstruct FTL block 2, but only log frame 2-1 belonging to FTL block 2 is used to reconstruct FTL block 2, and other entries of FTL2 not recorded in log frame 2-1 can be marked as unallocated during reconstruction. In another example, multiple complete FTL blocks 2 (each FTL block 2 includes 100 FTL frames) and incompletely recorded FTL blocks 2 are recorded in the solid-state drive log 610. In response to power failure of the storage device, the storage location of the first FTL frame and / or the last FTL frame of the latest complete FTL block 2 is recorded in the non-volatile storage medium and used for FTL reconstruction.
[0113] Figure 8 is a flow chart of a device startup method according to an embodiment of the present invention. Figure 8 The method of the embodiment can be implemented by a solid state drive, or by a host accessing the solid state drive. When a device such as a solid state drive is started, the FTL table needs to be rebuilt.
[0114] In an embodiment according to the present invention, the FTL table is divided into a plurality of FTL blocks, and each FTL block is independently reconstructed from the solid state drive log. The FTL block to be reconstructed is determined (800). For example, reconstruction is started from the first FTL block. Alternatively, the storage area that will be accessed first after the storage system is started (for example, the storage area where the host stores the operating system) is estimated, and the FTL blocks corresponding to this part of the storage area are loaded preferentially. Alternatively, the logical address or the corresponding FTL block that was first accessed after the last or previous solid state drive was started is stored in the solid state drive (for example, in the solid state drive log), and used as a basis for selecting the FTL block to be reconstructed preferentially. When the solid state drive is powered on, the stored logical address (one or more) or FTL block is obtained. When the logical address that was first accessed after the previous startup is stored on the solid state drive, the FTL block is selected so that the logical address range of the selected FTL block includes the logical address that was first accessed.
[0115] In another example, the FTL block corresponding to the IO request received by the storage device (the FTL block containing the logical address requested by the received IO request) is identified, and this part of the FTL block is loaded preferentially.
[0116] Still in another example, after the device is started, the FTL table is rebuilt in the order of the FTL block addresses. When rebuilding to FTL block 3, an IO request for accessing the logical address corresponding to FTL block 5 is received from the host, the reconstruction operation of FTL block 3 is suspended, and the reconstruction of FTL block 5 is started. After the reconstruction of FTL block 5 is completed, the IO request is responded to, and then the previously interrupted FTL table sequential reconstruction operation is continued.
[0117] Still in another example, after the device is started, the FTL table is rebuilt in a predictive manner. When it is predicted that the next FTL block to be accessed is FTL block 2, FTL block 2 is rebuilt. At this time, if an IO request for accessing the logical address corresponding to FTL block 5 is received from the host, the reconstruction operation of FTL block 2 is suspended, and the reconstruction of FTL block 5 is started. After the reconstruction of FTL block 5 is completed, the IO request is responded to, and then the FTL block to be rebuilt is re-predicted and the reconstruction operation is performed.
[0118] To reconstruct the FTL block, the storage location of the FTL frame and / or log frame (if any) of the specified FTL block (e.g., FTL block 1) in the solid state disk log is obtained from a predetermined location in the non-volatile storage medium (810). According to one embodiment of the present invention, the storage location of the last FTL frame of FTL block 1 and the storage location of the last log frame of FTL block 1 are recorded in the non-volatile storage medium.
[0119] The FTL frame is read from the storage position of the last FTL frame of FTL block 1, and the storage position of the previous FTL frame is obtained from the read FTL frame, and the previous FTL frame is read, in this way, all FTL frames belonging to FTL block 1 are read from the solid state drive log (820). And if there is a log frame belonging to the FTL block, the log frame is also read from the storage position of the last log frame of FTL block 1, and the storage position of the previous log frame is obtained from the read log frame, in this way, all log frames belonging to FTL block 1 are read from the solid state drive log.
[0120] Each FTL frame read is written into the memory according to its position in FTL block 1 as part of FTL block 1. All FTL frames belonging to FTL block 1 are placed into the memory to form the basic content of FTL block 1 (830). Next, if there is a log frame belonging to FTL block 1, the log frame is also used to update FTL block 1 in the memory to complete the reconstruction of FTL block 1 (840). Updating FTL block 1 with log frames needs to follow the specified order. For example, FTL block 1 is updated in the reverse order of the order in which the log entries in the log frame are generated. First, the last log frame belonging to FTL block 1 is obtained from the solid-state drive log, and multiple log entries in the last log frame are updated to FTL block 1 in a backward order. The meaning of updating the FTL block with log entries is to use the logical address in the log entry as an index to replace the physical address of the indexed entry in FTL block 1. Next, the second to last log frame belonging to FTL block 1 is obtained, and the log entry therein is used to update FTL block 1.
[0121] Since there may be multiple entries with the same logical address in the log entry, and the last entry among these entries records the latest content of the corresponding FTL entry, it is necessary to avoid replacing the new content with the old content of the FTL entry when updating FTL block 1. For this purpose, in the process of rebuilding FTL block 1, a mark is set for each updated FTL entry. In the subsequent reconstruction process, if there is a mark on the FTL entry to be updated by the log entry, the log entry is ignored (that is, the log entry is not used to update the FTL block). After all log frames of FTL block 1 are processed, all set marks of FTL block 1 are cleared.
[0122] As another embodiment of the present invention, the FTL block 1 is updated according to the order in which the log entries in the log frame are generated. First, the first log frame belonging to the FTL block 1 is obtained from the solid state drive log, and multiple log entries in the first log frame are updated to the FTL block 1 in a forward-to-backward order. Updating the FTL block with the log entry means that the physical address of the indexed entry in the FTL block 1 is replaced by the logical address in the log entry as an index. Next, the second log frame belonging to the FTL block 1 is obtained, and the FTL block 1 is updated with the log entry therein.
[0123] After the reconstruction of FTL block 1 is completed, although the complete FTL table has not yet been reconstructed, the IO request corresponding to the logical address range of FTL block 1 can be responded to.
[0124] Next, it is determined whether there are other FTL blocks to be rebuilt (850). If all FTL blocks of the FTL table have been rebuilt, the system startup can be completed (860). If there are still unrebuilt FTL blocks, continue with step 800 and determine the FTL blocks to be rebuilt.
[0125] Fig. 9 is a block diagram of a solid state drive according to an embodiment of the present invention. The storage device includes a controller, a NAND flash memory, a DRAM, and a NOR flash memory. The controller is coupled to the NAND flash memory, the NOR flash memory, and the DRAM, respectively. The NAND flash memory includes a boot page, a log area, and a user data area. The solid state drive log according to an embodiment of the present invention is stored in the log area, and the user data stored by the solid state drive as a storage device is stored in the user data area. The solid state drive log stores FTL frames and log frames from multiple FTL blocks.
[0126] The FTL table is stored in DRAM. Fig. 9 In the example, the portion of the FTL table indicated by the shadow is the portion of the FTL table that has been updated (e.g., corresponding to FTL block 1). Log frames 1-1 and 1-2 stored in the log area record the update of FTL block 1 of the FTL table. And log frame 1-1 also stores the address of the FTL frame 1 to which it corresponds, while log frame 1-2 stores the address of the previous log frame (log frame 1-2) that belongs to the same FTL frame 1. By replaying the updates recorded in log frames 1-1 and 1-2 on the portion of the FTL table corresponding to FTL block 1 (or, updating the FTL table with log frames 1-1 and 1-2), the portion of the FTL table indicated by the shadow can be obtained.
[0127] exist Fig. 9 In the example, the address of the FTL frame and log frame of each FTL block in the log area is stored in the startup page of the NAND flash memory. Optionally, the FTL frames belonging to the same FTL block are organized into a linked list, and the log frames belonging to the same FTL block are also organized into a linked list, and the first address and the last address of the FTL frame linked list and the log frame linked list of each FTL block in the log area are stored in the startup page. Alternatively, the storage location of the head node and the tail node of the FTL frame linked list of each FTL block in the log area, and the storage location of the head node and the tail node of the log frame linked list in the log area are stored in the startup page.
[0128] In a further embodiment, a plurality of boot pages are stored in the NAND flash memory for providing a backup of the boot page or different versions of the boot page. The storage location of the valid boot page (physical address in the NAND flash memory) is also stored in the NOR flash memory. When the solid state drive is powered on, the controller obtains the address of the valid boot page from the NOR flash memory, and obtains the valid boot page from the NAND flash memory based on the address, and then rebuilds the FTL table in the DRAM based on the FTL frame address and / or log frame address indicated by the boot page.
[0129] Fig.10 A schematic diagram of generating a solid state drive log in response to a power failure event according to an embodiment of the present invention is shown. Fig.10In the embodiment of the invention, the solid state drive log 1010 includes physical page 1020, physical page 1021, physical page 1022, ... physical page 1028 and physical page 1029. When a power outage occurs, physical page 1022 has been written to the non-volatile storage medium. After a power outage, the backup power supply has a limited time. In order to store the latest state of the FTL table in the non-volatile storage medium within a limited time, the priority or ratio of the FTL frame and the log frame written to the physical page is changed to increase the proportion of the log frame. Fig.10 In the example of FIG. 1 , after a power failure occurs, physical pages 1028 and 1029 are completely filled with log frames, and no FTL frames are written, so that as many log frames as possible are written to the non-volatile storage medium.
[0130] During the power supply of the backup power supply, even if the log frame is completely written without writing the FTL frame, the log frame that can be written to the non-volatile storage medium is also limited. In one embodiment of the present invention, to ensure that the update of the FTL table can be saved to the non-volatile storage medium, the number of log entries in the cache is determined according to the number of log frames that can be written to the non-volatile storage medium during the power supply of the backup power supply. For example, if the backup power supply can support writing N log frames to the non-volatile storage medium, the total amount of log entries in the cache does not exceed the number of log entries accommodated by the N log frames. Further, since the log frame corresponds to the FTL block, the number of log frames does not exceed N. If the log entries have been filled in the N log frames in the memory, before writing one or more of these log frames to the non-volatile storage medium, suspend the generation of new log frames, and optionally, suspend the response to the operation (e.g., write command, erase command, Trim command, etc.) that needs to update the FTL table entry.
[0131] In another embodiment of the present invention, the ratio of FTL frames to log frames is adjusted not only in response to a power failure event, but also based on other reasons. For example, when write commands occur frequently, more log entries are cached in the memory, and the ratio of FTL frames to log frames in the physical page of the solid-state drive log is adjusted to write the log entries to the non-volatile storage medium as quickly as possible.
[0132] Wherein, in response to the occurrence of an abnormal event, the method includes storing the address of the last FTL frame of each FTL block in the NVM and the address of the last log frame in the NVM in the startup page of the NVM, or storing the physical page address of the last FTL frame group of each FTL block in the NVM and the physical page address of the last log frame group in the NVM in the startup page of the NVM, wherein the FTL frame group is a plurality of FTL frames stored on the same NVM physical page, and the log frame group is a plurality of log frames stored on the same NVM physical page.
[0133] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices (equipment), or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0134] The present application is described with reference to the flowcharts and / or block diagrams of the methods, apparatuses (devices) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0137] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application. Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A solid state drive for storing log frames and log entries, characterized in that: include: A non-volatile storage medium comprising a plurality of physical pages; in A physical page includes one or more FTL frames and / or one or more log frames; in Each FTL frame includes multiple FTL table entries and metadata recording the storage location of the previous FTL frame belonging to the same FTL block as the FTL frame, each log frame includes multiple operation log entries and metadata recording the storage location of the previous log frame belonging to the same FTL block as the log frame, each operation log entry includes a logical address and a corresponding physical address, and the FTL block is part of the FTL table.
2. The solid state drive for storing log frames and log entries according to claim 1, wherein: The method further includes: storing, in a startup page of the NVM, an address of a last FTL frame of each FTL block in the NVM and an address of a last log frame in the NVM.
3. The solid state drive for storing log frames and log entries according to claim 1, wherein: The method further includes storing, in a boot page of the NVM, a physical page address of the last FTL frame group of each FTL block in the NVM and a physical page address of the last log frame group in the NVM, wherein the FTL frame group is a plurality of FTL frames stored on the same NVM physical page, and the log frame group is a plurality of log frames stored on the same NVM physical page.
4. The solid-state drive for storing log frames and log entries according to claim 1, wherein the log frame includes metadata, and the metadata indicates the FTL block to which the log frame belongs.
5. The solid state drive for storing log frames and log entries according to claim 1, wherein a plurality of FTL frames belonging to the same FTL block occupy a continuous physical address space in the solid state drive.
6. The solid state drive for storing log frames and log entries according to claim 5, wherein the plurality of FTL frames occupy a continuous physical address space in the solid state drive excluding a bad block space.
7. The solid state drive for storing log frames and log entries according to claim 1, wherein the non-volatile storage medium is an MLC (Multi Level Cell) or TLC (Triple Level Cell) non-volatile storage medium.
8. The solid state drive for storing log frames and log entries according to claim 1, wherein: The plurality of physical pages are accessed using a pSLC (pseudo-SLC) mode or an SLC (Single Level Cell) mode.
9. A log generation method based on FTL table, characterized in that: include: Record the logical address and physical address corresponding to the operation request as a log entry; generating a log frame using the log entries and further generating an FTL frame using portions of the FTL blocks, wherein the FTL table includes a plurality of FTL blocks; and storing the generated FTL frame and the log frame on NVM; The logical addresses of all log entries in the log frame belong to the same FTL block; the log frame includes metadata recording the storage location of a previous log frame that belongs to the same FTL block as the log frame.
10. The log generation method based on the FTL table as claimed in claim 9, wherein: The FTL frame includes metadata, which records the storage location of a previous FTL frame belonging to the same FTL block as the FTL frame on the NVM.
11. The log generation method based on the FTL table as claimed in claim 9, wherein: The size of the combination of the FTL frame and the log frame corresponds to the size of an NVM physical page.
12. The log generation method based on the FTL table as claimed in claim 11, wherein: The portion of the FTL block comes from a portion of the FTL block that has not yet been written to the non-volatile storage medium.
13. The log generation method based on the FTL table as claimed in claim 12, wherein: One or more FTL frames are combined with one or more log frames and written to a physical page of the NVM.
14. The log generation method based on the FTL table according to any one of claims 9 to 13, wherein: The method also includes, in response to the occurrence of an abnormal event, changing the ratio of the FTL frames and the log frames stored on the NVM according to the priority level.
15. The log generation method based on the FTL table according to any one of claims 9 to 13, wherein: In response to the occurrence of an abnormal event, the method further includes: storing, in a startup page of the NVM, an address of a last FTL frame of each FTL block in the NVM and an address of a last log frame in the NVM.
16. The log generation method based on the FTL table according to any one of claims 9 to 13, wherein: The FTL table is divided into a plurality of FTL blocks according to the memory address of the FTL table.
17. The log generation method based on the FTL table according to any one of claims 9 to 13, wherein: The plurality of FTL blocks are from different parts of the FTL table.
18. The log generation method based on the FTL table according to any one of claims 9 to 13, wherein: The FTL frames are written into the NVM in the order of the addresses of the FTL blocks.
19. The log generation method based on the FTL table according to any one of claims 9 to 13, wherein: The generating of log frames by using log entries includes: determining the number of log entries, and generating log frames if the number of log entries reaches a log frame generating standard.
20. The log generation method based on the FTL table as claimed in claim 19, wherein: When generating log entries, padding data is generated. When determining the number of log entries, the padding data is added before determining whether the log frame generation standard is met.
21. The log generation method based on the FTL table as claimed in claim 20, wherein: The size of the log frame corresponds to the size of a physical page of the NVM.
22. The log generation method based on the FTL table as claimed in claim 21, wherein: The size of the physical page of the NVM is an integral multiple of the size of the log frame.
23. The log generation method based on the FTL table as claimed in claim 22, wherein: The log frame also includes metadata; the metadata indicates the FTL block to which the log frame belongs.
24. The log generation method based on the FTL table as claimed in claim 23, wherein: The metadata also records the previous log frame belonging to the same FTL block.
