CN108536619B - Method and device for rapidly recovering FTL table - Google Patents

Method and device for rapidly recovering FTL table Download PDF

Info

Publication number
CN108536619B
CN108536619B CN201710126446.2A CN201710126446A CN108536619B CN 108536619 B CN108536619 B CN 108536619B CN 201710126446 A CN201710126446 A CN 201710126446A CN 108536619 B CN108536619 B CN 108536619B
Authority
CN
China
Prior art keywords
ftl
log
block
frame
frames
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710126446.2A
Other languages
Chinese (zh)
Other versions
CN108536619A (en
Inventor
孙宝勇
居颖轶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Memblaze Technology Co Ltd
Original Assignee
Beijing Memblaze Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Memblaze Technology Co Ltd filed Critical Beijing Memblaze Technology Co Ltd
Priority to CN201710126446.2A priority Critical patent/CN108536619B/en
Publication of CN108536619A publication Critical patent/CN108536619A/en
Application granted granted Critical
Publication of CN108536619B publication Critical patent/CN108536619B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/22Employing cache memory using specific memory technology
    • G06F2212/222Non-volatile memory
    • G06F2212/2228Battery-backed RAM
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7201Logical to physical mapping or translation of blocks or pages

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a method and a device for rapidly recovering an FTL table. The provided method for rapidly recovering the FTL table comprises the following steps: the first CPU obtains an FTL frame belonging to a first FTL block, obtains a log frame belonging to the first FTL block, and respectively stores the FTL frame belonging to the first FTL block and the log frame in different areas of a memory; and the second CPU acquires the log frame belonging to the first FTL block from the memory and updates the first FTL block by using the log frame.

Description

Method and device for rapidly recovering FTL table
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for quickly recovering an FTL table.
Background
With the advancement of technology, higher and higher requirements are put on the storage capacity and the response speed of electronic devices. Fig. 1 shows a block diagram of a Solid-State Storage Device (SSD) in the prior art.
The solid-state storage device 102 is coupled to a host for providing storage capabilities to the host. The host and the solid-state storage device 102 may be coupled by various methods, including but not limited to, connecting the host and the solid-state storage device 102 by, for example, SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express, PCIE, high-speed Peripheral Component Interconnect), NVMe (NVM Express, high-speed nonvolatile storage), ethernet, fiber channel, wireless communication network, etc. The host may be an information processing device, such as a personal computer, tablet, server, portable computer, network switch, router, cellular telephone, personal digital assistant, etc., capable of communicating with the storage device in the manner described above. The storage device 102 includes an interface 103, a control section 104, one or more NVM (Non-Volatile Memory) chips 105, and a DRAM (Dynamic Random Access Memory) 110. NAND flash, phase change memory, FeRAM, MRAM, etc. are common NVMs. The interface 103 may be adapted to exchange data with a host by means such as SATA, IDE, USB, PCIE, NVMe, SAS, ethernet, fibre channel, etc. The control unit 104 is used to control data transfer between the interface 103, the NVM chip 105, and the firmware memory 110, and also used for memory management, host logical address to flash physical address mapping, erase leveling, bad block management, and the like. The control component 104 can be implemented in a variety of ways including software, hardware, firmware, or a combination thereof. The control unit 104 may be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 may also include a processor or controller in which software is executed to manipulate the hardware of the control component 104 to process host IO commands. The control unit 104 is also coupled to the DRAM 110 and can access data of the DRAM 110. FTL tables and/or cached data of host IO commands may be stored in DRAM.
The control section 104 includes a flash interface controller (or referred to as a flash channel controller). The flash interface controller is coupled to NVM chip 105 and issues commands to NVM chip 105 to operate NVM chip 105 and receive command execution results output from NVM chip 105 in a manner that conforms to the interface protocol of NVM chip 105. The interface protocol of the NVM chip 105 includes well-known interface protocols or standards such as "Toggle", "ONFI", etc.
The memory Target (Target) is one or more Logic Units (LUNs) of a shared Chip Enable (CE) signal within the NAND flash package. Each logical Unit has a logical Unit Number (Logic Unit Number). One or more dies (Die) may be included within the NAND flash memory package. Typically, a logic cell corresponds to a single die. The logical unit may include a plurality of planes (planes). Multiple planes within a logical unit may be accessed in parallel, while multiple logical units within a NAND flash memory chip may execute commands and report status independently of each other. At the time of being available fromhttp:// www.micron.com/~/media/Documents/Products/Other%20Documents/ONFI3_ 0Gold.ashxThe "Open NAND Flash Interface Specification (replacement 3.0)" obtained provides meanings about target (target), logical unit, LUN, Plane (Plane), which are part of the prior art.
The solid-state storage device includes a plurality of NVM chips therein. Each NVM chip includes one or more DIEs (DIE) or Logical Units (LUNs). The dies or logic units can respond to read and write operations in parallel. Multiple read, write, or erase operations are performed sequentially on the same die or logic.
Data is typically stored and read on a storage medium on a page-by-page basis. And data is erased in blocks. A block contains a plurality of pages. Pages on the storage medium (referred to as physical pages) have a fixed size, e.g., 17664 bytes. Physical pages may also have other sizes. The physical page may include a plurality of data frames (data frames) therein, the data frames having a specified size, e.g., 4096 or 4416 bytes.
In the solid-state storage device, mapping information from logical addresses to physical addresses is maintained using FTL (Flash Translation Layer). The logical addresses constitute the storage space of the solid-state storage device as perceived by upper-level software, such as an operating system. The physical address is an address for accessing a physical memory location of the solid-state memory device. Address mapping may also be implemented in the prior art using an intermediate address modality. E.g. mapping the logical address to an intermediate address, which in turn is further mapped to a physical address.
A table structure storing mapping information from logical addresses to physical addresses is called an FTL table. FTL tables are important metadata in solid state storage devices. Usually, the data entry of the FTL table records the address mapping relationship in the unit of data page in the solid-state storage device. FTL tables are important metadata in solid state storage devices. Usually, the data entry of the FTL table records the address mapping relationship in the unit of data page in the solid-state storage device. FTL tables of solid state memory devices have large sizes, e.g., several GB levels. When the solid-state storage device is turned off, the FTL table needs to be completely stored, and when the solid-state storage device is turned on, the FTL needs to be completely loaded.
The FTL table includes a plurality of FTL table entries (or table entries). In one embodiment, each FTL table entry records a correspondence relationship between a logical page address and a physical page. In another example, each FTL table entry records the correspondence between consecutive logical page addresses and consecutive physical pages. In another embodiment, each FTL table entry records the corresponding relationship between the logical block address and the physical block address. In still another embodiment, the FTL table records the mapping relationship between logical block addresses and physical block addresses, and/or the mapping relationship between logical page addresses and physical page addresses.
When processing a read command from the host, the solid-state storage device obtains a corresponding physical address from the FTL table by using a logical address carried in the read command, sends a read request to the NVM chip according to the physical address, and receives data output by the NVM chip in response to the read request. When processing a write command from a host, the solid-state storage device allocates a physical address to the write command, records a corresponding relation between a logical address of the write command and the allocated physical address in an FTL table, and sends a write request to an NVM chip according to the allocated physical address.
In the prior art, each physical page of the solid-state storage device additionally stores a logical address corresponding to the physical page. 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 the FTL table is reconstructed. However, such an operation would require a lot of time and result in a time-consuming start-up procedure of the solid-state storage device.
Some solid-state storage devices also provide a backup power source that provides temporary power to the storage device for backing up metadata and processing commands that have not yet been completed when an unexpected power outage occurs. The standby power supply comprises a super capacitor, an aluminum capacitor, a tantalum polymer capacitor, a lithium battery and the like.
Disclosure of Invention
In view of the above, the present application provides a method and an apparatus for fast recovering an FTL table.
According to a first aspect of the present invention, there is provided a first FTL table-based log generating method according to the first aspect of the present invention, including: recording a logical address and a physical address corresponding to the operation request; generating a log frame according to the logical address and the physical address corresponding to the operation request; generating an FTL frame using a portion of a first FTL block, wherein an FTL table comprises a plurality of FTL blocks; storing the generated FTL frames and the log frames on the NVM, wherein the plurality of log frames of the first FTL block form a log frame linked list and the plurality of FTL frames of the first FTL block form a FTL frame linked list.
According to the first FTL table-based log generating method of the first aspect of the present invention, there is provided the second FTL table-based log generating method of the first aspect of the present invention, wherein in order to write frames other than FTL frames or log frames to NVM, the order of storing FTL frames, log frames, and other frames is selected according to the priority of different frames.
According to the first, second or third FTL table-based log generating method of the first aspect of the present invention, there is provided the third FTL table-based log generating method of the first aspect of the present invention, wherein in response to recognizing that the update frequency of the second FTL block is higher than the update frequency of the first FTL block, FTL frames and log frames belonging to the second FTL block are preferentially written to the NVM.
According to the first FTL table-based log generating method of the first aspect of the present invention, there is provided a fourth FTL table-based log generating method of the first aspect of the present invention, wherein FTL frames are not generated for the second FTL blocks in response to identifying that the second FTL blocks correspond to read only memory areas.
According to the first to fourth FTL table-based log generating methods of the first aspect of the present invention, there is provided a fifth FTL table-based log generating method according to the first aspect of the present invention, further comprising: generating a bad block table updating frame according to the updating of the bad block table; generating a bad block table data frame using a portion of the bad block table block, wherein the bad block table includes a plurality of bad block table blocks; storing the generated bad block table updating frames and bad block table data frames on an NVM (non-volatile memory), wherein a plurality of bad block table updating frames of the bad block table blocks form a bad block table updating frame linked list, and a plurality of bad block table data frames of the bad block table blocks form a bad block table data frame linked list; and writing the FTL frame and the log frame belonging to the second FTL block to the NVM with higher priority than writing the bad block table update frame and the bad block table data frame of the bad block table block to the NVM.
According to the first to fourth FTL table-based log generating methods of the first aspect of the present invention, there is provided a sixth FTL table-based log generating method according to the first aspect of the present invention, further comprising: generating a first type of frame upon an update to a volatile storage area accessible by a host; generating a second class of frames using a portion of the volatile storage area blocks accessible to the host, wherein the volatile storage area includes a plurality of volatile storage area blocks; and storing the generated first-class frames and second-class frames on the NVM, wherein the first-class frames of the volatile storage area blocks form a first-class frame linked list, and the second-class frames of the volatile storage area blocks form a second-class frame linked list.
According to a sixth FTL table-based log generating method of the first aspect of the present invention, there is provided a seventh FTL table-based log generating method of the first aspect of the present invention, further comprising: writing FTL frames and log frames belonging to a second FTL block to the NVM with higher priority than writing first and second type frames of the volatile storage area block to the NVM.
According to a second aspect of the present invention there is provided a first method of providing non-volatile RAM according to the second aspect of the present invention, comprising: generating a first type of frame upon an update to a volatile storage area accessible to a host, wherein the volatile storage area serves as non-volatile RAM provided to the host; generating a second class of frames using a portion of the volatile storage area blocks accessible to the host, wherein the volatile storage area includes a plurality of volatile storage area blocks; and storing the generated first-class frames and second-class frames on the NVM, wherein the first-class frames of the volatile storage area blocks form a first-class frame linked list, and the second-class frames of the volatile storage area blocks form a second-class frame linked list.
According to a third aspect of the present invention there is provided a method of rebuilding non-volatile RAM according to the first aspect of the present invention, comprising: acquiring storage positions of a first type frame and a second type frame of a volatile storage area block; reading a plurality of first type frames and a plurality of second type frames belonging to the volatile storage area block; reconstructing the block of volatile storage area using the plurality of first class frames; and updating the volatile storage area block with the plurality of second-class frames, wherein the volatile storage area serves as a non-volatile RAM provided to the host, and the volatile storage area includes a plurality of volatile storage area blocks.
According to a fourth aspect of the present invention, there is provided a first FTL table-based log updating method according to the fourth aspect of the present invention, comprising: determining to update a first FTL block, wherein the first FTL block has been completely stored to NVM, and a last FTL frame belonging to the first FTL block has a first address and an initial log frame belonging to the first FTL block has a second address; recording a third address of a log frame belonging to the first FTL block, which has been written into the NVM, nearest to the current time; generating an FTL frame using a portion of the first FTL block; recording a logical address and a physical address corresponding to the current operation request to generate a log frame; writing the FTL frame and the log frame into the NVM; responding to the occurrence of the abnormal event, when the abnormal event occurs, recording a fifth address of a log frame which belongs to the first FTL block and is written into the NVM and is closest to the current time, and if the first FTL block is not completely stored in the NVM again, recording the first address, the second address and the fifth address in a starting page.
According to the first FTL table-based log updating method of the fourth aspect of the present invention, there is provided the second FTL table-based log updating method of the fourth aspect of the present invention, wherein in response to an abnormal event occurrence, if the first FTL block has been completely stored to the NVM again and a last FTL frame belonging to the first FTL block stored again has a fourth address and a last log frame belonging to the first FTL block stored again has a fifth address, the fourth address, the third address and the fifth address are recorded in a start page.
According to the first or second FTL table-based log updating method of the fourth aspect of the present invention, there is provided the third FTL table-based log updating method of the fourth aspect of the present invention, wherein it is determined to update the first FTL block when the number of log frames belonging to the first FTL block exceeds a threshold value, or at a predetermined time period, or at a free storage space of the log storage area is below a threshold value, or in response to an indication of a user.
According to the first, second or third FTL table-based log updating method of the fourth aspect of the present invention, there is provided the fourth FTL table-based log updating method of the fourth aspect of the present invention, wherein when a plurality of FTL blocks have been completely stored to the NVM, the first FTL block is updated according to the priority determination according to the plurality of FTL blocks.
According to a fifth aspect of the present invention, there is provided a method for quickly restoring an FTL table according to the fifth aspect of the present invention, comprising: the first CPU acquires an FTL frame belonging to a first FTL block, acquires a log frame belonging to the first FTL block, and respectively stores the FTL frame belonging to the first FTL block and the log frame in different areas of a memory; and the second CPU acquires the log frame belonging to the first FTL block from the memory and updates the first FTL block by using the log frame.
According to the first method for quickly recovering FTL table of the fifth aspect of the present invention, there is provided the second method for quickly recovering FTL table of the fifth aspect of the present invention, wherein the storage address of the previous log frame belonging to the same FTL block as the log frame is recorded in the metadata of each log frame.
According to a second method for quickly restoring an FTL table according to a fifth aspect of the present invention, there is provided a third method for quickly restoring an FTL table according to the fifth aspect of the present invention, wherein a first CPU obtains a last generated log frame belonging to a first FTL block from a specified memory address and reads out the log frame from the memory address; the first CPU acquires a first storage address of a previous log frame belonging to the same FTL block from metadata of the log frame, and reads the previous log frame from the first storage address; until all log frames belonging to the FTL block are acquired.
According to the first, second or third method for fast recovery of FTL table of the fifth aspect of the present invention, there is provided a fourth method for fast recovery of FTL table according to the fifth aspect of the present invention, further comprising: and responding to the fact that all log frames belonging to the first FTL block are stored in the memory, and sending a message that the reading of all log frames belonging to the first FTL block is completed to the first CPU.
The method for rapidly restoring an FTL table according to any one of the first to fourth aspects of the present invention provides a method for rapidly restoring an FTL table according to the fifth aspect of the present invention, further comprising: further comprising: in response to storing all FTL frames and all log frames belonging to a first FTL block in the memory, the first CPU instructs updating of the first FTL block by the second CPU.
The method for rapidly restoring an FTL table according to any one of the first to fourth aspects of the present invention provides a sixth method for rapidly restoring an FTL table according to the fifth aspect of the present invention, further comprising: in response to storing all log frames belonging to the first FTL block in the memory, the first CPU instructs updating of the first FTL block by the second CPU.
According to a fifth or sixth method for fast restoring FTL table of the fifth aspect of the present invention, there is provided a seventh method for fast restoring FTL table according to the fifth aspect of the present invention, wherein the updating of the first FTL block by the second CPU comprises: the second CPU sequentially extracts log entries from all log frames belonging to the first FTL block in the memory; and the second CPU determines an FTL table entry corresponding to the logical address in a first FTL block in the memory according to the logical address recorded in each log entry, and updates the physical address in the determined FTL table entry by using the physical address corresponding to the logical address in the log entry.
According to a seventh method for rapidly restoring an FTL table of a fifth aspect of the present invention, there is provided the eighth method for rapidly restoring an FTL table according to the fifth aspect of the present invention, wherein for a plurality of log entries of a plurality of log frames belonging to the same FTL block, the second CPU updates the FTL block with each log entry sequentially from front to back or from back to front in the order of log entry generation.
According to the seventh or eighth method for fast recovery of FTL table of the fifth aspect of the present invention, there is provided a ninth method for fast recovery of FTL table according to the fifth aspect of the present invention, further comprising: the second CPU also sets a flag for each FTL entry that is updated.
According to a ninth method of rapidly restoring an FTL table of the fifth aspect of the present invention, there is provided a tenth method of rapidly restoring an FTL table of the fifth aspect of the present invention, when the FTL entries are sequentially updated with the extracted log entries, if there is a flag on the FTL entry to be updated, the second CPU does not update the FTL block using the extracted log entries.
According to the ninth or tenth method for rapidly restoring an FTL table of the fifth aspect of the present invention, there is provided the eleventh method for rapidly restoring an FTL table of the fifth aspect of the present invention, wherein after the update of the first FTL block is completely completed, the second CPU clears all the set flags of the first FTL block.
According to a fifth or sixth method for fast restoring FTL table of the fifth aspect of the present invention, there is provided a twelfth method for fast restoring FTL table according to the fifth aspect of the present invention, wherein the updating of the first FTL block by the second CPU comprises: the second CPU extracts the log entry belonging to the first FTL block from the memory; and the second CPU determines an FTL table entry corresponding to the logical address in a first FTL block in the memory according to the logical address recorded in the log entry, and updates the physical address in the determined FTL table entry by using the physical address corresponding to the logical address in the log entry.
According to a twelfth method for rapidly restoring an FTL table of the fifth aspect of the present invention, there is provided a thirteenth method for rapidly restoring an FTL table according to the fifth aspect of the present invention, further comprising: the second CPU determines the address of the next log entry in the memory and retrieves the next log entry from the memory.
According to a thirteenth method for rapidly restoring an FTL table of the fifth aspect of the present invention, there is provided the method for rapidly restoring an FTL table of the fourteenth aspect of the present invention, wherein for a plurality of log entries of a plurality of log frames belonging to the same FTL block, the second CPU updates the FTL block with the log entries sequentially from front to back or from back to front in the order of log entry generation.
The method for rapidly restoring an FTL table according to any one of the first to fourteenth aspects of the present invention provides a method for rapidly restoring an FTL table according to a fifteenth aspect of the present invention, further comprising: in response to storing all FTL frames belonging to the second FTL block and the log frame in the memory, the first CPU instructs updating of the second FTL block by the third CPU.
The method for rapidly restoring an FTL table according to any one of the first to fourteenth aspects of the present invention provides a sixteenth method for rapidly restoring an FTL table according to the fifth aspect of the present invention, further comprising: in response to storing the log frame belonging to the second FTL block in the memory, the first CPU instructs updating of the second FTL block by the third CPU.
According to the fifteenth or sixteenth FTL table restoring method of the fifth aspect of the present invention, there is provided the seventeenth FTL table restoring method according to the fifth aspect of the present invention, wherein the operation of the second CPU updating the first FTL block is performed simultaneously with the operation of the third CPU updating the second FTL block.
According to a fifteenth, sixteenth or seventeenth FTL table restoration method of the fifth aspect of the present invention, there is provided the eighteenth FTL table restoration method of the fifth aspect of the present invention, wherein the operation of updating the first FTL block by the second CPU is performed simultaneously with the operation of acquiring FTL frames belonging to the second FTL block and the log frames belonging to the second FTL block by the first CPU.
The method for rapidly restoring FTL tables according to any of the twelfth to eighteenth aspects of the present invention provides the nineteenth method for rapidly restoring FTL tables according to the fifth aspect of the present invention, further comprising: the second CPU notifies the first CPU of the completion of the update of the first FTL block.
The method for rapidly restoring an FTL table according to any one of the twelfth to eighteenth aspects of the present invention provides the twentieth method for rapidly restoring an FTL table according to the fifth aspect of the present invention, further comprising: in response to receiving the notification of the completion of the update of the first FTL block from the second CPU, the first CPU releases the space occupied by the log frame of the first FTL block in the memory, and allocates space in the memory for storing the log frame of the third FTL block, and acquires the log frame belonging to the third FTL block.
The method of quickly restoring FTL tables according to any one of the first to twenty-first aspects of the present invention provides the twenty-first method of quickly restoring FTL tables according to the fifth aspect of the present invention, wherein different FTL blocks are updated using different CPUs.
The method of rapidly restoring an FTL table according to any one of the first to twenty-first of the fifth aspect of the present invention, there is provided a twenty-second method of rapidly restoring an FTL table according to the fifth aspect of the present invention, further comprising: the first CPU determines FTL blocks to be reconstructed.
According to a sixth aspect of the present invention, there is provided a first FTL table-based log generating apparatus according to the fifth aspect of the present invention, comprising: the address recording module is used for recording a logical address and a physical address corresponding to the operation request; the log frame generating module is used for generating a log frame according to the logical address and the physical address corresponding to the operation request; an FTL frame generating module, configured to generate an FTL frame using a part of a first FTL block, where an FTL table includes a plurality of FTL blocks; and the storage module is used for storing the generated FTL frames and the log frames on the NVM, wherein a plurality of log frames of the first FTL block form a log frame linked list, and a plurality of FTL frames of the first FTL block form the FTL frame linked list.
According to a seventh aspect of the present invention, there is provided a first FTL table-based log updating apparatus according to the seventh aspect of the present invention, comprising: FTL block determining module, configured to determine to update a first FTL block, wherein the first FTL block has been completely stored to NVM and a last FTL frame belonging to the first FTL block has a first address and an initial log frame belonging to the first FTL block has a second address; recording a third address of a log frame belonging to the first FTL block, which has been written into the NVM, nearest to the current time; an FTL frame generating module for generating an FTL frame using a part of the first FTL block; the log frame generating module is used for recording a logical address and a physical address corresponding to the current operation request to generate a log frame; the NVM writing module is used for writing the FTL frame and the log frame into the NVM; and the exception handling module is used for responding to the occurrence of an exception event, when the exception event occurs, recording a fifth address of a log frame which is written into the NVM and belongs to the first FTL block, wherein the fifth address is closest to the current time, and if the first FTL block is not completely stored into the NVM again, recording the first address, the second address and the fifth address in a starting page.
According to an eighth aspect of the present invention, there is provided the first solid state disk according to the eighth aspect of the present invention, comprising a controller, a NVM, a random access memory; the controller is respectively coupled to the NVM and the random access memory; the NVM comprises a log area and a user data area; storing solid state disk logs in a log area; storing user data in a user data area; wherein an FTL table is stored in memory, the FTL table comprising a plurality of FTL blocks; wherein the controller is adapted to perform a method according to the first, second, third, fourth or fifth aspect of the invention.
According to a ninth aspect of the present invention, there is provided a program comprising program code which, when loaded into and executed on a storage device, causes the storage device to perform the FTL table based log generation method according to the first aspect of the present invention.
According to a tenth aspect of the present invention there is provided a program comprising program code which, when loaded into and executed on a storage device, causes the storage device to carry out the method of providing non-volatile RAM according to the second aspect of the invention.
According to an eleventh aspect of the present invention, there is provided a program comprising program code which, when loaded into and executed on a storage device, causes the storage device to carry out a method of rebuilding non-volatile RAM according to the third aspect of the invention.
According to a twelfth aspect of the present invention, there is provided a program comprising program code which, when loaded into and executed on a storage device, causes the storage device to perform the FTL table-based log updating method according to the fourth aspect of the present invention.
According to a thirteenth aspect of the present invention, there is provided a program comprising program code which, when loaded into and executed on a storage device, causes the storage device to perform a method of quickly recovering FTL tables according to the fifth aspect of the present invention.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a block diagram of a solid-state storage device in the prior art;
FIG. 2 is a block diagram of a solid state disk log according to one embodiment of the invention;
fig. 3 is a block diagram of the structure of an FTL table according to an embodiment of the present invention;
FIG. 4 is a block diagram of the structure of a "write" log according to an embodiment of the invention
FIG. 5 is a flowchart of a solid state disk log generation method according to an embodiment of the invention;
FIG. 6 is a block diagram of a solid state disk log according to another embodiment of the invention;
FIG. 7 is a flowchart of a solid state disk log generation method according to yet another embodiment of the invention;
FIG. 8 is a flowchart of a method for rebuilding an FTL table using a log according to an embodiment of the present invention;
FIG. 9 is a block diagram of a solid state disk according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of generating a solid state disk log in response to a power down event according to an embodiment of the invention;
fig. 11A is a schematic diagram of FTL block update according to still another embodiment of the present invention;
fig. 11B is a schematic diagram of FTL block update according to another embodiment of the present invention;
fig. 12 is a block diagram of a solid state disk according to still another embodiment of the present invention;
FIG. 13 is a block diagram of a structure of a non-volatile RAM log according to one embodiment of the invention;
FIG. 14 is a block diagram of a structure of a non-volatile RAM log according to another embodiment of the invention;
FIG. 15 is a flowchart of a solid state disk log generation method according to yet another embodiment of the invention;
FIG. 16 is a flow chart of a device boot method according to an embodiment of the invention;
FIG. 17 is a block diagram of a solid state disk according to yet another embodiment of the invention;
fig. 18 is a schematic diagram of an FTL table rebuild process according to an embodiment of the present invention;
FIG. 19 is a flow diagram of multiple CPUs collaboratively rebuilding an FTL table according to an embodiment of the present invention;
fig. 20 is a flow diagram of multiple CPUs collaboratively rebuilding an FTL table according to still another embodiment of the present invention.
Detailed Description
The application provides a log updating method, which is characterized in that when a log frame is too long, an FTL block of a log area is updated, so that the occupation of the storage space of the log area is reduced, and the log recovery speed is effectively improved.
Of course, it is not necessary for any particular embodiment of the invention to achieve all of the above advantages at the same time.
In order to make those skilled in the art 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 with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all embodiments. All other embodiments that can be derived from the embodiments given herein by a person of ordinary skill in the art are intended to be within the scope of the present disclosure.
The following further describes the present application with reference to the drawings.
FIG. 2 is a block diagram of a solid state disk log according to an embodiment of the invention. In order to be able to quickly rebuild the FTL table when the solid state disk is started, and reduce unnecessary FTL block writing operations, the solid state disk log 210 is provided according to an embodiment of the present invention. The solid state disk log 210 is stored in a non-volatile storage medium. Referring to fig. 2, the solid state disk log 210 includes FTL frames 1-1(220), FTL frames 1-2(221), … … FTL frames 2-3(225), and the solid state disk log 210 further includes log frames 230 … … log frames 235. The FTL frame is a component of the FTL block, and in the example of fig. 2, the 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 the first log frame for FTL block 0 (not shown in fig. 2), log frame 1-1(231) is the first log frame for FTL block 1, log frame 1-3(232) is the 2 nd log frame for FTL block 1, log frame 1-3(235) is the 3 rd log frame for FTL block 1, log frame 2-1(233) is the 1 st log frame for FTL block 2, log frame 4-1(234) is the first log frame for FTL block 4. Information is recorded in metadata of the log frame to indicate the FTL block to which the log frame belongs. And optionally, further recording a previous log frame (e.g., log frame 1-3(232)) in the log frames (e.g., log frame 1-3(232)) and log frame 1-1(231) belong to the same FTL block 1, and the previous log frame of log frame 1-3(232) is log frame 1-1(231)) in the metadata of the log frames (e.g., log frame 1-3 (232)). In the embodiment of fig. 2, FTL blocks occupy contiguous physical address space in the solid state disk (optionally skipping bad blocks). Optionally, a log storage area is provided in the solid state disk with a nonvolatile storage medium, and the FTL blocks are stored in a continuous address space of the log storage area. The FTL frame and the log frame occupy a physical page of the nonvolatile storage medium, so that the combination of the FTL frame and the log frame can be written to the nonvolatile storage medium in one write operation.
In one embodiment according to the present invention, the nonvolatile storage medium is an MLC (Multi Level Cell) or TLC (Triple Level Cell) nonvolatile storage medium, and when the solid state disk log is stored in a data page of the nonvolatile storage medium, the solid state disk log is accessed using a pSLC (pseudo-SLC) mode or an SLC (Single Level Cell) mode, or the solid state disk log is stored only in an LSB (Least Significant Bit) page, so as to speed up the solid state disk log storage process and obtain higher data reliability. As another embodiment, the solid state disk log is stored in an SLC nonvolatile storage medium. In yet another embodiment, the solid state disk log is stored in the LSB page of the MLC nonvolatile storage medium.
The number of log frames corresponding to each FTL block may be different. Referring to fig. 2, there are no updates to FTL block 3 for a period of time, so there are no log frames corresponding to FTL block 3 in the solid state disk log 210. While there are multiple updates to FTL block 1, all update operations to FTL block 1 are recorded with 3 log frames (231, 232, 235).
In the embodiment of fig. 2, the solid state disk log 210 stores FTL blocks in order of their memory addresses in the FTL table (for example, FTL block 2 is stored after FTL block 1), and records log frames in the order of log frame generation. Each log frame belongs to and only one FTL block. In one example, "write" log entries belonging to each FTL block are cached in a memory. And when the 'write' log entry belonging to a certain FTL block is filled with one log frame, writing the log frame into the solid state disk log.
In this way, the FTL table may only need to maintain one complete record in the solid state disk log, and record each update to the FTL table entry in the solid state disk log. When the FTL table entry is not updated, the FTL table does not need to be recorded in the solid state disk log, so that the system resource is saved. When the FTL table entry is updated, only the modification of the FTL table entry is recorded in the log frame, so that the write-in data volume of the solid state disk log is reduced.
With the solid state disk log 210, the FTL tables can be rebuilt. Due to reasons such as power failure of the storage device, the FTL table in the memory disappears, and the solid state disk log 210 needs to be read and the FTL table needs to be reconstructed. To rebuild the FTL table, in the non-volatile storage medium of the solid state disk, the storage address (physical address) of each FTL block in the solid state disk and the physical address of the last log frame belonging to each FTL block (optionally, the physical address of the earliest log frame belonging to each FTL block is also stored).
When the FTL table is rebuilt, for example, a physical address of the FTL frame of the FTL block 1 stored in the nonvolatile storage medium in the solid state disk log 210 is obtained, and the FTL block 1 (including the FTL frame 1-1, the FTL frame 1-2, and the FTL frame 1-3) in the solid state disk log 210 is read. Next, the physical address of the last log frame (see fig. 2, log frames 1-3(235)) belonging to FTL block 1 is obtained, and the log entries recorded in log frames 1-3(235) are used to update the corresponding FTL entries in FTL block 1 in the memory according to the reverse order of the log entries arranged by addresses in log frames 1-3 (235). As an example, updating the meaning of 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 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 reverse order of log frames 1-3(235), while the later log entries in log frames 1-3(235) contain the later updates to the FTL entries, each FTL entry only needs to be updated once in the process of rebuilding the FTL table. To this end, the FTL entry that is updated is further marked, so that the updated FTL entry is not updated any more in the process of rebuilding the FTL table. After FTL block 1 is updated with log frames 1-3(235), a previous log frame belonging to FTL block 1 and log frames 1-3(235) (see fig. 2, log frames 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. By way of example, the address of the previous FTL frame 1-2(232) belonging to FTL block 1 is recorded in log frames 1-3 (235).
As another example of the present invention, to rebuild the FTL table, a physical address of the FTL frame of the FTL block 1 stored in the nonvolatile storage medium in the solid state disk log 210 is obtained, and the FTL block 1 (including the FTL frame 1-1, the FTL frame 1-2, and the FTL frame 1-3) in the solid state disk log 210 is read. Next, the physical address of the first log frame (see fig. 2, log frames 1-1(231)) belonging to FTL block 1 is obtained, and the log entries recorded in log frames 1-1(231) are used to update the corresponding FTL entries in FTL block 1 in the memory according to the order of the log entries arranged by addresses in log frames 1-1 (231). As another example, updating the meaning of 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 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), FTL block needs to be updated with each log entry in the process of rebuilding FTL table. After the FTL block 1 is updated with the log frame 1-1(231), a subsequent log frame belonging to the FTL block 1 together with the log frame 1-1(231) is acquired (refer to fig. 2, log frames 1-2 (232)); all log frames (FTL frame 1-1(231)), FTL frame 1-2(232), and FTL frame 1-3(235)) of FTL block 1 are updated to FTL block 1. By way of example, the address of the next FTL frame 1-2(232) belonging to FTL block 1 is recorded in log frame 1-1 (231).
Fig. 3 is a block diagram of the structure of an FTL table according to an embodiment of the present invention. The FTL table includes a plurality of FTL table entries (or table entries). In one embodiment, each FTL table entry records a correspondence relationship between a logical page address and a physical page. In another embodiment, each FTL table entry records the corresponding relationship between the logical block address and the physical block address. In still another embodiment, the FTL table records the mapping relationship between logical block addresses and physical block addresses, and/or the mapping relationship between logical page addresses and physical page addresses. In yet another embodiment, the FTL tables are organized as a tree structure.
In still another embodiment, FTL tables are stored in a continuous memory address space, a physical address is recorded in each FTL table entry, and a logical address corresponding to the physical address is represented by the memory address of each FTL table entry itself. The number of FTL table entries corresponds to the size of the solid state storage device logical address space.
The FTL tables are organized as data frames for the purpose of storing the FTL tables in the nonvolatile storage medium. Referring to fig. 3, the FTL table (310) includes FTL frame 1, FTL frame 2, FTL frame 3 … … FTL frame 600. Each FTL frame includes a plurality of FTL table entries. The size of each FTL frame corresponds to a minimum writing unit (e.g., page) of the nonvolatile storage medium. The data page size of a non-volatile storage medium is typically 2KB, 4KB, 8KB, or 16 KB. In one embodiment, the data page size of the nonvolatile storage medium is 16KB, while the FTL frame size is 2KB, 4KB or 8 KB. In another embodiment, the data page size of the nonvolatile storage medium is 4KB, and the FTL frame size is 512B, 1KB, or 2 KB. Generally, the FTL frame size is selected such that the data page size of the nonvolatile storage medium is an integer multiple of the FTL frame size in order to store a plurality of FTL frames to a data page which is a nonvolatile storage medium. In one example, FTL frame 1, FTL frame 2, FTL frame 3 … … FTL frame 600 included in the FTL table are stored in the memory consecutively according to the memory address.
In an embodiment in accordance with the invention, the FTL tables (310) are also organized as FTL blocks. The FTL block includes a plurality of FTL frames, preferably, a plurality of FTL frames with consecutive memory addresses. In the example of fig. 3, 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. By way of example, the FTL frame size is 4KB, including 1K (1024) FTL entries, and each FTL entry corresponds to 4KB logical/physical address space, thus each FTL frame corresponds to 4MB logical/physical address space, and each FTL block includes 100 FTL frames, corresponding to 400MB logical/physical address space.
When the solid-state storage device processes a write request, a physical address is allocated to the write request, and the corresponding relation between the logical address and the physical address of the write request is recorded in an FTL table. In another embodiment, a host accessing the solid-state storage device maintains an FTL table, when a write request needs to be issued to the solid-state storage, a physical address of the solid-state storage device is allocated to the write request, and a correspondence between a logical address and the physical address of the write request is recorded in the FTL table.
FIG. 4 is a block diagram of the structure of a "write" log according to an embodiment of the invention. While the solid-state storage device is processing write requests, a "write" log is also generated. The logical address and the physical address corresponding to the write operation are recorded in the write log. For each FTL entry update request, a corresponding "write" log entry is generated.
For the purpose of storing the "write" log in a non-volatile storage medium, the "write" log is organized as a log frame 410 (see FIG. 4). Each log frame 410 includes a plurality of "write" log entries (422, 424, 42n) (or "entries"). Each "write" log entry (422, 424, or 42n) includes a logical address and a physical address corresponding thereto. And generating and organizing 'write' log entries in the log frame according to the sequence of updating the receiving FTL table. Thus, in a "write" log, there may be "write" log entries having the same logical and/or physical address.
The size of each log frame 410 corresponds to a minimum write unit (e.g., page) of the non-volatile storage medium. The data page size of a non-volatile storage medium is typically 2KB, 4KB, 8KB, or 16 KB. In one embodiment, the data page size of the nonvolatile storage medium is 16KB, while the log frame size is 2KB, 4KB, 8KB, or 16 KB. In another embodiment, the data page size of the non-volatile storage medium is 4KB, and the log frame size is 512B, 1KB, or 2KB, or 4 KB. Generally, the log frame size is selected such that the data page size of the non-volatile storage medium is an integer multiple of the log frame size in order to store one or more log frames to 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 one data page of the non-volatile storage medium.
Metadata 440 is also included in the log frame 410 according to an embodiment of the present invention, and it is indicated in the metadata 440 that the log frame 410 belongs to the FTL block 1. Log frame 410 belongs to FTL block 1, meaning that the entries in log frame 410 record updates to the entries of FTL block 1, in other words, the logical addresses of the entries in log frame 410 are all within the logical address range of FTL block 1.
In one example, a queue is provided to accommodate "write" log entries. When a "write" log is generated, a log entry is inserted into the queue (tail of the queue). Alternatively, multiple entries may be combined and inserted into a queue in one memory access operation, and the size of the combined multiple entries may be equal to the bus width or the memory interface width. In fetching a log entry from the head of the queue, a specified number of log entries are fetched by the log frame size. The queue is first-in-first-out, thereby enabling the order of generation of log entries to be easily identified in the solid state disk log. The depth of the queue is properly selected, so that log entries in the queue can be written into the solid state disk logs within the limited time of the standby power supply when power failure occurs.
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 properly selected so that the log entries in the log frame buffer can be written to the solid state disk log within a limited time of the backup power supply in the event of a power failure. When the log frame buffer accumulates data of the log frame size, the content of the data is written into the solid state disk log.
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 entries with the same logical address have been recorded in the queue or buffer, the existing entries in the queue or buffer are updated with the log entries to be written, thereby reducing the amount of data to be written to the solid state disk log.
Fig. 5 is a flowchart of a method for generating a log of a solid state disk based on FTL table according to an embodiment of the present invention. When the FTL table is updated, the corresponding relationship between the logical address and the physical address of the updated FTL table entry is recorded (510). Optionally the FTL tables are updated accordingly. And caching the recorded corresponding relation between the logical address and the physical address, wherein the corresponding relation between each logical address and the physical address forms a 'write' log entry. A certain number of "write" log entries constitutes a log frame. A "write" log entry in the same log frame records updates to the FTL entries of the same FTL block. When the correspondence relationship between the plurality of cached logical addresses and the physical addresses can constitute one log frame, the log frame is generated by using the correspondence relationship between the plurality of cached logical addresses and the physical addresses (520). A portion of one of the plurality of FTL blocks of the FTL table in the memory is also selected to generate an FTL frame (530). For example, the selected FTL frame 1-1 is the portion of FTL block 1 that has not been written to the non-volatile storage medium. In a preferred embodiment, the size of the combination of FTL frame 1-1(220) and log frame (230) corresponds to the data page size of the non-volatile storage medium of the solid state disk, so that the combination of FTL frame 1-1(220) and log frame (230) can be written to the non-volatile storage medium (540) of the solid state disk by one write operation of the non-volatile storage medium.
According to another embodiment of the 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, selecting a part of the FTL table to generate the FTL frame. According to yet another embodiment of the present invention, log frames are generated periodically with cached "write" log entries. And selecting a part of the FTL table to generate the FTL frame every time one log frame is generated. According to yet another embodiment of the present invention, the size of the log frame corresponds to the data page size of the nonvolatile storage medium, and the size of the FTL frame also corresponds to the data page size of the nonvolatile storage medium.
According to still another embodiment of the present invention, when the FTL frame of the FTL table is generated, the FTL frame is generated by selecting a portion of the FTL block according to the memory address of the FTL block itself.
For example, the portion of the length-L FTL block starting from address 0 within FTL block 1 is selected to form FTL frame 1-1. The portion of FTL blocks of length L starting from address L within FTL block 1 is selected to constitute FTL frames 1-2. The portion of FTL blocks of length L starting from address (N-1) × L within FTL block 1 is selected to constitute FTL frames 1-N. And sequentially writing each FTL block FTL frame of the FTL table into a nonvolatile storage medium, so that a complete FTL table can be recorded in the solid state disk log.
In this way, the solid state disk is stored one physical page at a time. Even if the solid state disk is powered off, the FTL table can be stored within the limited working time of the standby power supply.
Those skilled in the art will appreciate that in some cases, the complete FTL table is not included in the solid state disk log. For example, for a new or blank solid state disk, with the use of the solid state disk, after an FTL frame is generated by selecting a part of an FTL table 3 times, a power failure occurs, at this time, only the FTL block 1 in the FTL table is valid, and only the FTL block 1 is recorded in a solid state disk log. And identifying valid data frames in the solid state disk log by marking used data blocks and/or unused data blocks in the solid state disk log, so as to rebuild the FTL table when the solid state disk is powered down.
FIG. 6 is a block diagram of a solid state disk log according to another embodiment of the invention. Solid state disk log 610 is stored in a non-volatile storage medium. Referring to fig. 6, solid state disk log 410 includes a plurality of physical pages (physical pages 620, 621, 622 … … 628, 629). The physical page 620 includes FTL frames 1-1, FTL frames 1-2, FTL frames 1-3, and log frames 0-1. The FTL frame has the same size as the log frame. FTL frames 1-1, FTL frames 1-2 … … FTL frames 1-100 accommodate all FTL entries of FTL block 1, and log frames 1-1, 1-2 and 1-3 are log frames belonging to FTL block 1. Solid state disk log 610 also includes other types of frames (other frame 1, other frame 2, and other frame 3).
Each FTL frame further comprises metadata recording the storage location (physical address) of the FTL block to which the FTL frame belongs and the previous FTL frame belonging to the same FTL block. So that multiple FTL frames belonging to the same FTL block are organized into a linked list. Each log frame also includes metadata that 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. Whereby multiple log frames belonging to the same FTL block are organized into a linked list.
In the example of fig. 6, FTL frames 1-1 are the first FTL frame of FTL block 1, FTL frames 1-2 are the 2 nd FTL frame of FTL block 1, and so on, FTL frames 1-100 are the last FTL frame of FTL block 1. Multiple FTL frames belonging to the same FTL block can be stored discontinuously in the solid state disk log 610. When other types of frames with high priority appear, the frames can be stored in the solid state disk log in time. Log frame 0-1 is the first log frame for FTL block 0 (not shown in fig. 6), log frame 1-1 is the first log frame for FTL block 1, log frames 1-2 are the 2 nd log frame for FTL block 1, and log frames 1-3 are the 3 rd log frame for FTL block 1. The entries in the log frame are arranged in the order of generation.
Fig. 7 is a flowchart of a solid state disk log generation method according to still another embodiment of the present invention. According to the embodiment of fig. 7, a solid state disk log 610 as shown in fig. 6 is generated.
When the FTL table is updated, the corresponding relation between the logical address and the physical address of the updated FTL table entry is recorded (710). Optionally the FTL tables are updated accordingly. And caching the recorded corresponding relation between the logical address and the physical address, wherein the corresponding relation between each logical address and the physical address forms a 'write' log entry. A certain number of "write" log entries constitutes a log frame. A "write" log entry in the same log frame records updates to the FTL entries of the same FTL block. When the corresponding relation of a plurality of cached logical addresses and physical addresses can form a log frame, the log frame is generated by using a plurality of cached 'write' log entries, and the FTL block (720) which belongs to the log frame is marked in the log frame (see fig. 6 and 7, for example, log frames 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. Referring to FIG. 6, log frame 0-1 is the first log frame of FTL block 0 (not shown in FIG. 6), and its previous log frame is marked as not present in log frame 0-1.
One of a plurality of FTL blocks (e.g., FTL block 1) of the FTL table in the memory is also selected to generate the FTL frame (730). The generated one or more FTL frames are written to the non-volatile storage medium together with the log frame (740). In the example of fig. 6, a combination of 3 FTL frames and 1 log frame occupies one physical page of the nonvolatile storage medium. Step 710 and step 740 are repeatedly executed to write the log frame and the FTL frame into the solid state disk log at any time.
In one example, selecting one of the FTL blocks (e.g., FTL block 1) generates an FTL frame, and writing other FTL blocks to the solid state disk log is avoided as much as possible before completely writing FTL block 1 to the solid state disk log 610, so that the FTL blocks are distributed in the solid state disk log as intensively as possible. However, since the FTL frame includes metadata indicating the previous FTL frame, FTL frames belonging to the same FTL block do not have to be continuously stored in the solid state disk log. Other types of frames (e.g., other frame 1 of fig. 6) or FTL frames of other FTL blocks (e.g., FTL frame 2-1 of fig. 6) can be stored between FTL frames of FTL block 1.
When the storage device is powered on, FTL frames and log frames may be read from the solid state disk log 610 to reconstruct the FTL table. In one example, by reading the complete solid state disk log 610, each FTL block recorded in the solid state disk log 610 and a log frame corresponding to the FTL block are found, and the state of the FTL table before the power of the storage device is turned off is determined. In another example, to speed up the FTL table rebuilding process, storage locations of a first FTL frame and/or a last FTL frame of a plurality of FTL frames of each FTL block and storage locations of a first log frame and/or a last log frame of a plurality of log frames of each FTL block are also recorded in the nonvolatile storage medium. Therefore, when the storage device is powered on, the storage positions of the FTL frames and the log frames of each FTL block can be quickly located, and each FTL block can be recovered without reading the complete solid state disk log 610.
In one embodiment, in response to a power loss to the storage device, the cached log entries are filled to form log frames and written to the solid state disk log, even if the number of cached log entries is insufficient to form log frames. And recording storage locations of a first FTL frame and/or a last FTL frame of the plurality of FTL frames of each FTL block and storage locations of a first log frame and/or a last log frame of the plurality of log frames of each FTL block in the nonvolatile storage medium. Referring back to fig. 6, in the solid state disk log, 100 FTL frames of the FTL block 1 are completely recorded; thus, in response to a power loss to the storage device, the storage locations of FTL frames 1-1 and/or FTL frames 1-100 and the storage locations of log frames 1-1 and/or log frames 1-3 are recorded in the non-volatile storage medium to recover FTL block 1 from the solid state disk log. For example, when power is down, 100 FTL frames of FTL block 2 are not completely recorded, but updates to FTL block 2 are completely recorded in log frames, in this case, FTL frame 2-1, FTL frame 2-2, FTL frame 2-3, FTL frame 2-7, FTL frame 2-8, and FTL frame 2-9 recorded in solid state disk 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 that are not recorded in log frame 2-1 may be marked as unallocated when reconstructing. In another example, a plurality of complete FTL blocks 2 (each FTL block 2 includes 100 FTL frames) and incompletely recorded FTL blocks 2 are recorded in the solid state disk log 610, and the storage locations of the first and/or last FTL frames of the latest complete FTL block 2 are recorded in the nonvolatile storage medium in response to the power down of the storage device and used for FTL reconstruction.
Fig. 8 is a flow chart of a device booting method according to an embodiment of the present invention. The method according to the embodiment of fig. 8 may be implemented by a solid state disk, or may be implemented by a host accessing the solid state disk. At startup of a device such as a solid state drive, the FTL tables need to be rebuilt.
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 rebuilt from the solid state disk log. FTL blocks to be reconstructed are determined (800). For example, starting from the first FTL block. Alternatively, the memory region to be accessed first after the memory system is started (e.g., the memory region of the host memory operating system) is estimated, and the FTL blocks corresponding to this memory region are loaded preferentially. Or, the logical address or the corresponding FTL block that was accessed first since the last time or the previous solid state disk was started is stored in the solid state disk (e.g., in the solid state disk log) and used as a basis for selecting the FTL block to be rebuilt preferentially. When the solid state disk is powered on, the stored logical address (es) or FTL block is obtained. When the logical address which is accessed first after the solid state disk is started is stored, the FTL block is selected, so that the logical address range of the selected FTL block comprises the logical address which is accessed first.
In another example, FTL blocks corresponding to IO requests received by a storage device (FTL blocks containing logical addresses requested by the received IO requests) are identified and loaded preferentially.
In still another example, after the device is booted, the FTL table is rebuilt in order of FTL block addresses. When the FTL block 3 is rebuilt, an IO request from the host to access the logical address corresponding to the FTL block 5 is received, the rebuilding operation of the FTL block 3 is suspended, the rebuilding of the FTL block 5 is started, after the FTL block 5 is rebuilt, the IO request is responded, and then the previously interrupted FTL table sequential rebuilding operation is resumed.
In still another example, after the device is started, the FTL table is rebuilt in a predictive manner, and when the FTL block to be accessed next is predicted to be the FTL block 2, the FTL block 2 is rebuilt. At this time, if an IO request from the host to access the logical address corresponding to the FTL block 5 is received, the rebuilding operation of the FTL block 2 is suspended, the rebuilding of the FTL block 5 is started, after the FTL block 5 is rebuilt, the IO request is responded, and then the FTL block to be rebuilt is predicted again, and the rebuilding operation is performed.
To reconstruct the FTL blocks, FTL frames and/or log frames (if present) of a specified FTL block (e.g. FTL block 1) are obtained from a predetermined location in the non-volatile storage medium at the storage location of the solid state disk log (810). According to an embodiment of the present invention, the storage location of the last 1 FTL frame of FTL block 1 and the storage location of the last 1 log frame of FTL block 1 are recorded in the nonvolatile storage medium.
All FTL frames belonging to FTL block 1 are read from the solid state disk log in this way (820) by reading the FTL frame from the storage location of the last 1 FTL frame of FTL block 1, and acquiring the storage location of the first 1 FTL from the read FTL frame and reading the first 1 FTL frame. And if the log frame belonging to the FTL block exists, reading the log frame from the storage position of the last 1 log frame of the FTL block 1, and acquiring the storage position of the first 1 log frame from the read log frame, so as to read all the log frames belonging to the FTL block 1 from the solid state disk log.
And writing each read FTL frame into a memory according to the position of the FTL frame in the FTL block 1 as part of the FTL block 1. All FTL frames belonging to FTL block 1 are put into 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 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 requires following a specified order. For example, FTL block 1 is updated in the reverse order of the order in which log entries in log frames are generated. First, the last 1 log frame belonging to FTL block 1 is obtained from the solid state disk log, and a plurality of log entries in the last log frame are updated to FTL block 1 in the order from back to front. Updating the FTL block with log entries means that the physical address of the indexed entry in FTL block 1 is replaced with the logical address in log entries as an index. Next, the second to last log frame belonging to FTL block 1 is obtained and FTL block 1 is updated with the log entries therein.
Since there may be multiple entries in the log entry with the same logical address, and the last entry of these entries records the latest content of the corresponding FTL entry, it is to be avoided to replace the new content by the old content of the FTL entry when the FTL block 1 is updated. For this purpose, during the process of rebuilding the FTL block 1, a flag is set for each updated FTL entry, and during the subsequent rebuilding process, if there is a flag on the FTL entry to be updated by the log entry, the log entry is ignored (i.e., the log entry is not used to update the FTL block). And when all log frames of FTL block 1 are processed, all set flags of FTL block 1 are cleared.
As still another embodiment of the present invention, FTL block 1 is updated in the order in which log entries in log frames are generated, first, a first log frame belonging to FTL block 1 is obtained from a solid state disk log, and a plurality of log entries in the first log frame are updated to FTL block 1 in the order from front to back. Updating the FTL block with log entries means that the physical address of the indexed entry in FTL block 1 is replaced with the logical address in log entries as an index. Next, a second log frame belonging to FTL block 1 is obtained and FTL block 1 is updated with the log entries therein.
After the FTL block 1 is rebuilt, although the complete FTL table is not rebuilt, the IO request for the corresponding logical address range of the FTL block 1 can be responded.
Next, it is determined whether there are any more FTL blocks to be reconstructed (850). If all FTL blocks of the FTL table have been rebuilt, system startup may be completed (860). If there are still not reconstructed FTL blocks, continue to step 800 and determine FTL blocks to be reconstructed.
Fig. 9 is a block diagram of a solid state disk according to an embodiment of the present invention. The memory 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 disk log according to the embodiment of the invention is stored in the log area, and the user data saved by the solid state disk as the storage device is stored in the user data area. FTL frames and log frames from a plurality of FTL blocks are stored in the solid state disk log.
The FTL table is stored in the DRAM, and the portion of the FTL table indicated by hatching in fig. 9 is the FTL table portion that has been updated (e.g., corresponding to FTL frame 1). The log frame 1-1 and the log frame 1-2 stored in the log area record the update of the FTL table. And the log frame 1-1 also stores the address of the FTL frame 1 to which it corresponds, and the log frame 1-2 stores the address of the previous log frame (log frame 1-2) belonging to the FTL frame 1. The FTL table portion indicated by the hatching can thus be obtained by replaying the log frame 1-1 and the updates recorded in the log frame 1-2 on the FTL table portion indicated by the FTL frame 1.
In the example of fig. 9, FTL frames of respective FTL blocks and addresses of log frames in a log area are stored in a boot page of a NAND flash memory. Optionally, FTL frames belonging to the same FTL block are organized into a linked list, log frames belonging to the same FTL block are also organized into a linked list, and a start page stores the FTL frame linked list of each FTL block and the head address and the tail address of the log frame linked list in the log area. Or storing the storage positions 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 positions of the head node and the tail node of the log frame linked list in the log area in the starting page.
In a further embodiment, a plurality of boot pages are stored in the NAND flash memory for providing a backup of the boot pages or different versions of the boot pages. The storage location (physical address in NAND flash memory) of the valid boot page is also stored in the NOR flash memory. When the solid state disk is electrified, the controller acquires the address of the effective starting page from the NOR flash memory, acquires the effective starting page from the NAND flash memory according to the address, and reconstructs an FTL table in the DRAM according to the FTL frame address and/or the log frame address indicated by the starting page.
FIG. 10 illustrates a schematic diagram of generating a solid state disk log in response to a power down event according to an embodiment of the invention. In the embodiment of FIG. 10, solid state disk log 1010 includes physical page 1020, physical page 1021, physical pages 1022, … …, physical page 1028, and physical page 1029. Upon power loss, physical pages 1022 have been written to the non-volatile storage medium. After power failure, the power supply time of the standby power supply is limited, the proportion of FTL frames written into physical pages and log frames is changed for storing the latest state of the FTL table in a nonvolatile storage medium within the limited time, and the occupation ratio of the log frames is increased. In the example of fig. 10, after a power loss occurs, physical pages 1028 and 1029 are completely filled with log frames and FTL frames are not written any more, so that as many log frames as possible are written to the non-volatile storage medium.
During the standby power supply, even if the FTL frame is not written even if the log frame is completely written, the log frame that can be written to the nonvolatile storage medium is limited. In one embodiment according to the present invention, to ensure that updates to the FTL table can be saved to the non-volatile storage medium, the number of buffered log entries is determined according to the number of log frames that can be written to the non-volatile storage medium during standby power supply. For example, if the backup power supply is capable of supporting writing N log frames to the non-volatile storage medium, the total number of buffered log entries does not exceed the number of log entries held by the N log frames. Further, since the log frames correspond to FTL blocks, the number of log frames does not exceed N. If N log frames in memory have been filled with log entries, generation of new log frames and, optionally, response to operations (e.g., write commands, erase commands, Trim commands, etc.) requiring updates to FTL table entries is suspended prior to writing one or more of the log frames to the non-volatile storage medium.
In yet another embodiment according to the present invention, the ratio of FTL frames to log frames is adjusted not only in response to a power down event, but also for other reasons. For example, when a write command frequently occurs, a large number of log entries are cached in the memory, and the ratio of FTL frames to log frames in the physical page of the solid state disk log is adjusted to write the log entries into the nonvolatile storage medium as soon as possible.
Wherein, in response to the occurrence of the abnormal event, storing an address of a last FTL table data frame of each FTL block in the NVM and an address of a last log frame in the NVM in a boot page of the NVM or storing a physical page address of a last FTL table data frame group of each FTL block in the NVM and a physical page address of a last log frame group in the NVM in the boot page of the NVM, wherein the FTL table data frame groups are a plurality of FTL frames stored on a same NVM physical page and the log frame groups are a plurality of log frames stored on a same NVM physical page.
Fig. 11A and 11B are schematic diagrams illustrating FTL block update according to another embodiment of the present invention.
Referring to FIG. 11A, solid state disk log 1110 includes a plurality of physical pages (physical pages 1120, 1121, 1122 … … 1128, 1129). The physical page 1120 includes FTL frame 1-1, FTL frame 1-2, FTL frame 1-3, and log frame 1-1. The FTL frame has the same size as the log frame. FTL frames 1-1, FTL frames 1-2 … … FTL frames 1-6 accommodate all FTL entries (6 FTL frames) of FTL block 1, and log frames 1-1, log frames 1-2 … … log frames 1-10 are log frames belonging to FTL block 1. Frames belonging to other FTL blocks (e.g., FTL frame 2 belonging to FTL block 2, FTL frame 3 belonging to FTL block 3) are also included in solid state disk log 1110.
After writing physical pages 1128 to the nonvolatile storage device, log frames 1-10 are again generated and prepared for writing log frames 1-10 to the nonvolatile storage device (see FIG. 11A, indicated by "current time"). At this point, it is necessary to choose from which FTL block to generate FTL frame (or other data that needs to be persisted). In an embodiment according to the present invention, the number of log frames belonging to each FTL block is compared. In the example of fig. 11A, in the solid state disk log 1110, there are 9 log frames belonging to FTL block 1 and 1 log frame belonging to FTL block 2. It is advantageous to generate FTL frames from FTL blocks that have a large number of log frames. When an FTL block is reconstructed from a solid state disk log, the FTL block needs to be updated according to all log frames belonging to the FTL block. Thus, an increase in the number of log frames will slow the FTL block reconstruction speed, and an increase in the number of log frames will also result in a larger solid state disk log storage space.
Returning to fig. 11A, at the current time, it is determined that an FTL frame is generated from FTL block 1 to update FTL block 1 in the solid state disk log. Updating FTL block 1 in the solid state disk log means writing new FTL block 1 into the solid state disk log 1110 in case that FTL frame including complete FTL block 1 already exists in the solid state disk log 1110. When the new FTL block 1 is completely written into the solid state disk log 1110, the old FTL block 1 may be deleted from the solid state disk log.
In order to update the FTL block 1 in the solid state disk log, FTL frames 1-1, FTL frames 1-2 and FTL frames 1-3 belonging to the FTL block 1 are generated from the FTL block 1 in the memory, and form a physical page 1129 together with the log frames 1-10, and are written to the nonvolatile storage medium. At this time, if the FTL block 1 needs to be rebuilt due to power failure, the FTL block 1 can be recovered only by reading the physical page 1120 and the physical page 1121 from the solid state disk log 1110 to obtain the FTL frames 1-1 to 1-6, and the FTL block 1 is updated according to the log frames 1-1 to 1-10. Therefore, if power is lost after the physical page 1129 is written into the nonvolatile memory, it is also necessary to record the storage location of the last FTL frame belonging to the FTL block 1 as the location of the FTL1-6 in the physical page 1121, and the storage location of the last log frame belonging to the FTL block 1 as the storage location of the log frames 1-10 in the physical page 1129 in the nonvolatile memory.
Similarly, if a power failure occurs at the "current time" in FIG. 11A, it is necessary to record in the nonvolatile memory that the storage location of the last FTL frame belonging to the FTL block 1 is the location of the FTL1-6 in the physical page 1121, the storage location of the last log frame belonging to the FTL block 1 is the storage location of the log frames 1-9 in the physical page 1128, and the storage location of the 1 st log frame belonging to the FTL block 1 is the storage location of the log frames 1-1 in the physical page 1120. In another example, the number of FTL frames belonging to FTL block 1 can be known (e.g., 6), so that all FTL frames belonging to FTL block 1 are obtained by tracing back 5 FTL frames forward from the last FTL frame (FTL1-6) of FTL block 1 without recording the storage location of the 1 st FTL frame of FTL block 1.
Referring to fig. 11B, all 6 FTL frames belonging to FTL block 1 have been stored in physical page 1129 and physical page 1130. And log frames 1-11 record the last log updated for FTL block 1 before writing to physical page 1130. At this time, if it is necessary to rebuild the FTL block 1, it is only necessary to read out the FTL frames 1 to 6 from the physical pages 1129 and 1130 and obtain logs of updates to the FTL block 1 during the generation of the physical pages 1129 and 1130, which are recorded in the log frames 1-10 and the log frames 1-11. Therefore, if a power failure occurs at this time, it is necessary to record in the nonvolatile memory that the storage location of the last FTL frame belonging to FTL block 1 is the location of FTL1-6 in physical page 1130, and that the storage location of the last log frame belonging to FTL block 1 is the storage location of log frames 1-11 in physical page 1130. Further, it is also recorded that the storage location of the 1 st FTL frame belonging to the FTL block 1 is the location of the FTL1-1 in the physical page 1129, and the storage location of the 1 st log frame belonging to the FTL block 1 is the storage location of the log frames 1-10 in the physical page 1129.
At this time, the FTL frames stored in the physical page 1120 and the physical page 1121 may be deleted, and the log frames 1-1 to 1-9 may also be deleted. These memory spaces can be erased and used to store other data.
There may be multiple strategies for selecting from which FTL block to generate FTL frames (or other data that needs to be persisted). The FTL blocks correspond to a logical address space. In the event that write operations to certain logical address spaces are known or identified more frequently, updates to the FTL blocks corresponding to such logical address spaces may be preferred to reduce the number of log frames for these FTL blocks. Or it is known or recognized that certain logical address spaces are read more frequently or are read-only areas, the update frequency of FTL blocks corresponding to such logical address spaces can be reduced. In addition to FTL blocks, other types of data can be written into the nonvolatile memory device according to the method provided by the embodiment of the present invention, for example, a bad block table in the memory device. In general, the bad block table information is updated less frequently, and data frames to be written into the solid state disk logs are generated for the bad block table information with lower priority. For another example, if the reliability requirement of some data is not high, the data frame to be written to the solid state disk log may be generated for it with the lowest priority.
Fig. 12 is a block diagram of another solid state disk according to an embodiment of the present invention. The memory 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 disk log according to the embodiment of the invention is stored in the log area, and the user data saved by the solid state disk as the storage device is stored in the user data area. The solid state disk log stores FTL frames and log frames from a plurality of FTL blocks and NVRAM block frames and NVRAM log frames from a plurality of NVRAM blocks.
FTL tables are stored in DRAM, and NVRAM is provided by DRAM. NVRAM is a storage area in DRAM of a solid state disk; the host can access an NVRAM (Non-Volatile RAM) storage area in a mode of accessing the memory; although NVRAM storage is provided by DRAM, NVRAM appears to the host to be non-volatile; in a manner similar to recording FTL tables, the storage device records NVRAM blocks and updates to NVRAM into NVM; therefore, even if power failure occurs, the content of the NVRAM can be recovered from the NVM, and the nonvolatile characteristic is realized. In the present invention, the NVRAM is also partitioned, and the partitioning strategy is the same as that of the FTL table.
In fig. 12, the portion of NVRAM indicated by shading is an NVRAM portion that has been updated (e.g., corresponding to NVRAM block 1). NVRAM frame 1, NVRAM frame 2, and (NVRAM) log frame 1-1, (NVRAM) log frame 1-2 are stored in the log area. NVRAM frame 1 and NVRAM frame 2 constitute NVRAM block 1, and log frame 1-1 and log frame 1-2 record updates to NVRAM block 1 of the NVRAM. Optionally, NVRAM log frame 1-1 also stores the identity of its corresponding NVRAM block 1, while NVRAM log frame 1-2 stores the address of the previous NVRAM log frame (NVRAM log frame 1-1) that also belongs to NVRAM block 1. The portion of NVRAM indicated by the shading can be obtained by replaying the updates recorded in NVRAM log frames 1-1 and 1-2 on NVRAM block 1 (or, alternatively, by updating NVRAM block 1 with NVRAM log frames 1-1 and 1-2).
In a further embodiment, a plurality of boot pages are stored in the NAND flash memory for providing a backup of the boot pages or different versions of the boot pages. The storage location (physical address in NAND flash memory) of the valid boot page is also stored in the NOR flash memory. When the solid state disk is electrified, the controller acquires the address of the effective starting page from the NOR flash memory, acquires the effective starting page from the NAND flash memory according to the address, and rebuilds the NVRAM in the DRAM according to the NVRAM frame address of the NVMRAM block and/or the NVRAM log frame address indicated by the starting page.
Fig. 13 is a block diagram of a structure of an NVRAM according to an embodiment of the present invention. Solid state disk log 1310 is stored in a non-volatile storage medium. Referring to FIG. 13, solid state disk log 1310 includes a plurality of physical pages ( physical pages 1320, 1321, 1322 … … 1328, 1329). NVRAM frames 1-1, NVRAM frames 1-2, NVRAM frames 1-3, and NVRAM log frames 0-1 are included in physical pages 1320. The NVRAM frame has the same size as the NVRAM log frame. NVRAM frame 1-1, NVRAM frame 1-2 … … NVRAM frame 1-100 holds all the contents of NVRAM block 1, NVRAM log frame 1-2 and NVRAM log frame 1-3 are NVRAM log frames belonging to NVRAM block 1. Solid state disk log 1310 also includes other types of frames (other frame 1, other frame 2, and other frame 3). In the example of fig. 13, a combination of 3 NVRAM frames and 1 NVRAM log frame occupies one physical page of the non-volatile storage medium.
Optionally, each NVRAM frame also includes metadata that records the storage location (physical address on the non-volatile storage medium) of the previous NVRAM frame that belongs to the same NVRAM block as the NVM frame. Further, the metadata also includes an NVRAM block to which the NVRAM frame belongs. Such that multiple NVRAM frames belonging to the same NVRAM block are organized into a linked list. Each NVRAM log frame also includes metadata that records the storage location (physical address) of the NVRAM block to which the NVRAM log frame belongs and the previous NVRAM log frame belonging to the same NVRAM block. Such that multiple NVRAM log frames belonging to the same NVRAM block are organized into a linked list.
In the example of FIG. 13, NVRAM frame 1-1 is the first NVRAM frame of NVRAM block 1, NVRAM frame 1-2 is the 2 nd NVRAM frame of NVRAM block 1, and so on, NVRAM frame 1-100 is the last NVRAM frame of NVRAM block 1. Multiple NVRAM frames belonging to the same NVRAM block may be stored discontinuously in solid state disk log 1310. When other types of frames with high priority appear, the other types of frames can be stored in the solid state disk log in time. NVRAM log frame 0-1 is the first NVRAM log frame for NVRAM block 0 (not shown in fig. 13), NVRAM log frame 1-1 is the first NVRAM log frame for NVRAM block 1, NVRAM log frame 1-2 is the 2 nd NVRAM log frame for NVRAM block 1, NVRAM log frame 1-3 is the 3 rd NVRAM log frame for NVRAM block 1. The entries in the log frame are arranged in the order of generation.
Fig. 14 is a block diagram of a structure of an NVRAM according to another embodiment of the present invention. The NVRAM1410 is stored in a nonvolatile storage medium. Referring to FIG. 14, solid state disk log 1410 includes a plurality of physical pages ( physical pages 1420, 1421, 1422 … … 1430, 1431). The physical page 1420 includes FTL frames 1-1, FTL frames 1-2, FTL frames 1-3, and log frames 0-1. The FTL frame has the same size as the log frame. Physical page 1421 includes NVRAM frame 1-1, NVRAM frame 1-2, NVRAM frame 1-3, and NVRAM log frame 0-1. The NVRAM frame has the same size as the NVRAM log frame. NVRAM frame 1-1, NVRAM frame 1-2 … … NVRAM frame 1-100 holds all the contents of NVRAM block 1, NVRAM log frame 1-2 and NVRAM log frame 1-3 are NVRAM log frames belonging to NVRAM block 1. Solid state disk log 1410 also includes other types of frames (e.g., other frame 1, other frame 2, and other frame 3).
In the example of FIG. 14, NVRAM frame 1-1 is the first NVRAM frame of NVRAM block 1, NVRAM frame 1-2 is the 2 nd NVRAM frame of NVRAM block 1, and so on, NVRAM frame 1-100 is the last NVRAM frame of NVRAM block 1. Multiple NVRAM frames belonging to the same NVRAM block may be stored discontinuously in solid state disk log 1410. In the example of fig. 14, FTL frames 1-1 are the first FTL frame of FTL block 1, FTL frames 1-2 are the 2 nd FTL frame of FTL block 1, and FTL frames 1-3 are the last FTL frame of FTL block 1. Multiple FTL frames belonging to the same FTL block can be stored discontinuously in the solid state disk log 1410 as well. When the NVRAM frame is high-priority, the NVRAM frame is preferentially stored in the solid state disk log 1410, when the FTL frame is high-priority, the NVRAM frame is preferentially stored in the solid state disk log 1410, and when other types of frames with higher priority appear, the NVRAM frame can be timely stored in the solid state disk log according to the priority order.
Fig. 15 is a flowchart of a solid state disk log generation method according to still another embodiment of the present invention. According to the embodiment of FIG. 15, a solid state disk log 1310 as shown in FIG. 13 is generated.
Upon updating the NVRAM, the address of the NVRAM memory location being updated and the memory location contents are recorded (1510). The NVRAM is optionally updated accordingly. The address of the NVRAM storage unit may be a physical address of the DRAM or an address of the NVRAM visible to the host. And caching the recorded address and the content of the storage unit, wherein each pair of the address and the content of the storage unit forms an NVRAM log entry. The number of NVRAM log entries constitutes one NVRAM log frame. NVRAM log entries in the same log frame record updates to the same NVRAM block. When the cached pairs of addresses and storage unit contents can constitute one NVRAM log frame, an NVRAM log frame is generated with the cached plurality of NVRAM log entries (1520). Optionally, the NVRAM block to which it belongs is marked in an NVRAM log frame (see fig. 13, e.g., log frames 0-1). Optionally, the storage location of a previous NVRAM log frame belonging to the same NVRAM block as the NVRAM log frame is also marked in the NVRAM log frame. Referring to fig. 13, NVRAM log frame 0-1 is the first NVRAM log frame of NVRAM block 0 (not shown in fig. 13), in which NVRAM log frame 0-1 it is marked that its previous NVRAM log frame is not present.
One of a plurality of NVRAM blocks (e.g., NVRAM block 1) of NVRAM in memory is also selected to generate an NVRAM frame (1520). The generated one or more NVRAM frames are written to a non-volatile storage medium along with NVRAM log frames 1540. Step 1510 and 1540 are repeated to write the NVRAM log frame and the NVRAM frame into the solid state disk log at any time.
In one example, selecting one of the NVRAM blocks (e.g., NVRAM block 1) generates an NVRAM frame, and attempting to avoid writing frames of other NVRAM blocks or frames of other blocks to the NVRAM before completely writing NVRAM block 1 to solid state disk log 1310 (see fig. 13) such that NVRAM frames of the same NVRAM block are distributed as centrally as possible in solid state disk log 1310. However, since the NVRAM frame includes metadata indicating a previous NVRAM frame, NVRAM frames belonging to the same NVRAM block do not have to be stored contiguously in the solid state disk log. Other types of frames (e.g., other frame 1 of fig. 13 or FTL frame 1-1 of fig. 14) or NVRAM frames of other NVRAM blocks (e.g., NVRAM frame 2-1 of fig. 13) may be stored between NVRAM frames of NVRAM block 1.
Upon power up of the storage device, the NVRAM frames and NVRAM log frames may be read from solid state disk log 1310 to rebuild the NVRAM. In one example, by reading the complete solid state disk log 1310, each NVRAM frame recorded in the solid state disk log 1310 and the NVRAM log frame corresponding thereto are found, and the state of the NVRAM is determined before the power of the storage device is lost. In another example, to expedite the NVRAM rebuilding process, storage locations of a first NVRAM frame and/or a last NVRAM frame of the plurality of NVRAM frames of the respective NVRAM block and storage locations of a first NVRAM log frame and/or a last NVRAM log frame of the plurality of NVRAM log frames of the respective NVRAM block are also recorded in the non-volatile storage medium. Thus, at power up of the storage device, the storage locations of the NVRAM frames and NVRAM log frames of the respective NVRAM blocks can be quickly located and the respective NVRAM blocks can be restored without reading the complete solid state disk log 1310.
In one embodiment, in response to a power down of the storage device, the cached NVRAM log entries are filled to form an NVRAM log frame and written to the solid state disk log, even if the number of cached NVRAM log entries is insufficient to form the NVRAM log frame. And recording, in the non-volatile storage medium, storage locations of a first NVRAM frame and/or a last NVRAM frame of the plurality of NVRAM frames of the respective NVRAM block, and storage locations of a first NVRAM log frame and/or a last NVRAM log frame of the plurality of NVRAM log frames of the respective NVRAM block. Referring back to fig. 13, in solid state disk log 1310, 100 NVRAM frames of NVRAM block 1 are completely recorded. Thus, in response to a power loss of the storage device, the storage locations of NVRAM frame 1-1 and/or NVRAM frame 1-100 and the storage locations of NVRAM log frame 1-1 and/or NVRAM log frame 1-3 are recorded in the non-volatile storage medium to recover NVRAM block 1 from solid state disk log 1310. In another example, upon power down, 100 NVRAM frames of NVRAM block 2 have not been completely recorded, but all updates to NVRAM block 2 have been completely recorded in NVRAM log frames, in which case NVRAM block 2 is not reconstructed using NVRAM frames 2-1, NVRAM frames 2-2, NVRAM frames 2-3, NVRAM frames 2-7, NVRAM frames 2-8, NVRAM frames 2-9 recorded in solid state disk log 1310, but NVRAM block 2 is reconstructed using only NVRAM log frame 2-1 belonging to NVRAM block 2, while other portions of NVRAM block 2 not recorded in NVRAM log frame 2-1 may be marked as unused or set to an initial value upon reconstruction. In another example, multiple complete copies of NVRAM block 2 (each NVRAM block 2 comprising 100 NVRAM frames) are recorded in solid state disk log 1310 with incompletely recorded NVRAM block 2, and in response to a power failure of the storage device, the storage locations of the first NVRAM frame and/or the last NVRAM frame of the latest complete copy of NVRAM block 2 are recorded in the non-volatile storage medium and used for reconstruction of NVRAM block 2.
Fig. 16 is a flow chart of a device booting method according to an embodiment of the present invention. The method according to the embodiment of fig. 16 may be implemented by a solid state disk, or may be implemented by a host accessing the solid state disk. Upon startup of a device, such as a solid state disk, the NVRAM needs to be rebuilt.
In an embodiment in accordance with the invention, the NVRAM is divided into a plurality of NVRAM blocks, each being reconstructed independently from the NVRAM. An NVRAM block to be reconstructed is determined (1600). For example, the reconstruction starts from the first NVRAM block. Alternatively, an area in which the NVRAM is accessed first after the storage system is started is estimated, and an NVRAM block corresponding to the area is preferentially loaded. In another example, an NVRAM block corresponding to an NVRAM access request received by the storage device (an NVRAM block having an address requested by the received access request) is identified and the portion of the NVRAM block is preferentially loaded.
Next, the NVRAM frame of the designated NVRAM block (e.g., NVRAM block 1) and/or the storage location of the NVRAM log frame (if present) in the solid state disk log are retrieved from a predetermined location in the non-volatile storage medium (1610). According to one embodiment of the invention, the storage locations of the last 1 NVRAM frame of NVRAM block 1 and the storage locations of the last 1 NVRAM log frame of NVRAM block 1 are recorded in the non-volatile storage medium.
All NVRAM frames belonging to NVRAM block 1 are read from the solid state disk log in such a way that NVRAM frames are read from the storage locations of the last 1 NVRAM frame of NVRAM block 1, and the storage locations of the first 1 NVRAM frames are acquired from the read NVRAM frames and the first 1 NVRAM frames are read (1620). And if an NVRAM log frame belonging to the NVRAM block 1 exists, reading the NVRAM log frame from the storage position of the last 1 NVRAM log frame of the NVRAM block 1, acquiring the storage position of the first 1 NVRAM log frame from the read NVRAM log frame, and reading all NVRAM log frames belonging to the NVRAM block 1 from the solid-state hard disk log in such a way.
Each NVRAM frame read is written to memory as part of NVRAM block 1 as it is located in NVRAM block 1. All NVRAM frames belonging to NVRAM block 1 are put into memory to form the basic contents of NVRAM block 1 (1630). Next, if there is an NVRAM log frame belonging to NVRAM block 1, NVRAM block 1 in the memory is also updated with the NVRAM log frame to complete the reconstruction of NVRAM block 1 (1640). Updating NVRAM block 1 with NVRAM log frames requires following a specified order. In one example, NVRAM block 1 is updated in the reverse order of the order in which log entries in the NVRAM log frame were generated. First, the last 1 NVRAM log frame belonging to NVRAM block 1 is obtained from the solid-state disk log, and a plurality of NVRAM log entries in the last NVRAM log frame are updated to NVRAM block 1 in order from the back to the front in generation time. Updating the NVRAM block with NVRAM log entries means that the contents of the indexed memory cells in NVRAM block 1 are replaced with the memory cell contents of the NVRAM log entries, using the addresses in the NVRAM log entries as the index. Next, the second to last NVRAM log frame belonging to NVRAM block 1 is acquired and NVRAM block 1 is updated with its NVRAM log entries.
After the rebuilding of the NVRAM block 1 is completed, an NVRAM access request to the address range corresponding to the NVRAM block 1 may be responded.
Since there may be multiple entries in the NVRAM log entry with the same address, and the last of these entries states the latest content of the corresponding NVRAM entry, the new content is to be avoided from being replaced by the old content of the NVRAM entry when NVRAM block 1 is updated. To this end, during rebuilding of NVRAM block 1, a flag is set for each NVRAM storage unit that is updated, and during subsequent rebuilds, if a flag exists on an NVRAM storage unit that is to be updated by an NVRAM log entry, the NVRAM log entry is ignored (i.e., the NVRAM block is not updated using the NVRAM log entry). And when all log frames of NVRAM block 1 have been processed, all set flags of NVRAM block 1 are cleared.
Next, it is determined whether there are more NVRAM blocks to be reconstructed (1650). If all NVRAM blocks of the NVRAM have been rebuilt, the rebuilding process of the NVRAM is complete (1660). If there are still unrequired NVRAM blocks, proceed to step 1600 and determine the NVRAM blocks to be reconstructed.
Fig. 17 is a block diagram of a solid state disk according to still another embodiment of the present application. The solid state disk comprises a control part, a NAND flash memory and a DRAM. The control unit is coupled to the NAND flash memory and the DRAM, respectively. The NAND flash memory includes a log area and a user data area. The solid state disk log according to the embodiment of the application is stored in the log area, and the user data stored by the solid state disk as the storage device is stored in the user data area. FTL frames and log frames from a plurality of FTL blocks are stored in the solid state disk log. The control component includes a plurality of CPUs, shown in fig. 17 as CPU0, CPU1, and CPU 2.
The solid state disk log comprises FTL frames and log frames. In fig. 17, the b-th FTL frame of the FTL block a is indicated by "FTL frames a-b". The b-th log frame of FTL block a is indicated by "log frames a-b". Optionally, the FTL frame has the same size as the log frame. In fig. 17, FTL frames 1-1 and FTL frames 1-2 … … FTL frames 1-6 contain all FTL frames of FTL block 1, and log frames 1-1 and 1-2 are log frames belonging to FTL block 1. FTL frames 2-1 to FTL frames 2-6 are all FTL frames of FTL block 2, and log frame 2-1 is a log frame belonging to FTL block 2. Log frame 0-1 is a log frame belonging to FTL block 0 (not shown).
Optionally, FTL frames belonging to the same FTL block are stored on consecutive physical pages, so that consecutive read operations on multiple physical pages obtain FTL frames belonging to the same FTL block. And simultaneously storing the FTL frame and the log frame in the physical page, and storing the FTL frame and the log frame in the appointed address range of the physical page.
Optionally, each FTL frame further comprises metadata recording the storage location (physical address) of the FTL block to which the FTL frame belongs and the previous FTL frame belonging to the same FTL block. So that multiple FTL frames belonging to the same FTL block are organized into a linked list. Each log frame also includes metadata that 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. Whereby multiple log frames belonging to the same FTL block are organized into a linked list.
In the example of fig. 17, FTL frames 1-1 are the first FTL frame of FTL block 1, FTL frames 1-2 are the 2 nd FTL frame of FTL block 1, and so on, FTL frames 1-6 are the last FTL frame of FTL block 1. Multiple FTL frames belonging to the same FTL block can be stored continuously or discontinuously in the solid state disk log. Log frame 0-1 is the first log frame for FTL block 0 (not shown in fig. 17), log frame 1-1 is the first log frame for FTL block 1, and log frame 1-2 is the 2 nd log frame for FTL block 1. The entries in the log frame are arranged in the order of generation.
To rebuild the FTL table, FTL block 1 and FTL block 2 acquired from the log area are stored in the DRAM. All FTL frames (e.g., FTL frame 1-1 to FTL frame 1-6) belonging to FTL block 1 are read from the log area of the NAND flash memory and stored to the DRAM to form FTL block 1. All FTL frames (e.g., FTL frame 2-1 to FTL frame 2-6) belonging to the FTL block 2 are read from the log area of the NAND flash memory and stored to the DRAM to form the FTL block 2. It is to be understood that the FTL table can be divided into a plurality of FTL blocks and stored in the log area. And when the FTL table is rebuilt, acquiring a plurality of FTL blocks from the log area and storing the FTL blocks in the DRAM.
The FTL blocks in the DRAM are updated with FTL entries recorded in the log frame. In fig. 17, the portion of the FTL block indicated by hatching has been updated. A log entry in a log frame records a logical address and a corresponding physical address. The method includes determining FTL entries in the FTL block according to logical addresses of log entries, and updating the determined FTL entries with physical addresses of log entries.
In fig. 17, log frame 1-1 and log frame 1-2 stored in the log area record the update of FTL block 1. And log frame 1-1 also stores the identification of its corresponding FTL block 1, while log frame 1-2 stores the address of the previous log frame (log frame 1-1) which belongs to FTL block 1 with it. Thus, updated FTL block 1 can be obtained by replaying the updates recorded in log frame 1-1 and log frame 1-2 on FTL block 1. Similarly, a log frame belonging to FTL block 2 is acquired from the log area, each log entry is acquired in the reverse order of the order in which the log entries are generated, and FTL block 2 is updated with the log entries.
In the embodiment according to the present application, in order to accelerate the rebuild process of the FTL table, the rebuild of the FTL table is cooperatively and concurrently performed by a plurality of CPUs of the control part. In the FTL table rebuilding process, for each FTL block, the CPU0 reads out a plurality of FTL frames belonging to the FTL block from the log area of the NAND flash memory, stores in the DRAM, forms an FTL block (for example, FTL block 1) in the DRAM, and reads out a plurality of log frames belonging to the FTL block from the log area of the NAND flash memory, and stores in the DRAM, forms a log buffer area (for example, log buffer area 1, see fig. 17) in the DRAM. After all log frames for one of the FTL blocks (e.g., FTL block 1) are stored in the log buffer, CPU0 informs CPU1 and updates of the FTL block are processed by CPU 1. Meanwhile, the CPU0 acquires another FTL block (e.g., FTL block 2, see fig. 17) and all log frames belonging to the other FTL block from the NAND flash memory and stores them in the DRAM (e.g., log cache 2, see fig. 17). The CPU0 and the CPU1 may execute in parallel, with the FTL frame and the log frame of one FTL block (e.g., FTL block 2) in the NAND flash memory being stored into the DRAM by the CPU0, and the log frame of another FTL block (e.g., FTL block 1) in the DRAM being updated by the CPU 1. Upon completion of the updates to the FTL blocks, portions of the reconstructed FTL tables are formed.
It is understood that in the embodiment according to the present application, the control section further includes other CPUs (for example, CPU 2). After storing FTL block 2 and its log frame in DRAM, CPU0 instructs CPU2 to process the update of FTL block 2. And the control unit may also include more CPUs, each of which handles updates to one of the FTL blocks in addition to CPU 0.
In the embodiment according to the present application, the process of moving the FTL frame and the log frame in the NAND flash memory to the DRAM is processed by the CPU0, and the process of updating the FTL block according to the log entry of the log frame is processed by other CPUs. Because each FTL block and the log cache thereof are positioned in different storage spaces of the DRAM, the updating of the FTL blocks by a plurality of other CPUs can be processed in parallel, thereby further accelerating the reconstruction process of the FTL table.
Optionally, when the CPU0 acquires a log frame, the address of the next log frame is determined based on the metadata of the current log frame, so that the occupation of the bandwidth of the flash memory channel is low when the log frame is read. To improve bandwidth utilization, CPU0 concurrently obtains log frames for N FTL blocks (N is a positive integer, e.g., 1-4, while the FTL table may include tens or tens of FTL blocks). When other CPUs update the FTL block, a plurality of log entries belonging to the FTL block are accessed from the DRAM, and the FTL block is updated according to the log entries. The FTL table is thus divided into FTL blocks, and each CPU handles updating of one of the FTL blocks. In this way, the task of rebuilding the FTL table is reasonably distributed among all parts of the control component, the waiting time caused by resource conflict is reduced, and the rebuilding process of the FTL table is accelerated.
Further, in the process of updating the FTL blocks by other CPUs, the CPU0 can simultaneously move FTL frames and log frames of other FTL blocks in the NAND flash memory to the DRAM. Thereby further improving the parallelism of the reconstruction process of the FTL table.
The task of rebuilding the FTL table is cooperatively processed by a plurality of CPUs, so that the rebuilding process of the FTL table is accelerated, and the waiting time of a user after the solid state disk is started is reduced.
Fig. 18 is a schematic diagram of an FTL table rebuild process according to an embodiment of the present application. For each FTL block, CPU0 (see also fig. 17) reads out FTL frames constituting the same FTL block (e.g., FTL block 2) from the NAND flash memory and stores in DRAM 1620. The CPU0 also reads out log frames belonging to the FTL block 2 from the NAND flash memory (in the example of fig. 18, log frames 2-1 to 2-M stored in the NAND flash memory are all log frames belonging to the FTL block), and stores these log frames in the DRAM 1610. After FTL block 2 and the log frame belonging to FTL block 2 are both stored in the DRAM, CPU0 instructs CPU1 (see also fig. 17) to update FTL block 2 with the log frame belonging to FTL block 2. The CPU0 may then read another FTL block (e.g., FTL block 3, not shown) from the NAND flash memory and, after storing the FTL block 3 and the log frame belonging to the FTL block 3 to the DRAM, instruct the CPU2 to update the FTL block 3 with the log frame belonging to the FTL block 3.
To acquire a log frame belonging to the FTL block (for example, FTL block 2), the CPU0 acquires a last generated log frame (log frame 2-M) (1) belonging to the FTL block 2 from a designated address (1602) of the NAND flash memory. In the metadata of each log frame, the storage address of the previous log frame belonging to the same FTL block as the log frame in the NAND flash memory is recorded. The CPU0 obtains the storage address in the NAND flash memory of the penultimate log frame 2- (M-1) of the FTL block 2 from the last log frame 2-M (1604) (2), and reads out the log frame 2- (M-1) (3) from the location in the NAND flash memory (1604). Similarly, the CPU0 acquires the memory address of the previous log frame belonging to the FTL block 2 from the log frame 2- (M-1) (4), and reads out the log frame from the memory address until the CPU0 reads all the log frames belonging to the FTL block 2 from the NAND flash memory (5-7). The CPU0 stores the read log frame belonging to the FTL block 2 in the DRAM 1610. Subsequently, the CPU0 instructs the CPU1 to start processing the log frame of the FTL block 2.
In response to receiving the instruction of CPU0, CPU1 accesses the log frame belonging to FTL block 2 in DRAM 1610. The CPU1 starts from the first log frame (the earliest generated log frame 2-1) of all log frames belonging to the FTL block 2, extracts a logical address (e.g., LBA z) and a physical address (PBA) recorded in each log entry from the log frame 2-1 (8), finds the FTL table entry in the FTL block 2 according to the logical address, and updates the physical address (PBA) in the FTL table entry corresponding to the logical address LBA z in the DRAM 1620 with the physical address (PBA) recorded in the log entry (9). For all log frames of FTL block 2, the CPU1 updates FTL entries in FTL block 2 with each log entry sequentially from front to back in the order of log frame generation (10-13).
Optionally, the FTL blocks are updated in order from back to front for a plurality of log entries of a plurality of log frames belonging to the same FTL block. Since there may be multiple entries in the log entry with the same logical address, and the last entry of these entries records the latest content of the corresponding FTL entry, the replacement of the new content by the old content of the FTL entry is to be avoided when the FTL block is updated. For this purpose, during the process of rebuilding the FTL block, a flag is set for each updated FTL entry, and during the subsequent rebuilding process, if there is a flag on the FTL entry to be updated by the log entry, the log entry is ignored (i.e., the log entry is not used to update the FTL block). And when all log frames of the FTL block are processed, all set flags of the FTL block are cleared.
In fig. 18, numerals in arrows indicate the order in which operations indicated by the arrows occur. In response to completing a complete update of FTL block 2 (as an example) with the log entry, CPU1 (as an example) notifies CPU 0. So that CPU0 can free log cache 2 for FTL block 2. And may respond to IO commands with FTL block 2.
Alternatively, each CPU of the control unit may include an SRAM or a Cache. In order to update the FTL block with the log entry, the CPU1 or CPU2 loads the log entry from the log Cache in the DRAM to the SRAM or Cache belonging to itself, and identifies the logical address and the physical address indicated by the log entry, and updates the FTL entry of the FTL block in the DRAM with the logical address and the physical address. The SRAM or Cache has a higher access speed (lower latency) than the DRAM, and loading the log entries into the SRAM or Cache is beneficial for speeding up the process of updating the FTL block with the log entries.
Fig. 19 is a flow chart of a plurality of CPUs collaboratively rebuilding an FTL table according to an embodiment of the present application. The method according to the embodiment of fig. 19 may be implemented by a control component of the solid state disk, or may be implemented under the control of a host accessing the solid state disk. At startup of a device such as a solid state drive, the FTL tables need to be rebuilt.
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 rebuilt from the solid state disk log. FTL blocks to be reconstructed are determined by CPU0 (1910). For example, starting from the first FTL block. Alternatively, the memory region to be accessed first after the memory system is started (e.g., the memory region of the host memory operating system) is estimated, and the FTL blocks corresponding to this memory region are loaded preferentially. Or, the logical address or the corresponding FTL block that was accessed first since the last time or the previous solid state disk was started is stored in the solid state disk (e.g., in the solid state disk log) and used as a basis for selecting the FTL block to be rebuilt preferentially. When the solid state disk is powered on, the stored logical address (es) or FTL block is obtained. When the logical address which is accessed first after the solid state disk is started is stored, the FTL block is selected, so that the logical address range of the selected FTL block comprises the logical address which is accessed first.
To rebuild the FTL block, the CPU0 obtains the storage location of the FTL frame of the specified FTL block (e.g. FTL block 1) in the solid state disk log from the predetermined location in the nonvolatile storage medium. According to one embodiment of the present invention, the storage location of the last 1 FTL frame of FTL block 1 is recorded in the nonvolatile storage medium. The CPU0 reads the FTL frame from the storage location of the last 1 FTL frame of the FTL block 1, and acquires the storage location of the first 1 FTL from the read FTL frame and reads the first 1 FTL frame, in this way, reads all FTL frames belonging to the FTL block 1 from the solid state disk log (1912).
Next, the CPU0 also acquires, from a predetermined location in the nonvolatile storage medium, a storage location of a log frame of a specified FTL block (for example, FTL block 1) in the solid state disk log. According to an embodiment of the present invention, the storage location of the last 1 log frame of FTL block 1 is recorded in the nonvolatile storage medium. The CPU0 reads a log frame from the storage location of the last 1 log frame of the FTL block 1, acquires the storage location of the previous 1 log frame from the read log frame, reads all log frames belonging to the FTL block 1 from the solid state disk log in this manner (1914), and stores all the read log frames belonging to the FTL block 1 in the DRAM.
After FTL block 1 and the log frame belonging to FTL block 1 are both stored in the DRAM, to rebuild FTL block 1, CPU0 instructs the rebuilding of FTL block 1 to be processed by CPU 1. CPU1 retrieves log entries belonging to FTL block 1 from DRAM (1920), and updates FTL block 1 with the retrieved log entries (1922). For example, FTL block 1 is updated in the reverse order of the order in which log entries in log frames are generated. First, the last 1 log frame belonging to FTL block 1 is obtained from the solid state disk log, and a plurality of log entries in the last log frame are updated to FTL block 1 in the order from back to front. Updating the FTL block with log entries means that the physical address of the indexed entry in FTL block 1 is replaced with the logical address in log entries as an index. Next, the next log frame belonging to FTL block 1 is obtained and FTL block 1 is updated with the log entries therein.
Next, it is determined whether the FTL block 1 is updated completely (1924), and if the FTL block 1 is updated completely, the reconstruction of FTL block 1 is completed (1926). If FTL block 1 is not updated, then step 1920 is continued and other log frames belonging to FTL block 1 are obtained and FTL block 1 is updated with the log entries therein.
In the embodiment of the present invention, to improve the parallelism of the FTL table rebuilding process, the CPU0 also moves FTL frames and log frames of other FTL blocks (for example, FTL block 2) of the NAND flash memory to the DRAM while the CPU1 rebuilds the FTL block 1.
In the process of updating the FTL block by other CPUs (for example, CPU1 updates FTL block 1), to accelerate the rebuilding process of the FTL table, CPU0 instructs CPU2 to process the rebuilding task of FTL block 2, thereby reducing the waiting time of the user after the solid state disk is started.
The CPU2 acquires a log entry belonging to the FTL block 2 from the DRAM (1930), and updates the FTL block 2 with the acquired log entry (1932). For example, FTL block 2 is updated in the reverse order of the order in which log entries in log frames are generated.
Next, it is determined whether the FTL block 2 is updated (1934), and if the FTL block 2 is updated, the reconstruction of the FTL block 2 is completed (1936). If the FTL block 2 is not updated, step 1930 is continued, and other log frames belonging to the FTL block 2 are obtained, and the FTL block 2 is updated with the log entries therein.
Fig. 20 is a flow diagram of a plurality of CPUs collaboratively rebuilding an FTL table according to yet another embodiment of the present application.
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 rebuilt from the solid state disk log. The FTL blocks to be reconstructed are determined by the CPU0 (2010).
To rebuild the FTL block, the CPU0 obtains the storage location of the FTL frame of the specified FTL block (e.g. FTL block 1) in the solid state disk log from the predetermined location in the nonvolatile storage medium. According to one embodiment of the present invention, the storage location of the last 1 FTL frame of FTL block 1 is recorded in the nonvolatile storage medium. The CPU0 reads the FTL frames from the storage locations of the last 1 FTL frames of the FTL block 1, and acquires the storage locations of the first 1 FTLs from the read FTL frames and reads the first 1 FTL frames, in this way, reads all FTL frames belonging to the FTL block 1 from the solid state disk log (2012).
Next, the CPU0 allocates a storage space in the DRAM (2016) as a log buffer to hold the reconstructed log frame of the FTL block 1 and requests reading of the log frame belonging to the FTL block 1 from a predetermined location of the nonvolatile storage medium (2014). Since each FTL block includes a plurality of log frames, the plurality of log frames need to be read in a certain order. According to an embodiment of the present invention, to read the log frame belonging to the FTL block 1, the CPU0 obtains the storage location of the log frame of the FTL block 1 in the solid state disk log from a predetermined location in the nonvolatile storage medium. Wherein, the storage location of the last 1 log frame of FTL block 1 is recorded in the nonvolatile storage medium. The CPU0 reads the log frame from the storage location of the last 1 log frame of the FTL block 1, and acquires the storage location of the previous 1 log frame from the read log frame, in this way, reads all log frames belonging to the FTL block 1 from the solid state disk log.
In the example of fig. 20, the operation requesting to read the log frame (2014) is asynchronous. After reading the log frame from the flash memory, the CPU0 receives a log frame read completion message (2018). In response to receiving the log frame read completion message, CPU0 stores the read log frame in the DRAM (2020). Optionally, steps 2010 to 2014 may read FTL frames and log frames for a plurality of FTL blocks simultaneously. In particular, step 2014 consumes less flash bandwidth, and increases flash bandwidth utilization by allocating storage space in the DRAM for a plurality of FTL blocks and issuing a plurality of requests to read log frames (performing step 2014 a plurality of times).
Next, the CPU0 determines whether all log frames belonging to the FTL block 1 have been acquired (2022). If all log frames belonging to FTL block 1 have been acquired, CPU0 sends a message to CPU1 to notify CPU1 to update FTL block 1. If all log frames belonging to FTL block 1 have not been acquired (2022), a request is made to read the next log frame belonging to FTL block 1 (2024) according to the address recorded in the read log frame. And step 2024 is also asynchronous, similar to step 2014. After the process of step 2024 is completed, a log frame read completion message is received in response by step 2018. In step 2022, the CPU0 determines whether all log frames belonging to FTL block 1 have been acquired, and if all log frames belonging to FTL block 1 have been acquired, sends a message to the CPU1 instructing the CPU1 to update the FTL block 1 with the log frames.
In response to receiving the notification of the CPU0 (2026), to update the FTL table, the CPU1 acquires a log entry belonging to the FTL block 1 from the DRAM (2028). And updates FTL block 1(2030) with the acquired log entry. Alternatively, if the CPU0 reads the FTL frame and the log frame for a plurality of FTL blocks at the same time, in step 2022, for the FTL blocks that have acquired all log frames, the CPU0 selects one of the plurality of CPUs and instructs the selected CPU to update the FTL block, so that the plurality of CPUs can update their respective FTL blocks at the same time.
Next, it is determined whether the update of FTL block 1 is completed (2032), and if FTL block 1 has been updated, CPU0 is notified, so that CPU0 can release the log buffer allocated for the log frame of FTL block 1 and allocate the log buffer for storing the log frames of other FTL blocks. If FTL block 1 is not updated (2032), the storage location of the next log entry in the DRAM is determined (2034), and step 2028 is continued to obtain other log entries belonging to FTL block 1 to update FTL block 1. In step 2034, in the same log frame, the log entries are arranged in the order of generation, and the storage location of the next log entry is next to the current log entry; and if the current log entry is the last log entry in the log frame, acquiring the next log frame, and acquiring the next log entry of the current log entry from the next log frame.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus (device), or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such 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 intended to include such modifications and variations as well.

Claims (10)

1. A method for fast recovery of FTL tables, comprising:
the first CPU acquires an FTL frame belonging to a first FTL block, acquires a log frame belonging to the first FTL block, and respectively stores the FTL frame belonging to the first FTL block and the log frame in different areas of a memory;
the second CPU obtains the log frame belonging to the first FTL block from the memory and updates the first FTL block by using the log frame;
wherein the FTL block is part of an FTL table, the FTL block comprises a plurality of FTL frames, each log frame belongs to and only belongs to one FTL block.
2. The method of claim 1, further comprising: and responding to the fact that all log frames belonging to the first FTL block are stored in the memory, and sending a message that the reading of all log frames belonging to the first FTL block is completed to the first CPU.
3. The method of claim 1, further comprising: in response to storing all FTL frames and all log frames belonging to a first FTL block in the memory, the first CPU instructs updating of the first FTL block by the second CPU.
4. The method of claim 1, further comprising: in response to storing all log frames belonging to the first FTL block in the memory, the first CPU instructs updating of the first FTL block by the second CPU.
5. The method of claim 3 or 4, wherein the updating of the first FTL block by the second CPU comprises:
the second CPU sequentially extracts log entries from all log frames belonging to the first FTL block in the memory; and
and the second CPU determines an FTL table entry corresponding to the logical address in a first FTL block in the memory according to the logical address recorded in each log entry, and updates the physical address in the determined FTL table entry by using the physical address corresponding to the logical address in the log entry.
6. The method of claim 3 or 4, wherein the updating of the first FTL block by the second CPU comprises:
the second CPU extracts the log entry belonging to the first FTL block from the memory; and
and the second CPU determines an FTL table entry corresponding to the logical address in a first FTL block in the memory according to the logical address recorded in the log entry, and updates the physical address in the determined FTL table entry by using the physical address corresponding to the logical address in the log entry.
7. The method of claim 3, further comprising: in response to storing all FTL frames belonging to the second FTL block and the log frame in the memory, the first CPU instructs updating of the second FTL block by the third CPU.
8. The method of claim 4, further comprising: in response to storing the log frame belonging to the second FTL block in the memory, the first CPU instructs updating of the second FTL block by the third CPU.
9. The method of claim 7 or 8, wherein the operation of the second CPU updating the first FTL block is performed simultaneously with the operation of the third CPU updating the second FTL block.
10. A solid-state storage device is characterized by comprising a control component, an NVM chip and a memory, wherein the control component is respectively coupled to the NVM chip and the memory, the control component comprises a plurality of CPUs, and FTL frames and log frames of a plurality of FTL blocks are stored in a log area in the NVM chip;
when the solid-state storage device is powered on, a first CPU in the CPUs is used for acquiring an FTL frame belonging to a first FTL block from the NVM chip, acquiring a log frame belonging to the first FTL block from a log area in the NVM chip, and respectively storing the FTL frame belonging to the first FTL block and the log frame to different areas of a memory;
the second CPU in the CPUs is used for acquiring the log frame belonging to the first FTL block from the memory and updating the first FTL block by using the log frame;
wherein the FTL block is part of an FTL table, the FTL block comprises a plurality of FTL frames, each log frame belongs to and only belongs to one FTL block.
CN201710126446.2A 2017-03-03 2017-03-03 Method and device for rapidly recovering FTL table Active CN108536619B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710126446.2A CN108536619B (en) 2017-03-03 2017-03-03 Method and device for rapidly recovering FTL table

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710126446.2A CN108536619B (en) 2017-03-03 2017-03-03 Method and device for rapidly recovering FTL table

Publications (2)

Publication Number Publication Date
CN108536619A CN108536619A (en) 2018-09-14
CN108536619B true CN108536619B (en) 2021-12-14

Family

ID=63489194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710126446.2A Active CN108536619B (en) 2017-03-03 2017-03-03 Method and device for rapidly recovering FTL table

Country Status (1)

Country Link
CN (1) CN108536619B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367830B (en) * 2018-12-06 2023-11-14 北京忆恒创源科技股份有限公司 Method for rebuilding FTL table with participation of host and storage device thereof

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101495980A (en) * 2006-07-28 2009-07-29 日本电气株式会社 Cpu connection circuit, data processing device, operation device, and mobile communication terminal and data transfer method using them
CN102760161A (en) * 2012-06-12 2012-10-31 天津神舟通用数据技术有限公司 Log organization structure clustered based on transaction aggregation and method for realizing corresponding recovery protocol thereof
CN103136116A (en) * 2011-12-05 2013-06-05 财团法人工业技术研究院 Memory storage system and central control device, management method and blackout recovery method thereof
CN103201725A (en) * 2010-11-25 2013-07-10 国际商业机器公司 Memory access device for memory sharing among plurality of processors, and access method for same
WO2016069192A1 (en) * 2014-10-27 2016-05-06 Sandisk Enterprise Ip Llc Tracking intermix of writes and un-map commands across power cycles
CN105988726A (en) * 2014-10-31 2016-10-05 株式会社东芝 Storage device and method for processing power disable signal
CN106354615A (en) * 2015-07-21 2017-01-25 北京忆恒创源科技有限公司 Solid state disk log generating method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102043727B (en) * 2009-10-10 2014-04-02 成都市华为赛门铁克科技有限公司 Method and device for recovering solid-state hard disc mapping table
CN102955742A (en) * 2012-10-31 2013-03-06 浪潮集团有限公司 Fast rebuilding method of solid state hard disk address mapping table after system electrification
WO2014155525A1 (en) * 2013-03-26 2014-10-02 株式会社日立製作所 Storage system and control method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101495980A (en) * 2006-07-28 2009-07-29 日本电气株式会社 Cpu connection circuit, data processing device, operation device, and mobile communication terminal and data transfer method using them
CN103201725A (en) * 2010-11-25 2013-07-10 国际商业机器公司 Memory access device for memory sharing among plurality of processors, and access method for same
CN103136116A (en) * 2011-12-05 2013-06-05 财团法人工业技术研究院 Memory storage system and central control device, management method and blackout recovery method thereof
CN102760161A (en) * 2012-06-12 2012-10-31 天津神舟通用数据技术有限公司 Log organization structure clustered based on transaction aggregation and method for realizing corresponding recovery protocol thereof
WO2016069192A1 (en) * 2014-10-27 2016-05-06 Sandisk Enterprise Ip Llc Tracking intermix of writes and un-map commands across power cycles
CN105988726A (en) * 2014-10-31 2016-10-05 株式会社东芝 Storage device and method for processing power disable signal
CN106354615A (en) * 2015-07-21 2017-01-25 北京忆恒创源科技有限公司 Solid state disk log generating method and device

Also Published As

Publication number Publication date
CN108536619A (en) 2018-09-14

Similar Documents

Publication Publication Date Title
US11669444B2 (en) Computing system and method for controlling storage device
US11768632B2 (en) Memory system and method of controlling nonvolatile memory
EP3726364B1 (en) Data write-in method and solid-state drive array
US11467955B2 (en) Memory system and method for controlling nonvolatile memory
CN106354615B (en) Solid state disk log generation method and device
US11947837B2 (en) Memory system and method for controlling nonvolatile memory
CN106874211B (en) Memory system and control method of nonvolatile memory
JP6224253B2 (en) Speculative prefetching of data stored in flash memory
US10468077B2 (en) Adaptive object buffering and meta-data indexing using persistent memory to improve flash memory durability in tiered storage
US11762591B2 (en) Memory system and method of controlling nonvolatile memory by controlling the writing of data to and reading of data from a plurality of blocks in the nonvolatile memory
US20200192600A1 (en) Memory system and method for controlling nonvolatile
US11321231B2 (en) Memory system and method of controlling nonvolatile memory with a write buffer
US20200364145A1 (en) Information processing apparatus and method for controlling storage device
US11662952B2 (en) Memory system and method of controlling nonvolatile memory and for reducing a buffer size
US20220058116A1 (en) Controller, memory system and data processing system
US11163493B2 (en) Memory system and method of controlling nonvolatile memory with checking a total size indicative of a sum of data length specified by a write command
CN107544912B (en) Log recording method, loading method and device
CN113986773A (en) Write amplification optimization method and device based on solid state disk and computer equipment
CN108536619B (en) Method and device for rapidly recovering FTL table
CN107544866B (en) Log updating method and device
CN107544913B (en) FTL table rapid reconstruction method and device
CN109002265B (en) Data processing method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100192 room A302, building B-2, Dongsheng Science Park, Zhongguancun, 66 xixiaokou Road, Haidian District, Beijing

Applicant after: Beijing yihengchuangyuan Technology Co.,Ltd.

Address before: 100192 Room 302, 3 / F, building B-2, Dongsheng Science Park, 66 xixiaokou Road, Haidian District, Beijing

Applicant before: BEIJING MEMBLAZE TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant