Storage device dynamic wear balancing method, device, electronic device and storage medium

By performing ECC scanning and wear value evaluation on the memory block in the storage device, deciding whether to perform data migration, the problem that traditional wear balance algorithms cannot accurately consider the loss differences in memory blocks, achieving more efficient wear balance and longer equipment service life.

CN119759642APending Publication Date: 2025-04-04SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411985612.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

Traditional wear balance algorithms fail to accurately consider the actual loss differences of different memory blocks in storage devices, resulting in insufficient wear balance effect and affecting the service life of storage devices.

Method used

By performing an error correction code ECC scan of the memory block in the storage device, the wear value is determined, and whether to migrate data based on the preset wear threshold and wear value. If so, the migration target will be determined based on the wear status table to achieve balanced data migration.

Benefits of technology

It improves the accuracy of the wear balance effect, extends the service life of the storage device, and ensures the performance stability of the storage device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759642A_ABST
    Figure CN119759642A_ABST
Patent Text Reader

Abstract

The present invention provides a storage device dynamic wear balancing method, device, electronic device and storage medium, which relates to the wear balancing technology field, including: performing error correction code scanning on a storage block in a storage device to obtain a scanning result; determining the wear value of the storage block based on the scanning result; determining whether to perform data migration based on a preset wear threshold and the wear value; if data migration is performed, determining a data migration target based on a predetermined wear state table; and migrating the data in the storage block to the data migration target. In this way, the accuracy of the wear balancing effect is improved, thereby extending the service life of the storage device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of wear leveling technology, and in particular to a storage device dynamic wear leveling method, device, electronic device and storage medium. Background Art

[0002] In the storage devices of related devices (such as solid-state drives, flash memories, etc.), since repeated erasing and writing will cause the performance of the storage unit to degrade, a wear leveling algorithm is needed to balance the number of times each storage block is used to extend the service life of the storage device.

[0003] Traditional wear leveling algorithms usually use a simple counting method, that is, each erase operation increases the wear count of the corresponding storage block by 1. However, this method does not take into account that the actual wear degree of different storage blocks may be different, resulting in inaccurate wear leveling effect. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a method, apparatus, electronic device and storage medium for dynamic wear balancing of a storage device, so as to improve the accuracy of the wear balancing effect and thereby extend the service life of the storage device.

[0005] In a first aspect, an embodiment of the present invention provides a method for dynamic wear balancing of a storage device, which performs an error correction code (ECC) scan on a storage block in the storage device to obtain a scan result; determines a wear value of the storage block based on the scan result; determines whether to perform data migration based on a preset wear threshold and wear value; if data migration is performed, determines a data migration target based on a predetermined wear status table; and migrates the data in the storage block to the data migration target.

[0006] In a preferred embodiment of the present invention, the above-mentioned error correction code scanning of the storage block in the storage device to obtain the scanning result includes: reading the valid page in the storage block and determining the number of error bytes of the current valid page based on a preset algorithm; comparing the number of error bytes of each of multiple valid pages to determine the number of ECC error bits; and using the number of ECC error bits as the scanning result.

[0007] In a preferred embodiment of the present invention, the above-mentioned determination of the wear value of the storage block based on the scanning results includes: determining the number of ECC error bits based on the scanning results; determining the wear value of the storage block based on a preset basic wear coefficient, the number of ECC error bits and a preset ECC weight factor by the following formula: Wear value = basic wear coefficient × (1 + ECC error bit number × ECC weight factor).

[0008] In a preferred embodiment of the present invention, the above-mentioned determination of whether to perform data migration based on the preset wear threshold and wear value includes: comparing the wear threshold and the wear value; if the wear value is greater than the wear threshold, performing data migration.

[0009] In a preferred embodiment of the present invention, the above-mentioned determination of the data migration target based on a predetermined wear status table includes: updating the wear status table based on the wear value; determining the initial storage block without written data in the updated wear status table; determining the number of wear times of each initial storage block; if the number of wear times is less than or equal to a preset number threshold, then using the initial storage block as the data migration target.

[0010] In a preferred embodiment of the present invention, if the number of initial storage blocks with a wear count less than or equal to a preset threshold count is greater than 1, the initial storage block with the lowest wear count is used as a data migration target.

[0011] In a preferred embodiment of the present invention, the storage device includes an enterprise-level solid-state drive and a consumer-level flash memory; the ECC weight factor corresponding to the enterprise-level solid-state drive is smaller than the ECC weight factor corresponding to the consumer-level flash memory; the wear threshold corresponding to the enterprise-level solid-state drive is greater than the wear threshold corresponding to the consumer-level flash memory.

[0012] In a second aspect, an embodiment of the present invention further provides a dynamic wear balancing device for a storage device, comprising: a scanning result acquisition module, used to perform error correction code scanning on a storage block in a storage device to obtain a scanning result; a wear value determination module, used to determine the wear value of the storage block based on the scanning result; a data migration judgment module, used to determine whether to perform data migration based on a preset wear threshold and wear value; a migration target determination module, used to determine a data migration target based on a predetermined wear status table if data migration is to be performed; and a data migration module, used to migrate data in the storage block to the data migration target.

[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the dynamic wear balancing method for storage devices of the first aspect.

[0014] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the dynamic wear balancing method for storage devices of the first aspect mentioned above.

[0015] The embodiments of the present invention bring the following beneficial effects:

[0016] The embodiment of the present invention provides a method, apparatus, electronic device and storage medium for dynamic wear balancing of a storage device, wherein an error correction code is scanned on a storage block in the storage device to obtain a scanning result, a wear value of the storage block is determined based on the scanning result, and whether to perform data migration is determined based on a preset wear threshold and wear value. If data migration is performed, a data migration target is determined based on a pre-determined wear state table, and data in the storage block is migrated to the data migration target. In this manner, the accuracy of the wear balancing effect is improved, thereby extending the service life of the storage device.

[0017] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.

[0018] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 A flow chart of a storage device dynamic wear leveling method provided by an embodiment of the present invention;

[0021] Figure 2 A flowchart of another storage device dynamic wear leveling method provided by an embodiment of the present invention;

[0022] Figure 3 A schematic diagram of the structure of a dynamic wear leveling device for a storage device provided by an embodiment of the present invention;

[0023] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0025] In the storage devices of related devices (such as solid-state drives, flash memories, etc.), since repeated erasing and writing will cause the performance of the storage unit to degrade, a wear leveling algorithm is needed to balance the number of times each storage block is used to extend the service life of the storage device.

[0026] Traditional wear leveling algorithms usually use a simple counting method, that is, each erase operation increases the wear count of the corresponding storage block by 1. However, this method does not take into account that the actual wear degree of different storage blocks may be different, resulting in inaccurate wear leveling effect.

[0027] Based on this, the embodiments of the present invention provide a method, device, electronic device and storage medium for dynamic wear balancing of a storage device, which can scan the error correction code of the storage block in the storage device to obtain the scanning result, determine the wear value of the storage block based on the scanning result, determine whether to perform data migration based on the preset wear threshold and wear value, and if data migration is performed, determine the data migration target based on the pre-determined wear state table, and migrate the data in the storage block to the data migration target. In this way, the accuracy of the wear balancing effect is improved, thereby extending the service life of the storage device.

[0028] To facilitate understanding of this embodiment, a dynamic wear leveling method for a storage device disclosed in an embodiment of the present invention is first introduced in detail.

[0029] Example 1

[0030] The embodiment of the present invention provides a storage device dynamic wear leveling method. Figure 1 A flow chart of a method for dynamic wear balancing of a storage device provided by an embodiment of the present invention. Figure 1 As shown, the storage device dynamic wear leveling method may include the following steps:

[0031] Step S101, performing an error correction code (ECC) scan on a storage block in a storage device to obtain a scan result.

[0032] Among them, storage devices include enterprise-level solid-state drives and consumer-level flash memory, ECC (Error Correction Code).

[0033] The error correction code ECC scanning may be performed periodically on the storage blocks in the storage device, specifically, the scanning is performed when the storage device is in an idle state (no reading or writing is performed).

[0034] Specifically, performing an error correction code scan on a storage block in a storage device to obtain a scan result may include: reading a valid page in the storage block and determining the number of error bytes of the current valid page based on a preset algorithm; comparing the number of error bytes of each of a plurality of valid pages to determine the number of ECC error bits; and using the number of ECC error bits as the scan result.

[0035] The preset algorithm may be a BCH or LDPC algorithm.

[0036] Among the numbers of error bytes of the valid pages, the value with the largest number of error bytes represents the number of ECC error bits.

[0037] Step S102: determining the wear value of the storage block based on the scanning result.

[0038] Specifically, determining the wear value of the storage block based on the scanning results may include: determining the number of ECC error bits based on the scanning results; determining the wear value of the storage block based on a pre-set basic wear coefficient, the number of ECC error bits and a pre-set ECC weight factor by the following formula: wear value = basic wear coefficient × (1 + ECC error bit number × ECC weight factor).

[0039] Among them, by introducing the number of ECC error bits as the evaluation basis, the actual degree of wear of the storage block can be more accurately reflected, thereby extending the service life of the equipment.

[0040] Among them, the basic wear times are the life of the Flash block obtained through batch aging tests. The DataSheet provided by the original manufacturer of the Flash block also has a recommended wear times. This parameter is written into the main control firmware during mass production. The theoretical value of this parameter should be 1, that is, the wear times increase by 1 each time the storage block is fully written and erased. However, if the quality of the Flash block is not good, this value will become larger. Through the aging test, the number of times the data of this block is read, written and erased continuously until it becomes bad is recorded and calculated with the number given by the original manufacturer.

[0041] Therefore, basic wear coefficient = theoretical wear times / actual wear times.

[0042] Among them, the ECC weight factor corresponding to the enterprise-level solid-state drive is smaller than the ECC weight factor corresponding to the consumer-level flash memory.

[0043] Step S103: determining whether to perform data migration based on a preset wear threshold and wear value.

[0044] Specifically, determining whether to perform data migration based on a preset wear threshold and a wear value may include: comparing the wear threshold and the wear value; and if the wear value is greater than the wear threshold, performing data migration.

[0045] The wear value is the number of times the current storage block is erased.

[0046] Among them, when the wear value is greater than the wear threshold and reaches the preset condition threshold, the storage block will no longer be used as a data block, and the data in the current storage block will be moved to a free block with the lowest wear value. Because the actual capacity will be larger than the available logical capacity during the production process, this part of the excess capacity is the redundant block, so it is allowed that some blocks are damaged during use without affecting the accuracy of the entire logical capacity.

[0047] Among them, the wear threshold corresponding to the enterprise-level solid-state hard drive is greater than the wear threshold corresponding to the consumer-level flash memory.

[0048] Step S104: if data migration is to be performed, a data migration target is determined based on a predetermined wear status table.

[0049] Step S105: Migrate the data in the storage block to the data migration target.

[0050] The dynamic wear balancing method for storage devices provided by the embodiment of the present invention can scan the error correction code of the storage block in the storage device to obtain the scanning result, determine the wear value of the storage block based on the scanning result, determine whether to perform data migration based on the preset wear threshold and wear value, and if data migration is performed, determine the data migration target based on the pre-determined wear state table, and migrate the data in the storage block to the data migration target. In this way, the accuracy of the wear balancing effect is improved, thereby extending the service life of the storage device.

[0051] Example 2

[0052] The embodiment of the present invention also provides another method for dynamic wear balancing of storage devices; this method is implemented on the basis of the method of the above embodiment; this method focuses on describing the specific implementation method of determining the data migration target based on a predetermined wear status table.

[0053] Figure 2 A flowchart of another storage device dynamic wear leveling method provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the method of determining a data migration target based on a predetermined wear state table may include the following steps:

[0054] Step S201, updating the wear status table based on the wear value.

[0055] Therein, the wear value may be updated into the wear status table.

[0056] Step S202: determining an initial storage block without written data in the updated wear status table.

[0057] Among them, a free block without written input, ie, an initial storage block, can be found in the updated wear status table.

[0058] Step S203, determining the number of times each initial storage block is worn out.

[0059] Step S204: If the number of wear times is less than or equal to a preset number threshold, the initial storage block is used as a data migration target.

[0060] Step S205: If the number of initial storage blocks whose wear times are less than or equal to the preset times threshold is greater than 1, the initial storage block with the lowest wear times is used as the data migration target.

[0061] If the number of initial storage blocks whose wear times is less than or equal to a preset times threshold is 1, the initial storage block is used as a data migration target.

[0062] The dynamic wear balancing method for storage devices provided in the embodiment of the present invention realizes more reasonable data allocation through accurate wear assessment, effectively prolongs the overall service life of the storage device, and timely discovers and processes high-wear storage blocks, thereby reducing the risk of data loss.

[0063] Example 3

[0064] Corresponding to the above method embodiment, an embodiment of the present invention provides a dynamic wear leveling device for a storage device, Figure 3 A schematic diagram of a dynamic wear leveling device for a storage device provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the dynamic wear leveling device of the storage device may include:

[0065] The scanning result acquisition module 301 is used to perform error correction code scanning on the storage blocks in the storage device to obtain scanning results.

[0066] The wear value determination module 302 is used to determine the wear value of the storage block based on the scanning result.

[0067] The data migration judgment module 303 is used to determine whether to perform data migration based on a preset wear threshold and wear value.

[0068] The migration target determination module 304 is used to determine the data migration target based on a predetermined wear status table if data migration is performed.

[0069] The data migration module 305 is used to migrate the data in the storage block to the data migration target.

[0070] The dynamic wear balancing device for storage devices provided by the embodiment of the present invention can scan the storage blocks in the storage device for error correction codes to obtain the scanning results, determine the wear value of the storage blocks based on the scanning results, determine whether to perform data migration based on the preset wear threshold and wear value, and if data migration is performed, determine the data migration target based on the pre-determined wear state table, and migrate the data in the storage blocks to the data migration target. In this way, the accuracy of the wear balancing effect is improved, thereby extending the service life of the storage device.

[0071] In some embodiments, the scanning result acquisition module is also used to read the valid pages in the storage block and determine the number of error bytes of the current valid page based on a preset algorithm; compare the number of error bytes of each of multiple valid pages to determine the number of ECC error bits; and use the number of ECC error bits as the scanning result.

[0072] In some embodiments, the wear value determination module is also used to determine the number of ECC error bits based on the scanning results; based on a preset basic wear coefficient, the number of ECC error bits and a preset ECC weight factor, the wear value of the storage block is determined by the following formula: wear value = basic wear coefficient × (1 + ECC error bit × ECC weight factor).

[0073] In some embodiments, the data migration judgment module is further used to compare the wear threshold and the wear value; if the wear value is greater than the wear threshold, data migration is performed.

[0074] In some embodiments, the migration target determination module is also used to update the wear status table based on the wear value; determine the initial storage block without written data in the updated wear status table; determine the number of wear times of each initial storage block; if the number of wear times is less than or equal to a preset number threshold, the initial storage block is used as a data migration target.

[0075] In some embodiments, the migration target determination module is further configured to use the initial storage block with the lowest number of wear times as a data migration target if the number of initial storage blocks with the number of wear times less than or equal to a preset number threshold is greater than 1.

[0076] In some embodiments, the storage device includes an enterprise-level solid-state drive and a consumer-level flash memory; the ECC weight factor corresponding to the enterprise-level solid-state drive is smaller than the ECC weight factor corresponding to the consumer-level flash memory; the wear threshold corresponding to the enterprise-level solid-state drive is larger than the wear threshold corresponding to the consumer-level flash memory.

[0077] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0078] Example 4

[0079] The embodiment of the present invention also provides an electronic device for executing the above storage device dynamic wear leveling method; see Figure 4 A structural schematic diagram of an electronic device is shown, which includes a memory 400 and a processor 401, wherein the memory 400 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 401 to implement the above-mentioned dynamic wear balancing method for storage devices.

[0080] Further, Figure 4 The electronic device shown further includes a bus 402 and a communication interface 403 , and the processor 401 , the communication interface 403 and the memory 400 are connected via the bus 402 .

[0081] The memory 400 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0082] The processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 401. The above processor 401 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 400, and the processor 401 reads the information in the memory 400 and completes the steps of the method of the above embodiment in combination with its hardware.

[0083] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned dynamic wear balancing method for storage devices. The specific implementation can be found in the method embodiment, which will not be repeated here.

[0084] The computer program product for the method of performing dynamic wear balancing of storage devices provided in the embodiment of the present invention includes a computer-readable storage medium storing a non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment, which will not be repeated here.

[0085] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0086] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. 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 ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

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

[0088] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0089] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0090] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for dynamic wear leveling of a storage device, characterized in that: The method comprises: Performing an error correction code (ECC) scan on a storage block in a storage device to obtain a scan result; Determine a wear value of the storage block based on the scan result; Determining whether to perform data migration based on a preset wear threshold and the wear value; If data migration is performed, a data migration target is determined based on a predetermined wear status table; The data in the storage block is migrated to the data migration target.

2. The method according to claim 1, characterized in that The performing error correction code scanning on the storage block in the storage device to obtain the scanning result includes: Reading a valid page in the storage block and determining the number of error bytes of the current valid page based on a preset algorithm; Compare the number of error bytes of each of the multiple valid pages to determine the number of ECC error bits; The ECC error bit number is used as the scanning result.

3. The method according to claim 1, characterized in that The determining the wear value of the storage block based on the scanning result includes: Determine the number of ECC error bits based on the scanning result; The wear value of the storage block is determined based on a preset basic wear coefficient, the number of ECC error bits and a preset ECC weight factor by the following formula: wear value = basic wear coefficient × (1 + number of ECC error bits × ECC weight factor).

4. The method according to claim 1, characterized in that: The determining whether to perform data migration based on the preset wear threshold and the wear value includes: comparing the wear threshold value with the wear value; If the wear value is greater than the wear threshold, the data migration is performed.

5. The method according to claim 4, characterized in that The determining of the data migration target based on the predetermined wear status table includes: updating the wear status table based on the wear value; Determining an initial storage block without written data in the updated wear status table; Determining the number of times each of the initial storage blocks has been worn; If the number of wear times is less than or equal to a preset number threshold, the initial storage block is used as the data migration target.

6. The method according to claim 5, characterized in that If the number of initial storage blocks whose wear times is less than or equal to a preset times threshold is greater than 1, the initial storage block with the lowest wear times is used as the data migration target.

7. The method according to any one of claims 1 to 4, characterized in that: The storage device includes an enterprise-level solid-state hard drive and a consumer-level flash memory; the ECC weight factor corresponding to the enterprise-level solid-state hard drive is smaller than the ECC weight factor corresponding to the consumer-level flash memory; the wear threshold corresponding to the enterprise-level solid-state hard drive is larger than the wear threshold corresponding to the consumer-level flash memory.

8. A dynamic wear leveling device for a storage device, characterized in that: The device comprises: A scanning result acquisition module is used to perform error correction code scanning on the storage block in the storage device to obtain the scanning result; a wear value determination module, configured to determine the wear value of the storage block based on the scanning result; A data migration judgment module, used to determine whether to perform data migration based on a preset wear threshold and the wear value; A migration target determination module, used to determine a data migration target based on a predetermined wear state table if data migration is performed; A data migration module is used to migrate the data in the storage block to the data migration target.

9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the dynamic wear leveling method for a storage device according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the dynamic wear leveling method for a storage device according to any one of claims 1 to 7.