WO2022142544A1 - Method for preventing data loss from flash memory, solid state drive controller, solid state drive - Google Patents
Method for preventing data loss from flash memory, solid state drive controller, solid state drive Download PDFInfo
- Publication number
- WO2022142544A1 WO2022142544A1 PCT/CN2021/121393 CN2021121393W WO2022142544A1 WO 2022142544 A1 WO2022142544 A1 WO 2022142544A1 CN 2021121393 W CN2021121393 W CN 2021121393W WO 2022142544 A1 WO2022142544 A1 WO 2022142544A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- page
- data
- slow
- target segment
- physical
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 239000007787 solid Substances 0.000 title abstract description 14
- 230000006399 behavior Effects 0.000 claims abstract description 14
- 238000004364 calculation method Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 13
- 238000010586 diagram Methods 0.000 description 10
- 230000002159 abnormal effect Effects 0.000 description 8
- 239000003990 capacitor Substances 0.000 description 4
- 230000006870 function Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/70—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
- G06F21/78—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data
- G06F21/79—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data in semiconductor storage media, e.g. directly-addressable memories
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1456—Hardware arrangements for backup
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/16—Protection against loss of memory contents
Definitions
- the present application relates to a solid-state hard disk control technology, and in particular, to a method for preventing data loss in flash memory, a solid-state hard disk controller, and a solid-state hard disk.
- SSD Solid State Drives
- TLC flash memory has become the current mainstream storage medium.
- a cell (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 slow page respectively.
- TLC flash memory physical word lines are written in two ways, one pass and two pass. The so-called two-pass writing method means that the first step master writes the slow page into the flash word line, the second step master writes the fast page and the super page together into the flash word line, and then all cells in the entire word line are written. will remain in a stable state.
- the related art configures a backup power supply for the main power supply, and when the main power supply fails abnormally, the backup power supply intervenes to work.
- the backup power capacity of the capacitor will weaken with the use of time.
- the actual backup power capacity of the capacitor cannot meet the requirements of the initial design.
- the related art also chooses to use a capacitor with super power backup capability, but the capacitor is also relatively expensive. Therefore, it is of great significance to successfully solve the problem of sharing physical pages caused by abnormal power failure of the SSD without additional cost.
- the technical problem mainly solved by the embodiments of the present application is how to successfully solve the problem of sharing physical pages caused by abnormal power failure of the SSD without additional cost.
- a technical solution adopted by the embodiments of the present application is to provide a method for preventing data loss of flash memory, including:
- the obtaining the serial number of the target segment where the slow page corresponding to the fast page super page is located includes:
- the number of the target segment where the slow page corresponding to the fast page superpage is located is calculated according to the physical page number and the fixed step size.
- the acquiring the physical page number of the slow page corresponding to the fast page superpage, and the fixed step size specifically include:
- obtaining the backup data and the first slow page data of the target segment according to the serial number includes:
- the backup data is based on the first slow
- the page data and the second slow page data are calculated and stored in the SLC backup physical block;
- the unmissed slow page data in the physical page corresponding to the number of the target segment is read from the TLC physical block, and the unmissed slow page data constitutes the first slow page data.
- the backup data is XOR data
- the XOR data is obtained by performing an XOR operation on the non-lost slow page data and the second slow page data.
- the method further includes: backing up the backup data in a physical block;
- backing up the backup data in the physical block includes:
- the calculation result 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.
- the step of backing up the backup data in the physical block is performed on the previous target segment of the current target segment.
- the calculating and restoring the second slow page data according to the backup data and the first slow page data includes:
- a solid-state hard disk controller including: at least one processor; and a memory, where a program is stored in the memory; When the at least one processor is executed, the program causes the solid-state disk controller to execute the method described above.
- a solid-state hard disk including: the above-mentioned solid-state hard disk controller, and at least one flash memory medium communicatively connected to the solid-state hard disk controller .
- another technical solution adopted by the embodiments of the present application is to provide a computer program product, wherein the computer program product includes a computer program stored on a solid-state hard disk, and the computer program includes program instructions.
- the program instructions are executed by the solid-state hard disk controller, the solid-state hard disk controller is made to execute the above-mentioned method.
- the embodiment of the present application obtains the corresponding superpage of the fast page by detecting that the solid-state drive has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage.
- the number of the target segment where the slow page is located obtain the backup data and the first slow page data of the target segment according to the number; calculate and restore the second slow page data according to the backup data and the first slow page data.
- the second slow page data for recovering lost data can be calculated according to the backup data of the target segment and the first slow page data.
- a method for preventing data loss in flash memory, a solid state disk controller, and a solid state disk can solve the problem of shared physical pages, improve the stability of flash memory data, and do not require additional costs.
- FIG. 1 is a flowchart of a method for preventing data loss of flash memory provided by an embodiment of the present application
- FIG. 2 is a schematic diagram of the composition of a plane (Plane) in the TLC flash memory provided by an embodiment of the present application;
- FIG. 3 is a schematic diagram of a writing process flow of a physical page in the target segment provided by an embodiment of the present application
- FIG. 4 is a schematic diagram of a writing process flow of data in a backup physical block provided by an embodiment of the present application
- FIG. 5 is a schematic diagram of backing up and restoring the backup data of the target segment for TLC flash memory provided by an embodiment of the present application
- FIG. 6 is a schematic diagram of a hardware structure of a solid-state hard disk controller 20 according to an embodiment of the present application.
- the method for preventing flash data loss, the solid-state disk controller, and the solid-state disk provided by the embodiments of the present application divide a physical page into multiple target segments according to the characteristics of the shared physical page problem, and a target segment includes slow pages, fast pages and Superpage, the fast page and superpage corresponding to the slow page in each target segment are in the next target segment.
- a target segment includes slow pages, fast pages and Superpage
- the fast page and superpage corresponding to the slow page in each target segment are in the next target segment.
- 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.
- the SSD will notify the host that the slow page data is successfully written to the flash memory. Therefore, if the data of the current slow page is lost, it is unacceptable for the host.
- the embodiment of the present application backs up the backup data by acquiring the backup data corresponding to all the slow page data in the target segment, and when the data of a slow page in the target segment is lost, according to the The data of the lost slow page is obtained by calculating the backup data and the data of other slow pages that are not lost in the target segment, so as to restore the data of the slow page.
- the data of the lost slow page is obtained by calculating the backup data and the data of other slow pages that are not lost in the target segment, so as to restore the data of the slow page.
- FIG. 1 is a flowchart of a method for preventing data loss in a flash memory provided by an embodiment of the present application.
- the method includes:
- the obtaining the number of the target segment where the slow page corresponding to the fast page super page is located includes:
- the number of the target segment where the slow page corresponding to the fast page superpage is located is calculated according to the physical page number and the fixed step size.
- the acquiring the physical page number of the slow page corresponding to the fast page super page, and the fixed step size specifically include:
- the acquiring the backup data and the first slow page data of the target segment according to the number includes: searching for 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 unmissed slow page data in the physical page corresponding to the number of the target segment is read from the TLC physical block, and the unmissed slow page data constitutes the first slow page data.
- 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.
- S103 Calculate and restore the second slow page data according to the backup data and the first slow page data.
- the first slow page data is data that is not lost in a target segment
- 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.
- the data calculation restores the second slow page data, for example, performing an exclusive OR operation on the first slow page data and the backup data.
- the calculation of the backup data is performed before the data of the second slow page is not lost.
- the above-mentioned method for preventing flash data loss will be 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.
- the embodiment of the present application mainly solves the problem of sharing physical pages.
- the so-called shared physical page problem is that a physical cell (cell) is shared by two pages (pages), and two bits in one cell are mapped to two In different logical pages, when a write operation is performed on one of the bits (whether it is MSB or LSB), if the power is suddenly turned off, the data in this unit is bound to be lost, that is, the data in the two pages will be lost. Data will be wrong.
- 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.
- Three physical pages in a word line are shared physical pages. Among them, slow pages, fast pages and super pages are associated with each other.
- the method for preventing data loss of flash memory in this embodiment is mainly aimed at preventing data loss of the slow page.
- FIG. 2 is a schematic diagram of the structure of a plane (Plane) in the TLC flash memory, and the Plane includes a page of registers and several physical pages.
- the SSD master 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 shows the positional relationship of all shared physical pages in a physical block in Plane.
- the serial numbers of the physical pages in Figure 2 (such as 36, 37, 38, 39, etc.) are the writing order, and each dotted line links a The group shares physical pages.
- physical page 62 slow page
- physical page 132 fast page
- physical page 133 super page
- the fixed step size is 70 in FIG. 2 .
- the fixed step size is determined by the 3D stacking characteristics of the TLC flash memory.
- the method for dividing the target segment includes: obtaining the serial number of the physical page and the fixed step size; dividing all the physical pages into multiple targets equally according to the serial number of the physical page and the fixed step size
- Each target segment contains the same number of physical pages, and includes slow pages, fast pages and super pages, and the fast pages and super pages corresponding to any slow page in each target segment are under the in a target segment.
- the fast page and super page corresponding to physical page 65 are in the target segment x+1, namely physical page 135 (fast page) and physical page 136 (super page).
- the physical page corresponding to target segment x includes physical page 60 to physical page 131
- the physical page corresponding to target segment x+1 includes physical page 132 to physical page 203;
- FIG. 3 is a schematic diagram of a writing process of a physical page in the target segment.
- the master first the master writes the next physical page k; judges whether the physical page k is a slow page, if it is not a slow page, then continues to write the next physical page, if it is a slow page, judges the Whether physical page k is the last slow page; if the physical page k is the last slow page, calculate all the slow page data in the target segment to obtain backup data, write the backup data into the backup physical block, and then Then write to the next physical page 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.
- the writing sequence of TLC physical pages in the plane Plane is carried out in the manner of slow page, fast page superpage, slow page, fast page superpage... . If an abnormal power failure occurs and the slow page is being written, the data of the slow page will be lost, and the SSD will not send a notification to the host that the data writing is complete, that is, the data lost in the slow page will be lost. It is allowed, and the fast page and super page associated with the slow page are written later, which has not had time to write data, so it will not affect the fast page and super page. If an abnormal power failure occurs and the fast page superpage is being written, the data of the fast page superpage will be lost, and the data of the slow page associated with the fast page superpage will be lost. The write operation to the associated slow page has been completed before the write operation, and the solid-state drive has reported to the host that the part of the data has been written, but in fact the current data of the slow page has been lost.
- the backup data is used to convert the backup data and the corresponding The unmissed slow page data in the target segment is calculated to obtain the lost slow page data.
- the master After the SSD is powered on, it is found that the data of the slow page d is lost, then the master reads out the data slow page a, slow page b, slow page c, XOR, and performs XOR calculation on them.
- the XOR result is equal to the slow page d. data, i.e. slow pages
- a backup of backed up data is performed before the data is restored.
- FIG. 4 is a schematic diagram of a writing process of data in a backup physical block.
- first erase the SLC backup physical block divide the TLC physical block into a target segment according to the characteristics of the flash memory; write the physical pages into the target segment in sequence; judge whether the data in the target segment has been written, If it is not finished, continue to write physical pages into the target segment in sequence. If it has been written, read out all the slow page data in the target segment and perform calculation (for example, XOR calculation), The calculation result is obtained, and the calculation result is saved in the SLC backup physical block; then, the above-mentioned writing process is continued to be performed on the next SLC backup physical block.
- calculation for example, XOR calculation
- FIG. 5 is a schematic diagram of backing up and restoring the backup data of the target segment with respect to the TLC flash memory.
- the master 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, long life, and low capacity, and the writing method of the physical block in SLC mode is one pass, that is, there is naturally no problem of sharing physical pages. Therefore, this embodiment adopts the SLC backup physical block as the backup block.
- the calculation result of all slow page data in a target segment is stored 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 page number of the target segment corresponding to the calculation result. Numbering.
- the backup data is obtained from the SLC backup physical block according to the number of the target segment where the slow page where the data is lost is located, and then combined with other slow pages without data loss in the target segment where the slow page is located. The data is calculated together to obtain the lost data of the slow page.
- the above is to back up the calculation result of all slow page data in a target segment, instead of backing up all slow page data in a target segment. Therefore, the problem of shared physical pages is solved and the efficiency of data backup is also improved.
- the master immediately sends a Copy Back command (the function of the flash memory chip can copy a certain physical device in the same Plane. Copy the page data to another physical page) Write the data in the slow page to the SLC physical page of the backup physical block.
- a Copy Back command the function of the flash memory chip can copy a certain physical device in the same Plane. Copy the page data to another physical page
- the data backup method of the present application significantly improves the data backup efficiency, reduces the time consumption, and can solve the problem of sharing physical pages with a minimal performance cost.
- the TLC physical page is divided into several target segments, and the calculation results of all the slow page data in each target segment are backed up to the SLC backup physical block respectively.
- a certain fast page superpage in the TLC physical page is When an abnormal power failure occurs during the write operation, obtain the number of the last target segment of the target segment where the fast page superpage is located, and obtain the backup from the SLC backup physical block according to the number of the last target segment. data, and calculate the backup data with the slow page data without the lost data, so as to obtain the lost slow page data.
- the method provided by this embodiment can solve the problem of sharing physical pages, improve the stability of flash memory data, and does not require additional cost.
- FIG. 6 is a schematic diagram of a hardware structure of a solid-state disk controller 20 provided by an embodiment of the present application.
- the solid-state disk controller 20 can be used to execute the above-mentioned method for preventing data loss in a flash memory.
- the processor 20 includes: one or more processors 21 and a memory 22, and one processor 21 is taken as an example in FIG. 6 .
- the processor 21 and the memory 22 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 6 .
- the memory 22 can be used to store non-volatile software programs, non-volatile computer-executable programs and modules, such as corresponding to the method for preventing flash data loss in the embodiments of the present application. program instructions/modules.
- the processor 21 executes various functional applications and data processing of the SSD controller by running the non-volatile software programs, instructions and modules stored in the memory 22, that is, implementing the method for preventing flash data loss in the above method embodiments.
- the memory 22 may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function. Additionally, memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 22 may optionally include memory located remotely from processor 21 .
- the one or more modules are stored in the memory 22, and when executed by the one or more processors 21, execute the method for preventing flash data loss in any of the above method embodiments, for example, execute the above-described method.
- the above product can execute the method provided by the embodiments of the present application, and has functional modules corresponding to the execution method.
- functional modules corresponding to the execution method For technical details not described in detail in this embodiment, reference may be made to the methods provided in the embodiments of this application.
- the solid-state disk controller when it is detected that the solid-state disk has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage, it obtains the corresponding superpage of the fast page.
- the number of the target segment where the slow page is located; the backup data and the first slow page data of the target segment are obtained according to the number; the second slow page data is calculated according to the backup data and the first slow page data, and the first slow page data is calculated.
- the second slow page data is used to restore the lost data of the slow page.
- the second slow page data for recovering lost data can be calculated according to the backup data of the target segment and the first slow page data.
- the SSD controller can solve the problem of shared physical pages and improve the stability of flash data without additional cost.
- Embodiments of the present application further provide a solid-state hard disk, where the solid-state hard disk includes the solid-state hard disk controller 20 described in the foregoing embodiments, and at least one flash memory medium.
- the solid state disk controller 20 is communicatively connected to the at least one flash memory medium.
- the solid-state disk acquires the slow page corresponding to the fast-page superpage by detecting that the solid-state disk has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage
- the number of the target segment obtain the backup data and the first slow page data of the target segment according to the number; calculate the second slow page data according to the backup data and the first slow page data, the second slow page
- the page data is used to recover the lost data of the slow page.
- the second slow page data for recovering lost data can be calculated according to the backup data of the target segment and the first slow page data.
- Solid-state drives can solve the problem of shared physical pages, improve the stability of flash data, and do not require additional costs.
- An embodiment of the present application provides a computer program product, where the computer program product includes a computer program stored on a solid-state disk, and the computer program includes program instructions, when the program instructions are executed by the solid-state disk controller,
- the SSD controller is enabled to execute the method for preventing flash data loss in any of the above method embodiments, for example, execute the above-described method steps S101 to S103 in FIG. 1 , and execute the processes in FIGS. 3 and 4 .
- the device embodiments described above are only 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 it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each embodiment can be implemented by means of software plus a general hardware platform, and certainly can also be implemented by hardware.
- Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and the program is During execution, it may include the processes of the embodiments of the above-mentioned methods.
- the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM) or the like.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Software Systems (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
A method for preventing data loss from a flash memory, a solid state drive controller, and a solid state drive. The method comprises: when it is detected that a power-down behavior occurs in a solid state drive, and the page written when the power-down behavior occurs is an upper page/extra page, obtaining the number of a target segment where a lower page corresponding to the upper page/extra page is located; obtaining backup data of the target segment and first lower page data according to the number; and restoring second lower page data according to the backup data and the first lower page data. The present invention can solve the problem of sharing a physical page, improve the stability of flash memory data, and do not require additional costs.
Description
相关申请的交叉参考CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2020年12月29日提交中国专利局,申请号为202011595224.3,发明名称为“防止闪存数据丢失的方法、固态硬盘控制器、固态硬盘”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on December 29, 2020 with the application number 202011595224.3 and the invention titled "Method for Preventing Data Loss in Flash Memory, Solid State Disk Controller, Solid State Disk", the entire contents of which are Incorporated herein by reference.
本申请涉及固态硬盘控制技术,特别涉及一种防止闪存数据丢失的方法、固态硬盘控制器、固态硬盘。The present application relates to a solid-state hard disk control technology, and in particular, to a method for preventing data loss in flash memory, a solid-state hard disk controller, and a solid-state hard disk.
固态硬盘(Solid State Drives,SSD)是采用固态电子存储芯片阵列而制成的硬盘,已被广泛应用于各种场合,由于其在性能、功耗、环境适应性等方面的优秀指标,正逐步替换传统的硬盘。目前无论是SSD消费级市场还是企业级市场,TLC闪存成为当前主流的存储介质。Solid State Drives (SSD) are hard drives made of solid-state electronic memory chip arrays, which have been widely used in various occasions. Due to their excellent indicators in performance, power consumption, and environmental adaptability, they are gradually becoming Replace traditional hard drives. At present, whether it is the SSD consumer market or the enterprise market, TLC flash memory has become the current mainstream storage medium.
TLC闪存的一个单元(cell)可表示3个比特,128K个cell构成一个字线,字线中所有cell的第1个比特构成慢页(Lower Page),第2个和第3个比特分别构成快页(Upper Page)和超页(Extra Page)。我们称一个字线中的3个物理页为共享物理页。TLC闪存物理字线的写入方式又分为两种,分别为one pass和two pass。所谓two pass写入方式指的是第一步主控将慢页写入闪存字线,第二步主控将快页和超页一起写入闪存字线,之后整个字线中所有的cell才会保持在稳定的状态。然而,在上述第二步写入时如果发生异常掉电,不仅导致字线中当前写入的数据丢失,连之前成功写入慢页中的数据也会丢失。对主机而言,慢页的数据丢失是不可接受的,因为在执行上述第二步之前SSD主控就会告知主机,慢页的数据已成功写入闪存。A cell (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 slow page respectively. Fast page (Upper Page) and super page (Extra Page). We call 3 physical pages in a word line shared physical pages. TLC flash memory physical word lines are written in two ways, one pass and two pass. The so-called two-pass writing method means that the first step master writes the slow page into the flash word line, the second step master writes the fast page and the super page together into the flash word line, and then all cells in the entire word line are written. will remain in a stable state. However, if an abnormal power failure occurs during the above-mentioned second step of writing, not only the data currently written in the word line will be lost, but also the data previously successfully written in the slow page will be lost. For the host, the data loss of the slow page is unacceptable, because the SSD master will inform the host that the data of the slow page has been successfully written to the flash memory before the second step above.
为解决上述问题,相关技术给主电源配置备用电源,当主电源异常掉电后,备用电源介入工作。但是,电容的备电能力会随着使用时间变长而减弱,在SSD的生命后期,电容的实际备电能力不能满足初始设计的要求,此时大概率仍会出现第二步在写入数据时异常掉电的情况。为此,相关技术还选择了采用备电能力超级强的电容,但是该电容价格也比较昂贵。因此,如何在不额外增加成本的情况下成功解决由于SSD异常掉电而导致的共享物理页的问题,具有重要 意义。In order to solve the above problems, the related art configures a backup power supply for the main power supply, and when the main power supply fails abnormally, the backup power supply intervenes to work. However, the backup power capacity of the capacitor will weaken with the use of time. In the later 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 occur in writing data. In case of abnormal power failure. To this end, the related art also chooses to use a capacitor with super power backup capability, but the capacitor is also relatively expensive. Therefore, it is of great significance to successfully solve the problem of sharing physical pages caused by abnormal power failure of the SSD without additional cost.
发明内容SUMMARY OF THE INVENTION
本申请实施方式主要解决的技术问题是如何在不额外增加成本的情况下成功解决由于SSD异常掉电而导致的共享物理页的问题。The technical problem mainly solved by the embodiments of the present application is how to successfully solve the problem of sharing physical pages caused by abnormal power failure of the SSD without additional cost.
为解决上述技术问题,本申请实施方式采用的一个技术方案是:提供一种防止闪存数据丢失的方法,包括:In order to solve the above-mentioned technical problems, a technical solution adopted by the embodiments of the present application is to provide a method for preventing data loss of flash memory, including:
当检测到固态硬盘产生掉电行为,并且发生所述掉电行为时所写入的页为快页超页,则获取所述快页超页对应的慢页所在目标段的编号;When it is detected that the solid-state drive has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage, obtain the number of the target segment where the slow page corresponding to the fast page superpage is located;
根据所述编号获取所述目标段的备份数据和第一慢页数据;Acquire the backup data and the first slow page data of the target segment according to the number;
根据所述备份数据和所述第一慢页数据计算恢复第二慢页数据。Calculate and restore the second slow page data according to the backup data and the first slow page data.
可选地,所述获取所述快页超页对应的慢页所在目标段的编号,包括:Optionally, the obtaining the serial number of the target segment where the slow page corresponding to the fast page super page is located includes:
获取所述快页超页对应的慢页的物理页编号,以及固定步长,所述固定步长用于表示一个共享物理页的慢页与快页超页的序号间隔长度;Obtain the physical page number of the slow page corresponding to the fast page superpage, and a fixed step size, where the fixed step size is used to represent the serial number interval length between the slow page and the fast page superpage of a shared physical page;
根据所述物理页编号和所述固定步长计算所述快页超页对应的慢页所在目标段的编号。The number of the target segment where the slow page corresponding to the fast page superpage is located is calculated according to the physical page number and the fixed step size.
可选地,所述获取所述快页超页对应的慢页的物理页编号,以及固定步长具体包括:Optionally, the acquiring the physical page number of the slow page corresponding to the fast page superpage, and the fixed step size specifically include:
获取所述快页超页对应的慢页在TLC物理块中的物理页编号,以及所述TLC物理块对应的固定步长。Obtain the physical page number in the TLC physical block of the slow page corresponding to the fast page superpage, and the fixed step size corresponding to the TLC physical block.
可选地,所述根据所述编号获取所述目标段的备份数据和第一慢页数据,包括:Optionally, obtaining the backup data and the first slow page data of the target segment according to the serial number includes:
从SLC备份物理块中查找所述目标段的编号,并读取所述目标段的编号对应的备份数据;其中,所述备份数据是在所述固态硬盘未掉电时根据所述第一慢页数据和所述第二慢页数据计算得到的,并且保存在所述SLC备份物理块中;Find the number of the target segment from the SLC backup physical block, and read the backup data corresponding to the number of the target segment; wherein, the backup data is based on the first slow The page data and the second slow page data are calculated and stored in the SLC backup physical block;
从所述TLC物理块中读取所述目标段的编号对应的物理页中未丢失的慢页数据,所述未丢失的慢页数据构成所述第一慢页数据。The unmissed slow page data in the physical page corresponding to the number of the target segment is read from the TLC physical block, and the unmissed slow page data constitutes the first slow page data.
可选地,所述备份数据为异或数据,所述异或数据是将所述未丢失的慢页数据与所述第二慢页数据进行异或运算后得到的。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.
可选地,所述方法还包括:在物理块中对所述备份数据进行备份;Optionally, the method further includes: backing up the backup data in a physical block;
其中,所述在物理块中对所述备份数据进行备份,包括:Wherein, backing up the backup data in the physical block includes:
擦除SLC备份物理块;Erase the SLC backup physical block;
根据闪存特性对TLC物理块划分目标段;Divide the TLC physical block into the target segment according to the characteristics of the flash memory;
按顺序将物理页写入划分好的所述目标段中;Write physical pages into the divided target segments in sequence;
在一个所述目标段的物理页写完时,读取所述一个目标段中的全部慢页数据,并计算所述全部慢页数据,以获得所述一个目标段中的全部慢页数据对应的计算结果;When the physical page of one target segment is written, read all the slow page data in the one target segment, and calculate all the slow page data to obtain the corresponding data of all the slow pages in the one target segment the calculation result;
将所述计算结果保存至所述SLC备份物理块的物理页中,并且所述SLC备份物理块的物理页的页号为所述计算结果对应的目标段的编号。The calculation result 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.
可选地,在对当前目标段开始写入数据前,对所述当前目标段的上一个目标段执行所述在物理块中对所述备份数据进行备份的步骤。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 the previous target segment of the current target segment.
可选地,所述根据所述备份数据和所述第一慢页数据计算恢复第二慢页数据包括:Optionally, the calculating and restoring the second slow page data according to the backup data and the first slow page data includes:
将所述备份数据与所述第一慢页数据进行异或运算,所述异或运算的结果为所述第二慢页数据。Performing an XOR operation on the backup data and the first slow page data, and the result of the XOR operation is the second slow page data.
为解决上述技术问题,本申请实施方式采用的另一个技术方案是:提供一种固态硬盘控制器,包括:至少一个处理器;以及存储器,所述存储器中存储有程序;当所述程序被所述至少一个处理器执行时,所述程序使所述固态硬盘控制器执行如上所述的方法。In order to solve the above technical problem, another technical solution adopted by the embodiments of the present application is to provide a solid-state hard disk controller, including: at least one processor; and a memory, where a program is stored in the memory; When the at least one processor is executed, the program causes the solid-state disk controller to execute the method described above.
为解决上述技术问题,本申请实施方式采用的又一个技术方案是:提供一种固态硬盘,包括:如上所述的固态硬盘控制器,以及与所述固态硬盘控制器通信连接的至少一个闪存介质。In order to solve the above technical problem, another technical solution adopted by the embodiments of the present application is to provide a solid-state hard disk, including: the above-mentioned solid-state hard disk controller, and at least one flash memory medium communicatively connected to the solid-state hard disk controller .
为解决上述技术问题,本申请实施方式采用的又一个技术方案是:提供一种计算机程序产品,所述计算机程序产品包括存储在固态硬盘上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被固态硬盘控制器执行时,使所述固态硬盘控制器执行上述所述的方法。In order to solve the above technical problem, another technical solution adopted by the embodiments of the present application is to provide a computer program product, wherein the computer program product includes a computer program stored on a solid-state hard disk, and the computer program includes program instructions. When the program instructions are executed by the solid-state hard disk controller, the solid-state hard disk controller is made to execute the above-mentioned method.
区别于相关技术的情况,本申请实施例通过在检测到固态硬盘产生掉电行为,并且发生所述掉电行为时所写入的页为快页超页,则获取所述快页超页对应的慢页所在目标段的编号;根据所述编号获取所述目标段的备份数据和第一慢页数据;根据所述备份数据和所述第一慢页数据计算恢复第二慢页数据,。通过将物理块划分出目标段,从而可根据目标段的备份数据和第一慢页数据计算 得到用于恢复丢失数据的第二慢页数据,相比较于现有技术,本申请实施例提供的防止闪存数据丢失的方法、固态硬盘控制器以及固态硬盘能够解决共享物理页问题,提高闪存数据的稳定性,并且不需要额外增加成本。Different from the situation in the related art, the embodiment of the present application obtains the corresponding superpage of the fast page by detecting that the solid-state drive has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage. The number of the target segment where the slow page is located; obtain the backup data and the first slow page data of the target segment according to the number; calculate and restore 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 lost data can be calculated according to the backup data of the target segment and the first slow page data. A method for preventing data loss in flash memory, a solid state disk controller, and a solid state disk can solve the problem of shared physical pages, improve the stability of flash memory data, and do not require additional costs.
一个或多个实施例通过与之对应的附图进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。One or more embodiments are exemplified by the accompanying drawings, which are not intended to limit the embodiments, and elements with the same reference numerals in the drawings represent similar elements, unless otherwise specified. It is stated that the figures in the accompanying drawings do not constitute a scale limitation.
图1是本申请实施例提供的一种防止闪存数据丢失的方法的流程图;FIG. 1 is a flowchart of a method for preventing data loss of flash memory provided by an embodiment of the present application;
图2是本申请实施例提供的TLC闪存中一个平面(Plane)的构成的示意图;2 is a schematic diagram of the composition of a plane (Plane) in the TLC flash memory provided by an embodiment of the present application;
图3是本申请实施例提供的所述目标段中物理页的写入流程示意图;3 is a schematic diagram of a writing process flow of a physical page in the target segment provided by an embodiment of the present application;
图4是本申请实施例提供的备份物理块中数据的写入流程示意图;4 is a schematic diagram of a writing process flow of data in a backup physical block provided by an embodiment of the present application;
图5是本申请实施例提供的针对TLC闪存对所述目标段的备份数据进行备份和恢复的示意图;5 is a schematic diagram of backing up and restoring the backup data of the target segment for TLC flash memory provided by an embodiment of the present application;
图6是本申请实施例提供的一种固态硬盘控制器20的硬件结构示意图。FIG. 6 is a schematic diagram of a hardware structure of a solid-state hard disk controller 20 according to an embodiment of the present application.
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
此外,下面所描述的本申请各个实施方式中所涉及到的技术特征只要彼此之间未构成冲突就可以相互组合。In addition, the technical features involved in the various embodiments of the present application described below can be combined with each other as long as there is no conflict with each other.
本申请实施例提供的防止闪存数据丢失的方法、固态硬盘控制器以及固态硬盘,根据共享物理页问题的特性,将物理页分割成多个目标段,一个目标段中包括慢页、快页和超页,每一个目标段中的慢页对应的快页和超页都在下一个目标段中。鉴于在对快页和超页写操作时发生掉电情况会导致快页和超页对应的慢页的数据丢失,而所述慢页是位于上一个目标段中的,在其写入后,固态硬盘会通知主机该慢页数据写入闪存成功,因此,如果当前慢页的数据丢失了,对于主机来说是不可接受的。基于此,本申请实施例通过获取所述目标段中所有的慢页数据对应的备份数据,将所述备份数据进行备份,当所述目标段 中的某一慢页的数据丢失时,根据所述备份数据和所述目标段中其他未丢失的慢页的数据计算获得丢失的慢页的数据,从而恢复所述慢页的数据。由此,保障闪存的数据的稳定性,并且不需要增加其他成本。The method for preventing flash data loss, the solid-state disk controller, and the solid-state disk provided by the embodiments of the present application divide a physical page into multiple target segments according to the characteristics of the shared physical page problem, and a target segment includes slow pages, fast pages and Superpage, the fast page and superpage corresponding to the slow page in each target segment are in the next target segment. In view of the fact that the power failure occurs when writing 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. The SSD will notify the host that the slow page data is successfully written to the flash memory. Therefore, if the data of the current slow page is lost, it is unacceptable for the host. Based on this, the embodiment of the present application backs up the backup data by acquiring the backup data corresponding to all the slow page data in the target segment, and when the data of a slow page in the target segment is lost, according to the The data of the lost slow page is obtained by calculating the backup data and the data of other slow pages that are not lost in the target segment, so as to restore the data of the slow page. Thus, the stability of the data of the flash memory is guaranteed, and other costs do not need to be increased.
具体地,请参阅图1,图1是本申请实施例提供的一种防止闪存数据丢失的方法的流程图。所述方法包括:Specifically, please refer to FIG. 1 , which is a flowchart of a method for preventing data loss in a flash memory provided by an embodiment of the present application. The method includes:
S101、当检测到固态硬盘产生掉电行为,并且发生所述掉电行为时所写入的页为快页超页,则获取所述快页超页对应的慢页所在目标段的编号;S101. When it is detected that the solid-state hard disk has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage, obtain the number of the target segment where the slow page corresponding to the fast page superpage is located;
其中,所述获取所述快页超页对应的慢页所在目标段的编号,包括:Wherein, the obtaining the number of the target segment where the slow page corresponding to the fast page super page is located includes:
获取所述快页超页对应的慢页的物理页编号,以及固定步长,所述固定步长用于表示一个共享物理页的慢页与快页超页的序号间隔长度;Obtain the physical page number of the slow page corresponding to the fast page superpage, and a fixed step size, where the fixed step size is used to represent the serial number interval length between the slow page and the fast page superpage of a shared physical page;
根据所述物理页编号和所述固定步长计算所述快页超页对应的慢页所在目标段的编号。The number of the target segment where the slow page corresponding to the fast page superpage is located is calculated according to the physical page number and the fixed step size.
其中,所述获取所述快页超页对应的慢页的物理页编号,以及固定步长具体包括:Wherein, the acquiring the physical page number of the slow page corresponding to the fast page super page, and the fixed step size specifically include:
获取所述快页超页对应的慢页在TLC物理块中的物理页编号,以及所述TLC物理块对应的固定步长。Obtain the physical page number in the TLC physical block of the slow page corresponding to the fast page superpage, and the fixed step size corresponding to the TLC physical block.
S102、根据所述编号获取所述目标段的备份数据和第一慢页数据;S102. Acquire the backup data and the first slow page data of the target segment according to the serial number;
所述根据所述编号获取所述目标段的备份数据和第一慢页数据,包括:从SLC备份物理块中查找所述目标段的编号,并读取所述目标段的编号对应的备份数据;其中,所述备份数据是在所述固态硬盘未掉电时根据所述第一慢页数据和所述第二慢页数据计算得到的,并且保存在所述SLC备份物理块中;从所述TLC物理块中读取所述目标段的编号对应的物理页中未丢失的慢页数据,所述未丢失的慢页数据构成所述第一慢页数据。The acquiring the backup data and the first slow page data of the target segment according to the number includes: searching for 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 unmissed slow page data in the physical page corresponding to the number of the target segment is read from the TLC physical block, and the unmissed slow page data constitutes the first slow page data.
其中,所述备份数据为异或数据,所述异或数据是将所述未丢失的慢页数据与所述第二慢页数据进行异或运算后得到的。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.
S103、根据所述备份数据和所述第一慢页数据计算恢复第二慢页数据。S103. Calculate and restore the second slow page data according to the backup data and the first slow page data.
其中,所述第一慢页数据是一个目标段中未丢失的数据,所述第二慢页数据是所述目标段中丢失的数据。所述备份数据是根据所述第一慢页数据和所述第二慢页数据计算得到的,当需要恢复所述第二慢页数据时,可以根据所述第一慢页数据和所述备份数据计算恢复所述第二慢页数据,比如,将所述第一慢 页数据和所述备份数据执行异或运算。另外,需要说明的是,计算所述备份数据是在所述第二慢页数据未丢失前执行的。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 first slow page data and the backup data can be obtained. The data calculation restores the second slow page data, for example, performing an exclusive OR operation 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 data of the second slow page is not lost.
下面基于TLC闪存来具体说明上述防止闪存数据丢失的方法,该过程主要包括划分目标段、备份数据的计算、备份数据的备份以及丢失数据的恢复。The above-mentioned method for preventing flash data loss will be 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.
本申请实施例主要解决的就是共享物理页问题,所谓共享物理页问题即是:一个物理单元(cell)是被两个页(page)所共享,一个单元中的两个比特被映射到两个不同的逻辑页中,那么当对其中一个比特进行写入操作时(无论是MSB还是LSB),如果突然掉电,那么,这个单元中的数据势必会丢失,也就是说,两个页中的数据都会出现错误。The embodiment of the present application mainly solves the problem of sharing physical pages. The so-called shared physical page problem is that a physical cell (cell) is shared by two pages (pages), and two bits in one cell are mapped to two In different logical pages, when a write operation is performed on one of the bits (whether it is MSB or LSB), if the power is suddenly turned off, the data in this unit is bound to be lost, that is, the data in the two pages will be lost. Data will be wrong.
可以知道的,当前主流的存储介质TLC闪存的一个cell可表示3比特,字线中所有cell的第1个比特构成慢页,第2个和第3个比特分别构成快页和超页,称一个字线中的三个物理页为共享物理页。其中,慢页、快页和超页互相关联。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. Three physical pages in a word line are shared physical pages. Among them, slow pages, fast pages and super pages are associated with each other.
在本实施例中,当固态硬盘产生掉电行为时,如果当前正在写操作的对象是所述快页超页,则确定所述快页超页关联的慢页的数据存在丢失的风险,因此,本实施例的防止闪存数据丢失的方法主要针对的是防止所述慢页的数据丢失。In this embodiment, when the solid state drive is powered down, if the object currently being written is the fast page superpage, it is determined that there is a risk of data loss in the slow page associated with the fast page superpage. Therefore, , the method for preventing data loss of flash memory in this embodiment is mainly aimed at preventing data loss of the slow page.
请参阅图2,图2是TLC闪存中一个平面(Plane)的构成的示意图,该Plane包括一页寄存器和若干物理页。写入数据时,SSD主控首先将16KB数据传输至页寄存器,然后闪存将页寄存器中的数据写入到闪存的物理页中。通过图2可知Plane中某个物理块中所有的共享物理页的位置关系,其中,图2中物理页的序号(比如36、37、38、39等)就是写入顺序,每一虚线链接一组共享物理页,比如,图2中物理页62(慢页)和物理页132(快页)、物理页133(超页)共同构成所述共享物理页,即这三个物理页在物理上为同一字线。通过图2可知,物理页的慢页和快页超页的序号之间会间隔固定步长,比如图2中该固定步长是70。其中,所述固定步长是由TLC闪存的3D堆叠特性决定的。Please refer to FIG. 2. FIG. 2 is a schematic diagram of the structure of a plane (Plane) in the TLC flash memory, and the Plane includes a page of registers 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 shows the positional relationship of all shared physical pages in a physical block in Plane. The serial numbers of the physical pages in Figure 2 (such as 36, 37, 38, 39, etc.) are the writing order, and each dotted line links a The group shares physical pages. For example, in Figure 2, physical page 62 (slow page), physical page 132 (fast page), and physical page 133 (super page) together constitute the shared physical page, that is, these three physical pages are physically for the same word line. As can be seen from FIG. 2 , there is a fixed step size between the serial numbers of the slow page of the physical page and the superpage of the fast page, for example, the fixed step size is 70 in FIG. 2 . The fixed step size is determined by the 3D stacking characteristics of the TLC flash memory.
基于上述TLC闪存的特性,在本实施例中,将一个平面中的全部物理页划分为多个目标段。其中,划分所述目标段的方法包括:获取所述物理页的序号,以及所述固定步长;根据所述物理页的序号和所述固定步长将全部的物理页等分为多干目标段,每一所述目标段中所包含的物理页的数量相同,并且都包括 慢页、快页和超页,而且每一个目标段中的任何一个慢页对应的快页和超页都在下一个目标段中。比如,图2中,物理页65(慢页)对应的快页和超页在目标段x+1中,即物理页135(快页)和物理页136(超页)。划分好的所述目标段具体可参见图2,目标段x对应的物理页包括物理页60至物理页131;目标段x+1对应的物理页包括物理页132至物理页203;等。Based on the characteristics of the above-mentioned TLC flash memory, in this embodiment, all physical pages in one plane are divided into multiple target segments. Wherein, the method for dividing the target segment includes: obtaining the serial number of the physical page and the fixed step size; dividing all the physical pages into multiple targets equally according to the serial number of the physical page and the fixed step size Each target segment contains the same number of physical pages, and includes slow pages, fast pages and super pages, and the fast pages and super pages corresponding to any slow page in each target segment are under the in a target segment. For example, in FIG. 2, 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). 2, the physical page corresponding to target segment x includes physical page 60 to physical page 131; the physical page corresponding to target segment x+1 includes physical page 132 to physical page 203;
请参阅图3,图3是所述目标段中物理页的写入流程示意图。如图3所示,首先主控写入下一个物理页k;判断所述物理页k是否是慢页,若不是慢页,则继续写入下一个物理页,若是慢页,则判断所述物理页k是否是最后一个慢页;若所述物理页k是最后一个慢页,则将目标段中所有慢页数据进行计算获得备份数据,并将备份数据写入到备份物理块中,接下来再对下一个物理页进行写入,以备份下一个目标段对应的数据;其中,若所述物理页k不是最后一个慢页,则主控继续写入下一个物理页。Please refer to FIG. 3 . FIG. 3 is a schematic diagram of a writing process of a physical page in the target segment. As shown in Figure 3, first the master writes the next physical page k; judges whether the physical page k is a slow page, if it is not a slow page, then continues to write the next physical page, if it is a slow page, judges the Whether physical page k is the last slow page; if the physical page k is the last slow page, calculate all the slow page data in the target segment to obtain backup data, write the backup data into the backup physical block, and then Then write to the next physical page 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.
可以知道的,平面Plane中TLC物理页的写入顺序是按照慢页、快页超页、慢页、快页超页……这种方式进行的。如果当前发生异常掉电,并且正在针对慢页写操作,此时会造成慢页的数据丢失,固态硬盘不会向主机反馈数据写入完成的通知,也即是说,该慢页丢失的数据是允许的,并且与该慢页关联的快页和超页是在后面写入,其本来就还没来得及写入数据,所以也不会对快页和超页造成影响。如果当前发生异常掉电,并且正在针对快页超页写操作,此时会造成快页超页的数据丢失,以及该快页超页关联的慢页的数据丢失,而在对快页超页写操作之前就已经完成了对其关联的慢页的写操作,并且固态硬盘已经上报主机该部分数据写入完成,但实际上当前所述慢页的数据已经丢失了。It can be known that the writing sequence of TLC physical pages in the plane Plane is carried out in the manner of slow page, fast page superpage, slow page, fast page superpage... . If an abnormal power failure occurs and the slow page is being written, the data of the slow page will be lost, and the SSD will not send a notification to the host that the data writing is complete, that is, the data lost in the slow page will be lost. It is allowed, and the fast page and super page associated with the slow page are written later, which has not had time to write data, so it will not affect the fast page and super page. If an abnormal power failure occurs and the fast page superpage is being written, the data of the fast page superpage will be lost, and the data of the slow page associated with the fast page superpage will be lost. The write operation to the associated slow page has been completed before the write operation, and the solid-state drive has reported to the host that the part of the data has been written, but in fact the current data of the slow page has been lost.
基于上述特性可知,在对快页超页写操作且发生异常掉电时,是会造成其关联的慢页的数据丢失的,并且最多只会造成一个慢页的数据丢失,也即是该快页超页关联的慢页的数据会丢失,所述目标段中的其他慢页数据是完好的。因此,在一个目标段的慢页数据都写入完成时,计算所述目标段中全部的慢页数据以获得备份数据,并将所述备份数据进行备份;或者,在对当前目标段开始写入数据前,对所述当前目标段的上一个目标段中的慢页数据进行计算,获得备份数据,并将所述备份数据进行备份。Based on the above characteristics, when a fast page superpage 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 fast page will be lost. The data of the slow page associated with the page superpage is lost, and the data of other slow pages in the target segment is intact. Therefore, when all the slow page data of a target segment is written, calculate all the slow page data in the target segment to obtain backup data, and back up the backup data; or, start writing to the current target segment Before entering data, 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.
其中,所述备份数据用于在其对应的目标段的下一个目标段中的快页超页写操作时发生异常掉电的情况下,通过将所述备份数据,以及所述备份数据对 应的目标段中的未丢失的慢页数据进行计算,从而获得丢失的慢页的数据。Wherein, the backup data is used to convert the backup data and the corresponding The unmissed slow page data in the target segment is calculated to obtain the lost slow page data.
例如,假设一个慢页的数据由4(实际上有几十万个)比特组成,而且一个目标段中有4个慢页,即,For example, suppose the data of a slow page consists of 4 (actually hundreds of thousands) bits, and there are 4 slow pages in a target segment, i.e.,
慢页a=[0,1,1,1];slow page a = [0,1,1,1];
慢页b=[1,0,0,1];slowpage b = [1,0,0,1];
慢页c=[0,0,0,1];slowpage c=[0,0,0,1];
慢页d=[1,0,0,0];slowpage d=[1,0,0,0];
将慢页a、慢页b、慢页c和慢页d进行异或计算,获得备份数据,即是:XOR the slow page a, slow page b, slow page c and slow page d to obtain backup data, that is:
固态硬盘上电后发现慢页d数据丢失了,则主控读出数据慢页a,慢页b,慢页c,XOR,并将它们进行异或计算,异或结果就等于慢页d的数据,即慢页
After the SSD is powered on, it is found that the data of the slow page d is lost, then the master reads out the data slow page a, slow page b, slow page c, XOR, and performs XOR calculation on them. The XOR result is equal to the slow page d. data, i.e. slow pages
需要说明的是,上述仅作为如何恢复丢失的数据的一个示例,其中采用异或计算的方式来恢复丢失的数据,除了异或计算的方式之外,还可以采用其他方式,而不仅限于异或。It should be noted that the above is only an example of how to recover lost data, in which the way of XOR calculation is used to restore lost data, in addition to the way of XOR calculation, other ways can also be used, not limited to XOR .
下面再介绍如何对所述备份数据进行备份。备份数据的备份是在对数据进行恢复之前执行的。The following describes how to back up the backup data. A backup of backed up data is performed before the data is restored.
请参阅图4,图4是备份物理块中数据的写入流程示意图。如图4所示,首先擦除SLC备份物理块;根据闪存特性对TLC物理块划分目标段;按顺序将物理页写入所述目标段中;判断所述目标段中的数据是否写完,若没有写完,则继续按顺序将物理页写入所述目标段中,若已经写完,则将所述目标段中的所有慢页数据读出并进行计算(比如是异或计算),得到计算结果,将所述计算结果保存至SLC备份物理块中;接下来继续对下一个SLC备份物理块执行上述写入流程。Please refer to FIG. 4 . FIG. 4 is a schematic diagram of a writing process of data in a backup physical block. As shown in Figure 4, first erase the SLC backup physical block; divide the TLC physical block into a target segment according to the characteristics of the flash memory; write the physical pages into the target segment in sequence; judge whether the data in the target segment has been written, If it is not finished, continue to write physical pages into the target segment in sequence. If it has been written, read out all the slow page data in the target segment and perform calculation (for example, XOR calculation), The calculation result is obtained, and the calculation result is saved in the SLC backup physical block; then, the above-mentioned writing process is continued to be performed on the next SLC backup physical block.
请参阅图5,图5是针对TLC闪存对所述目标段的备份数据进行备份和恢复的示意图。其中,主控为闪存的每个平面Plane都配置一个SLC模式的物理块,作为备份模块。SLC模式的物理块具有性能高,寿命高,容量低的特点,并且SLC模式的物理块的写入方式为one pass,即天然的不存在共享物理页的问题。因此,本实施例采用SLC备份物理块作为备份块。Please refer to FIG. 5 , which is a schematic diagram of backing up and restoring the backup data of the target segment with respect to the TLC flash memory. Among them, the master 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, long life, and low capacity, and the writing method of the physical block in SLC mode is one pass, that is, there is naturally no problem of sharing physical pages. Therefore, this embodiment adopts the SLC backup physical block as the backup block.
其中,将一个目标段中全部慢页数据的计算结果保存至所述SLC备份物理 块的物理页中,并且所述SLC备份物理块的物理页的页号为所述计算结果对应的目标段的编号。The calculation result of all slow page data in a target segment is stored 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 page number of the target segment corresponding to the calculation result. Numbering.
当需要恢复数据时,根据数据丢失的慢页所在目标段的编号,从所述SLC备份物理块中获得所述备份数据,再与所述慢页所在目标段中的其他未丢失数据的慢页的数据一起进行计算,获得所述慢页丢失的数据。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 where the data is lost is located, and then combined with other slow pages without data loss in the target segment where the slow page is located. The data is calculated together to obtain the lost data of the slow page.
上述是将一个目标段的全部慢页数据的计算结果进行备份,而不是备份一个目标段中的所有的慢页数据,因此,在解决共享物理页问题的同时还提高了数据备份的效率。The above is to back up the calculation result of all slow page data in a target segment, instead of backing up all slow page data in a target segment. Therefore, the problem of shared physical pages is solved and the efficiency of data backup is also improved.
例如,每个目标段中有72/3=24个慢页,所以备份一个目标段中所有慢页数据花费的时间=读24个SLC物理页耗时+写1个SLC物理页耗时=24*30us+300us=1020us,所以备份整个TLC物理块中慢页数据我们只需要1020us*segment个数=1020us*(720/72)=10200us时间。For example, there are 72/3=24 slow pages in each target segment, so the time spent backing up all slow page data in a target segment = time spent reading 24 SLC physical pages + time spent writing 1 SLC physical page = 24 *30us+300us=1020us, so we only need 1020us*segment number=1020us*(720/72)=10200us time to back up the slow page data in the entire TLC physical block.
而如果是对一个目标段中的全部慢页数据都进行备份,即每写完一个慢页数据后,主控立马发一个Copy Back命令(闪存芯片的功能,能将同一个Plane中某个物理页数据拷贝到另一个物理页中)将慢页中的数据写入备份物理块的SLC物理页中。但是这么做,等价于所有慢页的写入时间增加了T_copyback(Copy Back耗时=读SLC物理页耗时+写SLC物理页耗时~=30us+300us=330us)的时间,假设一个物理块中有720个物理页(即有240个SLC物理页),那么备份一个TLC物理块中所有慢页数据花费的总时间=330*240=79200us。And if it is to back up all the slow page data in a target segment, that is, after each slow page data is written, the master immediately sends a Copy Back command (the function of the flash memory chip can copy a certain physical device in the same Plane. Copy the page data to another physical page) Write the data in the slow page to the SLC physical page of the backup physical block. But doing this is equivalent to increasing the writing time of all slow pages by T_copyback (Copy Back time = time spent reading SLC physical page + time spent writing SLC physical page ~ = 30us+300us=330us) time, assuming a physical There are 720 physical pages in the block (that is, there are 240 SLC physical pages), then the total time spent in backing up all slow page data in a TLC physical block=330*240=79200us.
相比较来说,本申请的数据备份方式明显提升了数据备份效率,降低了时间耗费,能够以极小的性能代价解决共享物理页的问题。In comparison, the data backup method of the present application significantly improves the data backup efficiency, reduces the time consumption, and can solve the problem of sharing physical pages with a minimal performance cost.
本实施例是针对TLC物理页划分若干个目标段,并将每个目标段中全部的慢页数据的计算结果分别备份至SLC备份物理块中,当TLC物理页中的某一快页超页写操作时发生了异常掉电的情况时,获取所述快页超页所在的目标段的上一个目标段的编号,根据所述上一个目标段的编号从所述SLC备份物理块中获得备份数据,并将所述备份数据与未丢失数据的慢页数据进行计算,从而获得丢失的慢页数据。本实施例提供的方法能够解决共享物理页问题,提高闪存数据的稳定性,并且不需要额外增加成本。In this embodiment, the TLC physical page is divided into several target segments, and the calculation results of all the slow page data in each target segment are backed up to the SLC backup physical block respectively. When a certain fast page superpage in the TLC physical page is When an abnormal power failure occurs during the write operation, obtain the number of the last target segment of the target segment where the fast page superpage is located, and obtain the backup from the SLC backup physical block according to the number of the last target segment. data, and calculate the backup data with the slow page data without the lost data, so as to obtain the lost slow page data. The method provided by this embodiment can solve the problem of sharing physical pages, improve the stability of flash memory data, and does not require additional cost.
需要说明的是,上述是针对TLC类型的物理块,而对于其他类型的物理块,比如MLC类型的物理块,也可以基于上述相同的申请构思来解决共享物理页的 问题,MLC类型的物理块也存在共享物理页问题,其备份的数据也可存储于SLC类型的物理块。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 sharing physical pages can also be solved based on the same application concept above. MLC-type physical blocks There is also the problem of shared physical pages, and the backed up data can also be stored in SLC-type physical blocks.
请参阅图6,图6是本申请实施例提供的一种固态硬盘控制器20的硬件结构示意图,该固态硬盘控制器20可用于执行如上所述的防止闪存数据丢失的方法,该固态硬盘控制器20包括:一个或多个处理器21以及存储器22,图6中以一个处理器21为例。Please refer to FIG. 6. FIG. 6 is a schematic diagram of a hardware structure of a solid-state disk controller 20 provided by an embodiment of the present application. The solid-state disk controller 20 can be used to execute the above-mentioned method for preventing data loss in a flash memory. The processor 20 includes: one or more processors 21 and a memory 22, and one processor 21 is taken as an example in FIG. 6 .
处理器21和存储器22可以通过总线或其他方式连接,图6中以通过总线连接为例。The processor 21 and the memory 22 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 6 .
存储器22作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请实施例中的防止闪存数据丢失的方法对应的程序指令/模块。处理器21通过运行存储在存储器22中的非易失性软件程序、指令以及模块,从而执行固态硬盘控制器的各种功能应用以及数据处理,即实现上述方法实施例防止闪存数据丢失的方法。As a non-volatile computer-readable storage medium, the memory 22 can be used to store non-volatile software programs, non-volatile computer-executable programs and modules, such as corresponding to the method for preventing flash data loss in the embodiments of the present application. program instructions/modules. The processor 21 executes various functional applications and data processing of the SSD controller by running the non-volatile software programs, instructions and modules stored in the memory 22, that is, implementing the method for preventing flash data loss in the above method embodiments.
存储器22可以包括存储程序区和存储数据区,其中,存储程序区可存储操作***、至少一个功能所需要的应用程序。此外,存储器22可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器22可选包括相对于处理器21远程设置的存储器。The memory 22 may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function. Additionally, memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 22 may optionally include memory located remotely from processor 21 .
所述一个或者多个模块存储在所述存储器22中,当被所述一个或者多个处理器21执行时,执行上述任意方法实施例中的防止闪存数据丢失的方法,例如,执行以上描述的图1、图2、图3中的方法步骤。The one or more modules are stored in the memory 22, and when executed by the one or more processors 21, execute the method for preventing flash data loss in any of the above method embodiments, for example, execute the above-described method. The method steps in FIG. 1 , FIG. 2 , and FIG. 3 .
上述产品可执行本申请实施例所提供的方法,具备执行方法相应的功能模块。未在本实施例中详尽描述的技术细节,可参见本申请实施例所提供的方法。The above product can execute the method provided by the embodiments of the present application, and has functional modules corresponding to the execution method. For technical details not described in detail in this embodiment, reference may be made to the methods provided in the embodiments of this application.
本实施例提供的固态硬盘控制器,通过在检测到固态硬盘产生掉电行为,并且发生所述掉电行为时所写入的页为快页超页,则获取所述快页超页对应的慢页所在目标段的编号;根据所述编号获取所述目标段的备份数据和第一慢页数据;根据所述备份数据和所述第一慢页数据计算第二慢页数据,所述第二慢页数据用于恢复所述慢页丢失的数据。通过将物理块划分出目标段,从而可根据目标段的备份数据和第一慢页数据计算得到用于恢复丢失数据的第二慢页数 据,相比较于现有技术,本申请实施例提供的固态硬盘控制器能够解决共享物理页问题,提高闪存数据的稳定性,并且不需要额外增加成本。In the solid-state disk controller provided in this embodiment, when it is detected that the solid-state disk has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage, it obtains the corresponding superpage of the fast page. The number of the target segment where the slow page is located; the backup data and the first slow page data of the target segment are obtained according to the number; the second slow page data is calculated according to the backup data and the first slow page data, and the first slow page data is calculated. The second slow page data is used to restore the lost data of the slow page. By dividing the physical block into target segments, the second slow page data for recovering lost data can be calculated according to the backup data of the target segment and the first slow page data. The SSD controller can solve the problem of shared physical pages and improve the stability of flash data without additional cost.
本申请实施例还提供一种固态硬盘,所述固态硬盘包括上述实施例所述的固态硬盘控制器20,以及至少一个闪存介质。所述固态硬盘控制器20与所述至少一个闪存介质通信连接。Embodiments of the present application further provide a solid-state hard disk, where the solid-state hard disk includes the solid-state hard disk controller 20 described in the foregoing embodiments, and at least one flash memory medium. The solid state disk controller 20 is communicatively connected to the at least one flash memory medium.
本实施例提供的固态硬盘,通过在检测到固态硬盘产生掉电行为,并且发生所述掉电行为时所写入的页为快页超页,则获取所述快页超页对应的慢页所在目标段的编号;根据所述编号获取所述目标段的备份数据和第一慢页数据;根据所述备份数据和所述第一慢页数据计算第二慢页数据,所述第二慢页数据用于恢复所述慢页丢失的数据。通过将物理块划分出目标段,从而可根据目标段的备份数据和第一慢页数据计算得到用于恢复丢失数据的第二慢页数据,相比较于现有技术,本申请实施例提供的固态硬盘能够解决共享物理页问题,提高闪存数据的稳定性,并且不需要额外增加成本。The solid-state disk provided by this embodiment acquires the slow page corresponding to the fast-page superpage by detecting that the solid-state disk has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage The number of the target segment; obtain the backup data and the first slow page data of the target segment according to the number; calculate the second slow page data according to the backup data and the first slow page data, the second slow page The 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 lost data can be calculated according to the backup data of the target segment and the first slow page data. Solid-state drives can solve the problem of shared physical pages, improve the stability of flash data, and do not require additional costs.
本申请实施例提供了一种计算机程序产品,所述计算机程序产品包括存储在固态硬盘上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被所述固态硬盘控制器执行时,使所述固态硬盘控制器能够执行上述任意方法实施例中的防止闪存数据丢失的方法,例如,执行以上描述的图1中的方法步骤S101至步骤S103,执行图3和图4中的流程。An embodiment of the present application provides a computer program product, where the computer program product includes a computer program stored on a solid-state disk, and the computer program includes program instructions, when the program instructions are executed by the solid-state disk controller, The SSD controller is enabled to execute the method for preventing flash data loss in any of the above method embodiments, for example, execute the above-described method steps S101 to S103 in FIG. 1 , and execute the processes in FIGS. 3 and 4 .
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The device embodiments described above are only 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 it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
通过以上的实施方式的描述,本领域普通技术人员可以清楚地了解到各实施方式可借助软件加通用硬件平台的方式来实现,当然也可以通过硬件。本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存 储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。From the description of the above embodiments, those of ordinary skill in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and certainly can also be implemented by hardware. Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and the program is During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM) or the like.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;在本申请的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,步骤可以以任意顺序实现,并存在如上所述的本申请的不同方面的许多其它变化,为了简明,它们没有在细节中提供;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; under the thinking of the present application, the technical features in the above embodiments or different embodiments can also be combined, The steps may be carried out in any order, and there are many other variations of the different aspects of the present application as described above, which are not provided in detail for the sake of brevity; although the present application has been The skilled person should understand that it is still possible to modify the technical solutions recorded in the foregoing embodiments, or to perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the implementation of the application. scope of technical solutions.
Claims (11)
- 一种防止闪存数据丢失的方法,其特征在于,包括:A method for preventing data loss in flash memory, comprising:当检测到固态硬盘产生掉电行为,并且发生所述掉电行为时所写入的页为快页超页,则获取所述快页超页对应的慢页所在目标段的编号;When it is detected that the solid-state drive has a power-down behavior, and the page written when the power-down behavior occurs is a fast page superpage, obtain the number of the target segment where the slow page corresponding to the fast page superpage is located;根据所述编号获取所述目标段的备份数据和第一慢页数据;Acquire the backup data and the first slow page data of the target segment according to the number;根据所述备份数据和所述第一慢页数据计算恢复第二慢页数据。Calculate and restore the second slow page data according to the backup data and the first slow page data.
- 根据权利要求1所述的方法,其特征在于,所述获取所述快页超页对应的慢页所在目标段的编号,包括:The method according to claim 1, wherein the acquiring the number of the target segment where the slow page corresponding to the fast page super page is located comprises:获取所述快页超页对应的慢页的物理页编号,以及固定步长,所述固定步长用于表示一个共享物理页的慢页与快页超页的序号间隔长度;Obtain the physical page number of the slow page corresponding to the fast page superpage, and a fixed step size, where the fixed step size is used to represent the serial number interval length between the slow page and the fast page superpage of a shared physical page;根据所述物理页编号和所述固定步长计算所述快页超页对应的慢页所在目标段的编号。The number of the target segment where the slow page corresponding to the fast page superpage is located is calculated according to the physical page number and the fixed step size.
- 根据权利要求2所述的方法,其特征在于,所述获取所述快页超页对应的慢页的物理页编号,以及固定步长具体包括:The method according to claim 2, wherein the acquiring the physical page number of the slow page corresponding to the fast page superpage, and the fixed step size specifically comprises:获取所述快页超页对应的慢页在TLC物理块中的物理页编号,以及所述TLC物理块对应的固定步长。Obtain the physical page number in the TLC physical block of the slow page corresponding to the fast page superpage, and the fixed step size corresponding to the TLC physical block.
- 根据权利要求3所述的方法,其特征在于,所述根据所述编号获取所述目标段的备份数据和第一慢页数据,包括:The method according to claim 3, wherein the acquiring the backup data and the first slow page data of the target segment according to the serial number comprises:从SLC备份物理块中查找所述目标段的编号,并读取所述目标段的编号对应的备份数据;其中,所述备份数据是在所述固态硬盘未掉电时根据所述第一慢页数据和所述第二慢页数据计算得到的,并且保存在所述SLC备份物理块中;Find the number of the target segment from the SLC backup physical block, and read the backup data corresponding to the number of the target segment; wherein, the backup data is based on the first slow The page data and the second slow page data are calculated and stored in the SLC backup physical block;从所述TLC物理块中读取所述目标段的编号对应的物理页中未丢失的慢页数据,所述未丢失的慢页数据构成所述第一慢页数据。The unmissed slow page data in the physical page corresponding to the number of the target segment is read from the TLC physical block, and the unmissed slow page data constitutes the first slow page data.
- 根据权利要求4所述的方法,其特征在于,所述备份数据为异或数据,所述异或数据是将所述未丢失的慢页数据与所述第二慢页数据进行异或运算后得到的。The method according to claim 4, wherein 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 owned.
- 根据权利要求1至5任一项所述的方法,其特征在于,所述方法还包括:在物理块中对所述备份数据进行备份;The method according to any one of claims 1 to 5, wherein the method further comprises: backing up the backup data in a physical block;其中,所述在物理块中对所述备份数据进行备份包括:The backing up the backup data in the physical block includes:擦除SLC备份物理块;Erase the SLC backup physical block;根据闪存特性对TLC物理块划分目标段;Divide the TLC physical block into the target segment according to the characteristics of the flash memory;按顺序将物理页写入划分好的所述目标段中;Write physical pages into the divided target segments in sequence;在一个所述目标段的物理页写完时,读取所述一个目标段中的全部慢页数据,并计算所述全部慢页数据,以获得所述一个目标段中的全部慢页数据对应的计算结果;When the physical page of one target segment is written, read all the slow page data in the one target segment, and calculate all the slow page data to obtain the corresponding data of all the slow pages in the one target segment the calculation result;将所述计算结果保存至所述SLC备份物理块的物理页中,并且所述SLC备份物理块的物理页的页号为所述计算结果对应的目标段的编号。The calculation result 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.
- 根据权利要求6所述的方法,其特征在于,The method of claim 6, wherein:在对当前目标段开始写入数据前,对所述当前目标段的上一个目标段执行所述在物理块中对所述备份数据进行备份的步骤。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.
- 根据权利要求5所述的方法,其特征在于,所述根据所述备份数据和所述第一慢页数据计算恢复第二慢页数据包括:The method according to claim 5, wherein the calculating and restoring the second slow page data according to the backup data and the first slow page data comprises:将所述备份数据与所述第一慢页数据进行异或运算,所述异或运算的结果为所述第二慢页数据。Performing an XOR operation on the backup data and the first slow page data, and the result of the XOR operation is the second slow page data.
- 一种固态硬盘控制器,其特征在于,包括:A solid-state hard disk controller, characterized in that it includes:至少一个处理器;at least one processor;以及存储器,所述存储器中存储有程序;and a memory in which a program is stored;当所述程序被所述至少一个处理器执行时,所述程序使所述固态硬盘控制器执行权利要求1至8任一项所述的方法。When the program is executed by the at least one processor, the program causes the solid-state disk controller to perform the method of any one of claims 1 to 8.
- 一种固态硬盘,其特征在于,包括:权利要求9所述的固态硬盘控制器,以及与所述固态硬盘控制器通信连接的至少一个闪存介质。A solid-state hard disk, comprising: the solid-state hard disk controller of claim 9, and at least one flash memory medium communicatively connected to the solid-state hard disk controller.
- 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在固态硬盘上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被固态硬盘控制器执行时,使所述固态硬盘控制器执行权利要求1-8任一项所述的方法。A computer program product, characterized in that the computer program product includes a computer program stored on a solid-state hard disk, the computer program includes program instructions, and when the program instructions are executed by a solid-state hard disk controller, make the solid-state hard disk The hard disk controller executes the method of any one of claims 1-8.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011595224.3A CN112632643A (en) | 2020-12-29 | 2020-12-29 | Method for preventing flash memory data loss, solid state disk controller and solid state disk |
CN202011595224.3 | 2020-12-29 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022142544A1 true WO2022142544A1 (en) | 2022-07-07 |
Family
ID=75287151
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/121393 WO2022142544A1 (en) | 2020-12-29 | 2021-09-28 | Method for preventing data loss from flash memory, solid state drive controller, solid state drive |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112632643A (en) |
WO (1) | WO2022142544A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116543822A (en) * | 2023-05-15 | 2023-08-04 | 深圳市领德创科技有限公司 | Flash memory test and processing method and system applied to solid state disk |
CN117995261A (en) * | 2024-03-21 | 2024-05-07 | 星汉智能科技股份有限公司 | Smart card power-off test method and device and storage medium |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112632643A (en) * | 2020-12-29 | 2021-04-09 | 深圳大普微电子科技有限公司 | Method for preventing flash memory data loss, solid state disk controller and solid state disk |
CN113342577B (en) * | 2021-06-24 | 2023-11-03 | 长江存储科技有限责任公司 | Storage device and data recovery method thereof |
CN113448778A (en) * | 2021-07-15 | 2021-09-28 | 华东师范大学 | Backup method for key data in hybrid SSD |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101483067A (en) * | 2008-01-11 | 2009-07-15 | 群联电子股份有限公司 | Flash memory data writing method and flash memory controller |
CN102591748A (en) * | 2011-12-29 | 2012-07-18 | 记忆科技(深圳)有限公司 | Solid state disc and power failure protection method and system thereof |
CN103279402A (en) * | 2013-05-13 | 2013-09-04 | 记忆科技(深圳)有限公司 | Data restoration method based on multilayer cell solid state hard disc and solid state hard disc |
US8902652B1 (en) * | 2014-05-13 | 2014-12-02 | Sandisk Technologies Inc. | Systems and methods for lower page writes |
US20150089325A1 (en) * | 2013-09-24 | 2015-03-26 | Sandisk Technologies Inc. | Method and device for write abort protection |
CN112632643A (en) * | 2020-12-29 | 2021-04-09 | 深圳大普微电子科技有限公司 | Method for preventing flash memory data loss, solid state disk controller and solid state disk |
-
2020
- 2020-12-29 CN CN202011595224.3A patent/CN112632643A/en active Pending
-
2021
- 2021-09-28 WO PCT/CN2021/121393 patent/WO2022142544A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101483067A (en) * | 2008-01-11 | 2009-07-15 | 群联电子股份有限公司 | Flash memory data writing method and flash memory controller |
CN102591748A (en) * | 2011-12-29 | 2012-07-18 | 记忆科技(深圳)有限公司 | Solid state disc and power failure protection method and system thereof |
CN103279402A (en) * | 2013-05-13 | 2013-09-04 | 记忆科技(深圳)有限公司 | Data restoration method based on multilayer cell solid state hard disc and solid state hard disc |
US20150089325A1 (en) * | 2013-09-24 | 2015-03-26 | Sandisk Technologies Inc. | Method and device for write abort protection |
US8902652B1 (en) * | 2014-05-13 | 2014-12-02 | Sandisk Technologies Inc. | Systems and methods for lower page writes |
CN112632643A (en) * | 2020-12-29 | 2021-04-09 | 深圳大普微电子科技有限公司 | Method for preventing flash memory data loss, solid state disk controller and solid state disk |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116543822A (en) * | 2023-05-15 | 2023-08-04 | 深圳市领德创科技有限公司 | Flash memory test and processing method and system applied to solid state disk |
CN116543822B (en) * | 2023-05-15 | 2024-04-05 | 深圳市领德创科技有限公司 | Flash memory test and processing method and system applied to solid state disk |
CN117995261A (en) * | 2024-03-21 | 2024-05-07 | 星汉智能科技股份有限公司 | Smart card power-off test method and device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112632643A (en) | 2021-04-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022142544A1 (en) | Method for preventing data loss from flash memory, solid state drive controller, solid state drive | |
CN109582217B (en) | Data storage device and method for writing data into memory device | |
US7984325B2 (en) | Storage control device, data recovery device, and storage system | |
US8286028B2 (en) | Backup method and disk array apparatus | |
US8799745B2 (en) | Storage control apparatus and error correction method | |
US8601347B1 (en) | Flash memory device and storage control method | |
US10347349B2 (en) | Method and device for fail-safe erase of flash memory | |
US11157357B2 (en) | Operation methods of memory system and host, and computing system | |
US20160306723A1 (en) | Method of channel content rebuild in ultra-high capacity ssd | |
US20110138221A1 (en) | Controller for disk array device, data transfer device, and method of power recovery process | |
CN101483067A (en) | Flash memory data writing method and flash memory controller | |
WO2021139166A1 (en) | Error page identification method based on three-dimensional flash storage structure | |
CN103534688A (en) | Data recovery method, storage equipment and storage system | |
US20230025642A1 (en) | Memory device equipped with data protection scheme | |
US20240143188A1 (en) | Data processing method and apparatus, device, and readable storage medium | |
CN111831476A (en) | Method of controlling operation of RAID system | |
CN114341815A (en) | Performing error control operations on memory components for garbage collection | |
US20210103517A1 (en) | Operating method of memory system and host recovering data with write error | |
TW202234411A (en) | Method and apparatus for bad block management in flash memory | |
JP2014074940A (en) | Information processor, method for controlling information processor and control program for information processor | |
WO2013080299A1 (en) | Data management device, data copy method, and program | |
US20230333750A1 (en) | Apparatus and method for power-loss data protection in a system | |
CN109918228A (en) | A kind of data power-down retaining method and system | |
CN113094307B (en) | Mapping information management method, memory storage device and memory controller | |
CN111338846B (en) | Method and device for recovering L2P (L2P) table based on multiple cores |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21913289 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21913289 Country of ref document: EP Kind code of ref document: A1 |