A storage device and a control method thereof

By adopting a combination of static and dynamic backup blocks in storage devices, the conflict between data storage stability and life management in flash memory devices is solved, and the life of data stable storage and storage devices is improved, and the efficiency of storage resource utilization is improved.

CN118689407BActive Publication Date: 2024-11-05合肥康芯威存储技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411170831.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-11-05
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

In storage devices, there is conflict between pursuing data storage stability and improving the life of storage devices, especially the instability of multi-layer storage units in flash memory devices, which leads to data backup and life management difficulties.

Method used

Adopting a combination of static backup blocks and dynamic backup blocks, the main controller selects storage single-layer storage units according to the data volume when writing important data. The data transfer and reconstruction module migrate data when the storage device is idle or abnormal power outage. and restore, threshold setting and monitoring modules manage the usage status of storage devices to extend life.

Benefits of technology

It realizes the stable storage of data and the improvement of storage device life, reduces the consumption of storage blocks, improves the utilization efficiency of storage resources, reduces the impact of storage device usage time on the device, and does not affect conventional storage work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689407B_ABST
    Figure CN118689407B_ABST
Patent Text Reader

Abstract

The present invention provides a storage device and a control method thereof, wherein the storage device comprises: a flash memory chip, the flash memory chip comprises a static backup block and a dynamic backup block, wherein the static backup block and the dynamic backup block store data in a single-layer storage unit, wherein the static backup block is a predetermined storage block in the flash memory chip, and the dynamic backup block is any blank super block in the flash memory chip; and a main controller, which is electrically connected to the flash memory chip and a host, wherein the main controller stores control firmware, wherein the control firmware comprises: a data backup module, wherein when the host writes important data, the backup data of the important data is stored in the static backup block or the dynamic backup block according to the data volume of the important data; a data transfer module, wherein in the idle mode of the storage device, the data in the static backup block is transferred to the dynamic backup block; and a reconstruction module, wherein when the storage device is abnormally powered off, the data of the dynamic backup block is reconstructed after the storage device is powered on again.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and in particular to a storage device and a control method thereof. Background Art

[0002] Lifespan is one of the important indicators for evaluating whether a storage device is good or not. The lifespan of a storage device is strongly related to the host behavior, and the lifespan of a storage device varies greatly under different host behaviors. Under different storage strategies, the consumption of storage blocks varies.

[0003] For storage devices using flash memory as storage media, the storage cells of the flash memory can be single-level cells (SLC), multi-level cells (MLC), triple-level cells (Triple-level cells), quad-level cells (QLC), etc. The data stored in a single-level cell is stable data. If a multi-level cell, a triple-level cell, or a quad-level cell is not fully stored, the data storage structure in the corresponding storage cell is unstable. When storing critical data, the stored data must also be backed up. Therefore, the pursuit of improving data storage stability and the pursuit of improving the life of storage devices are in conflict. Summary of the invention

[0004] The object of the present invention is to provide a storage device and a control method thereof, which can improve the service life of the storage device while taking into account the stability of data storage and save the occupied memory resources.

[0005] In order to solve the above technical problems, the present invention is achieved through the following technical solutions:

[0006] The present invention provides a storage device, comprising:

[0007] A flash memory chip, the flash memory chip comprising a static backup block and a dynamic backup block, wherein the static backup block and the dynamic backup block perform data storage in units of single-layer storage units, wherein the static backup block is a predetermined storage block in the flash memory chip, and the dynamic backup block is any blank super block in the flash memory chip; and

[0008] A main controller is electrically connected to the flash memory chip and the host, and the main controller stores control firmware, wherein the control firmware includes:

[0009] A data backup module, when the host writes important data, according to the data volume of the important data, the backup data of the important data is stored in the static backup block or the dynamic backup block;

[0010] A data transfer module, in an idle mode of the storage device, transfers the data in the static backup block to the dynamic backup block; and

[0011] The reconstruction module is used to reconstruct the data of the dynamic backup block when the storage device is powered on again after abnormal power failure of the storage device.

[0012] In one embodiment of the present invention, the control firmware includes a static block discarding module, which stores the discarding threshold of the static backup block. When the number of rereads or erases of the static backup block reaches the discarding threshold, the static backup block is marked as a bad block.

[0013] In one embodiment of the present invention, the control firmware includes a threshold setting module, in which the number of erasure times of the storage device is stored, wherein the threshold setting module outputs a volume threshold, and as the number of erasure times of the storage device increases, the volume threshold decreases;

[0014] The backup data whose data volume is greater than the volume threshold is stored in the dynamic backup block, and the backup data whose data volume is less than or equal to the volume threshold is stored in the static backup block.

[0015] In one embodiment of the present invention, the super block includes storage blocks of multiple storage planes, and in the super block, the sequence numbers of the multiple storage blocks are consistent;

[0016] When the number of bad blocks in the plurality of storage planes is equal, the static backup block is a good block in the super block with the largest sequence number;

[0017] When the number of bad blocks in the plurality of storage planes is not equal, the static backup block is a good block in the super block to which the bad block belongs.

[0018] In one embodiment of the present invention, the reconstruction module outputs a check interval, which is a storage page scanning interval after the dynamic backup block is reconstructed. The scanning page number of the check interval is (max(S_i, D_i), max(S_i, D_i)-WL_Pagenumber), where S_i is the maximum backup page number in the static backup block after power is restarted, D_i is the maximum backup page number in the dynamic backup block after power is restarted, max(S_i, D_i) is the larger page number between S_i and D_i, and WL_Pagenumber is the number of data pages required to be supplemented for the dynamic backup block to reach a stable storage state.

[0019] In one embodiment of the present invention, the data backup module includes a supplementary data generation unit, which outputs supplementary data, and after the backup data is written in the static backup block or the dynamic backup block, the data backup module fills the supplementary data into the static backup block or the dynamic backup block until the storage page of the static backup block or the super page of the dynamic backup block is filled.

[0020] In one embodiment of the present invention, the physical address of the static backup block is fixed, and the physical address of the dynamic backup block is the physical address of a randomly selected blank super block.

[0021] The present invention provides a method for controlling a storage device, comprising the following steps:

[0022] Setting a static backup block and a dynamic backup block, wherein the static backup block and the dynamic backup block perform data storage in a single-layer storage unit, the static backup block is a predetermined storage block in the flash memory chip, and the dynamic backup block is any blank super block in the flash memory chip;

[0023] When the host writes important data, the backup data of the important data is written into the static backup block or the dynamic backup block according to the data amount of the important data;

[0024] When the storage device is idle, transferring the data in the static backup block to the dynamic backup block;

[0025] After the storage device is powered on again, the data of the dynamic backup block is rebuilt.

[0026] In one embodiment of the present invention, the control method of the storage device includes monitoring the usage status of the static backup block during the life cycle of the storage device, and discarding the static backup block that meets the discarding condition, wherein the discarding condition includes: the number of erasure times of the static backup block reaches an erasure number threshold, and the static backup block is discarded.

[0027] In one embodiment of the present invention, after the backup data is written into the static backup block or the dynamic backup block, if the backup data does not fill up the storage page of the static backup block or the super page of the dynamic backup block, supplementary data is generated and written into the static backup block or the dynamic backup block until the storage page of the static backup block or the super page of the dynamic backup block is filled up.

[0028] As described above, the present invention provides a storage device and a control method thereof, and provides a data backup strategy that combines dynamic and static operations, which can not only achieve stable data storage, but also reduce the consumption of storage blocks, thereby increasing the life of the storage device. The storage device and the control method thereof provided by the present invention can improve the utilization efficiency of storage resources, formulate different backup strategies according to the life cycle of the storage device, reduce the impact of the storage device usage time on the storage device, and do not affect the normal storage work of the storage device.

[0029] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0031] Figure 1 FIG. 4 is a schematic diagram of the structure of a storage device in an embodiment of the present invention.

[0032] Figure 2 Schematic diagram of the structure of a super block in one embodiment of the present invention.

[0033] Figure 3 It is a schematic diagram of the structure of a storage block in one embodiment of the present invention.

[0034] Figure 4 It is a schematic diagram of the structure of bad blocks and static backup blocks in one embodiment of the present invention.

[0035] Figure 5 A schematic diagram of selecting a static backup block in an embodiment of the present invention.

[0036] Figure 6 The flowchart of the control method of the storage device in one embodiment of the present invention.

[0037] Figure 7 FIG. 4 is a schematic diagram of transferring data to a dynamic backup block according to an embodiment of the present invention.

[0038] Figure 8 FIG. 4 is a flow chart of step S600 in an embodiment of the present invention.

[0039] Fig. 9 FIG. 1 is a schematic diagram of the structure of the control firmware in one embodiment of the present invention.

[0040] In the figure: 100, storage device; 200, main controller; 210, processor; 220, control firmware; 300, flash memory chip; 310, storage plane; 311, storage block; 312, storage page; 320, super block; 330, static backup block; 340, dynamic backup block. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] See also Figure 1 As shown, the present invention provides a storage device 100. The storage device 100 includes a main controller 200 and a flash memory chip 300. The main controller 200 includes a processor 210 and a control firmware 220, and the processor 210 is electrically connected to the flash memory chip 300 and exchanges data with the flash memory chip 300. The control firmware 220 is a program code entered into the main controller 200 before and after the storage device 100 is opened. In this embodiment, the main controller 200 includes a memory, and the control firmware 220 is stored in the memory. In this embodiment, the memory can be a semiconductor or solid-state memory, a magnetic tape, a removable computer disk, a random access memory (RAM), a read-only memory (ROM), a hard disk, and an optical disk. The optical disk can include a compact disk-read only memory (CD-ROM), a compact disk-read / write (CD-RW), a DVD, and the like. In this embodiment, the memory cells of the flash memory chip 300 may be single-level cells (SLC), multi-level cells (MLC), triple-level cells (Triple Level Cell) and quad-level cells (QLC).

[0043] It should be noted that the data in the flash memory chip 300 is not volatile. However, as time passes or due to abnormal storage conditions, the data in the flash memory chip 300 may also be lost or erroneous. Among them, a single-layer storage unit can store, for example, 1 bit of data, a multi-layer storage unit can store, for example, 2 bits of data, a three-layer storage unit can store, for example, 3 bits of data, and a four-layer storage unit can store, for example, 4 bits of data. The data stored in a single-layer storage unit is stable data. If a multi-layer storage unit, a three-layer storage unit, and a four-layer storage unit are not fully stored, the data storage structure in the corresponding storage unit is unstable. The storage device 100 provided by the present invention can still maintain the stability of data storage when using a multi-layer storage unit, a three-layer storage unit, a four-layer storage unit, and the like.

[0044] See also Figures 1 to 3 As shown, in one embodiment of the present invention, the flash memory chip 300 includes a plurality of storage planes 310. In this embodiment, the number of storage planes 310 is, for example, 2. The storage plane 310 includes a plurality of storage blocks 311. The storage plane 310 is a physical plane (plane) of the flash memory medium, and the storage block 311 is a physical block (block) of the flash memory medium. The storage block 311 includes a plurality of storage pages 312. The storage page 312 is a physical page (page) of the flash memory medium. It should be noted that the plurality of storage planes 310, the plurality of storage blocks 311, and the plurality of storage pages 312 all have unique physical addresses. The plurality of storage planes 310 have sequential numbers. For example, there are 2 storage planes 310, and the sequential numbers are, for example, plane0 and plane1. In the storage plane 310, the plurality of storage blocks 311 are sorted in the order of the physical addresses, and the storage blocks 311 have sequential numbers. In this embodiment, there are a plurality of storage blocks 311, and the sequential numbers of the plurality of storage blocks 311 are, for example, B0, B1, B2 to Bn. Similarly, in the storage block 311, the plurality of storage pages 312 are arranged in the order of the physical addresses, and the storage pages 312 have sequential numbers. In this embodiment, there are a plurality of storage pages 312, and the sequential numbers of the plurality of storage pages 312 are, for example, P0, P1, P2 to Pn. Where n is a positive integer, and the present invention does not limit the value of n.

[0045] See also Figures 1 to 3As shown, in one embodiment of the present invention, the flash memory chip 300 includes a super block 320. The super block 320 includes multiple storage blocks 311. Specifically, the super block 320 includes storage blocks 311 with the same sequential number in different storage planes 310. And in this embodiment, the super block 320 has a sequential number. Specifically, the super blocks 320 are numbered according to the sequential numbers of the storage blocks 311. For example, the first super block C0 includes a storage block B0 in the first storage plane plane0 and a storage block B0 in the second storage plane plane1. The nth super block includes a storage block n in the first storage plane plane0 and a storage block n in the second storage plane plane1. And so on, the super blocks 320 are assigned sequential numbers, such as C0 to Cn.

[0046] See also Figures 1 to 4 As shown, in one embodiment of the present invention, in a flash memory chip 300, at least one storage block 311 is divided into a static backup block 330, wherein the physical address of the static backup block 330 is stored in a certain storage block 311 of the flash memory chip 300. A dynamic backup block 340 is set in the flash memory chip 300. It should be noted that only when a large amount of data that needs backup protection is written into the flash memory chip 300, and when the data of the static backup block 330 is transferred, at least one blank super block 320 is divided into a dynamic backup block 340. When there is no such requirement, the number of dynamic backup blocks 340 in the flash memory chip 300 can be zero.

[0047] See also Figures 3 to 5 As shown, in one embodiment of the present invention, the static backup block 330 can be an extra storage block 311 in the super block 320, or a storage block 311 in the super block 320 with the largest sequence number. The extra storage block 311 refers to the extra storage block 311 remaining in the super block 320 when there is a bad block in the super block 320. It should be noted that the multiple storage blocks 311 in the super block 320 belong to different storage planes 310. In this embodiment, data can be read, written and erased in units of super blocks 320. It should be noted that an allocation table is stored in the flash memory chip 300. The allocation table shows the physical address of the bad block. According to the test results of the storage device 100, the physical address of the bad block can be determined. Among them, the physical address of the bad block is stored in the allocation table. The present invention also provides a method for setting a static backup block, including steps S10 to S40.

[0048] Step S10: Determine whether the number of bad blocks in multiple storage planes is the same.

[0049] Step S20: When the number of bad blocks in multiple storage planes is the same, the storage block in the super block with the largest sequence number is used as a static backup block.

[0050] Step S30: When the number of bad blocks in multiple storage planes is different, obtain the physical address of the bad block and query the super block to which the bad block belongs.

[0051] Step S40: Obtain the address of a good block in the superblock to which the bad block belongs, and use the corresponding good block as a static backup block.

[0052] See also Figures 3 to 5 As shown, in one embodiment of the present invention, there are, for example, two storage planes 310. In step S10, it is determined whether the number of bad blocks of the first storage plane plane0 and the second storage plane plane1 is consistent. When the number of bad blocks of multiple storage planes 310 is equal, step S20 is executed. When the number of bad blocks of multiple storage planes 310 is not equal, steps S30 and S40 are executed. In this embodiment, in step S20, the number of bad blocks of multiple storage planes 310 is equal, but the location of the bad blocks is not necessarily required to be in the same super block 320. For example, in the first storage plane plane0, the bad block is storage block B2. In the second storage plane plane1, the bad block can be storage block B2, or storage block B0 or ​​storage block Bn, etc. In step S30, when the number of bad blocks of multiple storage planes 310 is not equal, the specific location of the bad block is not required. In this embodiment, for example, in the first storage plane plane0, the bad block is storage block B2. In the second storage plane plane1, the bad blocks may be storage block B2 and storage block Bn, or storage block B0 and storage block Bn, or there may be no bad blocks, and so on.

[0053] See also Figures 3 to 5 As shown, in one embodiment of the present invention, in step S20, when the bad blocks of two storage planes 310 are located in the same super block 320, the corresponding super block 320 is discarded. At this time, the storage block 311 in the super block 320 with the largest sequence number is used as the static backup block 330. It should be noted that when the discarded super block 320 is the super block 320 with the largest sequence number, when selecting the static backup block 330, the discarded super block 320 is excluded and the super block 320 with the largest sequence number is obtained. When the bad blocks of two storage planes 310 are located in different super blocks 320, the storage block 311 in the super block 320 with the largest current sequence number is still used as the static backup block 330. It should be noted that if the bad block is located in the super block 320 with the largest sequence number, since there are still good blocks in the super block 320, the super block 320 with the bad block will not be discarded. When selecting the static backup block 330, after excluding the bad blocks in the super block 320 with the largest sequence number, the remaining good blocks are used as the static backup block 330. It should be noted that in step S20, the static backup block 330 comes from the super block 320 with the largest sequence number, and the number of static backup blocks 330 is at least one.

[0054] See also Figures 3 to 5 As shown, in one embodiment of the present invention, in step S30, an allocation table is stored in the flash memory chip 30. The physical address of the bad block is recorded in the allocation table. By reading the allocation table, the physical address of the bad block can be directly obtained. According to the physical address of the bad block, the super block 320 to which the bad block belongs is queried. In step S40, as shown in FIG. Figure 4 As shown, the second storage block B1 and the third storage block B2 in the first storage plane plane0 are bad blocks, and the static backup block 330 is derived from the super block 320 where the bad blocks are located, that is, the second super block C1 and the third super block C2. Specifically, the static backup block 330 is a good block in the second super block C1 and the third super block C2. It should be noted that when the super block 320 is called, when there is a bad block in the super block 320. When calling a bad block, the actual operation is the mapping block of the bad block in another storage plane 310. For example, the second storage block B1 in the first storage plane plane0 is a bad block. When calling the second storage block B1 in the first storage plane plane0, the second storage block B1 in the second storage plane plane1 is actually called. It should be noted that when the storage blocks 311 in the super block 320 are all bad blocks, the corresponding super block 320 can be discarded.

[0055] See also Figure 5 As shown, it should be noted that the selection of the static backup block 330 can be performed at the card activation stage of the storage device 100. And the selection program corresponding to the static backup block 330 can be recorded in the main controller 200 in the form of firmware, or the static backup block 330 can be selected from the flash memory chip 30 in the form of external host control. It should be noted that when the static backup block 330 is selected, the corresponding program will no longer be enabled, and the corresponding program can be deleted. In this embodiment, after the static backup block 330 is selected, the physical address of the static backup block 330 is fixed.

[0056] See also Figure 5 As shown, in one embodiment of the present invention, the physical address of the dynamic backup block 340 is not fixed. When the dynamic backup block 340 is needed, a portion of the storage block 311 is selected from the blank super block 320 as the dynamic backup block 340. In this embodiment, the static backup block 330 and the dynamic backup block 340 store data in a single-layer storage unit SLC to prevent the backup data from being lost due to abnormal power failure.

[0057] See also Figures 1 to 6 As shown, the present invention also provides a data backup method, including steps S100 to S500.

[0058] Step S100, set a volume threshold. When the data backup function of the storage device is triggered, when the amount of data to be backed up is less than or equal to the volume threshold, the data to be backed up is written to the static backup block. When the amount of data to be backed up is greater than the volume threshold, the data to be backed up is written to the dynamic backup block.

[0059] Step S200: When the storage page of the static backup block or the super page of the dynamic backup block is not filled, fill the static backup block or the dynamic backup block with supplementary data until the storage page of the static backup block or the super page of the dynamic backup block is filled.

[0060] Step S300: When the storage device is idle, the data of the static backup block is transferred to the dynamic backup block.

[0061] Step S400: monitor the number of erasures of the storage device, and adjust the volume threshold according to the number of erasures of the storage device.

[0062] Step S500: Set a discarding threshold, monitor the usage status of the static backup block, and discard the static backup block when the parameter of the static backup block reaches the discarding threshold.

[0063] See also Figures 1 to 6 As shown, in one embodiment of the present invention, before step S100, the present invention determines the address of the static backup block 330 through steps S10 to S40. It should be noted that the static backup block 330 does not participate in the normal storage behavior of the storage device 100, and is only used for data backup of important data. In step S100, when the host wants to store data, the host will judge the importance of the data to be stored, and for important data, the host will mark the importance. When the main controller 200 receives the data, it recognizes that the data has an importance mark, and triggers the data backup function of the storage device 100. It should be noted that under the data backup function, the storage device 100 first completes the backup of the data, and then writes the next data. In this embodiment, the amount of important data will determine whether the important data is backed up in the static backup block 330 or the dynamic backup block 340.

[0064] See also Figures 1 to 6 As shown, it should be noted that in step S100, the volume threshold is designed by the designer and can be adjusted according to the type of storage device 100. For example, for storage devices 100 with a longer service life, since more erase and write times are allowed, the volume threshold can be reduced, and data with a smaller amount of data can be handled by the dynamic backup block 340. For storage devices 100 with a shorter service life, the volume threshold can be increased, and more data can be handled by the static backup block 330. It should be noted that the volume threshold does not exceed the upper limit of the storage capacity of the static backup block 330.

[0065] See also Figures 1 to 6 As shown, it should also be noted that the writing process of step S100 is a writing process for backup data. Important data is written into the flash memory chip 30, and then the important data is backed up. The data to be backed up is the data to be backed up. In the important data backup step, the important data will be written into the static backup block 330 or the dynamic backup block 340. In the step of writing backup data to the static backup block 330, the address of the static backup block 330 is obtained, and the important data is directly copied to the static backup block 330. In the step of writing backup data to the dynamic backup block 340, according to the allocation table, an idle super block 320 is obtained, at least one idle super block 320 is selected as the dynamic backup block 340, and the important data is copied to the dynamic backup block 340. Among them, the important data is written into the static backup block 330, and the data is stored in the form of a single-layer storage unit. The important data is written into the dynamic backup block 330, and the data is stored in units of a single-layer storage unit.

[0066] See also Figures 1 to 4 and Figure 6 As shown, in one embodiment of the present invention, in step S100, after the writing of the data to be backed up is completed, step S200 is executed. It should be noted that, in this embodiment, an inquiry instruction can be set to continuously inquire whether the data to be backed up has been written, and step S200 is executed after obtaining a positive inquiry result. In step S200, supplementary data is filled into the static backup block 330 or the dynamic backup block 340 until the storage page 312 of the static backup block 330 or the super page of the dynamic backup block 340 is filled. The supplementary data is invalid data and is only used to improve the data storage stability of the storage block 311. When the static backup block 330 or the dynamic backup block 340 is filled with supplementary data, the address information of the supplementary data is not generated accordingly. It should be noted that since the static backup block 330 is a storage mode of a single-layer storage unit, after the data to be backed up is written, for the same amount of data, the amount of data supplemented in the static backup block 330 is much lower than the amount of data supplemented in the dynamic backup block 340.

[0067] See also Figures 1 to 4 , Figure 6 and Figure 7As shown, in one embodiment of the present invention, in step S300, when the storage device 100 is idle, the data in the static backup block 330 is transferred to the dynamic backup block 340. The storage device 100 has a working mode and an idle mode. When the storage device 100 does not receive a control command from the main controller 200, the storage device 100 switches from the working mode to the idle mode. It should be noted that in other embodiments of the present invention, it can also be configured that when the storage device 100 does not receive a control command from the main controller 200 for a preset time, the storage device 100 switches from the working mode to the idle mode. In this embodiment, after the storage device 100 enters the idle mode, the data of the static backup block 330 is first transferred to the dynamic backup block 340. Then other predetermined tasks of the idle mode are performed. For example, the storage device 100 can be scanned, and the transmission interface opening and closing and the interface transmission rate of the storage device 100 can be adjusted. In step S200, after the data to be backed up is transferred to the dynamic backup block 340, if the backup data does not fill up the currently written super page, the dynamic backup block 340 is filled with data. Specifically, the supplementary data is written to the dynamic backup block 340 until the super page of the dynamic backup block 340 is filled up. It should be noted that when the data is transferred, the address information of the data to be backed up is adjusted to the table block accordingly. The table block is a storage block 311 for storing the table data of the flash memory chip 30.

[0068] See also Figures 1 to 4 , Figure 6 and Figure 7 As shown, it should be noted that even if the storage device 100 does not enter the idle mode, when the host issues a power-off instruction, the storage device 100 will also execute step S300. And in step S300, when the data of the static backup block 330 is transferred to the dynamic backup block 340, only the valid data in the static backup block 330 is transferred.

[0069] See also Figures 1 to 4 and Figure 6As shown, in one embodiment of the present invention, in step S400, the number of erasures of the storage device 100 is monitored throughout the life cycle of the storage device 100. The number of erasures of the storage device 100 is related to the service life of the storage device 100. Among them, the upper limit of the number of erasures of the storage device 100 is provided by the manufacturer. In this embodiment, the initial value of the volume threshold is set. When the number of erasures of the storage device 100 is less than or equal to, for example, 50% of the upper limit of the number of erasures, a first volume threshold is set. When the number of erasures of the storage device 100 is greater than, for example, 50% of the upper limit of the number of erasures, and less than or equal to, for example, 80% of the upper limit of the number of erasures, the value of the volume threshold is reduced as the second volume threshold. When the number of erasures of the storage device 100 is greater than, for example, 80% of the upper limit of the number of erasures, the value of the volume threshold is reduced again as the third volume threshold. Among them, the first volume threshold is greater than the second volume threshold, and the second volume threshold is greater than the third volume threshold. As the number of erasures of the storage device 100 increases, the frequency of use of the static backup block 330 is reduced.

[0070] See also Figures 1 to 4 and Figure 6 As shown, in one embodiment of the present invention, in step S500, the discarding threshold includes a rereading number threshold and an erasure number threshold of the static backup block 330. The erasure number threshold is used to measure the erasure number of the static backup block 330, so as to discard the static backup block 330 at the end of its life. When the erasure number of the static backup block 330 reaches the erasure number threshold, the current static backup block 330 is discarded, and the information of the static backup block 330 in the allocation table is updated accordingly, and the static backup block 330 is marked as a bad block. In this embodiment, the rereading number threshold is used to measure the rereading number of the static backup block 330. When reading data from the static backup block 330, if the data cannot be read correctly, the data is read from the static backup block 330 again according to the reading parameters provided by the manufacturer. If the rereading number reaches the rereading number threshold, the static backup block 330 is marked as a bad block and discarded. The information of the static backup block 330 is updated to the bad block table. In this embodiment, when data is reconstructed, when the static backup block 330 is read, the number of rereads of the static backup block 330 is recorded and compared.

[0071] See also Figures 1 to 4 , Figures 6 to 8As shown, in one embodiment of the present invention, after the storage device 100 is powered off and powered on again, the data of the storage device 100 is reconstructed. If the storage device 100 is powered off normally, in the data reconstruction step after powering on, it is not necessary to reconstruct the data of the static backup block 330. If the storage device 100 is powered off abnormally, the data of the dynamic backup block 340 is reconstructed first. After the data of the dynamic backup block 340 is reconstructed, the static backup block 330 and the dynamic backup block 340 are scanned. The backup data reconstruction step after the storage device 100 is powered on again is step S600. Step S600 includes steps S601 to S605.

[0072] Step S601: Reconstruct data of the dynamic backup block.

[0073] Step S602: Obtain the maximum backup page number D_i recorded in the dynamic backup block and the maximum backup page number S_i recorded in the static backup block.

[0074] Step S603: Set the inspection interval and scan the inspection interval of the dynamic backup block and the static backup block.

[0075] Step S604: determine whether the dynamic backup block has completely backed up the data to be backed up. If the dynamic backup block has completely backed up the data to be backed up, the backup data reconstruction step is terminated.

[0076] Step S605: copy the data in the static backup block to the dynamic backup block, and end the backup data reconstruction step.

[0077] See also Figures 1 to 4 , Figures 6 to 8As shown, in one embodiment of the present invention, after the data reconstruction of the dynamic backup block 340 is completed, step S602 is executed. In step S602, the maximum backup page number is the maximum storage page number of the data to be backed up. In step S603, the inspection interval is set according to the maximum backup page number S_i and the maximum backup page number D_i, as well as the stable storage data volume WL_Pagenumber. The stable storage data volume WL_Pagenumber is the number of data pages that need to be supplemented for xLC to reach a stable state. In this embodiment, the inspection interval is the storage page 312 corresponding to (max(S_i, D_i), max(S_i, D_i)-WL_Pagenumber). Max(S_i, D_i) refers to the larger page number of the maximum backup page number S_i and the maximum backup page number D_i. In step S603, the inspection intervals of the static backup block 330 and the dynamic backup block 340 are scanned respectively. In step S604, if the physical address backed up by the static backup block 330 is consistent with the physical address of the dynamic backup block 340, it is considered that the dynamic backup block 340 has completely backed up the data to be backed up before power failure, so step S600 is directly terminated. If the physical address backed up by the static backup block 330 is inconsistent with the physical address of the dynamic backup block 340, in step S605, the data in the static backup block 330 is copied to the dynamic backup block 340, and after the data copying is completed, step S600 is terminated.

[0078] See also Figures 1 to 9As shown, in one embodiment of the present invention, the control firmware 220 includes a selection module 221, a data backup module 222, a data transfer module 223, a threshold setting module 224, a static block discarding module 225 and a reconstruction module 226. The selection module 221 can implement the selection method as steps S10 to S40. After the selection module 221 selects the static backup block 330, it outputs the physical address of the static backup block 330 to the table block. The data backup module 222 writes the backup data of the important data into the static backup block 330 or the dynamic backup block 340 according to the data volume of the important data. The data backup module 222 includes a supplementary data generation unit for generating supplementary data. After the backup data is written into the static backup block 330 or the dynamic backup block 340, the data backup module 222 fills the supplementary data into the backup block where the backup data is located until the corresponding backup block is filled. The data transfer module 223 transfers the backup data in the static backup block 330 to the dynamic backup block 340 in the idle mode of the storage device 100. The threshold setting module 224 is used to generate a volume threshold. The static block discarding module 225 stores the discarding threshold of the static backup block 330. When the number of rereads or erases of the static backup block 330 reaches the discarding threshold, the static backup block 330 is marked as a bad block. After the storage device 100 is powered on again, the reconstruction module 226 reconstructs the data of the dynamic backup block 340.

[0079] The embodiments of the present invention disclosed above are only used to help illustrate the present invention. The embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A storage device, characterized in that: include: A flash memory chip, the flash memory chip comprising a static backup block and a dynamic backup block, wherein the static backup block and the dynamic backup block perform data storage in a single-layer storage unit, wherein the static backup block is a predetermined storage block in the flash memory chip, and the dynamic backup block is any blank super block in the flash memory chip; as well as A main controller is electrically connected to the flash memory chip and the host, and the main controller stores control firmware, wherein the control firmware includes: A data backup module, when the host writes important data, according to the data volume of the important data, the backup data of the important data is stored in the static backup block or the dynamic backup block; A data transfer module, in an idle mode of the storage device, transfers the data in the static backup block to the dynamic backup block; and The reconstruction module is used to reconstruct the data of the dynamic backup block when the storage device is powered on again after abnormal power failure of the storage device.

2. A storage device according to claim 1, characterized in that: The control firmware includes a static block discarding module, in which a discarding threshold of the static backup block is stored. When the number of rereads or erases of the static backup block reaches the discarding threshold, the static backup block is marked as a bad block.

3. A storage device according to claim 1, characterized in that: The control firmware includes a threshold setting module, in which the number of erasure times of the storage device is stored, wherein the threshold setting module outputs a volume threshold, and as the number of erasure times of the storage device increases, the volume threshold decreases; The backup data whose data volume is greater than the volume threshold is stored in the dynamic backup block, and the backup data whose data volume is less than or equal to the volume threshold is stored in the static backup block.

4. A storage device according to claim 1, characterized in that: The super block includes storage blocks of multiple storage planes, and in the super block, the sequence numbers of the multiple storage blocks are consistent; When the number of bad blocks in the plurality of storage planes is equal, the static backup block is a good block in the super block with the largest sequence number; When the number of bad blocks in the plurality of storage planes is not equal, the static backup block is a good block in the super block to which the bad block belongs.

5. A storage device according to claim 1, characterized in that: The reconstruction module outputs a check interval, which is a storage page scanning interval after the dynamic backup block is reconstructed. The scanning page number of the check interval is (max(S_i, D_i), max(S_i, D_i)-WL_Pagenumber), where S_i is the maximum backup page number in the static backup block after power is restarted, D_i is the maximum backup page number in the dynamic backup block after power is restarted, max(S_i, D_i) is the larger page number between S_i and D_i, and WL_Pagenumber is the number of data pages required to be supplemented for the dynamic backup block to reach a stable storage state.

6. A storage device according to claim 1, characterized in that: The data backup module includes a supplementary data generation unit, which outputs supplementary data. After the backup data is written in the static backup block or the dynamic backup block, the data backup module fills the supplementary data into the static backup block or the dynamic backup block until the storage page of the static backup block or the super page of the dynamic backup block is filled.

7. A storage device according to claim 1, characterized in that: The physical address of the static backup block is fixed, and the physical address of the dynamic backup block is the physical address of a randomly selected blank super block.

8. A method for controlling a storage device, characterized in that: The following steps are involved: Setting a static backup block and a dynamic backup block, wherein the static backup block and the dynamic backup block perform data storage in a single-layer storage unit, the static backup block is a predetermined storage block in a flash memory chip, and the dynamic backup block is any blank super block in the flash memory chip; When the host writes important data, the backup data of the important data is written into the static backup block or the dynamic backup block according to the data amount of the important data; When the storage device is idle, transferring the data in the static backup block to the dynamic backup block; After the storage device is powered on again, the data of the dynamic backup block is rebuilt.

9. The method for controlling a storage device according to claim 8, characterized in that: The control method of the storage device includes monitoring the usage status of the static backup block during the life cycle of the storage device, and discarding the static backup block that meets the discarding condition, wherein the discarding condition includes: the number of erasure times of the static backup block reaches an erasure number threshold, and the static backup block is discarded.

10. The method for controlling a storage device according to claim 8, characterized in that: After the backup data is written into the static backup block or the dynamic backup block, if the backup data does not fill up the storage page of the static backup block or the super page of the dynamic backup block, supplementary data is generated and written into the static backup block or the dynamic backup block until the storage page of the static backup block or the super page of the dynamic backup block is filled up.