Solid state disk log generation method and solid state disk thereofThe application discloses a method for generating solid state disk logs and a device thereof, which are applied for the purpose of filing the present application by the following division of application No. 2015104301746, 7 and 21.
Technical Field
The invention relates to electronic equipment, in particular to a log generation method, a starting method and a device of a solid state disk.
Background
Referring to fig. 1, taking a solid state storage device (Solid Storage Device, SSD) as an example of an electronic device, fig. 1 shows a block diagram of the storage device. The storage device 102 is coupled to a host for providing storage capability for the host. The host and storage device 102 may be coupled by a variety of means including, but not limited to, connecting the host to the storage device 102 via, for example, SATA, IDE, USB, PCIE, NVMe (NVM Express), SCSI, ethernet, fibre channel, wireless communication network, etc. The host may be an information processing device capable of communicating with the storage device in the manner described above, such as a personal computer, tablet, server, portable computer, network switch, router, cellular telephone, personal digital assistant, or the like. The storage device 102 includes an interface 103, a control section 104, one or more NVM (Non-Volatile Memory) Memory chips 105, and a firmware Memory 110. The interface 103 may be adapted to exchange data with a host by means of, for example SATA, IDE, USB, PCIE, NVMe, SCSI, ethernet, fibre channel, etc. The control unit 104 is used for controlling data transfer among the interface 103, the NVM memory chip 105 and the firmware memory 110, and also for memory management, host logical address to flash physical address mapping, erase balancing, bad block management, etc. The control component 104 can be implemented in a variety of ways, either in software, hardware, firmware, or a combination thereof. The control component 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 can also include a processor or controller. The control component 104 loads firmware from the firmware memory 110 at runtime. The firmware memory 110 may be NOR flash memory, ROM, EEPROM, or the like. Firmware is used to provide electronic device underlying functionality such as BIOS, operating system loading, etc.
The memory Target (Target) is one or more Logic units (Logic units) of a shared Chip Enable (CE) signal within the NAND flash package. Each logical unit has a logical unit number (LUN, logic Unit Number). One or more dies (Die) may be included within the NAND flash package. Typically, the logic unit corresponds to a single die. The logic cell may include multiple planes (planes). Multiple planes within a logic unit may be accessed in parallel, while multiple logic units within a NAND flash memory chip may execute commands and report status independently of each other. In "Open NAND FLASH INTERFACE Specification (Revision 3.0)" available from http:// www.micron.com/-/media/Documents/Products/Other%20 Documents/ONFI3_0gold. Ashx, meanings are provided with respect to target, logical unit, LUN, plane.
MLC (Multi-LEVEL CELL ) NVM is a non-volatile memory capable of storing at least two bits of information in each memory cell. Compared with SLC (Single Level Cell) NVM, the method has the characteristics of large storage capacity and low cost, but the reliability of storage is inferior to SLC, and data damage or loss can occur.
In a solid state storage device, FTL (Flash Translation Layer ) is utilized to maintain mapping information from logical addresses to physical addresses. The logical addresses constitute the storage space of the solid state storage device as perceived by upper level software such as the operating system. The physical address is an address for accessing a physical storage unit of the solid state storage device. Address mapping can also be implemented in the prior art using an intermediate address modality. For example, logical addresses are mapped to intermediate addresses, which in turn are further mapped to physical addresses.
The table structure storing mapping information from logical addresses to physical addresses is called FTL table. FTL tables are important metadata in solid state storage devices. Typically, the data items of the FTL table record address mapping relationships in units of data pages in the solid-state storage device. FTL tables of solid state storage devices have a large size, e.g., several GB levels. And when the solid-state storage device is closed, the FTL table needs to be completely stored, and when the solid-state storage device is started, the FTL is required to be completely loaded.
In the prior art, a logical address corresponding to each data page of a solid-state storage device is additionally stored in the data page. When the solid state storage device is started, all data pages need to be accessed to obtain the logical address corresponding to each data page, and the FTL table is reconstructed. However, such an operation would require a significant amount of time and result in a lengthy start-up process for the solid state storage device.
Disclosure of Invention
It is an object of the present invention to solve the problem of long time consuming loading FTL tables by solid state storage devices. It is a further object of the present invention to be able to reliably store FTL tables for a limited time after a power down of a solid state storage device.
According to a first aspect of the present invention, there is provided a method for starting a solid state disk, including obtaining a storage location of FTL (Flash Translation Layer ) logs on the solid state disk, where the FTL logs include a plurality of FTL log data frames, each FTL log data frame recording a portion of a FTL table; reading FTL logs and write request logs from the storage locations; the write request log comprises a plurality of write request log data frames, and each write request log data frame comprises a logical address and a physical address corresponding to a plurality of write requests sent to the solid state disk after a previous write request log data frame is generated; reconstructing an FTL table using the FTL log and the write request log; and completing the starting of the solid state disk.
According to the first solid state disk starting method of the first aspect of the present invention, there is provided the second solid state disk starting method of the first aspect of the present invention, wherein reconstructing the FTL table using the FTL log and the write request log includes: constructing a first FTL table using FTL log; the first FTL table is updated with the write request log to obtain a second FTL table.
According to the second solid state disk starting method of the first aspect of the present invention, a third solid state disk starting method of the first aspect of the present invention is provided, wherein the updating of the first FTL table by using the write request log includes sequentially using each write request log data frame of the write request log to update the first FTL table.
According to the first and second solid state disk starting methods of the first aspect of the present invention, a fourth solid state disk starting method of the first aspect of the present invention is provided, wherein all write requests issued to the solid state disk during creation of the FTL log are recorded in the write request log.
According to one of the above solid state disk starting methods of the first aspect of the present invention, a fifth solid state disk starting method of the first aspect of the present invention is provided, wherein the FTL table reflects a correspondence between a logical address and a physical address of the solid state disk.
According to one of the above solid state disk startup methods of the first aspect of the present invention, there is provided the sixth solid state disk startup method of the first aspect of the present invention, wherein, on the solid state disk, FTL log data frames are stored in association with write request log data frames.
According to one of the above solid state disk starting methods of the first aspect of the present invention, a seventh solid state disk starting method of the first aspect of the present invention is provided, wherein each FTL log data frame sequentially records a portion of the whole FTL table.
According to one of the above solid state disk starting methods of the first aspect of the present invention, an eighth solid state disk starting method of the first aspect of the present invention is provided, wherein each write request log data frame includes a logical address and a physical address corresponding to a write request sent to the solid state disk after a previous write request log data frame is generated and before a subsequent write request log data frame is generated.
According to one of the above solid state disk starting methods of the first aspect of the present invention, a ninth solid state disk starting method of the first aspect of the present invention is provided, wherein information of the whole FTL table is recorded in the FTL log.
According to one of the above solid state disk startup methods of the first aspect of the present invention, a tenth solid state disk startup method of the first aspect of the present invention is provided, wherein the solid state disk includes an MLC NVM (Multi-LEVEL CELL Non-Volatile Memory, multi-level cell nonvolatile Memory), and when FTL logs and write request logs are read from the storage location, pSLC mode is used to access the NVM.
According to a second aspect of the present invention there is provided a computer comprising a machine readable memory for storing program instructions; one or more processors for executing program instructions stored in the memory; the program instructions are for causing the one or more processors to perform one of the solid state disk startup methods according to the first aspect of the present invention.
According to a third aspect of the present invention, there is provided a computer program that causes a computer to execute one of the solid state disk startup methods according to the first aspect of the present invention.
According to a fourth aspect of the present invention, there is provided a computer-readable storage medium having stored thereon a recorded program, wherein the program causes the computer to execute one of the solid state disk startup methods according to the first aspect of the present invention.
According to a fifth aspect of the present invention, there is provided a program which, when executed by a controller of a solid state disk, causes the solid state disk to perform one of the solid state disk startup methods according to the first aspect of the present invention.
According to a sixth aspect of the present invention there is provided a solid state disk comprising a machine readable memory for storing program instructions, one or more processors or controllers for executing the program instructions stored in the memory, the program instructions for causing the one or more processors or controllers to perform one of the solid state disk booting methods according to the first aspect of the present invention.
According to a seventh aspect of the present invention, there is provided a first solid state disk starting apparatus, including a log positioning module, configured to obtain a storage location of FTL (Flash Translation Layer ) logs on a solid state disk, where the FTL logs include a plurality of FTL log data frames, each FTL log data frame records a portion of a FTL table; the log acquisition module is used for reading the FTL log and the write request log from the storage position; the write request log comprises a plurality of write request log data frames, and each write request log data frame comprises a logical address and a physical address corresponding to a plurality of write requests sent to the solid state disk after a previous write request log data frame is generated; the FTL table reconstruction module is used for reconstructing an FTL table by utilizing the FTL log and the write request log; and the starting module is used for completing the starting of the solid state disk.
According to a seventh aspect of the present invention, there is provided a first solid state disk starting device, and a second solid state disk starting device according to the seventh aspect of the present invention, wherein the FTL table reconstruction module includes: the FTL table construction module is used for constructing a first FTL table by using the FTL log; and the FTL table updating module is used for updating the first FTL table by using the write request log to obtain the second FTL table.
According to a seventh aspect of the present invention, there is provided the third solid state disk starting device of the seventh aspect of the present invention, wherein the FTL table updating module includes a FTL sequential updating module configured to sequentially update the first FTL table using each write request log data frame of the write request log.
According to the first or second solid state disk starting device of the seventh aspect of the present invention, there is provided the fourth solid state disk starting device of the seventh aspect of the present invention, wherein all write requests issued to the solid state disk during creation of the FTL log are recorded in the write request log.
According to the solid state disk starting device of the seventh aspect of the present invention, there is provided the fifth solid state disk starting device of the seventh aspect of the present invention, wherein the FTL table reflects a correspondence between a logical address and a physical address of the solid state disk.
According to the solid state disk starting device of the seventh aspect of the present invention, there is provided the sixth solid state disk starting device of the seventh aspect of the present invention, wherein, on the solid state disk, FTL log data frames are stored in association with write request log data frames.
According to the solid state disk starting device of the seventh aspect of the present invention, there is provided the seventh solid state disk starting device of the seventh aspect of the present invention, wherein each FTL log data frame sequentially records a portion of the entire FTL table.
According to the above solid state disk starting device of the seventh aspect of the present invention, there is provided the eighth solid state disk starting device of the seventh aspect of the present invention, wherein each write request log data frame includes a logical address and a physical address corresponding to a write request sent to the solid state disk after a previous write request log data frame is generated and before a subsequent write request log data frame is generated.
According to the solid state disk starting device of the seventh aspect of the present invention, there is provided the ninth solid state disk starting device of the seventh aspect of the present invention, wherein information of the whole FTL table is recorded in the FTL log.
According to the above-mentioned solid state disk starting device of the seventh aspect of the present invention, there is provided the tenth solid state disk starting device of the seventh aspect of the present invention, wherein the solid state disk includes an MLC NVM (Multi-LEVEL CELL Non-Volatile Memory), and when the FTL log and the write request log are read from the storage location, the NVM is accessed using pSLC mode.
According to an eighth aspect of the present invention, there is provided a method for generating a log of a first solid state disk, including recording a logical address and a physical address for the solid state disk corresponding to a write request sent to the solid state disk based on the write request; generating a write request log data frame by using a plurality of logical addresses and physical addresses for the solid state disk corresponding to the write requests; acquiring a part of an FTL table, and generating an FTL log data frame; storing the write request log data frame and the FTL log data frame on NVM (Non-Volatile Memory); and recording an address on the NVM where the FTL log data frame is stored.
According to the first solid state disk log generating method of the eighth aspect of the present invention, there is provided a second solid state disk log generating method of the eighth aspect of the present invention, further comprising: and when the solid state disk is powered off or power is turned off, the recorded address of the FTL log data frame stored on the NVM is stored into the NVM.
According to the first or second solid state disk log generating method of the eighth aspect of the present invention, there is provided the third solid state disk log generating method of the eighth aspect of the present invention, wherein the write request log data frame and the FTL log data frame are stored on NVM periodically.
According to a first or second solid state disk log generating method of an eighth aspect of the present invention, there is provided a fourth solid state disk log generating method of the eighth aspect of the present invention, wherein after the write request log data frame is generated, the write request log data frame and the FTL log data frame are stored on NVM, and wherein a predetermined number of logical address and physical address pairs are included in the write request log data frame.
According to the above solid state disk log generating method of the eighth aspect of the present invention, there is provided the fifth solid state disk log generating method of the eighth aspect of the present invention, wherein the obtaining the FTL table part generates FTL log data frame, and the method includes: the FTL log data frame is generated by obtaining a portion of FTL table not used for generating FTL log data frame.
According to the first or second solid state disk log generating method of the eighth aspect of the present invention, there is provided the sixth solid state disk log generating method of the eighth aspect of the present invention, wherein the obtaining the part of the FTL table generates FTL log data frames, including: a FTL table of a predetermined length from a first address of the FTL table is selected as part of the FTL table for generating FTL log data frames, wherein the FTL table part preceding the first address has been used to generate FTL log data frames.
According to the first or second solid state disk log generating method of the eighth aspect of the present invention, there is provided the seventh solid state disk log generating method of the eighth aspect of the present invention, wherein the obtaining the part of the FTL table that is not used for generating the FTL log entry includes: an FTL table of a predetermined length starting from a first address of the FTL table as part of the FTL table for generating FTL log data frames, wherein FTL table part preceding said first address has been used for generating FTL log data frames.
According to a method of one of the fifth to seventh solid state disk log generating methods of the eighth aspect of the present invention, there is provided the eighth solid state disk log generating method of the eighth aspect of the present invention, wherein a total size of the write request log data frame and the FTL log data frame is an integer multiple of a data page size of the solid state disk.
According to a method of one of the sixth to eighth solid state disk log generating methods of the eighth aspect of the present invention, there is provided the ninth solid state disk log generating method of the eighth aspect of the present invention, wherein the NVM (Non-Volatile Memory) is an MLC NVM, and the NVM is accessed using pSLC mode when storing the write request log data frame and the FTL log data frame on the NVM.
According to the above solid state disk log generating method of the eighth aspect of the present invention, there is provided the tenth solid state disk log generating method 10 of the eighth aspect of the present invention, wherein the write request log data frame is stored in association with the FTL log data frame on NVM.
According to a ninth aspect of the present invention there is provided a computer comprising a machine readable memory for storing program instructions; one or more processors for executing program instructions stored in the memory; the program instructions are for causing the one or more processors to perform one of the solid state disk log generation methods according to the eighth aspect of the present invention.
According to a tenth aspect of the present invention, there is provided a computer program that causes a computer to execute one of the solid state disk log generating methods according to the eighth aspect of the present invention.
According to an eleventh aspect of the present invention, there is provided a computer-readable storage medium having stored thereon a recorded program, wherein the program causes the computer to execute one of the solid state disk log generating methods according to the eighth aspect of the present invention.
According to a twelfth aspect of the present invention, there is provided a program which, when executed by a controller of a solid state disk, causes the solid state disk to execute one of the solid state disk log generating methods according to the eighth aspect of the present invention.
According to a thirteenth aspect of the present invention there is provided a solid state disk comprising a machine readable memory for storing program instructions, one or more processors or controllers for executing the program instructions stored in the memory, the program instructions for causing the one or more processors or controllers to perform one of the solid state disk log generation methods according to the eighth aspect of the present invention.
According to a fourteenth aspect of the present invention, there is provided the first log generating device for a solid state disk according to the fourteenth aspect of the present invention, including a write log recording module, configured to record, based on a write request sent to the solid state disk, a logical address and a physical address for the solid state disk corresponding to the write request; the write log data frame generation module is used for generating a write request log data frame by using a plurality of logical addresses and physical addresses for the solid state disk corresponding to a plurality of write requests; the FTL log data frame generation module is used for acquiring part of the FTL table and generating an FTL log data frame; the journal storage module is used for storing the write request journal data frame and the FTL journal data frame on an NVM (Non-Volatile Memory); and an address recording module for recording an address on the NVM where the FTL log data frame is stored.
According to a fourteenth aspect of the present invention, there is provided a log generating device for a solid state disk, further comprising: and the power-down storage module is used for storing the recorded address for storing the FTL log data frame on the NVM into the NVM when the solid state disk is powered off or powered down.
According to the log generating device for the solid state disk of the fourteenth aspect of the present invention, there is provided the log generating device for the solid state disk of the fourteenth aspect of the present invention, wherein the log storage module is configured to store the write request log data frame and the FTL log data frame on the NVM periodically.
According to a fourth aspect of the present invention, there is provided the first or second log generating device for a solid state disk, wherein after the write request log data frame is generated, the write request log data frame and the FTL log data frame are stored on NVM, and wherein the write request log data frame includes a predetermined number of logical address and physical address pairs.
According to one of the above log generating devices for solid state disk of the fourteenth aspect of the present invention, there is provided a fifth log generating device for solid state disk of the fourteenth aspect of the present invention, wherein the FTL log data frame generating module is configured to acquire a portion of the FTL table that is not used for generating FTL log data frames, to generate FTL log data frames.
According to one of the first to fourth log generating apparatuses for solid state drives of the fourteenth aspect of the present invention, there is provided the sixth log generating apparatus for solid state drives of the fourteenth aspect of the present invention, wherein the FTL log data frame generating module is configured to select, as a part of the FTL table, a FTL table of a predetermined length starting from a first address of the FTL table, for generating FTL log data frames, wherein a FTL table part preceding the first address has been used for generating FTL log data frames.
According to a fifth log generating device for a solid state disk of the fourteenth aspect of the present invention, there is provided the seventh log generating device for a solid state disk of the fourteenth aspect of the present invention, wherein the obtaining a portion of the FTL table that is not used for generating the FTL log entry includes: an FTL table of a predetermined length starting from a first address of the FTL table as part of the FTL table for generating FTL log data frames, wherein FTL table part preceding said first address has been used for generating FTL log data frames.
According to one of the fifth to seventh log generating devices for a solid state disk of the fourteenth aspect of the present invention, there is provided the eighth log generating device for a solid state disk of the fourteenth aspect of the present invention, wherein a total size of the write request log data frame and the FTL log data frame is an integer multiple of a data page size of the solid state disk.
According to one of the sixth to eighth log generating apparatuses for solid state disks of the fourteenth aspect of the present invention, there is provided the ninth log generating apparatus for solid state disk of the fourteenth aspect of the present invention, wherein the NVM (Non-Volatile Memory) is an MLC NVM, and the NVM is accessed using pSLC mode when storing the write request log data frame and the FTL log data frame on the NVM.
According to one of the above log generating apparatuses for solid state disks of the fourteenth aspect of the present invention, there is provided the tenth log generating apparatus for solid state disk of the fourteenth aspect of the present invention, wherein the write request log data frame is stored in association with the FTL log data frame on NVM.
According to a fifteenth aspect of the present invention, there is provided a method for a solid state disk, comprising: based on a write request sent to the solid state disk, recording a logical address and a physical address which correspond to the write request and are used for the solid state disk; generating a write request log data frame by using a plurality of logical addresses and physical addresses for the solid state disk corresponding to the write requests; acquiring a part of an FTL table, and generating an FTL log data frame; storing the write request log data frame and the FTL log data frame on NVM (Non-Volatile Memory); recording an address on the NVM where the FTL log data frame is stored; when the solid state disk is powered off or power is turned off, the recorded address of the FTL log data frame stored on the NVM is stored into the NVM; when the solid state disk is started, the storage position of the FTL log on the solid state disk is obtained through the address stored in the NVM and used for storing the FTL log data frame on the NVM, wherein the FTL log comprises a plurality of FTL log data frames, and each FTL log data frame records part of an FTL table; reading FTL logs and write request logs from the storage locations; the write request log comprises a plurality of write request log data frames, and each write request log data frame comprises a logical address and a physical address corresponding to a plurality of write requests sent to the solid state disk after a previous write request log data frame is generated; reconstructing an FTL table using the FTL log and the write request log; and completing the starting of the solid state disk.
According to a sixteenth aspect of the present invention, there is provided an apparatus for a solid state disk, comprising: the 'write' log recording module is used for recording a logical address and a physical address which correspond to a write request and are used for the solid state disk based on the write request sent to the solid state disk; the write log data frame generation module is used for generating a write request log data frame by using a plurality of logical addresses and physical addresses for the solid state disk corresponding to a plurality of write requests; the FTL log data frame generation module is used for acquiring part of the FTL table and generating an FTL log data frame; the journal storage module is used for storing the write request journal data frame and the FTL journal data frame on an NVM (Non-Volatile Memory); the address recording module is used for recording the address for storing the FTL log data frame on the NVM; the power-down protection module is used for storing the recorded address of the FTL log data frame stored on the NVM into the NVM when the solid state disk is powered off or powered down; the system comprises a solid state disk, a log positioning module, a storage module and a storage module, wherein the solid state disk is used for storing the FTL log data frames in the NVM, and acquiring the storage position of the FTL log on the solid state disk through the address stored in the NVM and used for storing the FTL log data frames in the NVM when the solid state disk is started, wherein the FTL log comprises a plurality of FTL log data frames, and each FTL log data frame records part of an FTL table; the log acquisition module is used for reading the FTL log and the write request log from the storage position; the write request log comprises a plurality of write request log data frames, and each write request log data frame comprises a logical address and a physical address corresponding to a plurality of write requests sent to the solid state disk after a previous write request log data frame is generated; the FTL table reconstruction module is used for reconstructing an FTL table by utilizing the FTL log and the write request log; and the starting module is used for completing the starting of the solid state disk.
Drawings
The invention, as well as a preferred mode of use and further objectives and advantages thereof, will best be understood by reference to the following detailed description of illustrative embodiments when read in conjunction with the accompanying drawings, wherein:
FIG. 1 is a block diagram of a prior art memory device;
FIG. 2 is a block diagram of the structure of an FTL table according to an embodiment of the present invention;
FIG. 3 is a block diagram of the structure of a "write" log according to an embodiment of the invention;
FIG. 4 is a block diagram of the structure of a solid state disk log according to an embodiment of the invention;
FIG. 5 is a flow chart of a solid state disk log generation method according to an embodiment of the present invention;
FIG. 6 is a flow chart of a solid state disk log generation method according to yet another embodiment of the present invention; and
Fig. 7 is a flowchart of a device start-up method according to an embodiment of the present invention.
Detailed Description
Fig. 2 is a block diagram of the structure of FTL table according to an embodiment of the present invention. FTL tables include a plurality of FTL table entries (or entries). In one embodiment, a correspondence of one logical page address to one physical page is recorded in each FTL table entry. In yet another embodiment, a correspondence of logical block addresses to physical block addresses is recorded in each FTL table entry. In still another embodiment, the FTL table records a mapping relationship between a logical block address and a physical block address, and/or a mapping relationship between a logical page address and a physical page address.
In yet another embodiment, FTL tables are stored in contiguous memory address space, each FTL table entry records a physical address, and the memory address of each FTL table entry itself represents a logical address corresponding to the physical address. The number of FTL table entries corresponds to the size of the solid state storage device logical address space.
FTL tables are organized into data frames for the purpose of storing FTL tables in a non-volatile storage medium. Referring to fig. 2, the ftl table includes a number of frames 1, data frame 2, data frame 3 … …, and data frame n. Each FTL table data frame comprises a plurality of FTL table entries. The size of each FTL table data frame corresponds to a minimum writing unit (e.g., page) of a nonvolatile storage medium. The data page size of a nonvolatile storage medium is typically 2KB, 4KB, 8KB, or 16KB. In one embodiment, the data page size of the nonvolatile storage medium is 16KB, while the data frame size of the FTL table is 2KB, 4KB, or 8KB. In another embodiment, the data page size of the nonvolatile storage medium is 4KB, and the data frame size of the FTL table is 512B, 1KB, or 2KB. In general, the data frame size of the FTL table is selected such that the data page size of the nonvolatile storage medium is an integer multiple of the FTL table data frame size, so as to store a plurality of FTL table data frames to the data page of the nonvolatile storage medium. In one example, FTL table contains several frames 1, 2,3 … … and n stored consecutively in memory according to memory address.
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 the FTL table. In another embodiment, a host accessing the solid state storage device maintains an FTL table, and when a write request needs to be sent to the solid state storage, a physical address of the solid state storage device is allocated to the write request, and a correspondence between the logical address and the physical address of the write request is recorded in the FTL table.
FIG. 3 is a block diagram of the structure of a "write" log according to an embodiment of the invention. A "write" log is also generated as the solid state storage device processes write requests. The logical address and the physical address corresponding to the write operation are recorded in the "write" log.
For the purpose of storing the "write" log in a nonvolatile storage medium, the "write" log is organized into data frames 310 (see fig. 3). Each write log data frame 310 includes a plurality of write log entries (322, 324, 32 n) (or "entries"). Each write log entry (322, 324, or 32 n) includes a logical address and a physical address corresponding thereto. The "write" log entries are generated and organized in the write log data frame in the order in which the write requests were received. Thus in a "write" log there may be "write" log entries with the same logical and/or physical address.
The size of each "write" log data frame corresponds to the minimum write unit (e.g., page) of the nonvolatile storage medium. The data page size of a nonvolatile storage medium is typically 2KB, 4KB, 8KB, or 16KB. In one embodiment, the data page size of the nonvolatile storage medium is 16KB, while the data frame size of the "write" log is 2KB, 4KB, 8KB, or 16KB. In another embodiment, the data page size of the nonvolatile storage medium is 4KB, while the data frame size of the "write" log is 512B, 1KB, or 2KB, or 4KB. Typically, the data frame size of the "write" log is selected such that the data page size of the nonvolatile storage medium is an integer multiple of the "write" log data frame size, so as to store one or more "write" log data frames to the data page of the nonvolatile storage medium. In yet another embodiment, one or more FTL table data frames and one or more "write" log data frames constitute one data page of a nonvolatile storage medium.
FIG. 4 is a block diagram of the structure of a solid state disk log according to an embodiment of the invention. In order to quickly rebuild the directory of the FTL table when the solid state disk is started, a solid state disk log 410 is provided according to an embodiment of the present invention. The solid state disk log 410 includes a plurality of solid state disk log data frames. The plurality of solid state disk log data are represented in fig. 4 as data frame 1 (422), data frame 2 (424), data frame 3, data frame 4 … …, data frame m (42 m). In the embodiment of fig. 4, each solid state disk log data frame includes 3 FTL table data frames and 1 write log data frame. For example, FTL table data frame 1 (432), FT table L data frame 2 (434), FTL table data frame 3 (436), and "write" log data frame 1 (438) are included in solid state disk log data frame 1 (422). FTL table data frame 4 (442), FTL table data frame 5 (444), FTL table data frame 6 (446) and "write" log data frame 2 (448) are included in solid state disk log data frame 2 (424). The solid state disk log data frame n (42 m) comprises an FTL table data frame n-2 (452), an FTL table data frame n-1 (454), an FTL table data frame n (456) and a write log data frame k (438).
In an embodiment according to the invention, the size of the solid state disk log data frame is an integer multiple of the data page size of the nonvolatile storage medium, so as to store the solid state disk log data frame to the data page of the nonvolatile storage medium. In another embodiment of the present invention, when the nonvolatile storage medium is an MLC nonvolatile storage medium and the solid state disk log data frame is stored in a data page of the nonvolatile storage medium, pSLC (pseudo-SLC) mode or SLC mode is used to access the nonvolatile storage medium, so as to accelerate the solid state disk log data frame storage process and obtain higher data reliability.
Those skilled in the art will appreciate that other numbers of FTL table data frames and/or "write" log data frames may be included in the data frames of the solid state disk log 410. The FTL table data frame and the write log data frame can also be respectively stored in a nonvolatile storage medium of the solid state disk.
In an embodiment according to the present invention, the m solid state disk log data frames of solid state disk log 410 are organized into a circular queue. When the solid state disk log is written into the solid state disk, the data frame 1 (422), the data frame 2 (424), the data frame 3 and the data frame 4 are written into the solid state disk in sequence until the data frame m (42 m). After the data frame m (42 m) is written, when the solid state disk log needs to be written again, the data frame 1 is written again (422). A solid state disk log write pointer 450 is provided indicating the last write location of the solid state disk log 410. The solid state disk journal write pointer 450 is stored on a non-volatile storage medium. In one embodiment, the solid state disk log write pointer 450 is maintained in memory when the solid state disk is operating normally, and is written to the nonvolatile storage medium when the solid state disk is turned off or powered down.
In solid state disk log 410, a plurality of FTL table data frames are included. FTL tables can be reconstructed using multiple FTL table data frames in the solid state disk log 410.
In an embodiment according to the invention, the complete FTL table comprises n FTL table data frames. In the m solid state disk log data frames of the solid state disk log 410, n FTL table data frames in total are stored. In another embodiment according to the present invention, a total of 2n FTL table data frames are stored in m solid state disk log data frames of solid state disk log 410. Among the plurality of solid state disk log data frames of the solid state disk log 410, FTL table data frames are sequentially stored, for example, FTL table data frames are stored from small to large or from large to small according to the storage address where the FTL table itself is located. In one embodiment, FTL table is stored in a continuous memory, and the memory addresses of the FTL table corresponding to FTL table data frame 1 (432), FTL table data frame 2 (434), FTL table data frame 3 (436), FTL table data frame 4 (442), FTL table data frame 5 (444), FTL table data frame 6 (446) in the FTL table are sequentially increased. In another embodiment, a bad block record table of the nonvolatile storage medium of the solid state disk is provided, and m solid state disk data frames of the available block storage solid state disk log 410 are selected according to the bad block map table. In yet another embodiment, other FTL table data frame organization methods may be employed by those skilled in the art for the purpose of reconstructing a complete FTL table from the solid state disk log 410.
In an embodiment according to the invention, the "write" log entries are generated and organized in the write log data frames in the order in which the write requests were received, and "write" log data frame 1 (438), and "write" log data frame 2 (448), … …, "write" log data frame k (458) are generated in the order in which the write requests were received.
The method for generating the solid state disk log according to the embodiment of the invention is described next. Fig. 5 is a flowchart of a solid state disk log generation method according to an embodiment of the present invention. When processing a write request, it is necessary to record the correspondence between logical addresses and physical addresses in the write request (510), and update the FTL table accordingly. And caching the corresponding relation between the recorded logical addresses and the physical addresses, wherein each corresponding relation between the logical addresses and the physical addresses forms a write log entry. A certain number of "write" log entries constitutes a "write" log data frame. When the correspondence of the cached logical addresses and physical addresses can form a write log data frame, the write log data frame is generated (520) by using the correspondence of the cached logical addresses and physical addresses. A portion of the FTL table is selected to generate a FTL table data frame (530). The selected portion of the FTL table is a portion of the FTL table for which FTL table data frames have not been generated. The FTL table data frame and the "write" log data frame generated constitute a solid state disk log data frame (e.g., data frame 1 (422), see fig. 4). In a preferred embodiment, the size of the solid state disk log data frame corresponds to the data page size of the nonvolatile storage medium of the solid state disk, so that the solid state disk log data frame can be written to the nonvolatile storage medium of the solid state disk by a write operation of the nonvolatile storage medium (540).
According to a further embodiment of the present invention, each time a predetermined number of write requests are received, a "write" log data frame is generated, wherein a mapping relationship between a logical address and a physical address corresponding to the predetermined number of write requests can be accommodated in one of the "write" log data frames. And selecting a part of the FTL table to generate one or more FTL table data frames every time a write log data frame is generated, so that the generated write log data frame and FTL table data frame form a solid state disk log data frame.
According to still another embodiment of the present invention, when processing a write request, the correspondence between the logical address and the physical address corresponding to the write request is cached, and each correspondence between the logical address and the physical address constitutes a "write" log entry. And periodically generating a "write" log data frame using the cached "write" log entries. And selecting a part of the FTL table to generate one or more FTL table data frames every time one write log data frame is generated, so that the generated write log data frame and FTL table data frame form a solid state disk log data frame.
According to yet another embodiment of the present invention, the "write" log data frame is stored physically separate from the FTL table data frame. The size of the "write" log data frame corresponds to the data page size of the nonvolatile storage medium of the solid state disk, and the size of the FTL table data frame also corresponds to the data page size of the nonvolatile storage medium of the solid state disk.
According to still another embodiment of the present invention, when selecting a portion of the FTL table to generate one or more FTL table data frames, the portion of the FTL table is selected according to the memory address of the FTL table itself. For example, when a portion of FTL is first selected, a portion of FTL table of length L starting from address 0 is selected to constitute one or more FTL table data frames. And a second time a portion of the FTL table is selected, a portion of the FTL table of length L starting from address L is selected to form one or more FTL table data frames. And selecting the portion of the FTL table for the nth time, selecting the portion of the FTL table of length L starting from address (N-1) x L to form one or more FTL table data frames. And when the end of the FTL table is reached when the portion of the FTL table is selected, continuing to select the portion of the FTL table from the header of the FTL table. In this way, a complete FTL table can be recorded in the solid state disk log. For example, if the overall length of FTL is n=n×l, when selecting the portion of FTL table for the n+1st time, the portion of FTL table having the length L from address 0 is selected. For another example, if the overall length of the FTL table is n=n×l+1, when the FTL table is selected for the n+1th time, the FTL table is selected from the address n×l to the length 1 and the FTL table is selected from the address 0 to the length L-1. There are still other ways to select portions of the FTL table so that a complete FTL table can be recorded in the solid state disk log, and a "write" log of all write requests received during recording of the complete FTL table can also be recorded.
In this way, one solid state disk log data frame is stored to the solid state disk at a time. Even if the solid state disk is powered down, only one solid state disk log data frame needs to be written into the solid state disk. Therefore, 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 solid state disk log does not include a complete FTL table. For example, for a new or blank solid state disk, a power failure occurs after the FTL table data frame is generated by selecting a part of the FTL table 3 times, and at this time, only 3 solid state disk log data frames are recorded in the solid state disk log. And marking the used data blocks and/or unused data blocks in the solid state disk log to identify effective data frames in the solid state disk log, so as to reconstruct an FTL table when the solid state disk is powered down.
Fig. 6 is a flowchart of a solid state disk log generation method according to still another embodiment of the present invention. The method according to the embodiment of fig. 6 may be implemented by a solid state disk, or may be implemented by a host accessing the solid state disk.
Upon receipt of a write request (600), the correspondence of logical addresses to physical addresses in the write request needs to be recorded (610), and the FTL table updated accordingly (615). And caching the corresponding relation between the recorded logical addresses and the physical addresses, wherein each corresponding relation between the logical addresses and the physical addresses forms a write log entry. A certain number of "write" log entries constitutes a "write" log data frame. And judging whether the corresponding relation between the cached logical addresses and the physical addresses can form a write log data frame (620), and generating the write log data frame by using the corresponding relation between the cached logical addresses and the physical addresses when the corresponding relation between the cached logical addresses and the physical addresses can form the write log data frame. If the corresponding relation between the cached logical addresses and the physical addresses is not enough to fill one 'write' log data frame, waiting for the arrival of the subsequent write request.
When the cached correspondence of logical addresses and physical addresses can form a "write" log data frame, a portion of the FTL table is also selected to generate FTL table data frames (630). The selected portion of the FTL table is a portion of the FTL table for which FTL table data frames have not been generated. The FTL table data frame and the "write" log data frame generated constitute a solid state disk log data frame (e.g., data frame 1 (422), see fig. 4). In a preferred embodiment, the size of the solid state disk log data frame corresponds to the data page size of the nonvolatile storage medium of the solid state disk, so that the solid state disk log data frame can be written to the nonvolatile storage medium of the solid state disk by a write operation of the nonvolatile storage medium (640).
In order to read out the solid state disk log from the solid state disk, each time a data frame of the solid state disk log is written into a nonvolatile storage medium of the solid state disk, a storage position (650) of the solid state disk log data frame on the nonvolatile storage medium is also recorded. In one embodiment, the m solid state disk log data frames of the solid state disk log are organized into a circular queue, so that the solid state disk log can be accessed completely by storing the storage position of the solid state disk log written into the nonvolatile storage medium of the solid state disk for the last time. In another embodiment, a monotonically changing sequence number is provided in each solid state disk data frame, and the storage position of the solid state disk log written into the nonvolatile storage medium of the solid state disk for the last time is obtained by identifying the sequence number.
In this way, one solid state disk log data frame is stored to the solid state disk at a time. Even if the solid state disk is powered down, only one solid state disk log data frame needs to be written into the solid state disk. Therefore, the storage of the solid state disk log data frame can be completed within the limited working time of the standby power supply.
Fig. 7 is a flowchart of a device start-up method according to an embodiment of the present invention. The method according to the embodiment of fig. 7 may be implemented by a solid state disk, or may be implemented by a host accessing the solid state disk. At a start-up of a device such as a solid state disk, a storage location of a solid state disk log is obtained from a predetermined location in a nonvolatile storage medium (710). According to one embodiment of the present invention, the predetermined location of the nonvolatile storage medium records the storage location of the last stored solid state disk log data frame. In the m solid state disk log data frames before the last storage position, a complete FTL table and a corresponding write log are recorded. Therefore, the initial storage position and the final storage position of the solid state disk log can be obtained according to the final storage position.
And reading the solid state disk log data frame from the nonvolatile storage medium according to the storage position of the solid state disk log. In one example, the solid state disk log data frames include FTL table data frames and "write" log data frames (720). In another example, FTL table data frames are stored in association with "write" log data frames on a nonvolatile storage medium, and if FTL data frames are obtained, then "write" log data frames can be obtained, and vice versa.
A plurality of FTL table data frames are read from the nonvolatile storage medium, each of the plurality of FTL table data frames including a portion of the FTL table, and a complete FTL table can be reconstructed from the plurality of FTL table data frames (730).
In a plurality of "write" log data frames corresponding to the plurality of FTL table data frames, the write request processed by the solid state disk during generation of the plurality of FTL table data frames is completely recorded. Processing the write request implies an update to the FTL table. Thus, based on the FTL table reconstructed in step (730), the reconstructed FTL table is updated by sequentially using the entries of the "write" log data frames recorded in the plurality of "write" log data frames (740), so as to obtain the FTL table when the last solid state disk log data frame is written into the nonvolatile storage medium of the solid state disk. The booting of the solid state disk device is then complete (750) and the updated FTL table may be utilized to respond to the access request.
In one embodiment of the present invention, m solid state disk log data frames of the solid state disk log are organized into a circular queue, and a complete FTL table with length n is stored in the solid state disk log data frame before the storage position in the circular queue by obtaining the storage position of the solid state disk log written into the nonvolatile storage medium of the solid state disk for the last time. And reading a preset number of solid state disk log data frames in the circulation queue to obtain a complete solid state disk log, and rebuilding an FTL table by utilizing the FTL table data frames in the solid state disk log.
As another example, referring again to fig. 4, solid state disk log write pointer 450 indicates the last write location of solid state disk log 410 as data frame 4. In the m solid state disk log data frames of the solid state disk log 410, n FTL table data frames in total are stored. Then in solid state disk log data frame 5 (not shown), solid state disk log data frame 6 (not shown), solid state disk log data frame 7 (not shown), … …, solid state disk log data frame m, solid state disk log data frames 1, … …, solid state disk log data frame 4, a complete FTL table is stored, and the "write" log of requests occurring during storage of the complete FTL table is recorded in order. Reading out m solid state disk log data frames recorded with a complete FTL table from a circular queue, extracting 3*m FTL table data frames from the m solid state disk log data frames, and reconstructing the FTL table. And extracting m 'write' log data frames from the m solid state disk log data frames, and sequentially updating the reconstructed FTL table by utilizing the corresponding relation between the logical addresses and the physical addresses recorded in the m 'write' log data frames according to the sequence generated by the m 'write' log data frames, thereby obtaining the FTL table when the last solid state disk log data frame is written into the nonvolatile storage medium of the solid state disk.
A log generation method in a storage device and a process of starting the storage device using the generated log have been disclosed above. Those of skill in the art will further appreciate that the methods or operational flows disclosed in the present disclosure may be implemented by software, firmware, hardware, and any combination thereof. The software and firmware implementing the method or the operation flow of the embodiment of the present invention may be executed by a CPU of a host accessing the storage device, or may be executed by an embedded processor or controller integrated with the storage device. Software, firmware, implementing the methods or operations of embodiments of the present invention may be stored on a network server, a host accessing a storage device, and/or a storage device. The method or operational flow according to embodiments of the present invention may also be implemented by an FPGA and/or an ASIC. The invention also provides electronic systems and/or control circuits implementing the disclosed methods or operational flows.
The description of the present invention has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to practitioners skilled in the art.