Method for preventing flash memory data from being lost, solid state drive controller, solid state drive

By detecting power outage behavior in the solid state drive, obtaining and calculating the backup data of the target segment to restore the lost slow page data, the problem of shared physical page data loss caused by abnormal power outage of the solid state drive is solved, improving data stability and maintaining Cost effective.

CN112632643BActive Publication Date: 2024-10-15DAPUSTOR CORP
View PDF 5 Cites -1 Cited by

Patent Information

Application Number
CN202011595224.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-29
Publication Date
2024-10-15
Estimated Expiration
2040-12-29

AI Technical Summary

Technical Problem

When the solid-state drive loses power abnormally, it leads to the problem of data loss of shared physical pages. It is difficult for existing technology to effectively solve this problem without increasing costs.

Method used

By detecting the power-off behavior of the solid-state drive, obtain the number of the target segment where the slow page corresponding to the fast page superpage is located, obtain the backup data of the target segment and the first slow page data, calculate and restore the second slow page data, and use physical block division Target segment to backup and restore lost data.

Benefits of technology

It improves the stability of flash memory data and avoids data loss due to abnormal power outage without additional costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112632643B_ABST
    Figure CN112632643B_ABST
Patent Text Reader

Abstract

The present invention relates to a solid state drive control technology, and in particular to a method for preventing flash memory data from being lost, a solid state drive controller, and a solid state drive. The method comprises: when a power failure behavior of the solid state drive is detected, and the page written when the power failure behavior occurs is a fast page super page, the number of the target segment where the slow page corresponding to the fast page super page is located is obtained; according to the number, the backup data and the first slow page data of the target segment are obtained; according to the backup data and the first slow page data, the second slow page data is calculated and restored. The present invention can solve the problem of shared physical pages, improve the stability of flash memory data, and does not require additional cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a solid state hard disk control technology, and in particular to a method for preventing flash memory data from being lost, a solid state hard disk controller, and a solid state hard disk. Background Art

[0002] Solid State Drives (SSDs) are hard disks made of solid-state electronic storage chip arrays. They have been widely used in various occasions and are gradually replacing traditional hard disks due to their excellent performance, power consumption, environmental adaptability, etc. At present, TLC flash memory has become the mainstream storage medium in both the SSD consumer market and the enterprise market.

[0003] A cell of TLC flash memory can represent 3 bits. 128K cells constitute a word line. The first bit of all cells in the word line constitutes a slow page (Lower Page), and the second and third bits constitute a fast page (Upper Page) and an extra page (Extra Page) respectively. We call the three physical pages in a word line a shared physical page. There are two ways to write the physical word line of TLC flash memory, namely one pass and two pass. The so-called two pass writing method means that in the first step, the master control writes the slow page to the flash word line, and in the second step, the master control writes the fast page and the extra page together to the flash word line. After that, all cells in the entire word line will remain in a stable state. However, if an abnormal power failure occurs during the second step of writing, not only the data currently written in the word line will be lost, but also the data successfully written to the slow page will be lost. For the host, the loss of data on the slow page is unacceptable because before executing the second step, the SSD master will inform the host that the data on the slow page has been successfully written to the flash memory.

[0004] To solve the above problems, the related technology configures a backup power supply for the main power supply. When the main power supply fails abnormally, the backup power supply intervenes. However, the backup power capacity of the capacitor will weaken as the use time increases. In the later stage of the life of the SSD, the actual backup power capacity of the capacitor cannot meet the requirements of the initial design. At this time, there is a high probability that the second step will still fail abnormally when writing data. For this reason, the related technology also chooses to use capacitors with super strong backup power capacity, but the price of this capacitor is also relatively expensive. Therefore, it is of great significance to successfully solve the problem of shared physical pages caused by abnormal power failure of the SSD without increasing the cost. Summary of the invention

[0005] The main technical problem solved by the embodiments of the present invention is how to successfully solve the problem of shared physical pages caused by abnormal power failure of the SSD without increasing additional costs.

[0006] In order to solve the above technical problems, a technical solution adopted by the embodiment of the present invention is: providing a method for preventing flash memory data from being lost, comprising:

[0007] When it is detected that the solid state drive has a power failure, and the page written when the power failure occurs is a fast page super page, the number of the target segment where the slow page corresponding to the fast page super page is located is obtained;

[0008] Acquire the backup data and the first slow page data of the target segment according to the serial number;

[0009] The second slow page data is calculated and restored according to the backup data and the first slow page data.

[0010] Optionally, obtaining the number of the target segment where the slow page corresponding to the fast page super page is located includes:

[0011] Obtaining the physical page number of the slow page corresponding to the fast page super page and a fixed step length, wherein the fixed step length is used to represent the length of the sequence number interval between a slow page and a fast page super page of a shared physical page;

[0012] The number of the target segment where the slow page corresponding to the fast page super page is located is calculated according to the physical page number and the fixed step size.

[0013] Optionally, the obtaining of the physical page number of the slow page corresponding to the fast page super page and the fixed step size specifically includes:

[0014] The physical page number of the slow page corresponding to the fast page super page in the TLC physical block and the fixed step size corresponding to the TLC physical block are obtained.

[0015] Optionally, acquiring the backup data and the first slow page data of the target segment according to the serial number includes:

[0016] Searching the number of the target segment from the SLC backup physical block, and reading the backup data corresponding to the number of the target segment; wherein the backup data is calculated according to the first slow page data and the second slow page data when the solid state drive is not powered off, and is stored in the SLC backup physical block;

[0017] The unlost slow page data in the physical page corresponding to the number of the target segment is read from the TLC physical block, and the unlost slow page data constitutes the first slow page data.

[0018] Optionally, the backup data is XOR data, and the XOR data is obtained by performing an XOR operation on the non-lost slow page data and the second slow page data.

[0019] Optionally, the method further comprises: backing up the backup data in a physical block;

[0020] The step of backing up the backup data in a physical block includes:

[0021] Erase SLC backup physical blocks;

[0022] Divide the TLC physical block into target segments according to the flash memory characteristics;

[0023] Writing physical pages into the divided target segments in order;

[0024] When the physical page of one of the target segments is written, all the slow page data in the target segment are read, and all the slow page data are calculated to obtain a calculation result corresponding to all the slow page data in the target segment;

[0025] The calculation result is saved in a physical page of the SLC backup physical block, and the page number of the physical page of the SLC backup physical block is the number of the target segment corresponding to the calculation result.

[0026] Optionally, before starting to write data to the current target segment, the step of backing up the backup data in the physical block is performed on a previous target segment of the current target segment.

[0027] Optionally, calculating and restoring the second slow page data according to the backup data and the first slow page data includes:

[0028] An XOR operation is performed on the backup data and the first slow page data, and a result of the XOR operation is the second slow page data.

[0029] To solve the above technical problems, another technical solution adopted in the embodiment of the present invention is: providing a solid state drive controller, comprising: at least one processor; and a memory, in which a program is stored; when the program is executed by the at least one processor, the program enables the solid state drive controller to execute the method as described above.

[0030] To solve the above technical problems, another technical solution adopted by the embodiment of the present invention is: providing a solid state drive, comprising: the solid state drive controller as described above, and at least one flash memory medium communicatively connected to the solid state drive controller.

[0031] Different from the related art, the embodiment of the present invention detects that the solid state drive has a power failure, and the page written when the power failure occurs is a fast page super page, then obtains the number of the target segment where the slow page corresponding to the fast page super page is located; obtains the backup data and the first slow page data of the target segment according to the number; and calculates and restores the second slow page data according to the backup data and the first slow page data. By dividing the physical block into target segments, the second slow page data for recovering the lost data can be calculated according to the backup data and the first slow page data of the target segment. Compared with the prior art, the method for preventing flash memory data loss, the solid state drive controller and the solid state drive provided by the embodiment of the present invention can solve the problem of shared physical pages, improve the stability of flash memory data, and do not require additional costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] One or more embodiments are exemplarily described by corresponding drawings, which do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and the figures in the drawings do not constitute proportional limitations unless otherwise stated.

[0033] Figure 1 is a flow chart of a method for preventing flash memory data loss provided by an embodiment of the present invention;

[0034] Figure 2 It is a schematic diagram of the structure of a plane in a TLC flash memory provided by an embodiment of the present invention;

[0035] Figure 3 is a schematic diagram of a writing process of a physical page in the target segment provided by an embodiment of the present invention;

[0036] Figure 4 It is a schematic diagram of the process of writing data in a backup physical block provided by an embodiment of the present invention;

[0037] Figure 5 is a schematic diagram of backing up and restoring the backup data of the target segment for a TLC flash memory provided by an embodiment of the present invention;

[0038] Figure 6 Schematic diagram of the hardware structure of a solid state disk controller 20 provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0041] The method for preventing flash memory data loss, solid state drive controller and solid state drive provided by the embodiment of the present invention divide the physical page into multiple target segments according to the characteristics of the shared physical page problem, and a target segment includes a slow page, a fast page and a super page, and the fast page and super page corresponding to the slow page in each target segment are in the next target segment. In view of the fact that power failure occurs during the write operation of the fast page and the super page, the data of the slow page corresponding to the fast page and the super page will be lost, and the slow page is located in the previous target segment. After it is written, the solid state drive will notify the host that the slow page data is successfully written into the flash memory. Therefore, if the data of the current slow page is lost, it is unacceptable to the host. Based on this, the embodiment of the present invention obtains the backup data corresponding to all the slow page data in the target segment, and backs up the backup data. When the data of a slow page in the target segment is lost, the data of the lost slow page is calculated based on the backup data and the data of other non-lost slow pages in the target segment, thereby restoring the data of the slow page. Thus, the stability of the data of the flash memory is guaranteed, and no other costs need to be increased.

[0042] Specifically, see Figure 1 , Figure 1 1 is a flow chart of a method for preventing flash memory data loss provided by an embodiment of the present invention. The method comprises:

[0043] S101, when it is detected that the solid state drive has a power failure, and the page written when the power failure occurs is a fast page super page, the number of the target segment where the slow page corresponding to the fast page super page is located is obtained;

[0044] The step of obtaining the number of the target segment where the slow page corresponding to the fast page super page is located includes:

[0045] Obtaining the physical page number of the slow page corresponding to the fast page super page and a fixed step length, wherein the fixed step length is used to represent the length of the sequence number interval between a slow page and a fast page super page of a shared physical page;

[0046] The number of the target segment where the slow page corresponding to the fast page super page is located is calculated according to the physical page number and the fixed step size.

[0047] The step of obtaining the physical page number of the slow page corresponding to the fast page super page and the fixed step size specifically includes:

[0048] The physical page number of the slow page corresponding to the fast page super page in the TLC physical block and the fixed step size corresponding to the TLC physical block are obtained.

[0049] S102, acquiring the backup data and the first slow page data of the target segment according to the serial number;

[0050] The method of obtaining the backup data and the first slow page data of the target segment according to the number includes: searching the number of the target segment from the SLC backup physical block, and reading the backup data corresponding to the number of the target segment; wherein the backup data is calculated based on the first slow page data and the second slow page data when the solid state drive is not powered off, and is stored in the SLC backup physical block; and reading the non-lost slow page data in the physical page corresponding to the number of the target segment from the TLC physical block, and the non-lost slow page data constitutes the first slow page data.

[0051] The backup data is XOR data, and the XOR data is obtained by performing an XOR operation on the non-lost slow page data and the second slow page data.

[0052] S103: Calculate and restore second slow page data according to the backup data and the first slow page data.

[0053] The first slow page data is data that is not lost in a target segment, and the second slow page data is data that is lost in the target segment. The backup data is calculated based on the first slow page data and the second slow page data. When the second slow page data needs to be restored, the second slow page data can be restored based on the first slow page data and the backup data. For example, an XOR operation is performed on the first slow page data and the backup data. In addition, it should be noted that the calculation of the backup data is performed before the second slow page data is lost.

[0054] The method for preventing flash memory data loss is specifically described below based on TLC flash memory. The process mainly includes dividing target segments, calculating backup data, backing up backup data, and restoring lost data.

[0055] The embodiment of the present invention mainly solves the problem of shared physical pages. The so-called shared physical page problem is that a physical unit (cell) is shared by two pages (pages), and two bits in a cell are mapped to two different logical pages. Then, when a write operation is performed on one of the bits (regardless of the MSB or the LSB), if there is a sudden power failure, the data in this cell will inevitably be lost, that is, the data in both pages will be erroneous.

[0056] It can be known that a cell of the current mainstream storage medium TLC flash memory can represent 3 bits. The first bit of all cells in the word line constitutes a slow page, and the second and third bits constitute a fast page and a super page respectively. The three physical pages in a word line are called shared physical pages. Among them, the slow page, fast page and super page are related to each other.

[0057] In this embodiment, when the solid-state hard disk loses power, if the object currently being written is the fast page super page, it is determined that there is a risk of data loss in the slow page associated with the fast page super page. Therefore, the method of preventing flash memory data loss in this embodiment is mainly aimed at preventing data loss in the slow page.

[0058] See also Figure 2 , Figure 2 This is a schematic diagram of the composition of a plane in TLC flash memory. The plane includes a page register and several physical pages. When writing data, the SSD master first transfers 16KB of data to the page register, and then the flash memory writes the data in the page register to the physical page of the flash memory. Figure 2 It can be known that the position relationship of all shared physical pages in a physical block in Plane, among which, Figure 2 The serial number of the physical page in (such as 36, 37, 38, 39, etc.) is the write order. Each dotted line links a group of shared physical pages. For example, Figure 2 The physical page 62 (slow page), the physical page 132 (fast page), and the physical page 133 (super page) together constitute the shared physical page, that is, these three physical pages are physically the same word line. Figure 2 It can be seen that there is a fixed step between the sequence numbers of the slow page and the fast page super page of the physical page, for example Figure 2 The fixed step size is 70. The fixed step size is determined by the 3D stacking characteristics of the TLC flash memory.

[0059] Based on the characteristics of the TLC flash memory, in this embodiment, all physical pages in a plane are divided into multiple target segments. The method of dividing the target segments includes: obtaining the serial number of the physical page and the fixed step length; dividing all physical pages into multiple target segments according to the serial number of the physical page and the fixed step length, each of the target segments contains the same number of physical pages, and all of them include slow pages, fast pages and super pages, and the fast pages and super pages corresponding to any slow page in each target segment are in the next target segment. For example, Figure 2 In the example, the fast page and super page corresponding to physical page 65 (slow page) are in the target segment x+1, namely, physical page 135 (fast page) and physical page 136 (super page). Figure 2 , the physical pages corresponding to the target segment x include physical pages 60 to 131; the physical pages corresponding to the target segment x+1 include physical pages 132 to 203; and so on.

[0060] See also Figure 3 , Figure 3 is a schematic diagram of the writing process of the physical page in the target segment. Figure 3 As shown, the master first writes the next physical page k; determines whether the physical page k is a slow page, if not, continues to write the next physical page, if it is a slow page, determines whether the physical page k is the last slow page; if the physical page k is the last slow page, all slow page data in the target segment are calculated to obtain backup data, and the backup data is written to the backup physical block, and then the next physical page is written to back up the data corresponding to the next target segment; wherein, if the physical page k is not the last slow page, the master continues to write the next physical page.

[0061] It can be known that the writing order of the TLC physical pages in the plane Plane is carried out in the order of slow page, fast page super page, slow page, fast page super page, etc. If an abnormal power outage occurs at present, and a write operation is being performed on the slow page, the data of the slow page will be lost at this time, and the solid-state drive will not feedback the notification of data writing completion to the host, that is to say, the data lost by the slow page is allowed, and the fast page and super page associated with the slow page are written later, and they have not had time to write data, so they will not affect the fast page and super page. If an abnormal power outage occurs at present, and a write operation is being performed on the fast page super page, the data of the fast page super page will be lost at this time, and the data of the slow page associated with the fast page super page will be lost, and the write operation of the associated slow page has been completed before the write operation of the fast page super page, and the solid-state drive has reported to the host that the writing of this part of the data has been completed, but in fact the data of the current slow page has been lost.

[0062] Based on the above characteristics, it can be known that when a fast page super page is written and an abnormal power failure occurs, the data of the associated slow page will be lost, and at most only one slow page will be lost, that is, the data of the slow page associated with the fast page super page will be lost, and the other slow page data in the target segment is intact. Therefore, when the slow page data of a target segment is written, all the slow page data in the target segment is calculated to obtain backup data, and the backup data is backed up; or, before starting to write data to the current target segment, the slow page data in the previous target segment of the current target segment is calculated to obtain backup data, and the backup data is backed up.

[0063] The backup data is used to obtain the lost slow page data by calculating the backup data and the non-lost slow page data in the target segment corresponding to the backup data when an abnormal power outage occurs during a fast page super-page write operation in the next target segment of its corresponding target segment.

[0064] For example, suppose that the data of a slow page consists of 4 (actually hundreds of thousands) bits, and there are 4 slow pages in a target segment, that is,

[0065] Slow page a = [0, 1, 1, 1];

[0066] Slow page b = [1, 0, 0, 1];

[0067] Slow page c = [0,0,0,1];

[0068] Slow page d = [1,0,0,0];

[0069] XOR the slow pages a, b, c, and d to obtain the backup data, which is:

[0070] XOR=a⊕b⊕c⊕d=[0,1,1,1];

[0071] After the solid state drive is powered on, it is found that the data of slow page d is lost. The master controller reads the data of slow page a, slow page b, slow page c, XOR, and performs XOR calculation on them. The XOR result is equal to the data of slow page d, that is, slow page d = a⊕b⊕c⊕XOR = [1,0,0,0].

[0072] It should be noted that the above is only an example of how to recover lost data, in which XOR calculation is used to recover lost data. In addition to the XOR calculation method, other methods can also be used, not limited to XOR.

[0073] The following describes how to back up the backup data. The backup data is backed up before the data is restored.

[0074] See also Figure 4 , Figure 4 This is a schematic diagram of the writing process of data in the backup physical block. Figure 4 As shown, firstly, the SLC backup physical block is erased; the TLC physical block is divided into target segments according to the flash memory characteristics; the physical pages are written into the target segments in sequence; it is determined whether the data in the target segment is completely written, if not, the physical pages are continuously written into the target segment in sequence, if already written, all the slow page data in the target segment are read out and calculated (such as XOR calculation), the calculation result is obtained, and the calculation result is saved into the SLC backup physical block; then the above-mentioned writing process is continuously executed for the next SLC backup physical block.

[0075] See also Figure 5 , Figure 5 It is a schematic diagram of backing up and restoring the backup data of the target segment for the TLC flash memory. Among them, the master controller configures a physical block in SLC mode for each plane of the flash memory as a backup module. The physical block in SLC mode has the characteristics of high performance, high life, and low capacity, and the writing mode of the physical block in SLC mode is onepass, that is, there is naturally no problem of shared physical pages. Therefore, this embodiment uses SLC backup physical blocks as backup blocks.

[0076] The calculation result of all slow page data in a target segment is saved in the physical page of the SLC backup physical block, and the page number of the physical page of the SLC backup physical block is the number of the target segment corresponding to the calculation result.

[0077] When data needs to be restored, the backup data is obtained from the SLC backup physical block according to the number of the target segment where the slow page with lost data is located, and then calculated together with the data of other slow pages in the target segment where the slow page is located that have not lost data to obtain the lost data of the slow page.

[0078] The above method backs up the calculation results of all slow page data of a target segment instead of backing up all slow page data in a target segment. Therefore, the efficiency of data backup is improved while solving the problem of shared physical pages.

[0079] For example, there are 72 / 3=24 slow pages in each target segment, so the time taken to back up all slow page data in a target segment = time taken to read 24 SLC physical pages + time taken to write 1 SLC physical page = 24*30us+300us=1020us, so to back up the slow page data in the entire TLC physical block we only need 1020us*number of segments = 1020us*(720 / 72)=10200us.

[0080] If all the slow page data in a target segment are backed up, that is, after writing each slow page data, the master controller immediately sends a Copy Back command (a function of the flash chip that can copy a physical page data in the same Plane to another physical page) to write the data in the slow page to the SLC physical page of the backup physical block. However, doing so is equivalent to increasing the writing time of all slow pages by T_copyback (Copy Back time = time to read SLC physical page + time to write SLC physical page ~ = 30us + 300us = 330us). Assuming that there are 720 physical pages in a physical block (that is, there are 240 SLC physical pages), the total time spent on backing up all slow page data in a TLC physical block = 330*240 = 79200us.

[0081] In comparison, the data backup method of the present application significantly improves data backup efficiency, reduces time consumption, and can solve the problem of shared physical pages at a very low performance cost.

[0082] This embodiment divides the TLC physical page into several target segments, and backs up the calculation results of all the slow page data in each target segment to the SLC backup physical block respectively. When an abnormal power failure occurs during a write operation of a fast page super page in the TLC physical page, the number of the previous target segment of the target segment where the fast page super page is located is obtained, and the backup data is obtained from the SLC backup physical block according to the number of the previous target segment, and the backup data is calculated with the slow page data of the non-lost data, so as to obtain the lost slow page data. The method provided by this embodiment can solve the problem of shared physical pages, improve the stability of flash memory data, and does not require additional costs.

[0083] It should be noted that the above is for TLC type physical blocks, and for other types of physical blocks, such as MLC type physical blocks, the problem of shared physical pages can also be solved based on the same inventive concept mentioned above. MLC type physical blocks also have the problem of shared physical pages, and their backup data can also be stored in SLC type physical blocks.

[0084] See also Figure 6 , Figure 6 1 is a schematic diagram of the hardware structure of a solid state drive controller 20 provided in an embodiment of the present invention. The solid state drive controller 20 can be used to execute the method for preventing flash memory data loss as described above. The solid state drive controller 20 includes: one or more processors 21 and a memory 22. Figure 6 A processor 21 is taken as an example.

[0085] The processor 21 and the memory 22 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0086] The memory 22 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the method for preventing flash memory data loss in the embodiment of the present invention. The processor 21 executes various functional applications and data processing of the solid-state drive controller by running the non-volatile software programs, instructions and modules stored in the memory 22, that is, the method for preventing flash memory data loss in the above method embodiment is implemented.

[0087] The memory 22 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function. In addition, the memory 22 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 22 may optionally include a memory remotely arranged relative to the processor 21.

[0088] The one or more modules are stored in the memory 22, and when executed by the one or more processors 21, perform the method for preventing flash memory data loss in any of the above method embodiments, for example, perform the above described Figure 1 , Figure 2 , Figure 3 The method steps in .

[0089] The above product can execute the method provided by the embodiment of the present invention and has the functional modules corresponding to the execution method. For the technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0090] The solid-state hard disk controller provided in this embodiment, when detecting that the solid-state hard disk has a power failure, and the page written when the power failure occurs is a fast page super page, obtains the number of the target segment where the slow page corresponding to the fast page super page is located; obtains the backup data and the first slow page data of the target segment according to the number; calculates the second slow page data according to the backup data and the first slow page data, and the second slow page data is used to recover the lost data of the slow page. By dividing the physical block into target segments, the second slow page data for recovering the lost data can be calculated according to the backup data and the first slow page data of the target segment. Compared with the prior art, the solid-state hard disk controller provided in the embodiment of the present invention can solve the problem of shared physical pages, improve the stability of flash memory data, and does not require additional costs.

[0091] The embodiment of the present invention further provides a solid state drive, which includes the solid state drive controller 20 described in the above embodiment and at least one flash memory medium. The solid state drive controller 20 is in communication connection with the at least one flash memory medium.

[0092] The solid-state hard disk provided in this embodiment, when detecting that the solid-state hard disk has a power failure, and the page written when the power failure occurs is a fast page super page, obtains the number of the target segment where the slow page corresponding to the fast page super page is located; obtains the backup data and the first slow page data of the target segment according to the number; calculates the second slow page data according to the backup data and the first slow page data, and the second slow page data is used to recover the lost data of the slow page. By dividing the physical block into target segments, the second slow page data for recovering the lost data can be calculated according to the backup data and the first slow page data of the target segment. Compared with the prior art, the solid-state hard disk provided in the embodiment of the present invention can solve the problem of shared physical pages, improve the stability of flash memory data, and does not require additional costs.

[0093] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0094] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for preventing flash memory data loss, characterized in that: include: When it is detected that the solid state drive has a power failure, and the page written when the power failure occurs is a fast page super page, the number of the target segment where the slow page corresponding to the fast page super page is located is obtained; Acquire the backup data and the first slow page data of the target segment according to the serial number; Calculate and restore second slow page data according to the backup data and the first slow page data; The step of obtaining the number of the target segment where the slow page corresponding to the fast page super page is located includes: obtaining the physical page number of the slow page corresponding to the fast page super page, and a fixed step length, wherein the fixed step length is used to represent the length of the interval between the serial numbers of a slow page and a fast page super page that share a physical page; and calculating the number of the target segment where the slow page corresponding to the fast page super page is located according to the physical page number and the fixed step length; The obtaining of the physical page number of the slow page corresponding to the fast page super page and the fixed step size specifically includes: obtaining the physical page number of the slow page corresponding to the fast page super page in the TLC physical block and the fixed step size corresponding to the TLC physical block; The method further comprises: backing up the backup data in a physical block; backing up the backup data in a physical block comprises: erasing an SLC backup physical block; dividing a TLC physical block into target segments according to flash memory characteristics; writing physical pages into the divided target segments in sequence; when a physical page of the target segment is written, reading all slow page data in the target segment, and calculating all slow page data to obtain a calculation result corresponding to all slow page data in the target segment; saving the calculation result into a physical page of the SLC backup physical block, and the page number of the physical page of the SLC backup physical block is the number of the target segment corresponding to the calculation result; Before starting to write data to the current target segment, the step of backing up the backup data in the physical block is performed on the previous target segment of the current target segment; Among them, dividing the TLC physical block into target segments according to the flash memory characteristics includes: obtaining the serial number of the physical page and the fixed step size; dividing all the physical pages into a number of target segments according to the serial number of the physical page and the fixed step size, the number of physical pages contained in each of the target segments is the same, and all include slow pages, fast pages and super pages, and the fast pages and super pages corresponding to any slow page in each target segment are in the next target segment.

2. The method according to claim 1, characterized in that The step of acquiring the backup data and the first slow page data of the target segment according to the serial number includes: Searching the number of the target segment from the SLC backup physical block, and reading the backup data corresponding to the number of the target segment; wherein the backup data is calculated according to the first slow page data and the second slow page data when the solid state drive is not powered off, and is stored in the SLC backup physical block; The unlost slow page data in the physical page corresponding to the number of the target segment is read from the TLC physical block, and the unlost slow page data constitutes the first slow page data.

3. The method according to claim 2, characterized in that The backup data is XOR data, and the XOR data is obtained by performing an XOR operation on the non-lost slow page data and the second slow page data.

4. The method according to claim 3, characterized in that: The calculating and restoring the second slow page data according to the backup data and the first slow page data comprises: An XOR operation is performed on the backup data and the first slow page data, and a result of the XOR operation is the second slow page data.

5. A solid state hard disk controller, characterized in that: include: at least one processor; and a memory, wherein the program is stored in the memory; When the program is executed by the at least one processor, the program enables the solid state drive controller to execute the method according to any one of claims 1 to 4.

6. A solid state hard disk, characterized in that: include: The solid-state drive controller of claim 5, and at least one flash memory medium communicatively connected to the solid-state drive controller.

Citation Information

Patent Citations

  • Flash memory data writing method and flash memory controller

    CN101483067A

  • Solid state disc and power failure protection method and system thereof

    CN102591748A

  • Data restoration method based on multilayer cell solid state hard disc and solid state hard disc

    CN103279402A

  • Method and device for write abort protection

    US20150089325A1

  • Systems and methods for lower page writes

    US8902652B1