WO2021027271A1 - Bad block information protection method and apparatus, computer device and storage medium - Google Patents

Bad block information protection method and apparatus, computer device and storage medium Download PDF

Info

Publication number
WO2021027271A1
WO2021027271A1 PCT/CN2020/076781 CN2020076781W WO2021027271A1 WO 2021027271 A1 WO2021027271 A1 WO 2021027271A1 CN 2020076781 W CN2020076781 W CN 2020076781W WO 2021027271 A1 WO2021027271 A1 WO 2021027271A1
Authority
WO
WIPO (PCT)
Prior art keywords
super
block
information
bad
bad block
Prior art date
Application number
PCT/CN2020/076781
Other languages
French (fr)
Chinese (zh)
Inventor
杨学森
李建
秦龙华
Original Assignee
深圳忆联信息系统有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳忆联信息系统有限公司 filed Critical 深圳忆联信息系统有限公司
Publication of WO2021027271A1 publication Critical patent/WO2021027271A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Definitions

  • This application relates to the technical field of solid state hard disks, and in particular to a method, device, computer equipment and storage medium for protecting bad block information.
  • bad blocks will be generated.
  • Bad blocks are the broken and no longer used storage blocks generated during SSD card opening or operation.
  • the generated bad block information will be recorded on a bad block table.
  • the bad block table is used to determine whether the storage block can be used, which plays a vital role in the normal operation of the SSD.
  • the bad block table In order to prevent the bad block information from being destroyed, the bad block table generally has two to three backups, which are stored in different storage blocks on the nand flash memory. If the original bad block table is damaged, the bad block information can be restored through the backup of the bad block table.
  • the existing solution is to distribute the bad block table and its backup to two to three storage blocks of the nand flash memory. If it happens that all the storage blocks that record the bad block table are damaged, the bad block table that records the bad block information is also lost. Without bad block information, the consistency of the data may be destroyed. After the bad block table and all its backups are lost, if part of the bad block information can be recovered, it will have a positive impact on data consistency. However, due to some abnormal reasons, all the bad block tables are damaged or lost, then all the bad block information is lost, and the SSD cannot distinguish the quality of the memory card, which may cause data consistency errors.
  • One of the objectives of the embodiments of this application is to provide a method, device, computer equipment, and storage medium for protecting bad block information, which aims to solve the problem that due to the loss of bad block information, the SSD cannot distinguish between the quality of the memory card and easily cause data consistency. Wrong question.
  • a method for protecting bad block information includes:
  • a device for protecting bad block information includes:
  • the detection unit is used to detect whether the bad block table and its backup are completely damaged
  • the acquisition unit is used to detect that the bad block table and its backup are completely damaged, traverse all super blocks, and obtain the local bad block information stored in the super block;
  • the recovery unit is used to recover the bad block information of all super blocks according to all the local bad block information.
  • a computer device including a memory, a processor, and a computer program that is stored in the memory and can run on the processor, and the processor implements the bad block described in the first aspect when the processor executes the computer program Information protection method steps.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the bad block information protection method described in the first aspect are implemented.
  • the bad block information protection method, device, computer equipment, and storage medium provided by the embodiments of the application have the following beneficial effects: after the SSD is powered on, when the bad block table and its backup are all damaged, the application traverses all the super blocks, The backup area of the first storage page of the first storage block of all super blocks reads the local bad block information, and obtains the good or bad information of all the super blocks through the partial bad block information, thereby protecting the bad block information of the SSD, which is accurate Determine whether the storage block can be used.
  • FIG. 1 is a schematic diagram of the application of the bad block information protection method provided by an embodiment of the application
  • FIG. 2 is a schematic flowchart of a method for protecting bad block information according to an embodiment of the application
  • FIG. 3 is a schematic flowchart of a method for protecting bad block information according to another embodiment of this application.
  • FIG. 4 is a schematic diagram of a sub-flow of a method for protecting bad block information according to another embodiment of this application.
  • FIG. 5 is a schematic block diagram of a bad block information protection device provided by an embodiment of this application.
  • FIG. 6 is a schematic block diagram of a device for protecting bad block information according to another embodiment of this application.
  • FIG. 7 is a schematic block diagram of a pre-storage unit of a device for protecting bad block information according to another embodiment of this application.
  • FIG. 8 is a schematic block diagram of a computer device provided by an embodiment of the application.
  • FIG. 1 is a schematic diagram of the application of the bad block information protection method provided by an embodiment of this application.
  • FIG. 2 is a schematic flowchart of a method for protecting bad block information according to an embodiment of the application.
  • FIG. 2 is a schematic flowchart of a method for protecting bad block information according to an embodiment of the present application. As shown in Fig. 2, the method includes steps S110 to S130.
  • the nand flash memory is composed of many storage blocks (block), each storage block contains many storage pages (page), each storage page is divided into a spare area (spare) and main Area (main), the main area stores user data, the spare area generally stores the system management data of the SSD, and the bad block table can be stored in the spare area.
  • bad blocks will be generated, and the information of these bad blocks will be recorded on a bad block table.
  • the bad block table In order to prevent the bad block information from being destroyed, the bad block table generally has two to three backups, which are stored in different storage blocks on the Nand flash memory. If the original bad block table is damaged, you can use the bad block table to The backups in other different storage blocks restore the bad block information to ensure the consistency of the data in the SSD.
  • the bad block information of all storage blocks can be directly restored through the backup. If due to abnormal reasons, all the bad block tables and corresponding backups are correspondingly damaged, then the bad block information cannot be restored according to the existing scheme. Therefore, when restoring bad block information in this application, it is necessary to first detect whether the bad block table and its backup are completely damaged, and perform subsequent recovery operations when it is completely damaged. If the bad block table and its backup are not completely damaged, then follow The undamaged backup directly restores the bad block information to ensure the normal use of the SSD.
  • a super block is a collection of multiple storage blocks that can be read and written in parallel.
  • any storage block in the super block may change from a good block to a bad block. If all the storage blocks in the super block become bad blocks, this super block is a bad super block and can no longer be used. It is necessary to record the good and bad information corresponding to the super block, and writing in the bad super block is not allowed data.
  • this solution further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Then, the complete record of the good and bad information of all super blocks is stored in multiple different super blocks, and the good and bad information of all super blocks can be obtained by integrating the good and bad information stored in different super blocks. Ensure the data consistency of SSD.
  • Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
  • the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position.
  • the quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap.
  • the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap.
  • Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
  • S130 Restore the bad block information of all super blocks according to all the local bad block information.
  • each super block that can write data records the quality information of adjacent super blocks, and all the quality information obtained removes the repeated parts, and the quality of all super blocks in the nand flash memory can be obtained. information. That is, after the bad block table and its backup saved in the conventional scheme are all lost, the bad block information of the SSD can be directly obtained according to all the local bad block information.
  • This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
  • FIG. 3 is a schematic flowchart of a method for protecting bad block information according to another embodiment of the present application.
  • the bad block information protection method of this embodiment includes steps S210-S240.
  • the steps S220-S240 are similar to the steps S110-S130 in the foregoing embodiment, and will not be repeated here.
  • the step S210 added in this embodiment will be described in detail below.
  • the NAND flash memory after the NAND flash memory saves the bad block table and its backup, it further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Bad information, and then store a complete record of the good and bad information of all super blocks in multiple different super blocks, and then integrate the good and bad information stored in different super blocks to get the good and bad information of all super blocks , To ensure the data consistency of the SSD.
  • step S210 includes steps S211-S215.
  • the super blocks are sequentially numbered according to the positions of the super blocks, and the specific numbers are numbered starting from 0, the number difference between adjacent super blocks is 1, and the super blocks are sequentially numbered 0, 1, 2, 3... n. Subsequently, the location of the super block can be judged according to the super block number, and at the same time, the quality information of a specific super block can be determined according to the number.
  • the distance between any two super blocks is defined to be equal to the difference of the corresponding numbers.
  • the distance between the number 6 super block and the number 9 super block corresponds to 3
  • the number 6 super block The distance between the block and the super block numbered 5 is 1, and we can clearly understand the super block adjacent to any super block through the distance data, so that the quality information of the super block can be recorded in the adjacent super block.
  • a super block is selected as the central super block, and the quality information of the super block within a certain distance is obtained with the super block as the center, and the quality information of the neighboring super blocks is stored.
  • the quality information of all super blocks is recorded.
  • any super block is selected as the center, and the quality information of all super blocks whose distance from this super block is less than or equal to 2 is recorded in a range table (local range bad super block table) )in.
  • Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
  • the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position.
  • the quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap.
  • the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap.
  • Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
  • Step S215 is specifically: recording the super block quality information in the local range bad super block table in the central super block as the local bad block information.
  • This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
  • Fig. 5 is a schematic block diagram of a bad block information protection device provided by an embodiment of the present application. As shown in FIG. 5, corresponding to the above bad block information protection method, this application also provides a bad block information protection device.
  • the bad block information protection device includes a unit for executing the above bad block information protection method, and the device can be configured in a desktop computer, a tablet computer, a laptop computer, and other terminals. Specifically, referring to FIG. 5, the device for protecting bad block information includes a detecting unit 10, an acquiring unit 20, and a restoring unit 30.
  • the detection unit 10 is used to detect whether the bad block table and its backup are completely damaged.
  • the nand flash memory is composed of many storage blocks, each storage block contains many storage pages (page), each storage page is divided into a spare area (spare) and a main area (main), the main The area stores user data, the spare area generally stores the system management data of the SSD, and the bad block table can be stored in the spare area.
  • bad blocks will be generated, and the information of these bad blocks will be recorded on a bad block table.
  • the bad block table In order to prevent the bad block information from being destroyed, the bad block table generally has two to three backups, which are stored in different storage blocks on the Nand flash memory. If the original bad block table is damaged, you can use the bad block table to The backups in other different storage blocks restore the bad block information to ensure the consistency of the data in the SSD.
  • the bad block information of all storage blocks can be directly restored through the backup. If due to abnormal reasons, all bad block tables and corresponding backups are correspondingly damaged, then the bad block information cannot be restored according to the existing scheme. Therefore, when restoring bad block information in this application, it is necessary to first detect whether the bad block table and its backup are completely damaged, and perform subsequent recovery operations when it is completely damaged. If the bad block table and its backup are not completely damaged, then follow The undamaged backup directly restores the bad block information to ensure the normal use of the SSD.
  • the obtaining unit 20 is used to detect that the bad block table and its backup are completely damaged, traverse all the super blocks, and obtain the partial bad block information stored in the super block.
  • a super block is a collection of multiple storage blocks that can be read and written in parallel.
  • any storage block in the super block may change from a good block to a bad block. If all the storage blocks in the super block become bad blocks, this super block is a bad super block and can no longer be used. It is necessary to record the good and bad information corresponding to the super block, and writing in the bad super block is not allowed data.
  • this solution further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Then, the complete record of the good and bad information of all super blocks is stored in multiple different super blocks, and the good and bad information of all super blocks can be obtained by integrating the good and bad information stored in different super blocks. Ensure the data consistency of SSD.
  • Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
  • the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position.
  • the quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap.
  • the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap.
  • Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
  • the recovery unit 30 is configured to recover the bad block information of all super blocks according to all the local bad block information.
  • each super block that can write data records the quality information of adjacent super blocks, and all the quality information obtained removes the repeated parts, and the quality of all super blocks in the nand flash memory can be obtained. information. That is, after the bad block table and its backup saved in the conventional scheme are all lost, the bad block information of the SSD can be directly obtained according to all the local bad block information.
  • This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
  • FIG. 6 is a schematic block diagram of a bad block information protection device provided by another embodiment of the present application. As shown in FIG. 6, the bad block information protection device of this embodiment adds a pre-storage unit 40 on the basis of the foregoing embodiment.
  • the pre-storage unit 40 is used to pre-store the quality information of any super block in a super block within a set range.
  • the NAND flash memory after the NAND flash memory saves the bad block table and its backup, it further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Bad information, and then store a complete record of the good and bad information of all super blocks in multiple different super blocks, and then integrate the good and bad information stored in different super blocks to get the good and bad information of all super blocks , To ensure the data consistency of the SSD.
  • the pre-storage unit 40 includes a numbering module 41, a distance defining module 42, a center selection module 43, an information acquisition module 44, and an information storage module 45.
  • the numbering module 41 is used to sequentially number the super blocks according to their positions, and the number difference between adjacent super blocks is 1.
  • the super blocks are sequentially numbered according to the positions of the super blocks, and the specific numbers are numbered starting from 0, the number difference between adjacent super blocks is 1, and the super blocks are sequentially numbered 0, 1, 2, 3... n. Subsequently, the location of the super block can be judged according to the super block number, and at the same time, the quality information of a specific super block can be determined according to the number.
  • the distance definition module 42 is used to define the difference between the numbers of any two super blocks as the distance between the two super blocks.
  • the distance between any two super blocks is defined to be equal to the difference of the corresponding numbers.
  • the distance between the number 6 super block and the number 9 super block corresponds to 3
  • the number 6 super block The distance between the block and the super block numbered 5 is 1, and we can clearly understand the super block adjacent to any super block through the distance data, so that the quality information of the super block can be recorded in the adjacent super block.
  • the center selection module 43 is used to sequentially select a super block as the center super block.
  • a super block is selected as the central super block, and the quality information of the super block within a certain distance is obtained with the super block as the center, and the quality information of the neighboring super blocks is stored.
  • the quality information of all super blocks is recorded.
  • the information obtaining module 44 is used to obtain the quality information of the super block whose distance from the central super block is less than or equal to 2.
  • the information storage module 45 is used to pre-store the corresponding good and bad information in the central super block as local bad block information.
  • any super block is selected as the center, and the quality information of all super blocks whose distance from this super block is less than or equal to 2 is recorded in a range table (local Range bad super block table).
  • Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
  • the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position.
  • the quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap.
  • the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap.
  • Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
  • the information storage module 45 is also used to record the super block quality information in the local range bad super block table in the central super block as the local bad block information.
  • This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
  • FIG. 8 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • the computer device 500 may be a terminal or a server, where the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device.
  • the server can be an independent server or a server cluster composed of multiple servers.
  • the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
  • the non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032.
  • the computer program 5032 includes program instructions. When the program instructions are executed, the processor 502 can execute a method for protecting bad block information.
  • the processor 502 is used to provide calculation and control capabilities to support the operation of the entire computer device 500.
  • the internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503.
  • the processor 502 can execute a bad block information protection method.
  • the network interface 505 is used for network communication with other devices.
  • FIG. 8 is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied.
  • the specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
  • the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
  • the computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium.
  • the program instructions are executed by at least one processor in the computer system to implement the process steps of the foregoing method embodiments.
  • the storage medium may be a computer-readable storage medium.
  • the storage medium stores a computer program.
  • the storage medium may be a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk or an optical disk, and other computer-readable storage media that can store program codes.
  • ROM Read-Only Memory
  • the disclosed device and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of each unit is only a logical function division, and there may be other division methods in actual implementation.
  • multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the steps in the method of the embodiment of the present application can be adjusted, merged, and deleted in order according to actual needs.
  • the units in the devices in the embodiments of the present application may be combined, divided, and deleted according to actual needs.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium.
  • the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium It includes several instructions to make a computer device (which may be a personal computer, a terminal, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.

Abstract

A bad block information protection method and apparatus, a computer device and a storage medium. The method comprises the following steps: checking whether a bad block table and a backup thereof are completely damaged (S110); if the both are completely damaged, traversing all super blocks to obtain local bad block information stored in the super blocks (S120); and restoring bad block information of all the super blocks according to all the local bad block information (S130). After an SSD is powered on, if the bad block table and the backup thereof are completely damaged, by traversing all super blocks, local bad block information is read from a backup area of a first storage page of a first storage block of all the super blocks, and normal and bad block information of all the super blocks is obtained according to the local bad block information, thereby protecting bad block information of the SSD, and accurately determining whether the storage blocks can be used.

Description

坏块信息保护方法、装置、计算机设备及存储介质Bad block information protection method, device, computer equipment and storage medium
本申请要求于2019年8月15日在中国专利局提交的、申请号为201910751842.3、发明名称为“坏块信息保护方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed at the Chinese Patent Office on August 15, 2019, with the application number 201910751842.3, and the invention title "Bad block information protection method, device, computer equipment and storage medium", all of which The content is incorporated in this application by reference.
技术领域Technical field
本申请涉及固态硬盘技术领域,具体涉及一种坏块信息保护方法、装置、计算机设备及存储介质。This application relates to the technical field of solid state hard disks, and in particular to a method, device, computer equipment and storage medium for protecting bad block information.
背景技术Background technique
在SSD(Solid State Drives,固态硬盘)开卡过程中和正常工作期间,都会产生坏块,坏块是SSD在开卡或者运行期间产生的坏掉的、不再被使用的存储块中,这些产生的坏块信息会记录在一张坏块表上,坏块表用来判断存储块是否可以被使用的,对于SSD正常工作起了至关重要的作用。为了防止坏块信息被破坏掉,坏块表一般有两到三个备份,它们分别存储到nand闪存上不同的存储块中。若原始的坏块表被损坏掉了,可以通过坏块表的备份把坏块信息恢复出来。During SSD (Solid State Drives) card opening process and during normal operation, bad blocks will be generated. Bad blocks are the broken and no longer used storage blocks generated during SSD card opening or operation. The generated bad block information will be recorded on a bad block table. The bad block table is used to determine whether the storage block can be used, which plays a vital role in the normal operation of the SSD. In order to prevent the bad block information from being destroyed, the bad block table generally has two to three backups, which are stored in different storage blocks on the nand flash memory. If the original bad block table is damaged, the bad block information can be restored through the backup of the bad block table.
现有的解决方案是,将坏块表及其备份分布存储到nand闪存的两到三个存储块上。若恰巧发生记录坏块表的存储块全部被损坏了,那么记录坏块信息的坏块表也随之丢失了。没有坏块信息的话,数据的一致性可能会遭到破坏。坏块表和它所有的备份都丢掉后,如果能够恢复出部分坏块信息,对数据的一致性会产生正面的影响。但是还是会出现因某些异常原因,所有坏块表均被损坏或者丢掉了,那么所有的坏块的信息就丢掉了,SSD就无法区分存储卡的好坏,可能会引起数据一致性错误。The existing solution is to distribute the bad block table and its backup to two to three storage blocks of the nand flash memory. If it happens that all the storage blocks that record the bad block table are damaged, the bad block table that records the bad block information is also lost. Without bad block information, the consistency of the data may be destroyed. After the bad block table and all its backups are lost, if part of the bad block information can be recovered, it will have a positive impact on data consistency. However, due to some abnormal reasons, all the bad block tables are damaged or lost, then all the bad block information is lost, and the SSD cannot distinguish the quality of the memory card, which may cause data consistency errors.
发明概述Summary of the invention
技术问题technical problem
本申请实施例的目的之一在于:提供一种坏块信息保护方法、装置、计算机设备及存储介质,旨在解决由于坏块信息丢失,SSD无法区分存储卡的好坏,容易引起数据一致性错误的问题。One of the objectives of the embodiments of this application is to provide a method, device, computer equipment, and storage medium for protecting bad block information, which aims to solve the problem that due to the loss of bad block information, the SSD cannot distinguish between the quality of the memory card and easily cause data consistency. Wrong question.
问题的解决方案The solution to the problem
技术解决方案Technical solutions
为解决上述技术问题,本申请实施例采用的技术方案是:In order to solve the above technical problems, the technical solutions adopted in the embodiments of this application are:
第一方面,提供了一种坏块信息保护方法,所述方法包括:In a first aspect, a method for protecting bad block information is provided, and the method includes:
检测坏块表及其备份是否完全损坏;Check whether the bad block table and its backup are completely damaged;
若完全损坏,则遍历所有的超级块,获取存储于超级块中的局部坏块信息;If it is completely damaged, traverse all super blocks to obtain the local bad block information stored in the super block;
根据所有的局部坏块信息恢复所有超级块的坏块信息。Restore the bad block information of all super blocks according to all the local bad block information.
第二方面,提供了一种坏块信息保护装置,所述装置包括:In a second aspect, a device for protecting bad block information is provided, and the device includes:
检测单元,用于检测坏块表及其备份是否完全损坏;The detection unit is used to detect whether the bad block table and its backup are completely damaged;
获取单元,用于检测坏块表及其备份完全损坏时,遍历所有的超级块,获取存储于超级块中的局部坏块信息;The acquisition unit is used to detect that the bad block table and its backup are completely damaged, traverse all super blocks, and obtain the local bad block information stored in the super block;
恢复单元,用于根据所有的局部坏块信息恢复所有超级块的坏块信息。The recovery unit is used to recover the bad block information of all super blocks according to all the local bad block information.
第三方面,提供一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现第一方面所述的坏块信息保护方法的步骤。In a third aspect, a computer device is provided, including a memory, a processor, and a computer program that is stored in the memory and can run on the processor, and the processor implements the bad block described in the first aspect when the processor executes the computer program Information protection method steps.
第四方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现第一方面所述的坏块信息保护方法的步骤。In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the bad block information protection method described in the first aspect are implemented.
本申请实施例提供的坏块信息保护方法、装置、计算机设备及存储介质的有益效果在于:本申请在SSD上电后,坏块表及其备份全部损坏时,通过遍历所有的超级块,从所有超级块的第一个存储块的第一个存储页的备份区域读出局部坏块信息,通过局部坏块信息获取该所有超级块的好坏信息,进而保护SSD的坏块信息,准确的判断存储块是否是可以被使用的。The bad block information protection method, device, computer equipment, and storage medium provided by the embodiments of the application have the following beneficial effects: after the SSD is powered on, when the bad block table and its backup are all damaged, the application traverses all the super blocks, The backup area of the first storage page of the first storage block of all super blocks reads the local bad block information, and obtains the good or bad information of all the super blocks through the partial bad block information, thereby protecting the bad block information of the SSD, which is accurate Determine whether the storage block can be used.
发明的有益效果The beneficial effects of the invention
对附图的简要说明Brief description of the drawings
附图说明Description of the drawings
图1为本申请实施例提供的坏块信息保护方法的应用示意图;FIG. 1 is a schematic diagram of the application of the bad block information protection method provided by an embodiment of the application;
图2为本申请实施例提供的一种坏块信息保护方法的流程示意图;2 is a schematic flowchart of a method for protecting bad block information according to an embodiment of the application;
图3为本申请另一实施例提供的一种坏块信息保护方法的流程示意图;3 is a schematic flowchart of a method for protecting bad block information according to another embodiment of this application;
图4为本申请另一实施例提供的一种坏块信息保护方法的子流程示意图;4 is a schematic diagram of a sub-flow of a method for protecting bad block information according to another embodiment of this application;
图5为本申请实施例提供的一种坏块信息保护装置的示意性框图;FIG. 5 is a schematic block diagram of a bad block information protection device provided by an embodiment of this application;
图6为本申请另一实施例提供的一种坏块信息保护装置的示意性框图;FIG. 6 is a schematic block diagram of a device for protecting bad block information according to another embodiment of this application;
图7为本申请另一实施例提供的一种坏块信息保护装置的预存单元的示意性框图;FIG. 7 is a schematic block diagram of a pre-storage unit of a device for protecting bad block information according to another embodiment of this application;
图8为本申请实施例提供的计算机设备的示意性框图。FIG. 8 is a schematic block diagram of a computer device provided by an embodiment of the application.
发明实施例Invention embodiment
本发明的实施方式Embodiments of the invention
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions, and advantages of this application clearer, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application, and not used to limit the application.
请参阅图1和图2,图1为本申请实施例提供的坏块信息保护方法的应用示意图。图2为本申请实施例提供的坏块信息保护方法的示意性流程图。Please refer to FIG. 1 and FIG. 2. FIG. 1 is a schematic diagram of the application of the bad block information protection method provided by an embodiment of this application. FIG. 2 is a schematic flowchart of a method for protecting bad block information according to an embodiment of the application.
图2是本申请实施例提供的一种坏块信息保护方法的流程示意图。如图2所示,该方法包括步骤S110至S130。FIG. 2 is a schematic flowchart of a method for protecting bad block information according to an embodiment of the present application. As shown in Fig. 2, the method includes steps S110 to S130.
S110、检测坏块表及其备份是否完全损坏。S110: Detect whether the bad block table and its backup are completely damaged.
如图1所示,在本实施例中,nand闪存是由许多存储块(block)组成的,每个存储块包含许多存储页(page),每个存储页分为备用区(spare)和主区(main),主区存储用户数据,备用区一般存储SSD的系统管理数据,坏块表可以存储到备用区。As shown in Figure 1, in this embodiment, the nand flash memory is composed of many storage blocks (block), each storage block contains many storage pages (page), each storage page is divided into a spare area (spare) and main Area (main), the main area stores user data, the spare area generally stores the system management data of the SSD, and the bad block table can be stored in the spare area.
在SSD开卡过程中和正常工作期间,都会产生坏块,这些产生的坏块信息会记录在一张坏块表上。为了防止坏块信息被破坏掉,坏块表一般有两到三个备份,它们分别存储到Nand闪存上不同的存储块中,若原始的坏块表被损坏掉了,可以通过坏块表在其他不同存储块中的备份把坏块信息恢复出来,保证SSD中数据的一致性。During the SSD card opening process and during normal operation, bad blocks will be generated, and the information of these bad blocks will be recorded on a bad block table. In order to prevent the bad block information from being destroyed, the bad block table generally has two to three backups, which are stored in different storage blocks on the Nand flash memory. If the original bad block table is damaged, you can use the bad block table to The backups in other different storage blocks restore the bad block information to ensure the consistency of the data in the SSD.
因此,进行坏块信息恢复时,只要存在一份坏块表备份完好,即可直接通过该备份恢复所有存储块的坏块信息。如果由于异常原因,所有的坏块表和对应的 备份都对应损坏,那么按照现有的方案是无法恢复坏块信息的。因此在本申请在恢复坏块信息时,需要先检测坏块表及其备份是否完全损坏,在其完全损坏时才执行后续的恢复操作,若坏块表及其备份没有完全损坏,那么还是根据没损坏的备份直接恢复坏块信息,保证SSD的正常使用。Therefore, when recovering bad block information, as long as there is a good backup of the bad block table, the bad block information of all storage blocks can be directly restored through the backup. If due to abnormal reasons, all the bad block tables and corresponding backups are correspondingly damaged, then the bad block information cannot be restored according to the existing scheme. Therefore, when restoring bad block information in this application, it is necessary to first detect whether the bad block table and its backup are completely damaged, and perform subsequent recovery operations when it is completely damaged. If the bad block table and its backup are not completely damaged, then follow The undamaged backup directly restores the bad block information to ensure the normal use of the SSD.
S120、若坏块表及其备份完全损坏,则遍历所有的超级块,获取存储于超级块中的局部坏块信息。S120: If the bad block table and its backup are completely damaged, all super blocks are traversed to obtain local bad block information stored in the super block.
在本实施例中,超级块是多个可并行读写的存储块的集合,在系统的开卡或者运行中,超级块里的任一存储块都有可能由好块变成一个坏块,若超级块里所有的存储块都变成了坏块,这个超级块就是一个坏的超级块,不能再被使用,需要记录该超级块对应的好坏信息,而坏超级块里是不允许写数据的。In this embodiment, a super block is a collection of multiple storage blocks that can be read and written in parallel. During card opening or operation of the system, any storage block in the super block may change from a good block to a bad block. If all the storage blocks in the super block become bad blocks, this super block is a bad super block and can no longer be used. It is necessary to record the good and bad information corresponding to the super block, and writing in the bad super block is not allowed data.
因此,本方案在nand闪存保存坏块表及其备份之后,进一步的将超级块的好坏信息记录于邻近的超级块中,通过在多个超级块中记录局部范围内的超级块的好坏信息,进而将所有超级块的好坏信息完整的记录存储于多个不同的超级块中,后续通过获取存储于不同超级块中的好坏信息进行整合即可得到所有超级块的好坏信息,保证SSD的数据一致性。Therefore, after storing the bad block table and its backup in the nand flash memory, this solution further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Then, the complete record of the good and bad information of all super blocks is stored in multiple different super blocks, and the good and bad information of all super blocks can be obtained by integrating the good and bad information stored in different super blocks. Ensure the data consistency of SSD.
具体的,选取任一个超级块作为中心,与这个超级块距离小于等于2的所有超级块的好坏信息都记录在一张range table(局部范围坏超级块表)中。Range table是一个含有5bit(位)的位图,每一bit都对应一具体的超级块进行记录,某一bit被设置为1,则表示对应位置的超级块是坏的;相反的,若某一bit(位)被设置为0,表示对应位置的超级块是好的。Specifically, any super block is selected as the center, and the quality information of all super blocks whose distance from this super block is less than or equal to 2 is recorded in a range table (local range bad super block table). Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
举例说明,选取的中心超级块的好坏信息记录在位图的中间位置,就是第2位。编号递减方向的超级块的好坏信息记录在位图的第1位和第0位,类似的,编号递增方向的超级块的好坏信息记录在位图的第3位和第4位。如图1所示,以超级块7为中心,距离在2以内的超级块有,超级块5、超级块6、超级块7、超级块8、超级块9,它们的好坏信息分别依次填入到range table中,之后把range table写入到超级块7的第一个存储块的第一个存储页的备份区域中。For example, the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position. The quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap. Similarly, the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap. As shown in Figure 1, there are super blocks with super block 7 as the center and within 2 distances: super block 5, super block 6, super block 7, super block 8, and super block 9. Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
S130、根据所有的局部坏块信息恢复所有超级块的坏块信息。S130: Restore the bad block information of all super blocks according to all the local bad block information.
在本实施例中,每个可以写入数据的超级块中记录有邻近的超级块的好坏信息 ,获取到的全部好坏信息去除重复部分,既可以得到nand闪存中全部超级块的好坏信息。也就是,常规方案保存的坏块表及其备份全部丢失之后,可以根据所有局部坏块信息直接获取SSD的坏块信息。In this embodiment, each super block that can write data records the quality information of adjacent super blocks, and all the quality information obtained removes the repeated parts, and the quality of all super blocks in the nand flash memory can be obtained. information. That is, after the bad block table and its backup saved in the conventional scheme are all lost, the bad block information of the SSD can be directly obtained according to all the local bad block information.
本申请在SSD上电后,坏块表及其备份全部损坏时,通过遍历所有的超级块,从所有超级块的第一个存储块的第一个存储页的备份区域读出局部坏块信息,通过局部坏块信息获取该所有超级块的好坏信息,进而保护SSD的坏块信息,准确的判断存储块是否是可以被使用的。This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
图3是本申请另一实施例提供的一种坏块信息保护方法的流程示意图。如图3所示,本实施例的坏块信息保护方法包括步骤S210-S240。其中步骤S220-S240与上述实施例中的步骤S110-S130类似,在此不再赘述。下面详细说明本实施例中所增加的步骤S210。FIG. 3 is a schematic flowchart of a method for protecting bad block information according to another embodiment of the present application. As shown in FIG. 3, the bad block information protection method of this embodiment includes steps S210-S240. The steps S220-S240 are similar to the steps S110-S130 in the foregoing embodiment, and will not be repeated here. The step S210 added in this embodiment will be described in detail below.
S210、将任一超级块的好坏信息预存储于设定范围内的超级块中。S210. Pre-store the quality information of any super block in a super block within a set range.
在本实施例中,nand闪存保存坏块表及其备份之后,进一步的将超级块的好坏信息记录于邻近的超级块中,通过在多个超级块中记录局部范围内的超级块的好坏信息,进而将所有超级块的好坏信息完整的记录存储于多个不同的超级块中,后续通过获取存储于不同超级块中的好坏信息进行整合即可得到所有超级块的好坏信息,保证SSD的数据一致性。In this embodiment, after the NAND flash memory saves the bad block table and its backup, it further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Bad information, and then store a complete record of the good and bad information of all super blocks in multiple different super blocks, and then integrate the good and bad information stored in different super blocks to get the good and bad information of all super blocks , To ensure the data consistency of the SSD.
参阅图4,在一实施例中,步骤S210包括步骤S211-S215。Referring to FIG. 4, in an embodiment, step S210 includes steps S211-S215.
S211、将超级块按所处位置依次编号,相邻超级块之间的编号差值为1。S211. Number the super blocks in sequence according to their positions, and the number difference between adjacent super blocks is 1.
在一实施例中,按照超级块所处位置依次编号,具体的编号从0开始起编,相邻超级块之间的编号差值为1,超级块依次编号为0、1、2、3…n。后续可以根据超级块编号判断超级块所处的位置,同时根据编号,确定特定超级块的好坏信息。In one embodiment, the super blocks are sequentially numbered according to the positions of the super blocks, and the specific numbers are numbered starting from 0, the number difference between adjacent super blocks is 1, and the super blocks are sequentially numbered 0, 1, 2, 3... n. Subsequently, the location of the super block can be judged according to the super block number, and at the same time, the quality information of a specific super block can be determined according to the number.
S212、将任两个超级块的编号的差值设为两个超级块之间的距离。S212. Set the difference between the numbers of any two super blocks as the distance between the two super blocks.
在一实施例中,在编好号之后,定义任意两个超级块之间的距离等于对应编号的差值,例如编号6的超级块和编号9的超级块距离对应为3,编号6的超级块和编号5的超级块距离对应为1,通过距离数据我们就可以清楚了解任意超级块所邻近的超级块,便于后续将超级块的好坏信息记录于邻近超级块中。In one embodiment, after the numbers are numbered, the distance between any two super blocks is defined to be equal to the difference of the corresponding numbers. For example, the distance between the number 6 super block and the number 9 super block corresponds to 3, and the number 6 super block The distance between the block and the super block numbered 5 is 1, and we can clearly understand the super block adjacent to any super block through the distance data, so that the quality information of the super block can be recorded in the adjacent super block.
S213、依次选定一超级块为中心超级块。S213. Select a super block in turn as the central super block.
在一实施例中,选定一超级块作为中心超级块,并以此超级块为中心获取一定距离内的超级块的好坏信息,并保存邻近超级块的好坏信息。通过依次选择所有可以使用的超级块作为中心超级块,进而实现对于所有超级块好坏信息的记载。In one embodiment, a super block is selected as the central super block, and the quality information of the super block within a certain distance is obtained with the super block as the center, and the quality information of the neighboring super blocks is stored. By sequentially selecting all available super blocks as the central super block, the quality information of all super blocks is recorded.
S214、获取与中心超级块距离小于等于2的超级块的好坏信息。S214. Obtain good or bad information about the super block whose distance from the central super block is less than or equal to 2.
S215、将对应的好坏信息预存储于中心超级块作为局部坏块信息。S215. Pre-store the corresponding good or bad information in the central super block as the local bad block information.
在一实施例中,对于步骤S214和S215,选取任一个超级块作为中心,与这个超级块距离小于等于2的所有超级块的好坏信息都记录在一张range table(局部范围坏超级块表)中。Range table是一个含有5bit(位)的位图,每一bit都对应一具体的超级块进行记录,某一bit被设置为1,则表示对应位置的超级块是坏的;相反的,若某一bit(位)被设置为0,表示对应位置的超级块是好的。In one embodiment, for steps S214 and S215, any super block is selected as the center, and the quality information of all super blocks whose distance from this super block is less than or equal to 2 is recorded in a range table (local range bad super block table) )in. Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
举例说明,选取的中心超级块的好坏信息记录在位图的中间位置,就是第2位。编号递减方向的超级块的好坏信息记录在位图的第1位和第0位,类似的,编号递增方向的超级块的好坏信息记录在位图的第3位和第4位。如图1所示,以超级块7为中心,距离在2以内的超级块有,超级块5、超级块6、超级块7、超级块8、超级块9,它们的好坏信息分别依次填入到range table中,之后把range table写入到超级块7的第一个存储块的第一个存储页的备份区域中。For example, the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position. The quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap. Similarly, the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap. As shown in Figure 1, there are super blocks with super block 7 as the center and within 2 distances: super block 5, super block 6, super block 7, super block 8, and super block 9. Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
步骤S215具体为:将超级块好坏信息记录于中心超级块中的局部范围坏超级块表作为局部坏块信息。Step S215 is specifically: recording the super block quality information in the local range bad super block table in the central super block as the local bad block information.
本申请在SSD上电后,坏块表及其备份全部损坏时,通过遍历所有的超级块,从所有超级块的第一个存储块的第一个存储页的备份区域读出局部坏块信息,通过局部坏块信息获取该所有超级块的好坏信息,进而保护SSD的坏块信息,准确的判断存储块是否是可以被使用的。This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
图5是本申请实施例提供的一种坏块信息保护装置的示意性框图。如图5所示,对应于以上坏块信息保护方法,本申请还提供一种坏块信息保护装置。该坏块信息保护装置包括用于执行上述坏块信息保护方法的单元,该装置可以被配置于台式电脑、平板电脑、手提电脑、等终端中。具体地,请参阅图5,该坏块信 息保护装置包括检测单元10,获取单元20和恢复单元30。Fig. 5 is a schematic block diagram of a bad block information protection device provided by an embodiment of the present application. As shown in FIG. 5, corresponding to the above bad block information protection method, this application also provides a bad block information protection device. The bad block information protection device includes a unit for executing the above bad block information protection method, and the device can be configured in a desktop computer, a tablet computer, a laptop computer, and other terminals. Specifically, referring to FIG. 5, the device for protecting bad block information includes a detecting unit 10, an acquiring unit 20, and a restoring unit 30.
检测单元10,用于检测坏块表及其备份是否完全损坏。The detection unit 10 is used to detect whether the bad block table and its backup are completely damaged.
在本实施例中,nand闪存是由许多存储块(block)组成的,每个存储块包含许多存储页(page),每个存储页分为备用区(spare)和主区(main),主区存储用户数据,备用区一般存储SSD的系统管理数据,坏块表可以存储到备用区。In this embodiment, the nand flash memory is composed of many storage blocks, each storage block contains many storage pages (page), each storage page is divided into a spare area (spare) and a main area (main), the main The area stores user data, the spare area generally stores the system management data of the SSD, and the bad block table can be stored in the spare area.
在SSD开卡过程中和正常工作期间,都会产生坏块,这些产生的坏块信息会记录在一张坏块表上。为了防止坏块信息被破坏掉,坏块表一般有两到三个备份,它们分别存储到Nand闪存上不同的存储块中,若原始的坏块表被损坏掉了,可以通过坏块表在其他不同存储块中的备份把坏块信息恢复出来,保证SSD中数据的一致性。During the SSD card opening process and during normal operation, bad blocks will be generated, and the information of these bad blocks will be recorded on a bad block table. In order to prevent the bad block information from being destroyed, the bad block table generally has two to three backups, which are stored in different storage blocks on the Nand flash memory. If the original bad block table is damaged, you can use the bad block table to The backups in other different storage blocks restore the bad block information to ensure the consistency of the data in the SSD.
因此,进行坏块信息恢复时,只要存在一份坏块表备份完好,即可直接通过该备份恢复所有存储块的坏块信息。如果由于异常原因,所有的坏块表和对应的备份都对应损坏,那么按照现有的方案是无法恢复坏块信息的。因此在本申请在恢复坏块信息时,需要先检测坏块表及其备份是否完全损坏,在其完全损坏时才执行后续的恢复操作,若坏块表及其备份没有完全损坏,那么还是根据没损坏的备份直接恢复坏块信息,保证SSD的正常使用。Therefore, when recovering bad block information, as long as there is a good backup of the bad block table, the bad block information of all storage blocks can be directly restored through the backup. If due to abnormal reasons, all bad block tables and corresponding backups are correspondingly damaged, then the bad block information cannot be restored according to the existing scheme. Therefore, when restoring bad block information in this application, it is necessary to first detect whether the bad block table and its backup are completely damaged, and perform subsequent recovery operations when it is completely damaged. If the bad block table and its backup are not completely damaged, then follow The undamaged backup directly restores the bad block information to ensure the normal use of the SSD.
获取单元20,用于检测坏块表及其备份完全损坏时,遍历所有的超级块,获取存储于超级块中的局部坏块信息。The obtaining unit 20 is used to detect that the bad block table and its backup are completely damaged, traverse all the super blocks, and obtain the partial bad block information stored in the super block.
在本实施例中,超级块是多个可并行读写的存储块的集合,在系统的开卡或者运行中,超级块里的任一存储块都有可能由好块变成一个坏块,若超级块里所有的存储块都变成了坏块,这个超级块就是一个坏的超级块,不能再被使用,需要记录该超级块对应的好坏信息,而坏超级块里是不允许写数据的。In this embodiment, a super block is a collection of multiple storage blocks that can be read and written in parallel. During card opening or operation of the system, any storage block in the super block may change from a good block to a bad block. If all the storage blocks in the super block become bad blocks, this super block is a bad super block and can no longer be used. It is necessary to record the good and bad information corresponding to the super block, and writing in the bad super block is not allowed data.
因此,本方案在nand闪存保存坏块表及其备份之后,进一步的将超级块的好坏信息记录于邻近的超级块中,通过在多个超级块中记录局部范围内的超级块的好坏信息,进而将所有超级块的好坏信息完整的记录存储于多个不同的超级块中,后续通过获取存储于不同超级块中的好坏信息进行整合即可得到所有超级块的好坏信息,保证SSD的数据一致性。Therefore, after storing the bad block table and its backup in the nand flash memory, this solution further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Then, the complete record of the good and bad information of all super blocks is stored in multiple different super blocks, and the good and bad information of all super blocks can be obtained by integrating the good and bad information stored in different super blocks. Ensure the data consistency of SSD.
具体的,选取任一个超级块作为中心,与这个超级块距离小于等于2的所有超 级块的好坏信息都记录在一张range table(局部范围坏超级块表)中。Range table是一个含有5bit(位)的位图,每一bit都对应一具体的超级块进行记录,某一bit被设置为1,则表示对应位置的超级块是坏的;相反的,若某一bit(位)被设置为0,表示对应位置的超级块是好的。Specifically, any super block is selected as the center, and the quality information of all super blocks whose distance from this super block is less than or equal to 2 is recorded in a range table (local range bad super block table). Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
举例说明,选取的中心超级块的好坏信息记录在位图的中间位置,就是第2位。编号递减方向的超级块的好坏信息记录在位图的第1位和第0位,类似的,编号递增方向的超级块的好坏信息记录在位图的第3位和第4位。如图1所示,以超级块7为中心,距离在2以内的超级块有,超级块5、超级块6、超级块7、超级块8、超级块9,它们的好坏信息分别依次填入到range table中,之后把range table写入到超级块7的第一个存储块的第一个存储页的备份区域中。For example, the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position. The quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap. Similarly, the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap. As shown in Figure 1, there are super blocks with super block 7 as the center and within 2 distances: super block 5, super block 6, super block 7, super block 8, and super block 9. Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
恢复单元30,用于根据所有的局部坏块信息恢复所有超级块的坏块信息。The recovery unit 30 is configured to recover the bad block information of all super blocks according to all the local bad block information.
在本实施例中,每个可以写入数据的超级块中记录有邻近的超级块的好坏信息,获取到的全部好坏信息去除重复部分,既可以得到nand闪存中全部超级块的好坏信息。也就是,常规方案保存的坏块表及其备份全部丢失之后,可以根据所有局部坏块信息直接获取SSD的坏块信息。In this embodiment, each super block that can write data records the quality information of adjacent super blocks, and all the quality information obtained removes the repeated parts, and the quality of all super blocks in the nand flash memory can be obtained. information. That is, after the bad block table and its backup saved in the conventional scheme are all lost, the bad block information of the SSD can be directly obtained according to all the local bad block information.
本申请在SSD上电后,坏块表及其备份全部损坏时,通过遍历所有的超级块,从所有超级块的第一个存储块的第一个存储页的备份区域读出局部坏块信息,通过局部坏块信息获取该所有超级块的好坏信息,进而保护SSD的坏块信息,准确的判断存储块是否是可以被使用的。This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
图6是本申请另一实施例提供的一种坏块信息保护装置的示意性框图。如图6所示,本实施例的坏块信息保护装置是上述实施例的基础上增加了预存单元40。FIG. 6 is a schematic block diagram of a bad block information protection device provided by another embodiment of the present application. As shown in FIG. 6, the bad block information protection device of this embodiment adds a pre-storage unit 40 on the basis of the foregoing embodiment.
预存单元40,用于将任一超级块的好坏信息预存储于设定范围内的超级块中。The pre-storage unit 40 is used to pre-store the quality information of any super block in a super block within a set range.
在本实施例中,nand闪存保存坏块表及其备份之后,进一步的将超级块的好坏信息记录于邻近的超级块中,通过在多个超级块中记录局部范围内的超级块的好坏信息,进而将所有超级块的好坏信息完整的记录存储于多个不同的超级块中,后续通过获取存储于不同超级块中的好坏信息进行整合即可得到所有超级块的好坏信息,保证SSD的数据一致性。In this embodiment, after the NAND flash memory saves the bad block table and its backup, it further records the quality information of the super block in the adjacent super block, and records the quality of the super block in a local range in multiple super blocks. Bad information, and then store a complete record of the good and bad information of all super blocks in multiple different super blocks, and then integrate the good and bad information stored in different super blocks to get the good and bad information of all super blocks , To ensure the data consistency of the SSD.
参阅图7,在一实施例中,预存单元40包括编号模块41,距离定义模块42,中 心选定模块43,信息获取模块44和信息存储模块45。Referring to FIG. 7, in one embodiment, the pre-storage unit 40 includes a numbering module 41, a distance defining module 42, a center selection module 43, an information acquisition module 44, and an information storage module 45.
编号模块41,用于将超级块按所处位置依次编号,相邻超级块之间的编号差值为1。The numbering module 41 is used to sequentially number the super blocks according to their positions, and the number difference between adjacent super blocks is 1.
在一实施例中,按照超级块所处位置依次编号,具体的编号从0开始起编,相邻超级块之间的编号差值为1,超级块依次编号为0、1、2、3…n。后续可以根据超级块编号判断超级块所处的位置,同时根据编号,确定特定超级块的好坏信息。In one embodiment, the super blocks are sequentially numbered according to the positions of the super blocks, and the specific numbers are numbered starting from 0, the number difference between adjacent super blocks is 1, and the super blocks are sequentially numbered 0, 1, 2, 3... n. Subsequently, the location of the super block can be judged according to the super block number, and at the same time, the quality information of a specific super block can be determined according to the number.
距离定义模块42,用于将任两个超级块的编号的差值定义为两个超级块之间的距离。The distance definition module 42 is used to define the difference between the numbers of any two super blocks as the distance between the two super blocks.
在一实施例中,在编好号之后,定义任意两个超级块之间的距离等于对应编号的差值,例如编号6的超级块和编号9的超级块距离对应为3,编号6的超级块和编号5的超级块距离对应为1,通过距离数据我们就可以清楚了解任意超级块所邻近的超级块,便于后续将超级块的好坏信息记录于邻近超级块中。In one embodiment, after the numbers are numbered, the distance between any two super blocks is defined to be equal to the difference of the corresponding numbers. For example, the distance between the number 6 super block and the number 9 super block corresponds to 3, and the number 6 super block The distance between the block and the super block numbered 5 is 1, and we can clearly understand the super block adjacent to any super block through the distance data, so that the quality information of the super block can be recorded in the adjacent super block.
中心选定模块43,用于依次选定一超级块为中心超级块。The center selection module 43 is used to sequentially select a super block as the center super block.
在一实施例中,选定一超级块作为中心超级块,并以此超级块为中心获取一定距离内的超级块的好坏信息,并保存邻近超级块的好坏信息。通过依次选择所有可以使用的超级块作为中心超级块,进而实现对于所有超级块好坏信息的记载。In one embodiment, a super block is selected as the central super block, and the quality information of the super block within a certain distance is obtained with the super block as the center, and the quality information of the neighboring super blocks is stored. By sequentially selecting all available super blocks as the central super block, the quality information of all super blocks is recorded.
信息获取模块44,用于获取与中心超级块距离小于等于2的超级块的好坏信息。The information obtaining module 44 is used to obtain the quality information of the super block whose distance from the central super block is less than or equal to 2.
信息存储模块45,用于将对应的好坏信息预存储于中心超级块作为局部坏块信息。The information storage module 45 is used to pre-store the corresponding good and bad information in the central super block as local bad block information.
在一实施例中,对于信息获取模块44和信息存储模块45,选取任一个超级块作为中心,与这个超级块距离小于等于2的所有超级块的好坏信息都记录在一张range table(局部范围坏超级块表)中。Range table是一个含有5bit(位)的位图,每一bit都对应一具体的超级块进行记录,某一bit被设置为1,则表示对应位置的超级块是坏的;相反的,若某一bit(位)被设置为0,表示对应位置的超级块是好的。In one embodiment, for the information acquisition module 44 and the information storage module 45, any super block is selected as the center, and the quality information of all super blocks whose distance from this super block is less than or equal to 2 is recorded in a range table (local Range bad super block table). Range table is a bitmap containing 5 bits (bits). Each bit corresponds to a specific super block for recording. If a bit is set to 1, it means that the super block at the corresponding position is bad; on the contrary, if a bit One bit is set to 0, indicating that the super block at the corresponding position is good.
举例说明,选取的中心超级块的好坏信息记录在位图的中间位置,就是第2位。编号递减方向的超级块的好坏信息记录在位图的第1位和第0位,类似的,编号递增方向的超级块的好坏信息记录在位图的第3位和第4位。如图1所示,以超级块7为中心,距离在2以内的超级块有,超级块5、超级块6、超级块7、超级块8、超级块9,它们的好坏信息分别依次填入到range table中,之后把range table写入到超级块7的第一个存储块的第一个存储页的备份区域中。For example, the quality information of the selected central super block is recorded in the middle position of the bitmap, which is the second position. The quality information of the super block in the direction of decreasing number is recorded in the 1st and 0th bits of the bitmap. Similarly, the quality information of the super block in the direction of increasing number is recorded in the 3rd and 4th bits of the bitmap. As shown in Figure 1, there are super blocks with super block 7 as the center and within 2 distances: super block 5, super block 6, super block 7, super block 8, and super block 9. Fill in their good and bad information in turn. Enter the range table, and then write the range table to the backup area of the first storage page of the first storage block of super block 7.
具体的,信息存储模块45,还用于将超级块好坏信息记录于中心超级块中的局部范围坏超级块表作为局部坏块信息。Specifically, the information storage module 45 is also used to record the super block quality information in the local range bad super block table in the central super block as the local bad block information.
本申请在SSD上电后,坏块表及其备份全部损坏时,通过遍历所有的超级块,从所有超级块的第一个存储块的第一个存储页的备份区域读出局部坏块信息,通过局部坏块信息获取该所有超级块的好坏信息,进而保护SSD的坏块信息,准确的判断存储块是否是可以被使用的。This application reads the local bad block information from the backup area of the first storage page of the first storage block of all super blocks by traversing all super blocks when the bad block table and its backup are all damaged after the SSD is powered on , Obtain the good and bad information of all super blocks through the local bad block information, thereby protecting the bad block information of the SSD, and accurately judging whether the storage block can be used.
需要说明的是,所属领域的技术人员可以清楚地了解到,上述坏块信息保护装置和各单元的具体实现过程,可以参考前述方法实施例中的相应描述,为了描述的方便和简洁,在此不再赘述。It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned bad block information protection device and each unit can refer to the corresponding description in the foregoing method embodiment. For the convenience and brevity of the description, No longer.
请参阅图8,图8是本申请实施例提供的一种计算机设备的示意性框图。该计算机设备500可以是终端,也可以是服务器,其中,终端可以是智能手机、平板电脑、笔记本电脑、台式电脑、个人数字助理和穿戴式设备等具有通信功能的电子设备。服务器可以是独立的服务器,也可以是多个服务器组成的服务器集群。Please refer to FIG. 8. FIG. 8 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 may be a terminal or a server, where the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device. The server can be an independent server or a server cluster composed of multiple servers.
参阅图8,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。Referring to FIG. 8, the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032包括程序指令,该程序指令被执行时,可使得处理器502执行一种坏块信息保护方法。The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions. When the program instructions are executed, the processor 502 can execute a method for protecting bad block information.
该处理器502用于提供计算和控制能力,以支撑整个计算机设备500的运行。The processor 502 is used to provide calculation and control capabilities to support the operation of the entire computer device 500.
该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,可使得处理器502执行一种坏块信息保 护方法。The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a bad block information protection method.
该网络接口505用于与其他设备进行网络通信。本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。The network interface 505 is used for network communication with other devices. Those skilled in the art can understand that the structure shown in FIG. 8 is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
应当理解,在本申请实施例中,处理器502可以是中央处理单元(Central Processing Unit,CPU),该处理器502还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in this embodiment of the application, the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
本领域普通技术人员可以理解的是实现上述实施例的方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成。该计算机程序包括程序指令,计算机程序可存储于一存储介质中,该存储介质为计算机可读存储介质。该程序指令被该计算机系统中的至少一个处理器执行,以实现上述方法的实施例的流程步骤。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the foregoing embodiments can be implemented by computer programs instructing relevant hardware. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the foregoing method embodiments.
因此,本申请还提供一种存储介质。该存储介质可以为计算机可读存储介质。该存储介质存储有计算机程序。Therefore, this application also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program.
所述存储介质可以是U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的计算机可读存储介质。The storage medium may be a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk or an optical disk, and other computer-readable storage media that can store program codes.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the hardware and software Interchangeability. In the above description, the composition and steps of each example have been generally described in terms of function. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通 过其他的方式实现。例如,以上所描述的装置实施例仅仅是示意性的。例如,各个单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。In the several embodiments provided in this application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented.
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。本申请实施例装置中的单元可以根据实际需要进行合并、划分和删减。另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。The steps in the method of the embodiment of the present application can be adjusted, merged, and deleted in order according to actual needs. The units in the devices in the embodiments of the present application may be combined, divided, and deleted according to actual needs. In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,终端,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium It includes several instructions to make a computer device (which may be a personal computer, a terminal, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Anyone familiar with the technical field can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements, these modifications or replacements shall be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (16)

  1. 一种坏块信息保护方法,其特征在于,所述方法包括:A method for protecting bad block information, characterized in that the method includes:
    检测坏块表及其备份是否完全损坏;Check whether the bad block table and its backup are completely damaged;
    若完全损坏,则遍历所有的超级块,获取存储于超级块中的局部坏块信息;If it is completely damaged, traverse all super blocks to obtain the local bad block information stored in the super block;
    根据所有的局部坏块信息恢复所有超级块的坏块信息。Restore the bad block information of all super blocks according to all the local bad block information.
  2. 根据权利要求1所述的坏块信息保护方法,其特征在于,所述遍历所有的超级块,获取存储于超级块中的局部坏块信息的步骤之前包括:The method for protecting bad block information according to claim 1, wherein before the step of traversing all super blocks and obtaining local bad block information stored in the super block comprises:
    将任一超级块的好坏信息预存储于设定范围内的超级块中。Pre-store the quality information of any super block in the super block within the set range.
  3. 根据权利要求2所述的坏块信息保护方法,其特征在于,所述将任一超级块的好坏信息预存储于设定范围内的超级块中的步骤包括:The method for protecting bad block information according to claim 2, wherein the step of pre-storing the quality information of any super block in a super block within a set range comprises:
    将超级块按所处位置依次编号,相邻超级块之间的编号差值为1;Number the super blocks in sequence according to their positions, and the number difference between adjacent super blocks is 1;
    将任两个超级块的编号的差值设为两个超级块之间的距离;Set the difference between the numbers of any two super blocks as the distance between the two super blocks;
    依次选定一超级块为中心超级块;Select a super block in turn as the central super block;
    获取与中心超级块距离小于等于2的超级块的好坏信息;Get information about the quality of super blocks whose distance from the central super block is less than or equal to 2;
    将对应的好坏信息预存储于中心超级块作为局部坏块信息。The corresponding good and bad information is pre-stored in the central super block as local bad block information.
  4. 根据权利要求3所述的坏块信息保护方法,其特征在于,所述将对应的好坏信息预存储于中心超级块作为局部坏块信息的步骤包括:The method for protecting bad block information according to claim 3, wherein the step of pre-storing the corresponding good or bad information in the central super block as local bad block information comprises:
    将超级块的好坏信息记录于中心超级块中的局部范围坏超级块表作为局部坏块信息。The quality information of the super block is recorded in the local range bad super block table in the central super block as the local bad block information.
  5. 一种坏块信息保护装置,其特征在于,所述装置包括:A device for protecting bad block information, characterized in that the device includes:
    检测单元,用于检测坏块表及其备份是否完全损坏;The detection unit is used to detect whether the bad block table and its backup are completely damaged;
    获取单元,用于检测坏块表及其备份完全损坏时,遍历所有的超级块,获取存储于超级块中的局部坏块信息;The acquisition unit is used to detect that the bad block table and its backup are completely damaged, traverse all super blocks, and obtain the local bad block information stored in the super block;
    恢复单元,用于根据所有的局部坏块信息恢复所有超级块的坏块 信息。The recovery unit is used to recover the bad block information of all super blocks according to all the local bad block information.
  6. 根据权利要求5所述的坏块信息保护装置,其特征在于,还包括预存单元,用于将任一超级块的好坏信息预存储于设定范围内的超级块中。The device for protecting bad block information according to claim 5, further comprising a pre-storage unit for pre-storing the quality information of any super block in a super block within a set range.
  7. 根据权利要求6所述的坏块信息保护装置,其特征在于,所述预存单元包括编号模块,距离定义模块,中心选定模块,信息获取模块和信息存储模块;The bad block information protection device according to claim 6, wherein the pre-storage unit includes a numbering module, a distance definition module, a center selection module, an information acquisition module and an information storage module;
    所述编号模块,用于将超级块按所处位置依次编号,相邻超级块之间的编号差值为1;The numbering module is used to sequentially number the super blocks according to their positions, and the number difference between adjacent super blocks is 1;
    所述距离定义模块,用于将任两个超级块的编号的差值定义为两个超级块之间的距离;The distance definition module is used to define the difference between the numbers of any two super blocks as the distance between the two super blocks;
    所述中心选定模块,用于依次选定一超级块为中心超级块;The center selection module is used to sequentially select a super block as the center super block;
    所述信息获取模块,用于获取与中心超级块距离小于等于2的超级块的好坏信息;The information acquiring module is used to acquire the quality information of the super block whose distance from the central super block is less than or equal to 2;
    所述信息存储模块,用于将对应的好坏信息预存储于中心超级块作为局部坏块信息。The information storage module is used to pre-store the corresponding good and bad information in the central super block as local bad block information.
  8. 根据权利要求7所述的坏块信息保护装置,其特征在于,所述信息存储模块,用于将超级块好坏信息记录于中心超级块中的局部范围坏超级块表作为局部坏块信息。8. The bad block information protection device according to claim 7, wherein the information storage module is used to record the super block quality information in the local range bad super block table in the central super block as the local bad block information.
  9. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如下步骤:A computer device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that the processor implements the following steps when the processor executes the computer program:
    检测坏块表及其备份是否完全损坏;Check whether the bad block table and its backup are completely damaged;
    若完全损坏,则遍历所有的超级块,获取存储于超级块中的局部坏块信息;If it is completely damaged, traverse all super blocks to obtain the local bad block information stored in the super block;
    根据所有的局部坏块信息恢复所有超级块的坏块信息。Restore the bad block information of all super blocks according to all the local bad block information.
  10. 根据权利要求9所述的计算机设备,其特征在于,所述处理器执行所述计算机程序时还实现如下步骤:The computer device according to claim 9, wherein the processor further implements the following steps when executing the computer program:
    将任一超级块的好坏信息预存储于设定范围内的超级块中。Pre-store the quality information of any super block in the super block within the set range.
  11. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机程序时还实现如下步骤:The computer device according to claim 10, wherein the processor further implements the following steps when executing the computer program:
    将超级块按所处位置依次编号,相邻超级块之间的编号差值为1;Number the super blocks in sequence according to their positions, and the number difference between adjacent super blocks is 1;
    将任两个超级块的编号的差值设为两个超级块之间的距离;Set the difference between the numbers of any two super blocks as the distance between the two super blocks;
    依次选定一超级块为中心超级块;Select a super block in turn as the central super block;
    获取与中心超级块距离小于等于2的超级块的好坏信息;Get information about the quality of super blocks whose distance from the central super block is less than or equal to 2;
    将对应的好坏信息预存储于中心超级块作为局部坏块信息。The corresponding good and bad information is pre-stored in the central super block as local bad block information.
  12. 根据权利要求11所述的计算机设备,其特征在于,所述处理器执行所述计算机程序时还实现如下步骤:The computer device according to claim 11, wherein the processor further implements the following steps when executing the computer program:
    将超级块的好坏信息记录于中心超级块中的局部范围坏超级块表作为局部坏块信息。The quality information of the super block is recorded in the local range bad super block table in the central super block as the local bad block information.
  13. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如下步骤:A computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the following steps:
    检测坏块表及其备份是否完全损坏;Check whether the bad block table and its backup are completely damaged;
    若完全损坏,则遍历所有的超级块,获取存储于超级块中的局部坏块信息;If it is completely damaged, traverse all super blocks to obtain the local bad block information stored in the super block;
    根据所有的局部坏块信息恢复所有超级块的坏块信息。Restore the bad block information of all super blocks according to all the local bad block information.
  14. 根据权利要求13所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行时还实现如下步骤:The computer-readable storage medium according to claim 13, wherein the computer program further implements the following steps when being executed by the processor:
    将任一超级块的好坏信息预存储于设定范围内的超级块中。Pre-store the quality information of any super block in the super block within the set range.
  15. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行时还实现如下步骤:The computer-readable storage medium of claim 14, wherein the computer program further implements the following steps when being executed by the processor:
    将超级块按所处位置依次编号,相邻超级块之间的编号差值为1;Number the super blocks in sequence according to their positions, and the number difference between adjacent super blocks is 1;
    将任两个超级块的编号的差值设为两个超级块之间的距离;Set the difference between the numbers of any two super blocks as the distance between the two super blocks;
    依次选定一超级块为中心超级块;Select a super block in turn as the central super block;
    获取与中心超级块距离小于等于2的超级块的好坏信息;Get information about the quality of super blocks whose distance from the central super block is less than or equal to 2;
    将对应的好坏信息预存储于中心超级块作为局部坏块信息。The corresponding good and bad information is pre-stored in the central super block as local bad block information.
  16. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行时还实现如下步骤:The computer-readable storage medium according to claim 15, wherein the computer program further implements the following steps when being executed by the processor:
    将超级块的好坏信息记录于中心超级块中的局部范围坏超级块表作为局部坏块信息。The quality information of the super block is recorded in the local range bad super block table in the central super block as the local bad block information.
PCT/CN2020/076781 2019-08-15 2020-02-26 Bad block information protection method and apparatus, computer device and storage medium WO2021027271A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910751842.3 2019-08-15
CN201910751842.3A CN110471625B (en) 2019-08-15 2019-08-15 Bad block information protection method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021027271A1 true WO2021027271A1 (en) 2021-02-18

Family

ID=68511808

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/076781 WO2021027271A1 (en) 2019-08-15 2020-02-26 Bad block information protection method and apparatus, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN110471625B (en)
WO (1) WO2021027271A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110471625B (en) * 2019-08-15 2021-04-20 深圳忆联信息系统有限公司 Bad block information protection method and device, computer equipment and storage medium
CN111026332B (en) * 2019-12-09 2024-02-13 深圳忆联信息系统有限公司 SSD bad block information protection method, SSD bad block information protection device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090216832A1 (en) * 2008-02-26 2009-08-27 Quinn Steven C Array-based distributed storage system with parity
CN108804045A (en) * 2018-06-28 2018-11-13 郑州云海信息技术有限公司 A kind of bad block table method for building up and relevant apparatus
CN109582239A (en) * 2018-12-03 2019-04-05 郑州云海信息技术有限公司 A kind of store method, device, equipment and the storage medium of SSD bad block table
CN110471625A (en) * 2019-08-15 2019-11-19 深圳忆联信息系统有限公司 Bad block message guard method, device, computer equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101510445B (en) * 2009-03-19 2012-11-21 无锡中星微电子有限公司 Method and apparatus for storing and reading bad block meter of memory
CN103593303A (en) * 2013-10-29 2014-02-19 福建星网视易信息系统有限公司 Bad block table storage method and device and NAND gate nonvolatile memory
CN103530069A (en) * 2013-11-05 2014-01-22 浪潮(北京)电子信息产业有限公司 Method for processing bad sectors of RAID5 disk array
CN104731674B (en) * 2015-02-02 2020-09-01 北京忆恒创源科技有限公司 Method and apparatus for storing electronic system firmware using MLC NVM
US10372355B2 (en) * 2017-12-29 2019-08-06 Micron Technology, Inc. Managing partial superblocks in a NAND device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090216832A1 (en) * 2008-02-26 2009-08-27 Quinn Steven C Array-based distributed storage system with parity
CN108804045A (en) * 2018-06-28 2018-11-13 郑州云海信息技术有限公司 A kind of bad block table method for building up and relevant apparatus
CN109582239A (en) * 2018-12-03 2019-04-05 郑州云海信息技术有限公司 A kind of store method, device, equipment and the storage medium of SSD bad block table
CN110471625A (en) * 2019-08-15 2019-11-19 深圳忆联信息系统有限公司 Bad block message guard method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110471625B (en) 2021-04-20
CN110471625A (en) 2019-11-19

Similar Documents

Publication Publication Date Title
AU2017228544B2 (en) Nonvolatile media dirty region tracking
US7509567B1 (en) System and method for resolving data inconsistencies with a data majority
US7103811B2 (en) Mechanisms for detecting silent errors in streaming media devices
CN114579340A (en) Memory error processing method and device
CN102135925B (en) Method and device for detecting error check and correcting memory
CN109496292B (en) Disk management method, disk management device and electronic equipment
WO2021027271A1 (en) Bad block information protection method and apparatus, computer device and storage medium
CN110333971B (en) SSD bad block table backup method and device, computer equipment and storage medium
US9086990B2 (en) Bitline deletion
CN113223583A (en) Method for rereading data in NAND Flash bad block, electronic equipment and storage medium
US20100169572A1 (en) Data storage method, apparatus and system for interrupted write recovery
CN110729014A (en) Method and device for backing up erase count table in SSD (solid State disk) storage, computer equipment and storage medium
CN110865772A (en) Method and device for protecting system data physical block erasure count value, computer equipment and storage medium
EP3794451A1 (en) Parity log with by-pass
CN113849123B (en) Method, system, equipment and medium for processing data of slow disk
CN111026332B (en) SSD bad block information protection method, SSD bad block information protection device, computer equipment and storage medium
CN113485872A (en) Fault processing method and device and distributed storage system
US11221773B2 (en) Method and apparatus for performing mapping information management regarding redundant array of independent disks
CN108231134B (en) RAM yield remediation method and device
KR860002027B1 (en) Key memory error processing system
CN112562774B (en) Storage device mounting method and device, computer device and storage medium
CN114879916B (en) Method and device for managing storage unit
TWI768476B (en) Method and apparatus for performing mapping information management regarding redundant array of independent disks, and associated storage system
CN106874161B (en) Method and device for processing cache exception
US20080247282A1 (en) Method of Data Protection

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: 20852255

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: 20852255

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC DATED 12.08.2022 (EPO FORM 1205A)

122 Ep: pct application non-entry in european phase

Ref document number: 20852255

Country of ref document: EP

Kind code of ref document: A1